diff --git a/data/.fern/metadata.json b/data/.fern/metadata.json new file mode 100644 index 0000000000000000000000000000000000000000..ac90d61e6c88f8079a87cd63ddd38d2c8db691fd --- /dev/null +++ b/data/.fern/metadata.json @@ -0,0 +1,60 @@ +{ + "cliVersion": "5.146.2", + "generatorName": "fernapi/fern-python-sdk", + "generatorVersion": "4.64.1", + "generatorConfig": { + "timeout_in_seconds": 240, + "default_bytes_stream_chunk_size": 1024, + "inline_request_params": false, + "follow_redirects_by_default": true, + "recursion_limit": 10000, + "pydantic_config": { + "skip_validation": true + }, + "client": { + "class_name": "BaseElevenLabs", + "filename": "base_client.py", + "exported_class_name": "ElevenLabs", + "exported_filename": "client.py" + }, + "extra_dependencies": { + "requests": ">=2.20", + "websockets": ">=13.0", + "pyaudio": { + "version": ">=0.2.14", + "optional": true + } + }, + "extra_dev_dependencies": { + "types-pyaudio": "^0.2.16.20240516" + }, + "extras": { + "pyaudio": [ + "pyaudio" + ] + }, + "additional_init_exports": [ + { + "from": "play", + "imports": [ + "play", + "save", + "stream" + ] + }, + { + "from": "realtime", + "imports": [ + "RealtimeEvents", + "RealtimeAudioOptions", + "RealtimeUrlOptions", + "AudioFormat", + "CommitStrategy", + "RealtimeConnection" + ] + } + ] + }, + "originGitCommit": "54b8c672ac5673b901df1e2603f9a98de8eb15fd", + "sdkVersion": "2.74.0" +} \ No newline at end of file diff --git a/data/.fern/replay.lock b/data/.fern/replay.lock new file mode 100644 index 0000000000000000000000000000000000000000..1ecb9c46f19665ecbcaca09d8883ba94758a762b --- /dev/null +++ b/data/.fern/replay.lock @@ -0,0 +1,6261 @@ +# DO NOT EDIT MANUALLY - Managed by Fern Replay +version: "1.0" +generations: + - commit_sha: 6cdc807dbce06ea8b7e9037f018adb6816f39236 + tree_hash: 86240007aae7bfde82f6e453828a4b21974b8d3b + timestamp: 2026-05-20T07:38:29.115Z + cli_version: unknown + generator_versions: {} + - commit_sha: f6162d3b9e7ae2eb506569dc34938d5bd5f7d427 + tree_hash: 11577f041e5c4d0ef52d53130c965cee5722b53b + timestamp: 2026-05-26T13:58:19.631Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.42.0 + - commit_sha: 53ea245de6f5ee2ce3e44ee1adc2914eed606dd7 + tree_hash: 55def33f6d7c9729ab626faaa28674aa9060930b + timestamp: 2026-07-07T10:01:45.138Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.42.0 + - commit_sha: 9a1aed5baf8ba11a6319713529deadb212aa38de + tree_hash: 24f65efbf6ded828b8e933d54ab259dd6048ccfe + timestamp: 2026-07-09T07:38:14.043Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.42.0 + - commit_sha: 50965d3c84d178394d7276feaf440e1180077570 + tree_hash: 80f079181bbb8c25740527893363c3c3365293e5 + timestamp: 2026-07-13T08:25:02.899Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.42.0 + - commit_sha: 5f9dcf2dc2258622575d790bbfe7d9e724e8a2e4 + tree_hash: 2526662c1102613c7326d7ccd97b621f40ac8150 + timestamp: 2026-07-22T08:20:47.677Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: a7ccd7a4629a1173eafd554dc3f3505eb1ef105d + tree_hash: f9c8ba2cb39bdccb64f84b4046ca4485d1cbf6b9 + timestamp: 2026-07-30T10:04:22.461Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: cf7b4949242b5023487088ffa5a2ed6e82ba362a + tree_hash: 93090600cf9b23cb9aa71e64b5e97a5ed8f5167f + timestamp: 2026-08-05T09:53:37.453Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: 2c23274cf1033c8274ba000f5c707f4d55699167 + tree_hash: 3a5bf7eae106e53866ff9a129f0243536d035e7c + timestamp: 2026-08-06T15:18:53.471Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: 1e5d4021226cde19f15c23561bdb4b2ba765989e + tree_hash: bf7c69be78a0d4728acae1b0621eaad6b1fdf67b + timestamp: 2026-08-11T10:18:57.895Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: 42e85da7b81ab7cffa012b93a414b46cac013952 + tree_hash: f1c00d92a18a7aee272cf35e2225bb1e20b196cc + timestamp: 2026-08-13T09:12:22.603Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: 5fac7df460975189992ea93274c4a09b67e8d801 + tree_hash: 7a6227025d514441676ed5b16ef73d3d78e4a51f + timestamp: 2026-08-25T17:57:00.754Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: 3e762098479140440d47351f18dd8989bba08ea9 + tree_hash: bb170a260e147afdf041ebbfa4aad450f59a4a26 + timestamp: 2026-09-02T11:30:01.211Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: f969584d16a435d0d22a0d2d676eb4515b719e3c + tree_hash: b5e1ed351a6fc1b561e96b201fd5547293afc0fd + timestamp: 2026-09-07T11:10:18.860Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: e7e087183c0088cfe0830631ba89b5b0bb7a7698 + tree_hash: ff04368b0df16271879549c299d4ee10db671912 + timestamp: 2026-09-11T15:35:14.281Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: ce6bf6723aa833de04efea2d5d21546ac4730001 + tree_hash: 61a2b4d2ab7c2250356af00efb326c53b1ab0cd8 + timestamp: 2026-09-24T08:41:57.312Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: d2ae8c0436bcb6dd04fabb9856007adaf012d19c + tree_hash: 8fd8369441fa1fe2c79db0de0e0c6790339a93fb + timestamp: 2026-09-28T13:49:39.861Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: 265f67f1f27e00906e716bb3d0bd41ab2121b113 + tree_hash: de3f7635309dae3a0afb271ec7d1456a0d4c37b3 + timestamp: 2026-10-05T11:07:53.110Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: 7c9f25a7915a339b65f32c15c286d0152b9613cb + tree_hash: 5ccaf2d115ec5548ce4fcb232febe50054a19060 + timestamp: 2026-10-13T08:02:04.887Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: dd2ecbd535a897dba64e60e4eeb8d85f8257fbc4 + tree_hash: e7713655812d98046ecd7d9675bd566e08790d2e + timestamp: 2026-10-15T09:29:55.017Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 + - commit_sha: 3fcfbed12daf90dd92eb1a09e499b267f60683e9 + tree_hash: b6ae0d94c1ef5d5c494e599ff1e17282de70d70e + timestamp: 2026-10-20T08:04:56.156Z + cli_version: unknown + generator_versions: + fernapi/fern-python-sdk: 4.64.1 +current_generation: 3fcfbed12daf90dd92eb1a09e499b267f60683e9 +patches: + - id: patch-560b8934 + content_hash: sha256:7cc64e2c0e717976480e69331fa8402968c0ed67dc8d7dd94b304a0ad98e606a + original_commit: 560b89344199f0abe20d36f6963565818b3df6dd + original_message: "fix: send list-of-primitive multipart fields as repeated form fields (#819) (#825)" + original_author: Kræn Hansen + base_generation: cf7b4949242b5023487088ffa5a2ed6e82ba362a + files: + - src/elevenlabs/audio_native/raw_client.py + - src/elevenlabs/dubbing/project/raw_client.py + - src/elevenlabs/music/finetunes/raw_client.py + - src/elevenlabs/music/raw_client.py + - src/elevenlabs/speech_to_text/raw_client.py + - src/elevenlabs/studio/projects/raw_client.py + patch_content: | + diff --git a/src/elevenlabs/audio_native/raw_client.py b/src/elevenlabs/audio_native/raw_client.py + index 85caf294..8b6c0fe3 100644 + --- a/src/elevenlabs/audio_native/raw_client.py + +++ b/src/elevenlabs/audio_native/raw_client.py + @@ -1,6 +1,5 @@ + # This file was auto-generated by Fern from our API Definition. + + -import json + import typing + from json.decoder import JSONDecodeError + + @@ -122,7 +121,7 @@ class RawAudioNativeClient: + "model_id": model_id, + "auto_convert": auto_convert, + "apply_text_normalization": apply_text_normalization, + - "pronunciation_dictionary_locators": json.dumps(jsonable_encoder(pronunciation_dictionary_locators)), + + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + }, + files={ + **({"file": file} if file is not None else {}), + @@ -467,7 +466,7 @@ class AsyncRawAudioNativeClient: + "model_id": model_id, + "auto_convert": auto_convert, + "apply_text_normalization": apply_text_normalization, + - "pronunciation_dictionary_locators": json.dumps(jsonable_encoder(pronunciation_dictionary_locators)), + + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + }, + files={ + **({"file": file} if file is not None else {}), + diff --git a/src/elevenlabs/dubbing/project/raw_client.py b/src/elevenlabs/dubbing/project/raw_client.py + index 83a1e459..dadb8747 100644 + --- a/src/elevenlabs/dubbing/project/raw_client.py + +++ b/src/elevenlabs/dubbing/project/raw_client.py + @@ -1,6 +1,5 @@ + # This file was auto-generated by Fern from our API Definition. + + -import json + import typing + from json.decoder import JSONDecodeError + + @@ -159,7 +158,7 @@ class RawProjectClient: + "reference": reference, + "source_language": source_language, + "model_id": model_id, + - "keyterms": json.dumps(jsonable_encoder(keyterms)), + + "keyterms": keyterms, + "target_language": target_language, + }, + files={ + @@ -436,7 +435,7 @@ class AsyncRawProjectClient: + "reference": reference, + "source_language": source_language, + "model_id": model_id, + - "keyterms": json.dumps(jsonable_encoder(keyterms)), + + "keyterms": keyterms, + "target_language": target_language, + }, + files={ + diff --git a/src/elevenlabs/music/finetunes/raw_client.py b/src/elevenlabs/music/finetunes/raw_client.py + index e4de27f0..dc8c71e3 100644 + --- a/src/elevenlabs/music/finetunes/raw_client.py + +++ b/src/elevenlabs/music/finetunes/raw_client.py + @@ -1,6 +1,5 @@ + # This file was auto-generated by Fern from our API Definition. + + -import json + import typing + from json.decoder import JSONDecodeError + + @@ -167,7 +166,7 @@ class RawFinetunesClient: + data={ + "name": name, + "primary_genre": primary_genre, + - "tags": json.dumps(jsonable_encoder(tags)), + + "tags": tags, + "visibility": visibility, + "model_id": model_id, + }, + @@ -622,7 +621,7 @@ class AsyncRawFinetunesClient: + data={ + "name": name, + "primary_genre": primary_genre, + - "tags": json.dumps(jsonable_encoder(tags)), + + "tags": tags, + "visibility": visibility, + "model_id": model_id, + }, + diff --git a/src/elevenlabs/music/raw_client.py b/src/elevenlabs/music/raw_client.py + index bce5d86d..4a526987 100644 + --- a/src/elevenlabs/music/raw_client.py + +++ b/src/elevenlabs/music/raw_client.py + @@ -9,7 +9,6 @@ from .. import core + from ..core.api_error import ApiError + from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + from ..core.http_response import AsyncHttpResponse, HttpResponse + -from ..core.jsonable_encoder import jsonable_encoder + from ..core.parse_error import ParsingError + from ..core.request_options import RequestOptions + from ..core.serialization import convert_and_respect_annotation_metadata + @@ -105,7 +104,7 @@ class RawMusicClient: + }, + data={ + "description": description, + - "tags": json.dumps(jsonable_encoder(tags)), + + "tags": tags, + "model_id": model_id, + "sign_with_c2pa": sign_with_c_2_pa, + }, + @@ -895,7 +894,7 @@ class AsyncRawMusicClient: + }, + data={ + "description": description, + - "tags": json.dumps(jsonable_encoder(tags)), + + "tags": tags, + "model_id": model_id, + "sign_with_c2pa": sign_with_c_2_pa, + }, + diff --git a/src/elevenlabs/speech_to_text/raw_client.py b/src/elevenlabs/speech_to_text/raw_client.py + index d1c62835..877dae07 100644 + --- a/src/elevenlabs/speech_to_text/raw_client.py + +++ b/src/elevenlabs/speech_to_text/raw_client.py + @@ -195,7 +195,7 @@ class RawSpeechToTextClient: + "detect_speaker_roles": detect_speaker_roles, + "entity_redaction": json.dumps(jsonable_encoder(entity_redaction)), + "entity_redaction_mode": entity_redaction_mode, + - "keyterms": json.dumps(jsonable_encoder(keyterms)), + + "keyterms": keyterms, + }, + files={ + **({"file": file} if file is not None else {}), + @@ -405,7 +405,7 @@ class AsyncRawSpeechToTextClient: + "detect_speaker_roles": detect_speaker_roles, + "entity_redaction": json.dumps(jsonable_encoder(entity_redaction)), + "entity_redaction_mode": entity_redaction_mode, + - "keyterms": json.dumps(jsonable_encoder(keyterms)), + + "keyterms": keyterms, + }, + files={ + **({"file": file} if file is not None else {}), + diff --git a/src/elevenlabs/studio/projects/raw_client.py b/src/elevenlabs/studio/projects/raw_client.py + index bccd5df9..28f79edc 100644 + --- a/src/elevenlabs/studio/projects/raw_client.py + +++ b/src/elevenlabs/studio/projects/raw_client.py + @@ -1,6 +1,5 @@ + # This file was auto-generated by Fern from our API Definition. + + -import json + import typing + from json.decoder import JSONDecodeError + + @@ -304,7 +303,7 @@ class RawProjectsClient: + "title": title, + "author": author, + "description": description, + - "genres": json.dumps(jsonable_encoder(genres)), + + "genres": genres, + "target_audience": target_audience, + "language": language, + "content_type": content_type, + @@ -313,14 +312,14 @@ class RawProjectsClient: + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "volume_normalization": volume_normalization, + - "pronunciation_dictionary_locators": json.dumps(jsonable_encoder(pronunciation_dictionary_locators)), + + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + "callback_url": callback_url, + "fiction": fiction, + "apply_text_normalization": apply_text_normalization, + "auto_convert": auto_convert, + "auto_assign_voices": auto_assign_voices, + "source_type": source_type, + - "voice_settings": json.dumps(jsonable_encoder(voice_settings)), + + "voice_settings": voice_settings, + "create_publishing_read": create_publishing_read, + }, + files={ + @@ -960,7 +959,7 @@ class AsyncRawProjectsClient: + "title": title, + "author": author, + "description": description, + - "genres": json.dumps(jsonable_encoder(genres)), + + "genres": genres, + "target_audience": target_audience, + "language": language, + "content_type": content_type, + @@ -969,14 +968,14 @@ class AsyncRawProjectsClient: + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "volume_normalization": volume_normalization, + - "pronunciation_dictionary_locators": json.dumps(jsonable_encoder(pronunciation_dictionary_locators)), + + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + "callback_url": callback_url, + "fiction": fiction, + "apply_text_normalization": apply_text_normalization, + "auto_convert": auto_convert, + "auto_assign_voices": auto_assign_voices, + "source_type": source_type, + - "voice_settings": json.dumps(jsonable_encoder(voice_settings)), + + "voice_settings": voice_settings, + "create_publishing_read": create_publishing_read, + }, + files={ + theirs_snapshot: + src/elevenlabs/audio_native/raw_client.py: | + # This file was auto-generated by Fern from our API Definition. + + import typing + from json.decoder import JSONDecodeError + + from .. import core + from ..core.api_error import ApiError + from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + from ..core.http_response import AsyncHttpResponse, HttpResponse + from ..core.jsonable_encoder import jsonable_encoder + from ..core.parse_error import ParsingError + from ..core.request_options import RequestOptions + from ..core.unchecked_base_model import construct_type + from ..errors.unprocessable_entity_error import UnprocessableEntityError + from ..types.audio_native_create_project_response_model import AudioNativeCreateProjectResponseModel + from ..types.audio_native_edit_content_response_model import AudioNativeEditContentResponseModel + from ..types.get_audio_native_project_settings_response_model import GetAudioNativeProjectSettingsResponseModel + from .types.audio_native_create_request_apply_text_normalization import AudioNativeCreateRequestApplyTextNormalization + from pydantic import ValidationError + + # this is used as the default value for optional parameters + OMIT = typing.cast(typing.Any, ...) + + + class RawAudioNativeClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + name: str, + image: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + small: typing.Optional[bool] = OMIT, + text_color: typing.Optional[str] = OMIT, + background_color: typing.Optional[str] = OMIT, + sessionization: typing.Optional[int] = OMIT, + voice_id: typing.Optional[str] = OMIT, + model_id: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[AudioNativeCreateRequestApplyTextNormalization] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AudioNativeCreateProjectResponseModel]: + """ + Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet. + + Parameters + ---------- + name : str + Project name. + + image : typing.Optional[str] + (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + small : typing.Optional[bool] + (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used. + + text_color : typing.Optional[str] + Text color used in the player. If not provided, default text color set in the Player settings is used. + + background_color : typing.Optional[str] + Background color used in the player. If not provided, default background color set in the Player settings is used. + + sessionization : typing.Optional[int] + (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + + voice_id : typing.Optional[str] + Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + + model_id : typing.Optional[str] + TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + apply_text_normalization : typing.Optional[AudioNativeCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioNativeCreateProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/audio-native", + method="POST", + data={ + "name": name, + "image": image, + "author": author, + "title": title, + "small": small, + "text_color": text_color, + "background_color": background_color, + "sessionization": sessionization, + "voice_id": voice_id, + "model_id": model_id, + "auto_convert": auto_convert, + "apply_text_normalization": apply_text_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeCreateProjectResponseModel, + construct_type( + type_=AudioNativeCreateProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_settings( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetAudioNativeProjectSettingsResponseModel]: + """ + Get player settings for the specific project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAudioNativeProjectSettingsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/audio-native/{jsonable_encoder(project_id)}/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAudioNativeProjectSettingsResponseModel, + construct_type( + type_=GetAudioNativeProjectSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + project_id: str, + *, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_publish: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AudioNativeEditContentResponseModel]: + """ + Updates content for the specific AudioNative Project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + auto_publish : typing.Optional[bool] + Whether to auto publish the new project snapshot after it's converted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioNativeEditContentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/audio-native/{jsonable_encoder(project_id)}/content", + method="POST", + data={ + "auto_convert": auto_convert, + "auto_publish": auto_publish, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeEditContentResponseModel, + construct_type( + type_=AudioNativeEditContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_content_from_url( + self, + *, + url: str, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AudioNativeEditContentResponseModel]: + """ + Finds an AudioNative project matching the provided URL, extracts content from the URL, updates the project content, and queues it for conversion and auto-publishing. + + Parameters + ---------- + url : str + URL of the page to extract content from. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioNativeEditContentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/audio-native/content", + method="POST", + json={ + "url": url, + "author": author, + "title": title, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeEditContentResponseModel, + construct_type( + type_=AudioNativeEditContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + + class AsyncRawAudioNativeClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + name: str, + image: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + small: typing.Optional[bool] = OMIT, + text_color: typing.Optional[str] = OMIT, + background_color: typing.Optional[str] = OMIT, + sessionization: typing.Optional[int] = OMIT, + voice_id: typing.Optional[str] = OMIT, + model_id: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[AudioNativeCreateRequestApplyTextNormalization] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AudioNativeCreateProjectResponseModel]: + """ + Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet. + + Parameters + ---------- + name : str + Project name. + + image : typing.Optional[str] + (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + small : typing.Optional[bool] + (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used. + + text_color : typing.Optional[str] + Text color used in the player. If not provided, default text color set in the Player settings is used. + + background_color : typing.Optional[str] + Background color used in the player. If not provided, default background color set in the Player settings is used. + + sessionization : typing.Optional[int] + (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + + voice_id : typing.Optional[str] + Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + + model_id : typing.Optional[str] + TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + apply_text_normalization : typing.Optional[AudioNativeCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioNativeCreateProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/audio-native", + method="POST", + data={ + "name": name, + "image": image, + "author": author, + "title": title, + "small": small, + "text_color": text_color, + "background_color": background_color, + "sessionization": sessionization, + "voice_id": voice_id, + "model_id": model_id, + "auto_convert": auto_convert, + "apply_text_normalization": apply_text_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeCreateProjectResponseModel, + construct_type( + type_=AudioNativeCreateProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_settings( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetAudioNativeProjectSettingsResponseModel]: + """ + Get player settings for the specific project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAudioNativeProjectSettingsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/audio-native/{jsonable_encoder(project_id)}/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAudioNativeProjectSettingsResponseModel, + construct_type( + type_=GetAudioNativeProjectSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + project_id: str, + *, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_publish: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AudioNativeEditContentResponseModel]: + """ + Updates content for the specific AudioNative Project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + auto_publish : typing.Optional[bool] + Whether to auto publish the new project snapshot after it's converted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioNativeEditContentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/audio-native/{jsonable_encoder(project_id)}/content", + method="POST", + data={ + "auto_convert": auto_convert, + "auto_publish": auto_publish, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeEditContentResponseModel, + construct_type( + type_=AudioNativeEditContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_content_from_url( + self, + *, + url: str, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AudioNativeEditContentResponseModel]: + """ + Finds an AudioNative project matching the provided URL, extracts content from the URL, updates the project content, and queues it for conversion and auto-publishing. + + Parameters + ---------- + url : str + URL of the page to extract content from. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioNativeEditContentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/audio-native/content", + method="POST", + json={ + "url": url, + "author": author, + "title": title, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeEditContentResponseModel, + construct_type( + type_=AudioNativeEditContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + src/elevenlabs/dubbing/project/raw_client.py: | + # This file was auto-generated by Fern from our API Definition. + + import typing + from json.decoder import JSONDecodeError + + from ... import core + from ...core.api_error import ApiError + from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + from ...core.http_response import AsyncHttpResponse, HttpResponse + from ...core.jsonable_encoder import jsonable_encoder + from ...core.parse_error import ParsingError + from ...core.request_options import RequestOptions + from ...core.unchecked_base_model import construct_type + from ...errors.unprocessable_entity_error import UnprocessableEntityError + from ...types.dubbing_project_list_response import DubbingProjectListResponse + from ...types.dubbing_project_response import DubbingProjectResponse + from .types.project_list_request_sort_direction import ProjectListRequestSortDirection + from pydantic import ValidationError + + # this is used as the default value for optional parameters + OMIT = typing.cast(typing.Any, ...) + + + class RawProjectClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + sort_direction: typing.Optional[ProjectListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingProjectListResponse]: + """ + List the workspace's dubbing projects (cursor-paginated). + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor from a previous response's next_cursor. + + page_size : typing.Optional[int] + Number of projects per page (max 100). + + status : typing.Optional[str] + Filter to projects in this status (preparing, ready, failed). + + sort_direction : typing.Optional[ProjectListRequestSortDirection] + Sort by creation time (default 'DESCENDING'). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingProjectListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/dubbing/project", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectListResponse, + construct_type( + type_=DubbingProjectListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + source_url: typing.Optional[str] = OMIT, + reference: typing.Optional[str] = OMIT, + source_language: typing.Optional[str] = OMIT, + model_id: typing.Optional[typing.Literal["dubbing_v2"]] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + target_language: typing.Optional[str] = OMIT, + transcript: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingProjectResponse]: + """ + Create a dubbing project from an uploaded file or a source URL. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + source_url : typing.Optional[str] + Public URL to fetch the source media from. Provide this or file. + + reference : typing.Optional[str] + Optional free-form string (max 500 characters) to identify the project on your end. + + source_language : typing.Optional[str] + BCP-47 language tag of the source media; must be a language the transcription model supports. Any region or script subtag is ignored, since transcription is per-language. Omit to auto-detect. + + model_id : typing.Optional[typing.Literal["dubbing_v2"]] + Default dubbing model id for the project's language targets; a target may override it. Omit to use the system default. + + keyterms : typing.Optional[typing.List[str]] + Key terms to bias transcription/translation toward (e.g. product or brand names). At most 1000 terms; each term at most 50 characters and 5 words; the characters `<>{}[]\\` are not allowed. + + target_language : typing.Optional[str] + Optional shortcut: also create a language target in this BCP-47 language, queued to start once the project is ready. Must be a language the dubbing model supports, and a region-qualified tag must be one of the supported dialects. + + transcript : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingProjectResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/dubbing/project", + method="POST", + data={ + "source_url": source_url, + "reference": reference, + "source_language": source_language, + "model_id": model_id, + "keyterms": keyterms, + "target_language": target_language, + }, + files={ + **({"file": file} if file is not None else {}), + **({"transcript": transcript} if transcript is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectResponse, + construct_type( + type_=DubbingProjectResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingProjectResponse]: + """ + Full project detail, including its language target ids. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingProjectResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectResponse, + construct_type( + type_=DubbingProjectResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Delete a project and its language targets. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + + class AsyncRawProjectClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + sort_direction: typing.Optional[ProjectListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingProjectListResponse]: + """ + List the workspace's dubbing projects (cursor-paginated). + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor from a previous response's next_cursor. + + page_size : typing.Optional[int] + Number of projects per page (max 100). + + status : typing.Optional[str] + Filter to projects in this status (preparing, ready, failed). + + sort_direction : typing.Optional[ProjectListRequestSortDirection] + Sort by creation time (default 'DESCENDING'). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingProjectListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/dubbing/project", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectListResponse, + construct_type( + type_=DubbingProjectListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + source_url: typing.Optional[str] = OMIT, + reference: typing.Optional[str] = OMIT, + source_language: typing.Optional[str] = OMIT, + model_id: typing.Optional[typing.Literal["dubbing_v2"]] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + target_language: typing.Optional[str] = OMIT, + transcript: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingProjectResponse]: + """ + Create a dubbing project from an uploaded file or a source URL. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + source_url : typing.Optional[str] + Public URL to fetch the source media from. Provide this or file. + + reference : typing.Optional[str] + Optional free-form string (max 500 characters) to identify the project on your end. + + source_language : typing.Optional[str] + BCP-47 language tag of the source media; must be a language the transcription model supports. Any region or script subtag is ignored, since transcription is per-language. Omit to auto-detect. + + model_id : typing.Optional[typing.Literal["dubbing_v2"]] + Default dubbing model id for the project's language targets; a target may override it. Omit to use the system default. + + keyterms : typing.Optional[typing.List[str]] + Key terms to bias transcription/translation toward (e.g. product or brand names). At most 1000 terms; each term at most 50 characters and 5 words; the characters `<>{}[]\\` are not allowed. + + target_language : typing.Optional[str] + Optional shortcut: also create a language target in this BCP-47 language, queued to start once the project is ready. Must be a language the dubbing model supports, and a region-qualified tag must be one of the supported dialects. + + transcript : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingProjectResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/dubbing/project", + method="POST", + data={ + "source_url": source_url, + "reference": reference, + "source_language": source_language, + "model_id": model_id, + "keyterms": keyterms, + "target_language": target_language, + }, + files={ + **({"file": file} if file is not None else {}), + **({"transcript": transcript} if transcript is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectResponse, + construct_type( + type_=DubbingProjectResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingProjectResponse]: + """ + Full project detail, including its language target ids. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingProjectResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectResponse, + construct_type( + type_=DubbingProjectResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete a project and its language targets. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + src/elevenlabs/music/finetunes/raw_client.py: | + # This file was auto-generated by Fern from our API Definition. + + import typing + from json.decoder import JSONDecodeError + + from ... import core + from ...core.api_error import ApiError + from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + from ...core.http_response import AsyncHttpResponse, HttpResponse + from ...core.jsonable_encoder import jsonable_encoder + from ...core.parse_error import ParsingError + from ...core.request_options import RequestOptions + from ...core.unchecked_base_model import construct_type + from ...errors.forbidden_error import ForbiddenError + from ...errors.not_found_error import NotFoundError + from ...errors.unprocessable_entity_error import UnprocessableEntityError + from ...types.finetune_created_by import FinetuneCreatedBy + from ...types.finetune_visibility import FinetuneVisibility + from ...types.music_finetune_page_response_model import MusicFinetunePageResponseModel + from ...types.music_finetune_response_model import MusicFinetuneResponseModel + from .types.finetunes_create_request_model_id import FinetunesCreateRequestModelId + from .types.finetunes_create_request_visibility import FinetunesCreateRequestVisibility + from .types.finetunes_list_request_sort import FinetunesListRequestSort + from .types.finetunes_list_request_sort_direction import FinetunesListRequestSortDirection + from .types.update_music_finetune_request_model_visibility import UpdateMusicFinetuneRequestModelVisibility + from pydantic import ValidationError + + # this is used as the default value for optional parameters + OMIT = typing.cast(typing.Any, ...) + + + class RawFinetunesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + visibility: typing.Optional[FinetuneVisibility] = None, + created_by: typing.Optional[FinetuneCreatedBy] = None, + sort: typing.Optional[FinetunesListRequestSort] = None, + sort_direction: typing.Optional[FinetunesListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MusicFinetunePageResponseModel]: + """ + List music finetunes accessible to you (your own, workspace-shared, and ElevenLabs-curated), with optional filtering, sorting, and cursor pagination. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching the next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many finetunes to return. Max 100, default 50. + + visibility : typing.Optional[FinetuneVisibility] + Filter by visibility. 'private' returns private finetunes; 'workspace' returns workspace-shared finetunes; 'public' returns public finetunes, which are currently ElevenLabs curated finetunes. Omit to return all accessible finetunes. + + created_by : typing.Optional[FinetuneCreatedBy] + Filter by creator. 'self' returns finetunes you created; 'workspace' returns finetunes created by workspace teammates; 'elevenlabs' returns ElevenLabs curated finetunes. Omit to return finetunes from all creators. + + sort : typing.Optional[FinetunesListRequestSort] + Sort by field (created_at or name) + + sort_direction : typing.Optional[FinetunesListRequestSortDirection] + Sort direction (asc or desc) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetunePageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/music/finetunes", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "visibility": visibility, + "created_by": created_by, + "sort": sort, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetunePageResponseModel, + construct_type( + type_=MusicFinetunePageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + name: str, + primary_genre: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + visibility: typing.Optional[FinetunesCreateRequestVisibility] = OMIT, + model_id: typing.Optional[FinetunesCreateRequestModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MusicFinetuneResponseModel]: + """ + Create a new music finetune + + Parameters + ---------- + name : str + Name for the finetune (5-200 characters). + + primary_genre : str + Primary musical genre of the finetune. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + tags : typing.Optional[typing.List[str]] + Tags to associate with the finetune. + + visibility : typing.Optional[FinetunesCreateRequestVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + model_id : typing.Optional[FinetunesCreateRequestModelId] + The model to create a finetune for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/music/finetunes", + method="POST", + data={ + "name": name, + "primary_genre": primary_genre, + "tags": tags, + "visibility": visibility, + "model_id": model_id, + }, + files={ + **({"files": files} if files is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MusicFinetuneResponseModel]: + """ + Get a music finetune. + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MusicFinetuneResponseModel]: + """ + Delete a music finetune + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + finetune_id: str, + *, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + primary_genre: typing.Optional[str] = OMIT, + visibility: typing.Optional[UpdateMusicFinetuneRequestModelVisibility] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MusicFinetuneResponseModel]: + """ + Update a music finetune. + + Parameters + ---------- + finetune_id : str + + name : typing.Optional[str] + Updated name for the finetune. + + tags : typing.Optional[typing.Sequence[str]] + Replacement set of tags. + + primary_genre : typing.Optional[str] + Updated primary musical genre. + + visibility : typing.Optional[UpdateMusicFinetuneRequestModelVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="PATCH", + json={ + "name": name, + "tags": tags, + "primary_genre": primary_genre, + "visibility": visibility, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + + class AsyncRawFinetunesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + visibility: typing.Optional[FinetuneVisibility] = None, + created_by: typing.Optional[FinetuneCreatedBy] = None, + sort: typing.Optional[FinetunesListRequestSort] = None, + sort_direction: typing.Optional[FinetunesListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MusicFinetunePageResponseModel]: + """ + List music finetunes accessible to you (your own, workspace-shared, and ElevenLabs-curated), with optional filtering, sorting, and cursor pagination. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching the next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many finetunes to return. Max 100, default 50. + + visibility : typing.Optional[FinetuneVisibility] + Filter by visibility. 'private' returns private finetunes; 'workspace' returns workspace-shared finetunes; 'public' returns public finetunes, which are currently ElevenLabs curated finetunes. Omit to return all accessible finetunes. + + created_by : typing.Optional[FinetuneCreatedBy] + Filter by creator. 'self' returns finetunes you created; 'workspace' returns finetunes created by workspace teammates; 'elevenlabs' returns ElevenLabs curated finetunes. Omit to return finetunes from all creators. + + sort : typing.Optional[FinetunesListRequestSort] + Sort by field (created_at or name) + + sort_direction : typing.Optional[FinetunesListRequestSortDirection] + Sort direction (asc or desc) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetunePageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/music/finetunes", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "visibility": visibility, + "created_by": created_by, + "sort": sort, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetunePageResponseModel, + construct_type( + type_=MusicFinetunePageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + name: str, + primary_genre: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + visibility: typing.Optional[FinetunesCreateRequestVisibility] = OMIT, + model_id: typing.Optional[FinetunesCreateRequestModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MusicFinetuneResponseModel]: + """ + Create a new music finetune + + Parameters + ---------- + name : str + Name for the finetune (5-200 characters). + + primary_genre : str + Primary musical genre of the finetune. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + tags : typing.Optional[typing.List[str]] + Tags to associate with the finetune. + + visibility : typing.Optional[FinetunesCreateRequestVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + model_id : typing.Optional[FinetunesCreateRequestModelId] + The model to create a finetune for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/music/finetunes", + method="POST", + data={ + "name": name, + "primary_genre": primary_genre, + "tags": tags, + "visibility": visibility, + "model_id": model_id, + }, + files={ + **({"files": files} if files is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MusicFinetuneResponseModel]: + """ + Get a music finetune. + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MusicFinetuneResponseModel]: + """ + Delete a music finetune + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + finetune_id: str, + *, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + primary_genre: typing.Optional[str] = OMIT, + visibility: typing.Optional[UpdateMusicFinetuneRequestModelVisibility] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MusicFinetuneResponseModel]: + """ + Update a music finetune. + + Parameters + ---------- + finetune_id : str + + name : typing.Optional[str] + Updated name for the finetune. + + tags : typing.Optional[typing.Sequence[str]] + Replacement set of tags. + + primary_genre : typing.Optional[str] + Updated primary musical genre. + + visibility : typing.Optional[UpdateMusicFinetuneRequestModelVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="PATCH", + json={ + "name": name, + "tags": tags, + "primary_genre": primary_genre, + "visibility": visibility, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + src/elevenlabs/music/raw_client.py: | + # This file was auto-generated by Fern from our API Definition. + + import contextlib + import json + import typing + from json.decoder import JSONDecodeError + + from .. import core + from ..core.api_error import ApiError + from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + from ..core.http_response import AsyncHttpResponse, HttpResponse + from ..core.parse_error import ParsingError + from ..core.request_options import RequestOptions + from ..core.serialization import convert_and_respect_annotation_metadata + from ..core.unchecked_base_model import construct_type + from ..errors.forbidden_error import ForbiddenError + from ..errors.unprocessable_entity_error import UnprocessableEntityError + from ..types.allowed_output_formats import AllowedOutputFormats + from ..types.music_upload_response import MusicUploadResponse + from .types.body_compose_music_v_1_music_post_composition_plan import BodyComposeMusicV1MusicPostCompositionPlan + from .types.body_compose_music_v_1_music_post_model_id import BodyComposeMusicV1MusicPostModelId + from .types.body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan import ( + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, + ) + from .types.body_compose_music_with_a_detailed_response_v_1_music_detailed_post_model_id import ( + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostModelId, + ) + from .types.body_stream_composed_music_v_1_music_stream_post_composition_plan import ( + BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, + ) + from .types.body_stream_composed_music_v_1_music_stream_post_model_id import ( + BodyStreamComposedMusicV1MusicStreamPostModelId, + ) + from .types.body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_composition_plan import ( + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, + ) + from .types.body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_model_id import ( + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostModelId, + ) + from .types.music_compose_detailed_request_output_format import MusicComposeDetailedRequestOutputFormat + from .types.music_compose_detailed_stream_request_output_format import MusicComposeDetailedStreamRequestOutputFormat + from .types.music_compose_request_output_format import MusicComposeRequestOutputFormat + from .types.music_separate_stems_request_stem_variation_id import MusicSeparateStemsRequestStemVariationId + from .types.music_stream_request_output_format import MusicStreamRequestOutputFormat + from .types.music_video_to_music_request_model_id import MusicVideoToMusicRequestModelId + from pydantic import ValidationError + + # this is used as the default value for optional parameters + OMIT = typing.cast(typing.Any, ...) + + + class RawMusicClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def video_to_music( + self, + *, + videos: typing.List[core.File], + output_format: typing.Optional[AllowedOutputFormats] = None, + description: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + model_id: typing.Optional[MusicVideoToMusicRequestModelId] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Generate background music from one or more video files. Videos are combined in order. Optional description and style tags influence the generated music. + + Parameters + ---------- + videos : typing.List[core.File] + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + description : typing.Optional[str] + Optional text description of the music you want. A maximum of 1000 characters is allowed. + + tags : typing.Optional[typing.List[str]] + Optional list of style tags (e.g. ['upbeat', 'cinematic']). A maximum of 10 tags is allowed. + + model_id : typing.Optional[MusicVideoToMusicRequestModelId] + The model to use for the generation. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Generated audio file matching the video. Content-Type and file extension depend on the output_format parameter (default mp3). + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/video-to-music", + method="POST", + params={ + "output_format": output_format, + }, + data={ + "description": description, + "tags": tags, + "model_id": model_id, + "sign_with_c2pa": sign_with_c_2_pa, + }, + files={ + "videos": videos, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def compose( + self, + *, + output_format: typing.Optional[MusicComposeRequestOutputFormat] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[BodyComposeMusicV1MusicPostModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[BodyComposeMusicV1MusicPostModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The generated audio file in the format specified + """ + with self._client_wrapper.httpx_client.stream( + "v1/music", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, annotation=BodyComposeMusicV1MusicPostCompositionPlan, direction="write" + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "respect_sections_durations": respect_sections_durations, + "store_for_inpainting": store_for_inpainting, + "sign_with_c2pa": sign_with_c_2_pa, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def compose_detailed( + self, + *, + output_format: typing.Optional[MusicComposeDetailedRequestOutputFormat] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Multipart/mixed response with JSON metadata and binary audio file + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/detailed", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "respect_sections_durations": respect_sections_durations, + "store_for_inpainting": store_for_inpainting, + "with_timestamps": with_timestamps, + "sign_with_c2pa": sign_with_c_2_pa, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def compose_detailed_stream( + self, + *, + output_format: typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[str]]]: + """ + Stream a song and its detailed metadata using Server-Sent Events (SSE). + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[HttpResponse[typing.Iterator[str]]] + Server-Sent Events for composition plan, song metadata, audio chunks with optional word timestamps, and completion. + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/detailed/stream", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "store_for_inpainting": store_for_inpainting, + "with_timestamps": with_timestamps, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[str]]: + try: + if 200 <= _response.status_code < 300: + + def _iter(): + for _text in _response.iter_lines(): + try: + if len(_text) == 0: + continue + yield typing.cast( + str, + construct_type( + type_=str, # type: ignore + object_=json.loads(_text), + ), + ) + except Exception: + pass + return + + return HttpResponse(response=_response, data=_iter()) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def stream( + self, + *, + output_format: typing.Optional[MusicStreamRequestOutputFormat] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[BodyStreamComposedMusicV1MusicStreamPostModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Stream a composed song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[BodyStreamComposedMusicV1MusicStreamPostModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Streaming audio data in the format specified + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/stream", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "store_for_inpainting": store_for_inpainting, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + def upload( + self, + *, + file: core.File, + extract_composition_plan: typing.Optional[str] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MusicUploadResponse]: + """ + Upload a music file to be later used for inpainting. Price for uploading is the same as the one for song generation. All uploaded content gets inspected for copyright infringement. If copyrighted content is detected, half of the request cost is still charged. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + extract_composition_plan : typing.Optional[str] + Whether to generate and return the composition plan for the uploaded song. Pass a model id (`music_v1` or `music_v2`) to control which composition plan format is returned. Passing `true`/`false` is deprecated; `true` defaults to the `music_v1` plan format. Enabling this will increase the latency. + + with_timestamps : typing.Optional[bool] + Whether to transcribe the uploaded song and return word-level timestamps. If True, the response will include words_timestamps but will increase the latency. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicUploadResponse] + Successfully uploaded music file with optional composition plan + """ + _response = self._client_wrapper.httpx_client.request( + "v1/music/upload", + method="POST", + data={ + "extract_composition_plan": extract_composition_plan, + "with_timestamps": with_timestamps, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicUploadResponse, + construct_type( + type_=MusicUploadResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def separate_stems( + self, + *, + file: core.File, + output_format: typing.Optional[AllowedOutputFormats] = None, + stem_variation_id: typing.Optional[MusicSeparateStemsRequestStemVariationId] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Separate an audio file into individual stems. This endpoint might have high latency, depending on the length of the audio file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + stem_variation_id : typing.Optional[MusicSeparateStemsRequestStemVariationId] + The id of the stem variation to use. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + ZIP archive containing separated audio stems. Each stem is provided as a separate audio file in the requested output format. + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/stem-separation", + method="POST", + params={ + "output_format": output_format, + }, + data={ + "stem_variation_id": stem_variation_id, + "sign_with_c2pa": sign_with_c_2_pa, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + + class AsyncRawMusicClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def video_to_music( + self, + *, + videos: typing.List[core.File], + output_format: typing.Optional[AllowedOutputFormats] = None, + description: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + model_id: typing.Optional[MusicVideoToMusicRequestModelId] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Generate background music from one or more video files. Videos are combined in order. Optional description and style tags influence the generated music. + + Parameters + ---------- + videos : typing.List[core.File] + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + description : typing.Optional[str] + Optional text description of the music you want. A maximum of 1000 characters is allowed. + + tags : typing.Optional[typing.List[str]] + Optional list of style tags (e.g. ['upbeat', 'cinematic']). A maximum of 10 tags is allowed. + + model_id : typing.Optional[MusicVideoToMusicRequestModelId] + The model to use for the generation. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Generated audio file matching the video. Content-Type and file extension depend on the output_format parameter (default mp3). + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/video-to-music", + method="POST", + params={ + "output_format": output_format, + }, + data={ + "description": description, + "tags": tags, + "model_id": model_id, + "sign_with_c2pa": sign_with_c_2_pa, + }, + files={ + "videos": videos, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def compose( + self, + *, + output_format: typing.Optional[MusicComposeRequestOutputFormat] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[BodyComposeMusicV1MusicPostModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[BodyComposeMusicV1MusicPostModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The generated audio file in the format specified + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, annotation=BodyComposeMusicV1MusicPostCompositionPlan, direction="write" + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "respect_sections_durations": respect_sections_durations, + "store_for_inpainting": store_for_inpainting, + "sign_with_c2pa": sign_with_c_2_pa, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def compose_detailed( + self, + *, + output_format: typing.Optional[MusicComposeDetailedRequestOutputFormat] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Multipart/mixed response with JSON metadata and binary audio file + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/detailed", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "respect_sections_durations": respect_sections_durations, + "store_for_inpainting": store_for_inpainting, + "with_timestamps": with_timestamps, + "sign_with_c2pa": sign_with_c_2_pa, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def compose_detailed_stream( + self, + *, + output_format: typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[str]]]: + """ + Stream a song and its detailed metadata using Server-Sent Events (SSE). + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[str]]] + Server-Sent Events for composition plan, song metadata, audio chunks with optional word timestamps, and completion. + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/detailed/stream", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "store_for_inpainting": store_for_inpainting, + "with_timestamps": with_timestamps, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[str]]: + try: + if 200 <= _response.status_code < 300: + + async def _iter(): + async for _text in _response.aiter_lines(): + try: + if len(_text) == 0: + continue + yield typing.cast( + str, + construct_type( + type_=str, # type: ignore + object_=json.loads(_text), + ), + ) + except Exception: + pass + return + + return AsyncHttpResponse(response=_response, data=_iter()) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def stream( + self, + *, + output_format: typing.Optional[MusicStreamRequestOutputFormat] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[BodyStreamComposedMusicV1MusicStreamPostModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Stream a composed song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[BodyStreamComposedMusicV1MusicStreamPostModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Streaming audio data in the format specified + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/stream", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "store_for_inpainting": store_for_inpainting, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + async def upload( + self, + *, + file: core.File, + extract_composition_plan: typing.Optional[str] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MusicUploadResponse]: + """ + Upload a music file to be later used for inpainting. Price for uploading is the same as the one for song generation. All uploaded content gets inspected for copyright infringement. If copyrighted content is detected, half of the request cost is still charged. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + extract_composition_plan : typing.Optional[str] + Whether to generate and return the composition plan for the uploaded song. Pass a model id (`music_v1` or `music_v2`) to control which composition plan format is returned. Passing `true`/`false` is deprecated; `true` defaults to the `music_v1` plan format. Enabling this will increase the latency. + + with_timestamps : typing.Optional[bool] + Whether to transcribe the uploaded song and return word-level timestamps. If True, the response will include words_timestamps but will increase the latency. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicUploadResponse] + Successfully uploaded music file with optional composition plan + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/music/upload", + method="POST", + data={ + "extract_composition_plan": extract_composition_plan, + "with_timestamps": with_timestamps, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicUploadResponse, + construct_type( + type_=MusicUploadResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def separate_stems( + self, + *, + file: core.File, + output_format: typing.Optional[AllowedOutputFormats] = None, + stem_variation_id: typing.Optional[MusicSeparateStemsRequestStemVariationId] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Separate an audio file into individual stems. This endpoint might have high latency, depending on the length of the audio file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + stem_variation_id : typing.Optional[MusicSeparateStemsRequestStemVariationId] + The id of the stem variation to use. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + ZIP archive containing separated audio stems. Each stem is provided as a separate audio file in the requested output format. + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/stem-separation", + method="POST", + params={ + "output_format": output_format, + }, + data={ + "stem_variation_id": stem_variation_id, + "sign_with_c2pa": sign_with_c_2_pa, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + src/elevenlabs/speech_to_text/raw_client.py: | + # This file was auto-generated by Fern from our API Definition. + + import json + import typing + from json.decoder import JSONDecodeError + + from .. import core + from ..core.api_error import ApiError + from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + from ..core.http_response import AsyncHttpResponse, HttpResponse + from ..core.jsonable_encoder import jsonable_encoder + from ..core.parse_error import ParsingError + from ..core.request_options import RequestOptions + from ..core.unchecked_base_model import construct_type + from ..errors.unprocessable_entity_error import UnprocessableEntityError + from ..types.additional_formats import AdditionalFormats + from .types.speech_to_text_convert_request_entity_detection import SpeechToTextConvertRequestEntityDetection + from .types.speech_to_text_convert_request_entity_redaction import SpeechToTextConvertRequestEntityRedaction + from .types.speech_to_text_convert_request_file_format import SpeechToTextConvertRequestFileFormat + from .types.speech_to_text_convert_request_model_id import SpeechToTextConvertRequestModelId + from .types.speech_to_text_convert_request_multichannel_output_style import ( + SpeechToTextConvertRequestMultichannelOutputStyle, + ) + from .types.speech_to_text_convert_request_timestamps_granularity import SpeechToTextConvertRequestTimestampsGranularity + from .types.speech_to_text_convert_request_webhook_metadata import SpeechToTextConvertRequestWebhookMetadata + from .types.speech_to_text_convert_response import SpeechToTextConvertResponse + from pydantic import ValidationError + + # this is used as the default value for optional parameters + OMIT = typing.cast(typing.Any, ...) + + + class RawSpeechToTextClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def convert( + self, + *, + model_id: SpeechToTextConvertRequestModelId, + token: typing.Optional[str] = None, + enable_logging: typing.Optional[bool] = None, + file: typing.Optional[core.File] = OMIT, + language_code: typing.Optional[str] = OMIT, + tag_audio_events: typing.Optional[bool] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + timestamps_granularity: typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] = OMIT, + diarize: typing.Optional[bool] = OMIT, + diarization_threshold: typing.Optional[float] = OMIT, + additional_formats: typing.Optional[AdditionalFormats] = OMIT, + file_format: typing.Optional[SpeechToTextConvertRequestFileFormat] = OMIT, + cloud_storage_url: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + webhook: typing.Optional[bool] = OMIT, + webhook_id: typing.Optional[str] = OMIT, + temperature: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + use_multi_channel: typing.Optional[bool] = OMIT, + multichannel_output_style: typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] = OMIT, + webhook_metadata: typing.Optional[SpeechToTextConvertRequestWebhookMetadata] = OMIT, + entity_detection: typing.Optional[SpeechToTextConvertRequestEntityDetection] = OMIT, + no_verbatim: typing.Optional[bool] = OMIT, + use_speaker_library: typing.Optional[bool] = OMIT, + detect_speaker_roles: typing.Optional[bool] = OMIT, + entity_redaction: typing.Optional[SpeechToTextConvertRequestEntityRedaction] = OMIT, + entity_redaction_mode: typing.Optional[str] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SpeechToTextConvertResponse]: + """ + Transcribe an audio or video file. If webhook is set to true, the request will be processed asynchronously and results sent to configured webhooks. When use_multi_channel is true and the provided audio has multiple channels, a 'transcripts' object with separate transcripts for each channel is returned; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Otherwise, returns a single transcript. The optional webhook_metadata parameter allows you to attach custom data that will be included in webhook responses for request correlation and tracking. + + Parameters + ---------- + model_id : SpeechToTextConvertRequestModelId + The ID of the model to use for transcription. + + token : typing.Optional[str] + A single-use authentication token created via POST /v1/single-use-token/batch_scribe. This token can only be used once and expires after 15 minutes. Alternative to API key or bearer token authentication for frontend clients. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean log and transcript storage features are unavailable for this request. Zero retention mode may only be used by enterprise customers. + + file : typing.Optional[core.File] + See core.File for more documentation + + language_code : typing.Optional[str] + An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. Can sometimes improve transcription performance if known beforehand. Defaults to null, in this case the language is predicted automatically. + + tag_audio_events : typing.Optional[bool] + Whether to tag audio events like (laughter), (footsteps), etc. in the transcription. + + num_speakers : typing.Optional[int] + The maximum amount of speakers talking in the uploaded file. Can help with predicting who speaks when. The maximum amount of speakers that can be predicted is 32. Defaults to null, in this case the amount of speakers is set to the maximum value the model supports. + + timestamps_granularity : typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] + The granularity of the timestamps in the transcription. 'word' provides word-level timestamps and 'character' provides character-level timestamps per word. + + diarize : typing.Optional[bool] + Whether to annotate which speaker is currently talking in the uploaded file. + + diarization_threshold : typing.Optional[float] + Diarization threshold to apply during speaker diarization. A higher value means there will be a lower chance of one speaker being diarized as two different speakers but also a higher chance of two different speakers being diarized as one speaker (less total speakers predicted). A low value means there will be a higher chance of one speaker being diarized as two different speakers but also a lower chance of two different speakers being diarized as one speaker (more total speakers predicted). Can only be set when diarize=True and num_speakers=None. Defaults to None, in which case we will choose a threshold based on the model_id (0.22 usually). + + additional_formats : typing.Optional[AdditionalFormats] + A list of additional formats to export the transcript to. + + file_format : typing.Optional[SpeechToTextConvertRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + cloud_storage_url : typing.Optional[str] + [Deprecated] This parameter is deprecated and will be removed in the future. Use 'source_url' instead.The HTTPS URL of the file to transcribe. Exactly one of the file or cloud_storage_url parameters must be provided. The file must be accessible via HTTPS and the file size must be less than 2GB. Any valid HTTPS URL is accepted, including URLs from cloud storage providers (AWS S3, Google Cloud Storage, Cloudflare R2, etc.), CDNs, or any other HTTPS source. URLs can be pre-signed or include authentication tokens in query parameters. + + source_url : typing.Optional[str] + The URL of an audio or video file to transcribe. Supports hosted video or audio files, YouTube video URLs, TikTok video URLs, and other video hosting services. + + webhook : typing.Optional[bool] + Whether to send the transcription result to configured speech-to-text webhooks. If set the request will return early without the transcription, which will be delivered later via webhook. + + webhook_id : typing.Optional[str] + Optional specific webhook ID to send the transcription result to. Only valid when webhook is set to true. If not provided, transcription will be sent to all configured speech-to-text webhooks. + + temperature : typing.Optional[float] + Controls the randomness of the transcription output. Accepts values between 0.0 and 2.0, where higher values result in more diverse and less deterministic results. If omitted, we will use a temperature based on the model you selected which is usually 0. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be an integer between 0 and 2147483647. + + use_multi_channel : typing.Optional[bool] + Whether the audio file contains multiple channels where each channel contains a single speaker. When enabled, each channel is transcribed independently. By default a separate transcript is returned per channel; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Each word in the response includes a 'channel_index' field indicating which channel it was spoken on. A maximum of 5 channels is supported. Each channel is billed independently at the full audio duration, so cost scales linearly with the number of channels. + + multichannel_output_style : typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] + Controls the response shape when use_multi_channel is enabled. 'separate' (default) returns one transcript per channel under 'transcripts'. 'combined' merges all channels into a single transcript whose words are sorted by start time, each carrying a 'channel_index' - matching the single-channel response shape. 'combined' requires timestamps (timestamps_granularity must not be 'none') and does not support entity detection or redaction. + + webhook_metadata : typing.Optional[SpeechToTextConvertRequestWebhookMetadata] + Optional metadata to be included in the webhook response. This should be a JSON string representing an object with a maximum depth of 2 levels and maximum size of 16KB. Useful for tracking internal IDs, job references, or other contextual information. + + entity_detection : typing.Optional[SpeechToTextConvertRequestEntityDetection] + Detect entities in the transcript. Can be 'all' to detect all entities, a single entity type or category string, or a list of entity types/categories. Categories include 'pii', 'phi', 'pci', 'other', 'offensive_language'. When enabled, detected entities will be returned in the 'entities' field with their text, type, and character positions. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost. + + no_verbatim : typing.Optional[bool] + If true, the transcription will not have any filler words, false starts and non-speech sounds. Only supported with scribe_v2 model. + + use_speaker_library : typing.Optional[bool] + Whether to use the speaker library for identifying known speakers during diarization. When enabled and diarize is true, detected speakers will be matched against registered speakers in the workspace's speaker library. + + detect_speaker_roles : typing.Optional[bool] + Whether to detect speaker roles (agent vs customer). Requires diarize=true. Cannot be used with use_multi_channel=true. When enabled, speaker_id values will be 'agent' and 'customer' instead of 'speaker_0', 'speaker_1', etc. Usage incurs an additional 10% surcharge on base transcription cost. + + entity_redaction : typing.Optional[SpeechToTextConvertRequestEntityRedaction] + Redact entities from the transcript text. Accepts the same format as entity_detection: 'all', a category ('pii', 'phi'), or specific entity types. Must be a subset of entity_detection. When redaction is enabled, the entities field will not be returned. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost. + + entity_redaction_mode : typing.Optional[str] + How to format redacted entities. 'redacted' replaces with {REDACTED}, 'entity_type' replaces with {ENTITY_TYPE}, 'enumerated_entity_type' replaces with {ENTITY_TYPE_N} where N enumerates each occurrence. Only used when entity_redaction is set. + + keyterms : typing.Optional[typing.List[str]] + A list of keyterms to bias the transcription towards. The keyterms are words or phrases you want the model to recognise more accurately. The number of keyterms cannot exceed 1000. The length of each keyterm must be less than 50 characters. Keyterms can contain at most 5 words (after normalisation). For example ["hello", "world", "technical term"]. The following characters are not supported: `<`, `>`, `{`, `}`, `[`, `]`, `\\`. Usage of this parameter will incur an additional 20% surcharge on the base transcription cost. When more than 100 keyterms are provided, a minimum billable duration of 20 seconds applies per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeechToTextConvertResponse] + Synchronous transcription result + """ + _response = self._client_wrapper.httpx_client.request( + "v1/speech-to-text", + method="POST", + params={ + "token": token, + "enable_logging": enable_logging, + }, + data={ + "model_id": model_id, + "language_code": language_code, + "tag_audio_events": tag_audio_events, + "num_speakers": num_speakers, + "timestamps_granularity": timestamps_granularity, + "diarize": diarize, + "diarization_threshold": diarization_threshold, + "file_format": file_format, + "cloud_storage_url": cloud_storage_url, + "source_url": source_url, + "webhook": webhook, + "webhook_id": webhook_id, + "temperature": temperature, + "seed": seed, + "use_multi_channel": use_multi_channel, + "multichannel_output_style": multichannel_output_style, + "webhook_metadata": json.dumps(jsonable_encoder(webhook_metadata)), + "entity_detection": json.dumps(jsonable_encoder(entity_detection)), + "no_verbatim": no_verbatim, + "use_speaker_library": use_speaker_library, + "detect_speaker_roles": detect_speaker_roles, + "entity_redaction": json.dumps(jsonable_encoder(entity_redaction)), + "entity_redaction_mode": entity_redaction_mode, + "keyterms": keyterms, + }, + files={ + **({"file": file} if file is not None else {}), + **( + {"additional_formats": (None, json.dumps(jsonable_encoder(additional_formats)), "application/json")} + if additional_formats is not OMIT + else {} + ), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechToTextConvertResponse, + construct_type( + type_=SpeechToTextConvertResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + + class AsyncRawSpeechToTextClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def convert( + self, + *, + model_id: SpeechToTextConvertRequestModelId, + token: typing.Optional[str] = None, + enable_logging: typing.Optional[bool] = None, + file: typing.Optional[core.File] = OMIT, + language_code: typing.Optional[str] = OMIT, + tag_audio_events: typing.Optional[bool] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + timestamps_granularity: typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] = OMIT, + diarize: typing.Optional[bool] = OMIT, + diarization_threshold: typing.Optional[float] = OMIT, + additional_formats: typing.Optional[AdditionalFormats] = OMIT, + file_format: typing.Optional[SpeechToTextConvertRequestFileFormat] = OMIT, + cloud_storage_url: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + webhook: typing.Optional[bool] = OMIT, + webhook_id: typing.Optional[str] = OMIT, + temperature: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + use_multi_channel: typing.Optional[bool] = OMIT, + multichannel_output_style: typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] = OMIT, + webhook_metadata: typing.Optional[SpeechToTextConvertRequestWebhookMetadata] = OMIT, + entity_detection: typing.Optional[SpeechToTextConvertRequestEntityDetection] = OMIT, + no_verbatim: typing.Optional[bool] = OMIT, + use_speaker_library: typing.Optional[bool] = OMIT, + detect_speaker_roles: typing.Optional[bool] = OMIT, + entity_redaction: typing.Optional[SpeechToTextConvertRequestEntityRedaction] = OMIT, + entity_redaction_mode: typing.Optional[str] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SpeechToTextConvertResponse]: + """ + Transcribe an audio or video file. If webhook is set to true, the request will be processed asynchronously and results sent to configured webhooks. When use_multi_channel is true and the provided audio has multiple channels, a 'transcripts' object with separate transcripts for each channel is returned; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Otherwise, returns a single transcript. The optional webhook_metadata parameter allows you to attach custom data that will be included in webhook responses for request correlation and tracking. + + Parameters + ---------- + model_id : SpeechToTextConvertRequestModelId + The ID of the model to use for transcription. + + token : typing.Optional[str] + A single-use authentication token created via POST /v1/single-use-token/batch_scribe. This token can only be used once and expires after 15 minutes. Alternative to API key or bearer token authentication for frontend clients. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean log and transcript storage features are unavailable for this request. Zero retention mode may only be used by enterprise customers. + + file : typing.Optional[core.File] + See core.File for more documentation + + language_code : typing.Optional[str] + An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. Can sometimes improve transcription performance if known beforehand. Defaults to null, in this case the language is predicted automatically. + + tag_audio_events : typing.Optional[bool] + Whether to tag audio events like (laughter), (footsteps), etc. in the transcription. + + num_speakers : typing.Optional[int] + The maximum amount of speakers talking in the uploaded file. Can help with predicting who speaks when. The maximum amount of speakers that can be predicted is 32. Defaults to null, in this case the amount of speakers is set to the maximum value the model supports. + + timestamps_granularity : typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] + The granularity of the timestamps in the transcription. 'word' provides word-level timestamps and 'character' provides character-level timestamps per word. + + diarize : typing.Optional[bool] + Whether to annotate which speaker is currently talking in the uploaded file. + + diarization_threshold : typing.Optional[float] + Diarization threshold to apply during speaker diarization. A higher value means there will be a lower chance of one speaker being diarized as two different speakers but also a higher chance of two different speakers being diarized as one speaker (less total speakers predicted). A low value means there will be a higher chance of one speaker being diarized as two different speakers but also a lower chance of two different speakers being diarized as one speaker (more total speakers predicted). Can only be set when diarize=True and num_speakers=None. Defaults to None, in which case we will choose a threshold based on the model_id (0.22 usually). + + additional_formats : typing.Optional[AdditionalFormats] + A list of additional formats to export the transcript to. + + file_format : typing.Optional[SpeechToTextConvertRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + cloud_storage_url : typing.Optional[str] + [Deprecated] This parameter is deprecated and will be removed in the future. Use 'source_url' instead.The HTTPS URL of the file to transcribe. Exactly one of the file or cloud_storage_url parameters must be provided. The file must be accessible via HTTPS and the file size must be less than 2GB. Any valid HTTPS URL is accepted, including URLs from cloud storage providers (AWS S3, Google Cloud Storage, Cloudflare R2, etc.), CDNs, or any other HTTPS source. URLs can be pre-signed or include authentication tokens in query parameters. + + source_url : typing.Optional[str] + The URL of an audio or video file to transcribe. Supports hosted video or audio files, YouTube video URLs, TikTok video URLs, and other video hosting services. + + webhook : typing.Optional[bool] + Whether to send the transcription result to configured speech-to-text webhooks. If set the request will return early without the transcription, which will be delivered later via webhook. + + webhook_id : typing.Optional[str] + Optional specific webhook ID to send the transcription result to. Only valid when webhook is set to true. If not provided, transcription will be sent to all configured speech-to-text webhooks. + + temperature : typing.Optional[float] + Controls the randomness of the transcription output. Accepts values between 0.0 and 2.0, where higher values result in more diverse and less deterministic results. If omitted, we will use a temperature based on the model you selected which is usually 0. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be an integer between 0 and 2147483647. + + use_multi_channel : typing.Optional[bool] + Whether the audio file contains multiple channels where each channel contains a single speaker. When enabled, each channel is transcribed independently. By default a separate transcript is returned per channel; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Each word in the response includes a 'channel_index' field indicating which channel it was spoken on. A maximum of 5 channels is supported. Each channel is billed independently at the full audio duration, so cost scales linearly with the number of channels. + + multichannel_output_style : typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] + Controls the response shape when use_multi_channel is enabled. 'separate' (default) returns one transcript per channel under 'transcripts'. 'combined' merges all channels into a single transcript whose words are sorted by start time, each carrying a 'channel_index' - matching the single-channel response shape. 'combined' requires timestamps (timestamps_granularity must not be 'none') and does not support entity detection or redaction. + + webhook_metadata : typing.Optional[SpeechToTextConvertRequestWebhookMetadata] + Optional metadata to be included in the webhook response. This should be a JSON string representing an object with a maximum depth of 2 levels and maximum size of 16KB. Useful for tracking internal IDs, job references, or other contextual information. + + entity_detection : typing.Optional[SpeechToTextConvertRequestEntityDetection] + Detect entities in the transcript. Can be 'all' to detect all entities, a single entity type or category string, or a list of entity types/categories. Categories include 'pii', 'phi', 'pci', 'other', 'offensive_language'. When enabled, detected entities will be returned in the 'entities' field with their text, type, and character positions. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost. + + no_verbatim : typing.Optional[bool] + If true, the transcription will not have any filler words, false starts and non-speech sounds. Only supported with scribe_v2 model. + + use_speaker_library : typing.Optional[bool] + Whether to use the speaker library for identifying known speakers during diarization. When enabled and diarize is true, detected speakers will be matched against registered speakers in the workspace's speaker library. + + detect_speaker_roles : typing.Optional[bool] + Whether to detect speaker roles (agent vs customer). Requires diarize=true. Cannot be used with use_multi_channel=true. When enabled, speaker_id values will be 'agent' and 'customer' instead of 'speaker_0', 'speaker_1', etc. Usage incurs an additional 10% surcharge on base transcription cost. + + entity_redaction : typing.Optional[SpeechToTextConvertRequestEntityRedaction] + Redact entities from the transcript text. Accepts the same format as entity_detection: 'all', a category ('pii', 'phi'), or specific entity types. Must be a subset of entity_detection. When redaction is enabled, the entities field will not be returned. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost. + + entity_redaction_mode : typing.Optional[str] + How to format redacted entities. 'redacted' replaces with {REDACTED}, 'entity_type' replaces with {ENTITY_TYPE}, 'enumerated_entity_type' replaces with {ENTITY_TYPE_N} where N enumerates each occurrence. Only used when entity_redaction is set. + + keyterms : typing.Optional[typing.List[str]] + A list of keyterms to bias the transcription towards. The keyterms are words or phrases you want the model to recognise more accurately. The number of keyterms cannot exceed 1000. The length of each keyterm must be less than 50 characters. Keyterms can contain at most 5 words (after normalisation). For example ["hello", "world", "technical term"]. The following characters are not supported: `<`, `>`, `{`, `}`, `[`, `]`, `\\`. Usage of this parameter will incur an additional 20% surcharge on the base transcription cost. When more than 100 keyterms are provided, a minimum billable duration of 20 seconds applies per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeechToTextConvertResponse] + Synchronous transcription result + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/speech-to-text", + method="POST", + params={ + "token": token, + "enable_logging": enable_logging, + }, + data={ + "model_id": model_id, + "language_code": language_code, + "tag_audio_events": tag_audio_events, + "num_speakers": num_speakers, + "timestamps_granularity": timestamps_granularity, + "diarize": diarize, + "diarization_threshold": diarization_threshold, + "file_format": file_format, + "cloud_storage_url": cloud_storage_url, + "source_url": source_url, + "webhook": webhook, + "webhook_id": webhook_id, + "temperature": temperature, + "seed": seed, + "use_multi_channel": use_multi_channel, + "multichannel_output_style": multichannel_output_style, + "webhook_metadata": json.dumps(jsonable_encoder(webhook_metadata)), + "entity_detection": json.dumps(jsonable_encoder(entity_detection)), + "no_verbatim": no_verbatim, + "use_speaker_library": use_speaker_library, + "detect_speaker_roles": detect_speaker_roles, + "entity_redaction": json.dumps(jsonable_encoder(entity_redaction)), + "entity_redaction_mode": entity_redaction_mode, + "keyterms": keyterms, + }, + files={ + **({"file": file} if file is not None else {}), + **( + {"additional_formats": (None, json.dumps(jsonable_encoder(additional_formats)), "application/json")} + if additional_formats is not OMIT + else {} + ), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechToTextConvertResponse, + construct_type( + type_=SpeechToTextConvertResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + src/elevenlabs/studio/projects/raw_client.py: | + # This file was auto-generated by Fern from our API Definition. + + import typing + from json.decoder import JSONDecodeError + + from ... import core + from ...core.api_error import ApiError + from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + from ...core.http_response import AsyncHttpResponse, HttpResponse + from ...core.jsonable_encoder import jsonable_encoder + from ...core.parse_error import ParsingError + from ...core.request_options import RequestOptions + from ...core.unchecked_base_model import construct_type + from ...errors.unprocessable_entity_error import UnprocessableEntityError + from ...types.add_project_response_model import AddProjectResponseModel + from ...types.convert_project_response_model import ConvertProjectResponseModel + from ...types.delete_project_response_model import DeleteProjectResponseModel + from ...types.edit_project_response_model import EditProjectResponseModel + from ...types.get_projects_response import GetProjectsResponse + from ...types.project_extended_response import ProjectExtendedResponse + from ...types.project_muted_tracks_response_model import ProjectMutedTracksResponseModel + from ...types.quality_preset_type import QualityPresetType + from .types.projects_create_request_apply_text_normalization import ProjectsCreateRequestApplyTextNormalization + from .types.projects_create_request_fiction import ProjectsCreateRequestFiction + from .types.projects_create_request_source_type import ProjectsCreateRequestSourceType + from .types.projects_create_request_target_audience import ProjectsCreateRequestTargetAudience + from pydantic import ValidationError + + # this is used as the default value for optional parameters + OMIT = typing.cast(typing.Any, ...) + + + class RawProjectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[GetProjectsResponse]: + """ + Returns a list of your Studio projects with metadata. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetProjectsResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/studio/projects", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetProjectsResponse, + construct_type( + type_=GetProjectsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + name: str, + default_title_voice_id: typing.Optional[str] = OMIT, + default_paragraph_voice_id: typing.Optional[str] = OMIT, + default_model_id: typing.Optional[str] = OMIT, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + genres: typing.Optional[typing.List[str]] = OMIT, + target_audience: typing.Optional[ProjectsCreateRequestTargetAudience] = OMIT, + language: typing.Optional[str] = OMIT, + content_type: typing.Optional[str] = OMIT, + original_publication_date: typing.Optional[str] = OMIT, + mature_content: typing.Optional[bool] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + acx_volume_normalization: typing.Optional[bool] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + fiction: typing.Optional[ProjectsCreateRequestFiction] = OMIT, + apply_text_normalization: typing.Optional[ProjectsCreateRequestApplyTextNormalization] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_assign_voices: typing.Optional[bool] = OMIT, + source_type: typing.Optional[ProjectsCreateRequestSourceType] = OMIT, + voice_settings: typing.Optional[typing.List[str]] = OMIT, + create_publishing_read: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddProjectResponseModel]: + """ + Creates a new Studio project, it can be either initialized as blank, from a document or from a URL. + + Parameters + ---------- + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new paragraphs. + + default_model_id : typing.Optional[str] + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + description : typing.Optional[str] + An optional description of the Studio project. + + genres : typing.Optional[typing.List[str]] + An optional list of genres associated with the Studio project. + + target_audience : typing.Optional[ProjectsCreateRequestTargetAudience] + An optional target audience of the Studio project. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + content_type : typing.Optional[str] + An optional content type of the Studio project. + + original_publication_date : typing.Optional[str] + An optional original publication date of the Studio project, in the format YYYY-MM-DD or YYYY. + + mature_content : typing.Optional[bool] + An optional specification of whether this Studio project contains mature content. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + acx_volume_normalization : typing.Optional[bool] + [Deprecated] When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + fiction : typing.Optional[ProjectsCreateRequestFiction] + An optional specification of whether the content of this Studio project is fiction. + + apply_text_normalization : typing.Optional[ProjectsCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + auto_assign_voices : typing.Optional[bool] + [Alpha Feature] Whether automatically assign voices to phrases in the create Project. + + source_type : typing.Optional[ProjectsCreateRequestSourceType] + The type of Studio project to create. + + voice_settings : typing.Optional[typing.List[str]] + Optional voice settings overrides for the project, encoded as a list of JSON strings. + + Example: + ["{\\"voice_id\\": \\"21m00Tcm4TlvDq8ikWAM\\", \\"stability\\": 0.7, \\"similarity_boost\\": 0.8, \\"style\\": 0.5, \\"speed\\": 1.0, \\"use_speaker_boost\\": true}"] + + + create_publishing_read : typing.Optional[bool] + If true, creates a corresponding read for direct publishing in draft state + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/studio/projects", + method="POST", + data={ + "name": name, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "default_model_id": default_model_id, + "from_url": from_url, + "from_content_json": from_content_json, + "quality_preset": quality_preset, + "title": title, + "author": author, + "description": description, + "genres": genres, + "target_audience": target_audience, + "language": language, + "content_type": content_type, + "original_publication_date": original_publication_date, + "mature_content": mature_content, + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "volume_normalization": volume_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + "callback_url": callback_url, + "fiction": fiction, + "apply_text_normalization": apply_text_normalization, + "auto_convert": auto_convert, + "auto_assign_voices": auto_assign_voices, + "source_type": source_type, + "voice_settings": voice_settings, + "create_publishing_read": create_publishing_read, + }, + files={ + **({"from_document": from_document} if from_document is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddProjectResponseModel, + construct_type( + type_=AddProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + project_id: str, + *, + share_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ProjectExtendedResponse]: + """ + Returns information about a specific Studio project. This endpoint returns more detailed information about a project than `GET /v1/studio`. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + share_id : typing.Optional[str] + The share ID of the project + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProjectExtendedResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="GET", + params={ + "share_id": share_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectExtendedResponse, + construct_type( + type_=ProjectExtendedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + project_id: str, + *, + name: str, + default_title_voice_id: str, + default_paragraph_voice_id: str, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[EditProjectResponseModel]: + """ + Updates the specified Studio project by setting the values of the parameters passed. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : str + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : str + The voice_id that corresponds to the default voice used for new paragraphs. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EditProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="POST", + json={ + "name": name, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "title": title, + "author": author, + "isbn_number": isbn_number, + "volume_normalization": volume_normalization, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditProjectResponseModel, + construct_type( + type_=EditProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteProjectResponseModel]: + """ + Deletes a Studio project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteProjectResponseModel, + construct_type( + type_=DeleteProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def convert( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ConvertProjectResponseModel]: + """ + Starts conversion of a Studio project and all of its chapters. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConvertProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/convert", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvertProjectResponseModel, + construct_type( + type_=ConvertProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_muted_tracks( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ProjectMutedTracksResponseModel]: + """ + Returns a list of chapter IDs that have muted tracks in a project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProjectMutedTracksResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/muted-tracks", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectMutedTracksResponseModel, + construct_type( + type_=ProjectMutedTracksResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + + class AsyncRawProjectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetProjectsResponse]: + """ + Returns a list of your Studio projects with metadata. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetProjectsResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/studio/projects", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetProjectsResponse, + construct_type( + type_=GetProjectsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + name: str, + default_title_voice_id: typing.Optional[str] = OMIT, + default_paragraph_voice_id: typing.Optional[str] = OMIT, + default_model_id: typing.Optional[str] = OMIT, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + genres: typing.Optional[typing.List[str]] = OMIT, + target_audience: typing.Optional[ProjectsCreateRequestTargetAudience] = OMIT, + language: typing.Optional[str] = OMIT, + content_type: typing.Optional[str] = OMIT, + original_publication_date: typing.Optional[str] = OMIT, + mature_content: typing.Optional[bool] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + acx_volume_normalization: typing.Optional[bool] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + fiction: typing.Optional[ProjectsCreateRequestFiction] = OMIT, + apply_text_normalization: typing.Optional[ProjectsCreateRequestApplyTextNormalization] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_assign_voices: typing.Optional[bool] = OMIT, + source_type: typing.Optional[ProjectsCreateRequestSourceType] = OMIT, + voice_settings: typing.Optional[typing.List[str]] = OMIT, + create_publishing_read: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddProjectResponseModel]: + """ + Creates a new Studio project, it can be either initialized as blank, from a document or from a URL. + + Parameters + ---------- + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new paragraphs. + + default_model_id : typing.Optional[str] + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + description : typing.Optional[str] + An optional description of the Studio project. + + genres : typing.Optional[typing.List[str]] + An optional list of genres associated with the Studio project. + + target_audience : typing.Optional[ProjectsCreateRequestTargetAudience] + An optional target audience of the Studio project. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + content_type : typing.Optional[str] + An optional content type of the Studio project. + + original_publication_date : typing.Optional[str] + An optional original publication date of the Studio project, in the format YYYY-MM-DD or YYYY. + + mature_content : typing.Optional[bool] + An optional specification of whether this Studio project contains mature content. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + acx_volume_normalization : typing.Optional[bool] + [Deprecated] When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + fiction : typing.Optional[ProjectsCreateRequestFiction] + An optional specification of whether the content of this Studio project is fiction. + + apply_text_normalization : typing.Optional[ProjectsCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + auto_assign_voices : typing.Optional[bool] + [Alpha Feature] Whether automatically assign voices to phrases in the create Project. + + source_type : typing.Optional[ProjectsCreateRequestSourceType] + The type of Studio project to create. + + voice_settings : typing.Optional[typing.List[str]] + Optional voice settings overrides for the project, encoded as a list of JSON strings. + + Example: + ["{\\"voice_id\\": \\"21m00Tcm4TlvDq8ikWAM\\", \\"stability\\": 0.7, \\"similarity_boost\\": 0.8, \\"style\\": 0.5, \\"speed\\": 1.0, \\"use_speaker_boost\\": true}"] + + + create_publishing_read : typing.Optional[bool] + If true, creates a corresponding read for direct publishing in draft state + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/studio/projects", + method="POST", + data={ + "name": name, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "default_model_id": default_model_id, + "from_url": from_url, + "from_content_json": from_content_json, + "quality_preset": quality_preset, + "title": title, + "author": author, + "description": description, + "genres": genres, + "target_audience": target_audience, + "language": language, + "content_type": content_type, + "original_publication_date": original_publication_date, + "mature_content": mature_content, + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "volume_normalization": volume_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + "callback_url": callback_url, + "fiction": fiction, + "apply_text_normalization": apply_text_normalization, + "auto_convert": auto_convert, + "auto_assign_voices": auto_assign_voices, + "source_type": source_type, + "voice_settings": voice_settings, + "create_publishing_read": create_publishing_read, + }, + files={ + **({"from_document": from_document} if from_document is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddProjectResponseModel, + construct_type( + type_=AddProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + project_id: str, + *, + share_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ProjectExtendedResponse]: + """ + Returns information about a specific Studio project. This endpoint returns more detailed information about a project than `GET /v1/studio`. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + share_id : typing.Optional[str] + The share ID of the project + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProjectExtendedResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="GET", + params={ + "share_id": share_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectExtendedResponse, + construct_type( + type_=ProjectExtendedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + project_id: str, + *, + name: str, + default_title_voice_id: str, + default_paragraph_voice_id: str, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[EditProjectResponseModel]: + """ + Updates the specified Studio project by setting the values of the parameters passed. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : str + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : str + The voice_id that corresponds to the default voice used for new paragraphs. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EditProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="POST", + json={ + "name": name, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "title": title, + "author": author, + "isbn_number": isbn_number, + "volume_normalization": volume_normalization, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditProjectResponseModel, + construct_type( + type_=EditProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteProjectResponseModel]: + """ + Deletes a Studio project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteProjectResponseModel, + construct_type( + type_=DeleteProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def convert( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ConvertProjectResponseModel]: + """ + Starts conversion of a Studio project and all of its chapters. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConvertProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/convert", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvertProjectResponseModel, + construct_type( + type_=ConvertProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_muted_tracks( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ProjectMutedTracksResponseModel]: + """ + Returns a list of chapter IDs that have muted tracks in a project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProjectMutedTracksResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/muted-tracks", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectMutedTracksResponseModel, + construct_type( + type_=ProjectMutedTracksResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + user_owned: true + status: unresolved + - id: patch-a8e155fd + content_hash: sha256:b3e05f422d8e3c20c786806bc26e03d2422c2d9fab5657328300a8c0005420af + original_commit: a8e155fdb36a1bec80a205ce20c8ace56c9bcb73 + original_message: Fix tests on Python 3.13+, add 3.13/3.14 to CI, bump to 2.73.1 (#898) + original_author: Paul Asjes + base_generation: 886719aa300390e4166dbf789e667e67bcdb40eb + files: + - pyproject.toml + - src/elevenlabs/core/client_wrapper.py + patch_content: | + diff --git a/pyproject.toml b/pyproject.toml + index bdbbc2f2..37b7ac39 100644 + --- a/pyproject.toml + +++ b/pyproject.toml + @@ -4,7 +4,7 @@ dynamic = ["version"] + + [tool.poetry] + name = "elevenlabs" + -version = "2.73.0" + +version = "2.73.1" + description = "" + readme = "README.md" + authors = [] + diff --git a/src/elevenlabs/core/client_wrapper.py b/src/elevenlabs/core/client_wrapper.py + index 071490e7..6d26cf0a 100644 + --- a/src/elevenlabs/core/client_wrapper.py + +++ b/src/elevenlabs/core/client_wrapper.py + @@ -27,12 +27,12 @@ class BaseClientWrapper: + import platform + + headers: typing.Dict[str, str] = { + - "User-Agent": "elevenlabs/2.73.0", + + "User-Agent": "elevenlabs/2.73.1", + "X-Fern-Language": "Python", + "X-Fern-Runtime": f"python/{platform.python_version()}", + "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", + "X-Fern-SDK-Name": "elevenlabs", + - "X-Fern-SDK-Version": "2.73.0", + + "X-Fern-SDK-Version": "2.73.1", + **(self.get_custom_headers() or {}), + } + if self._api_key is not None: + theirs_snapshot: + pyproject.toml: | + [project] + name = "elevenlabs" + dynamic = ["version"] + + [tool.poetry] + name = "elevenlabs" + version = "2.73.1" + description = "" + readme = "README.md" + authors = [] + keywords = [] + license = "MIT" + 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", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", + "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", + "License :: OSI Approved :: MIT License" + ] + packages = [ + { include = "elevenlabs", from = "src"} + ] + + [tool.poetry.urls] + Repository = 'https://github.com/elevenlabs/elevenlabs-python' + + [tool.poetry.dependencies] + python = "^3.8" + httpx = ">=0.21.2" + pyaudio = { version = ">=0.2.14", optional = true} + pydantic = ">= 1.9.2" + pydantic-core = ">=2.18.2" + requests = ">=2.20" + typing_extensions = ">= 4.0.0" + websockets = ">=13.0" + + [tool.poetry.group.dev.dependencies] + mypy = "==1.13.0" + pytest = "^7.4.0" + pytest-asyncio = "^0.23.5" + pytest-xdist = "^3.6.1" + python-dateutil = "^2.9.0" + types-python-dateutil = "^2.9.0.20240316" + ruff = "==0.11.5" + types-pyaudio = "^0.2.16.20240516" + + [tool.pytest.ini_options] + testpaths = [ "tests" ] + asyncio_mode = "auto" + + [tool.mypy] + plugins = ["pydantic.mypy"] + + [tool.ruff] + line-length = 120 + + [tool.ruff.lint] + select = [ + "E", # pycodestyle errors + "F", # pyflakes + "I", # isort + ] + ignore = [ + "E402", # Module level import not at top of file + "E501", # Line too long + "E711", # Comparison to `None` should be `cond is not None` + "E712", # Avoid equality comparisons to `True`; use `if ...:` checks + "E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks + "E722", # Do not use bare `except` + "E731", # Do not assign a `lambda` expression, use a `def` + "F821", # Undefined name + "F841" # Local variable ... is assigned to but never used + ] + + [tool.ruff.lint.isort] + section-order = ["future", "standard-library", "third-party", "first-party"] + + [build-system] + requires = ["poetry-core"] + build-backend = "poetry.core.masonry.api" + + [tool.poetry.extras] + pyaudio=["pyaudio"] + src/elevenlabs/core/client_wrapper.py: | + # This file was auto-generated by Fern from our API Definition. + + import typing + + import httpx + from .http_client import AsyncHttpClient, HttpClient + from .logging import LogConfig, Logger + + + class BaseClientWrapper: + def __init__( + self, + *, + api_key: typing.Optional[str] = None, + headers: typing.Optional[typing.Dict[str, str]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + ): + self._api_key = api_key + self._headers = headers + self._base_url = base_url + self._timeout = timeout + self._logging = logging + + def get_headers(self) -> typing.Dict[str, str]: + import platform + + headers: typing.Dict[str, str] = { + "User-Agent": "elevenlabs/2.73.1", + "X-Fern-Language": "Python", + "X-Fern-Runtime": f"python/{platform.python_version()}", + "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "2.73.1", + **(self.get_custom_headers() or {}), + } + if self._api_key is not None: + headers["xi-api-key"] = self._api_key + return headers + + def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]: + return self._headers + + 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, + *, + api_key: typing.Optional[str] = None, + headers: typing.Optional[typing.Dict[str, str]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + httpx_client: httpx.Client, + ): + super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout, logging=logging) + self.httpx_client = HttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers, + base_timeout=self.get_timeout, + base_url=self.get_base_url, + logging_config=self._logging, + ) + + + class AsyncClientWrapper(BaseClientWrapper): + def __init__( + self, + *, + api_key: typing.Optional[str] = None, + headers: typing.Optional[typing.Dict[str, str]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None, + httpx_client: httpx.AsyncClient, + ): + super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout, logging=logging) + self._async_token = async_token + self.httpx_client = AsyncHttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers, + base_timeout=self.get_timeout, + base_url=self.get_base_url, + async_base_headers=self.async_get_headers, + logging_config=self._logging, + ) + + async def async_get_headers(self) -> typing.Dict[str, str]: + headers = self.get_headers() + if self._async_token is not None: + token = await self._async_token() + headers["Authorization"] = f"Bearer {token}" + return headers + status: unresolved +dismissals: + - patch_id: patch-1b45413e + original_commit: 1b45413e916fda868341ad48225c4b7211017849 + original_message: "[Speech Engine] Add disable_auth parameter (#806)" + content_hashes: + - sha256:39ab43ecd30a8791dc5eef09812657f167c0c1dfe33609c89795b12015738682 + dismissed_at: 2026-07-30T10:30:38.774Z + via: forget +forgotten_hashes: + - sha256:39ab43ecd30a8791dc5eef09812657f167c0c1dfe33609c89795b12015738682 diff --git a/data/.fernignore b/data/.fernignore new file mode 100644 index 0000000000000000000000000000000000000000..18f6663398d0050ccb94bfde474cada7976fef78 --- /dev/null +++ b/data/.fernignore @@ -0,0 +1,29 @@ +# Specify files that shouldn't be modified by Fern + +# Ignore manually created SDK wrappers +src/elevenlabs/client.py +src/elevenlabs/conversational_ai/conversation.py +src/elevenlabs/conversational_ai/default_audio_interface.py +src/elevenlabs/realtime_tts.py +src/elevenlabs/play.py +src/elevenlabs/webhooks_custom.py +src/elevenlabs/music_custom.py +src/elevenlabs/speech_to_text_custom.py +src/elevenlabs/url_utils.py +src/elevenlabs/realtime/ +src/elevenlabs/speech_engine/ +src/elevenlabs/speech_engine_custom.py +src/elevenlabs/flows_custom.py + +# Ignore CI files +.github/ + +README.md +AGENTS.md +assets/ + +# Ignore custom tests +tests/ +.fern/replay.lock +.fern/replay.yml +.gitattributes diff --git a/data/AGENTS.md b/data/AGENTS.md new file mode 100644 index 0000000000000000000000000000000000000000..68904faee511b0f67c4a936c71340fb2cf4958e8 --- /dev/null +++ b/data/AGENTS.md @@ -0,0 +1,7 @@ +# Agent Instructions + +## Fern-generated code + +Most of the source code in this repository is auto-generated by [Fern](https://buildwithfern.com/). Only files listed in `.fernignore` are hand-maintained and safe to edit. **Do not modify files outside of `.fernignore`** — they will be overwritten on the next regeneration. Always check `.fernignore` before editing any file. + +When fixing build issues caused by Fern regeneration, always fix the hand-maintained wrapper files to adapt to the new generated code — never patch the generated files directly. diff --git a/data/LICENSE b/data/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9c29930256f807229644714103e13d8c6d493714 --- /dev/null +++ b/data/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Elevenlabs. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/data/README.md b/data/README.md new file mode 100644 index 0000000000000000000000000000000000000000..456c5b8cca3e9a36d58ce5517f23cef67b6acc72 --- /dev/null +++ b/data/README.md @@ -0,0 +1,431 @@ +# ElevenLabs Python Library + +![LOGO](https://github.com/elevenlabs/elevenlabs-python/assets/12028621/21267d89-5e82-4e7e-9c81-caf30b237683) + +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://buildwithfern.com/?utm_source=fern-elevenlabs/elevenlabs-python/readme) +[![Discord](https://badgen.net/badge/black/ElevenLabs/icon?icon=discord&label)](https://discord.gg/elevenlabs) +[![Twitter](https://badgen.net/badge/black/elevenlabsio/icon?icon=twitter&label)](https://twitter.com/elevenlabsio) +[![PyPI - Python Version](https://img.shields.io/pypi/v/elevenlabs?style=flat&colorA=black&colorB=black)](https://pypi.org/project/elevenlabs/) +[![Downloads](https://static.pepy.tech/personalized-badge/elevenlabs?period=total&units=international_system&left_color=black&right_color=black&left_text=Downloads)](https://pepy.tech/project/elevenlabs) + +The official Python SDK for [ElevenLabs](https://elevenlabs.io/). ElevenLabs brings the most compelling, rich and lifelike voices to creators and developers in just a few lines of code. + +## 📖 API & Docs + +Check out the [HTTP API documentation](https://elevenlabs.io/docs/api-reference). + +## Install + +```bash +pip install elevenlabs +``` + +## Usage + +### Main Models + +1. **Eleven v3** (`eleven_v3`) + - Dramatic delivery and performances + - 70+ languages supported + - Supported for natural multi-speaker dialogue + +2. **Eleven Multilingual v2** (`eleven_multilingual_v2`) + + - Excels in stability, language diversity, and accent accuracy + - Supports 29 languages + - Recommended for most use cases + +3. **Eleven Flash v2.5** (`eleven_flash_v2_5`) + + - Ultra-low latency + - Supports 32 languages + - Faster model, 50% lower price per character + +4. **Eleven Turbo v2.5** (`eleven_turbo_v2_5`) + + - Good balance of quality and latency + - Ideal for developer use cases where speed is crucial + - Supports 32 languages + +For more detailed information about these models and others, visit the [ElevenLabs Models documentation](https://elevenlabs.io/docs/models). + +```py +from dotenv import load_dotenv +from elevenlabs.client import ElevenLabs +from elevenlabs.play import play + +load_dotenv() + +elevenlabs = ElevenLabs() + +audio = elevenlabs.text_to_speech.convert( + text="The first move is what sets everything in motion.", + voice_id="JBFqnCBsd6RMkjVDRZzb", + model_id="eleven_v3", + output_format="mp3_44100_128", +) + +play(audio) +``` + +
Play + +🎧 **Try it out!** Want to hear our voices in action? Visit the [ElevenLabs Voice Lab](https://elevenlabs.io/voice-lab) to experiment with different voices, languages, and settings. + +
+ +## Voices + +List all your available voices with `search()`. + +```py +from elevenlabs.client import ElevenLabs + +elevenlabs = ElevenLabs( + api_key="YOUR_API_KEY", +) + +response = elevenlabs.voices.search() +print(response.voices) +``` + +For information about the structure of the voices output, please refer to the [official ElevenLabs API documentation for Get Voices](https://elevenlabs.io/docs/api-reference/get-voices). + +Build a voice object with custom settings to personalize the voice style, or call +`elevenlabs.voices.settings.get("your-voice-id")` to get the default settings for the voice. + + + +## Clone Voice + +Clone your voice in an instant. Note that voice cloning requires an API key, see below. + +```py +from elevenlabs.client import ElevenLabs +from elevenlabs.play import play + +elevenlabs = ElevenLabs( + api_key="YOUR_API_KEY", +) + +voice = elevenlabs.voices.ivc.create( + name="Alex", + description="An old American male voice with a slight hoarseness in his throat. Perfect for news", # Optional + files=["./sample_0.mp3", "./sample_1.mp3", "./sample_2.mp3"], +) +``` + +## Streaming + +Stream audio in real-time, as it's being generated. + +```py +from elevenlabs import stream +from elevenlabs.client import ElevenLabs + +elevenlabs = ElevenLabs( + api_key="YOUR_API_KEY", +) + +audio_stream = elevenlabs.text_to_speech.stream( + text="This is a test", + voice_id="JBFqnCBsd6RMkjVDRZzb", + model_id="eleven_multilingual_v2" +) + +# option 1: play the streamed audio locally +stream(audio_stream) + +# option 2: process the audio bytes manually +for chunk in audio_stream: + if isinstance(chunk, bytes): + print(chunk) + +``` + +## Async Client + +Use `AsyncElevenLabs` if you want to make API calls asynchronously. + +```python +import asyncio + +from elevenlabs.client import AsyncElevenLabs + +elevenlabs = AsyncElevenLabs( + api_key="MY_API_KEY" +) + +async def print_models() -> None: + models = await elevenlabs.models.list() + print(models) + +asyncio.run(print_models()) +``` + +## ElevenAgents + +Build interactive AI agents with real-time audio capabilities using ElevenAgents. + +### Basic Usage + +```python +from elevenlabs.client import ElevenLabs +from elevenlabs.conversational_ai.conversation import Conversation, ClientTools +from elevenlabs.conversational_ai.default_audio_interface import DefaultAudioInterface + +elevenlabs = ElevenLabs( + api_key="YOUR_API_KEY", +) + +# Create audio interface for real-time audio input/output +audio_interface = DefaultAudioInterface() + +# Create conversation +conversation = Conversation( + client=elevenlabs, + agent_id="your-agent-id", + requires_auth=True, + audio_interface=audio_interface, +) + +# Start the conversation +conversation.start_session() + +# The conversation runs in background until you call: +conversation.end_session() +``` + +### Custom Event Loop Support + +For advanced use cases involving context propagation, resource reuse, or specific event loop management, `ClientTools` supports custom asyncio event loops: + +```python +import asyncio +from elevenlabs.conversational_ai.conversation import ClientTools + +elevenlabs = ElevenLabs( + api_key="YOUR_API_KEY", +) + +async def main(): + # Get the current event loop + custom_loop = asyncio.get_running_loop() + + # Create ClientTools with custom loop to prevent "different event loop" errors + client_tools = ClientTools(loop=custom_loop) + + # Register your tools + async def get_weather(params): + location = params.get("location", "Unknown") + # Your async logic here + return f"Weather in {location}: Sunny, 72°F" + + client_tools.register("get_weather", get_weather, is_async=True) + + # Use with conversation + conversation = Conversation( + client=elevenlabs, + agent_id="your-agent-id", + requires_auth=True, + audio_interface=audio_interface, + client_tools=client_tools + ) + +asyncio.run(main()) +``` + +**Benefits of Custom Event Loop:** +- **Context Propagation**: Maintain request-scoped state across async operations +- **Resource Reuse**: Share existing async resources like HTTP sessions or database pools +- **Loop Management**: Prevent "Task got Future attached to a different event loop" errors +- **Performance**: Better control over async task scheduling and execution + +**Important:** When using a custom loop, you're responsible for its lifecycle +Don't close the loop while ClientTools are still using it. + +### Tool Registration + +Register custom tools that the AI agent can call during conversations: + +```python +client_tools = ClientTools() + +# Sync tool +def calculate_sum(params): + numbers = params.get("numbers", []) + return sum(numbers) + +# Async tool +async def fetch_data(params): + url = params.get("url") + # Your async HTTP request logic + return {"data": "fetched"} + +client_tools.register("calculate_sum", calculate_sum, is_async=False) +client_tools.register("fetch_data", fetch_data, is_async=True) +``` + +## Speech Engine + +Speech Engine lets you build server-side voice agents that receive real-time transcripts from the ElevenLabs API and stream LLM responses back for text-to-speech synthesis. Your server acts as a WebSocket endpoint — ElevenLabs connects to it, sends user transcripts, and your code decides how to respond. + +Speech Engine is async-only and available on `AsyncElevenLabs`. + +### Quick Start + +```python +import asyncio +from openai import AsyncOpenAI +from elevenlabs import AsyncElevenLabs + +openai_client = AsyncOpenAI() +elevenlabs = AsyncElevenLabs() + +async def main(): + engine = await elevenlabs.speech_engine.get("seng_123") + + async def on_transcript(transcript, session): + stream = await openai_client.responses.create( + model="gpt-4o", + input=[ + {"role": "assistant" if m.role == "agent" else m.role, "content": m.content} + for m in transcript + ], + stream=True, + ) + await session.send_response(stream) + + async def on_init(conversation_id, session): + print(f"Session started: {conversation_id}") + + async def on_close(session): + print(f"Session ended: {session.conversation_id}") + + async def on_error(err, session): + print(f"Error: {err}") + + await engine.serve( + port=3001, + debug=True, + on_init=on_init, + on_transcript=on_transcript, + on_close=on_close, + on_error=on_error, + ) + +asyncio.run(main()) +``` + +### How It Works + +When `engine.serve()` starts, it opens a WebSocket server on the specified port. For each incoming connection from the ElevenLabs API: + +1. An `init` message arrives with a `conversation_id` +2. As the user speaks, `user_transcript` messages arrive with the full conversation history +3. Your `on_transcript` handler generates a response (using any LLM) and calls `session.send_response()` +4. If the user interrupts (speaks again mid-response), the previous handler is automatically cancelled + +### Sending Responses + +`send_response()` accepts strings or async iterators. LLM stream formats from OpenAI, Anthropic, and Google Gemini are auto-detected: + +```python +# Plain string +await session.send_response("Hello world") + +# OpenAI stream (auto-parsed) +stream = await openai_client.responses.create(model="gpt-4o", ..., stream=True) +await session.send_response(stream) + +# Anthropic stream (auto-parsed) +stream = anthropic_client.messages.stream(model="claude-sonnet-4-20250514", ...) +await session.send_response(stream) + +# Any async iterator of strings +async def my_generator(): + yield "Hello " + yield "world" +await session.send_response(my_generator()) +``` + +### Interruption Handling + +When a new transcript arrives while a previous response is still streaming, the previous handler's `asyncio.Task` is cancelled automatically. Any `await` in your handler (including LLM SDK calls) will raise `asyncio.CancelledError`, which cleanly aborts the in-flight request. No manual signal handling needed. + +### Custom Server Integration (FastAPI, Starlette) + +For integrating with an existing web server, use `create_session()` instead of `serve()`: + +```python +from fastapi import FastAPI, WebSocket + +app = FastAPI() +engine = ... # SpeechEngineResource from await client.speech_engine.get(...) + +@app.websocket("/api/speech-engine/ws") +async def speech_engine_ws(ws: WebSocket): + await ws.accept() + session = engine.create_session(ws, debug=True) + session.on("user_transcript", handle_transcript) + await session.run() +``` + +When using `session.on()` directly, handlers receive just the event data (no `session` argument, since you already have the reference): + +| Event | Handler signature | +|---|---| +| `"init"` | `async (conversation_id: str) -> None` | +| `"user_transcript"` | `async (transcript: list[ConversationMessage]) -> None` | +| `"close"` | `async () -> None` | +| `"disconnected"` | `async () -> None` | +| `"error"` | `async (error: Exception) -> None` | + +### Standalone Server + +For full control over the server lifecycle, use `SpeechEngineServer` directly: + +```python +from elevenlabs.speech_engine import SpeechEngineServer + +server = SpeechEngineServer( + port=3001, + debug=True, + on_transcript=handle_transcript, +) + +# In one task: +await server.serve() + +# In another task (e.g. signal handler): +await server.stop() +``` + +### Authentication + +Both `engine.serve()` and `SpeechEngineServer` automatically verify the `X-Elevenlabs-Speech-Engine-Authorization` header on every incoming connection, rejecting any requests that were not signed by ElevenLabs. The API key is read from the `AsyncElevenLabs` client (or `api_key=` on `SpeechEngineServer`), falling back to the `ELEVENLABS_API_KEY` environment variable. + +#### Disabling authentication + +If your server sits behind an infrastructure layer that already restricts incoming traffic to ElevenLabs (typically an IP allowlist scoped to [ElevenLabs' egress ranges](https://elevenlabs.io/docs/overview/capabilities/speech-engine#ip-allowlisting)), you can skip JWT verification by passing `disable_auth=True`: + +```python +# Via engine.serve() — no api_key required when disable_auth is True +await engine.serve(port=3001, disable_auth=True, on_transcript=on_transcript) + +# Or directly on SpeechEngineServer +server = SpeechEngineServer(port=3001, disable_auth=True, on_transcript=on_transcript) +await server.serve() +``` + +When auth is disabled the server accepts any client that can reach it and emits a `UserWarning` on startup. **Only use this if you have an IP allowlist or equivalent network-level restriction in front of the server** — without one, anyone on the internet can open a session and consume your compute and downstream LLM quota. + +## Languages Supported + +Explore [all models & languages](https://elevenlabs.io/docs/models). + +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! diff --git a/data/poetry.lock b/data/poetry.lock new file mode 100644 index 0000000000000000000000000000000000000000..951f0c5f0662c1d8178aa98f4aae29fcd61ca8e0 --- /dev/null +++ b/data/poetry.lock @@ -0,0 +1,970 @@ +# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand. + +[[package]] +name = "annotated-types" +version = "0.7.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.8" +files = [ + {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] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} + +[[package]] +name = "anyio" +version = "4.5.2" +description = "High level compatibility layer for multiple asynchronous event loop implementations" +optional = false +python-versions = ">=3.8" +files = [ + {file = "anyio-4.5.2-py3-none-any.whl", hash = "sha256:c011ee36bc1e8ba40e5a81cb9df91925c218fe9b778554e0b56a21e1b5d4716f"}, + {file = "anyio-4.5.2.tar.gz", hash = "sha256:23009af4ed04ce05991845451e11ef02fc7c5ed29179ac9a420e5ad0ac7ddc5b"}, +] + +[package.dependencies] +exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} +idna = ">=2.8" +sniffio = ">=1.1" +typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} + +[package.extras] +doc = ["Sphinx (>=7.4,<8.0)", "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", "truststore (>=0.9.1)", "uvloop (>=0.21.0b1)"] +trio = ["trio (>=0.26.1)"] + +[[package]] +name = "certifi" +version = "2026.10.19" +description = "Python package for providing Mozilla's CA Bundle." +optional = false +python-versions = ">=3.7" +files = [ + {file = "certifi-2026.10.19-py3-none-any.whl", hash = "sha256:42d35340cc5b9ba78e818ddbff0c5b1c2b779de448a340fd1b989f5fa8670e1b"}, + {file = "certifi-2026.10.19.tar.gz", hash = "sha256:035c1e85572b141bf1c3a3eff0e33a8eb74917522f2559075ff8d2fea780a1ae"}, +] + +[[package]] +name = "charset-normalizer" +version = "3.5.2" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +optional = false +python-versions = ">=3.7" +files = [ + {file = "charset_normalizer-3.5.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:195c26fb65950f8fce54e26349852b7bdd7c5f120aeefbcc440b8a20faaed4a3"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9373ad13ef0d2c0fb761e04e55bfdee5a08b52cef2c882c8fbe9935b1517152e"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:ddf19c062bea7a0cc80f519243d2c01dd091be0cf952a0750d4ad576709559f5"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3d14b50de6bf4d0edf857a9386836846f982b8f524e188e2e68b96d702bcf4aa"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:28a15fdad492a99b6eccfaaed66ef3f74050680545ea61ec8b2f4c538f1f1320"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8a893cc101149f80a653f82062ebc95b34525a2614382e1da5458fe7c6997249"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:619799369eeef6366ed3e8755a5670f4f2f0fb6b30a0fd7264dc0fdc2357058e"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:447441e76ec720b15e64418d32e092297340387053047c7c694f579efb0ee1d9"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:62588a277bfb59def052abd940703fa35107152bf479781a878617d60faf8fb5"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:44bd4fbb29dfbeba60e7d2bd000c59e4b21ddb3cc53912b14048d37092706d7c"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:30fcd120b732aa79317f08dee04d7de0847822e4cf7ee0e9f445bb958832252c"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:50e3adfb96fc189eb27b1cf62d3b598b89b4bb0420d93a3d3e42e137409011be"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b736353c0a625bbd5fcec108576e2385db3496f4f771f785ff32e108d3c3bc45"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-win32.whl", hash = "sha256:f5833ad231be5eb6553de524a70f48d71b2c8563101750531e0b80184e175cd4"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-win_amd64.whl", hash = "sha256:1461ac396c4fdb983a675f20aa555624f0ee18ac83d832b9244ffff3d8055275"}, + {file = "charset_normalizer-3.5.2-cp310-cp310-win_arm64.whl", hash = "sha256:c6708715abcf3c73b99508253e961a9967f02fe536532834149574eda6de0d1c"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:3d21b8b13c7592db2ac5e544a6d83187b995257472b0c9e8351b6d507ae37ed6"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d760fe2a4d7c3b226cb9026d6a842868d52a7901bd98420e1baf14e80da85cf5"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c9790464842f85f437dbbb54417eda1e0e6bfc52dd8d22d6fd1c994b73b2dc74"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4685902cf26edf013ed7a3da0f426ebba7a00ebb9541386d835afbf002c11cab"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4495c5002a7b28557e7e222e77e0b661183e432b7d6d2e788101e3f240e05b8c"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:211d5a3eb6af8f513b8d4ca19a8c1b7accab1b5f0d3175f9826b03c1a920dc1f"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ef4fcbf3327382cd4c9f540babd61248208af7b93eec4de397b4d5f58a09e288"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bd16aabe4a02a297c23417aa17ac6299dbd8c49f673bcd645b4929b11f5a4400"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:fb9e68df06293761f9fe66ade60a9bc6d0f5e42b8acf2939a9158af86ab0e5bd"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:59f63901b0031c3136cf64704dcb21de0bbae62ce2c9529bc39d27665463de37"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:304d5463e65a35d7bb0850550e0780395395f6fcf452f04db7d5ca7cecc425ac"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:9cf9b1a857e25c4baceeb3624e92a56df3668f398c4acba74e174d81fb4d1d3a"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:114e4d0c92d618409ed82a99e22b5c5e768fe995f2973f78265f4524f49d4640"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-win32.whl", hash = "sha256:2625388c6c754520c37abaf3b41eb34d1cc4a373f457898f08606c8e362b891d"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-win_amd64.whl", hash = "sha256:87e50a3e7cb90af586b6c5faf23e302a970415ac73bd7bd90a515a04b427ef96"}, + {file = "charset_normalizer-3.5.2-cp311-cp311-win_arm64.whl", hash = "sha256:254eb48b9fa5ee9898a3c445825a1f340fe53712a098904b39b0bddba8ea3cb1"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:ed2a239c0ea213acc1908150a3037257083c7c083128f1a4cec2ec4b97dca491"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b91363207bd9dc966a691e959bb47f64b30f7ac4b072be9968b366982f7db77c"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:38a873987f3be698494da8b2e3085e29da02da7b633dce73e79c699a113d7bf0"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:355ad8011081dec5412240c087a9a0c9d4d5039f3ed11a3f13e18c2b29b56c51"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:ee21e28f0430bd6dc9086c6e525d5e818a44a5ad19720c8a0ef766792f3eb5e5"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3d31298449090ab8d47b7b1b2a555ff73cac7ed438a08b7ac160980c7ebed649"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:5cde776b7cc66e4f6c99612cea4aa7269aa65863f7a15841b2c264f103822f4e"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ae4f5fea5b8b8ccff88238cc8569303e5ee95efae67fa62922a311397a71f346"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:f7d486c83842422badd511868fd8a9a20e9407ace71564b6af47ce7e60a336c1"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:11a4d68a6ecda3292cb1e50239e111543ba5d709bb62a6b4ea1afcfa729d8875"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d6734d2ef8a50fbf8445c139477da401f50d62a0606bf00e20ec6d87773fefb1"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:a815775b6c38d4e0ff7bcffbeba67feded90202bb6a226b8dd35f1c855217413"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:23851fb4e1b85ed3f6c2a27b777cdfe2e19fb5b38429a8faf38c7542b7665869"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-win32.whl", hash = "sha256:db19d07e2e0129e974a0e65d0064fc222a446cd5122c2fd4184d2af9fc734a9e"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-win_amd64.whl", hash = "sha256:780fbe7cab297b81dad9fb8dc5eb003c0468ffb0d9e5f65068c53a34661a96bc"}, + {file = "charset_normalizer-3.5.2-cp312-cp312-win_arm64.whl", hash = "sha256:e2af3aad578aa6bd1384bcf4750fc285e5a9de53f40b7d41e5a0bf748edeb2b3"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-android_24_arm64_v8a.whl", hash = "sha256:ed905975ab14056a2e5eb1c376cb2e1ebc5396baf84163939c518556fccde9f5"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-android_24_x86_64.whl", hash = "sha256:a66c3bc5ab1f0ff2164fc9965ddd611ff0802173f4b9d24554c563f6ab7e1d6e"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:d2374b62878abb00cd8309b32af6c0b715cd02dec0ca74ef12e5069bdc64144a"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:d376bbd28b3a8999db1a103b3b388aee6f1ddeb3e51bc2172993efdcd86e064d"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:6045373d5a89a5ec71afde535db987ca28e76dfa276c2d4c818265b375d4b055"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:849df64e889b2e17230d58410a03dba311a65b163508fd33679b2b737d4b7858"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:15c44f7edfd477b06f517a5cc317fc1707edb9de2c865f43d4b6513907473234"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:a89012d6d5476ee112d20d998570ed58df2260a852afb1758809cd6900411d21"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:0c951d5e6dd9c2ff60609476752bee49da4206adde960ebc247766937f72e718"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7218e8f32b0956cfcd048fd42d9d5779809745ca1d86113ca56f66e7ae1549c4"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:a19a731138fc27d5682277d3b9df22855cea1239bce7fcec5f78f42ef2d1f3c3"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:62603db9a7caa0802eaa28c1c46fecd7b3a263a774069c24c3c28c302448721c"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:b6856554c4f44d79fc2307d5768854310a8f0096e501c75637542c82292b0429"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:1bc0baf5ef96b6ede57d47f4b8fe4d9d84019c3bfcbeb20a41edc6a6ee341f1f"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:56bc200a365efb37383b7852e4cc5898d3b2da5987289b543956cf8cad71018a"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:2c9ad19a6cfcd5ea5c0d41161d22f9df1dcc277e9bef2751391334546a314c00"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:e243bd13217235fc7290c621941c3f5cc8b66e4872495be821d7436ba2fb838d"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-pyemscripten_2025_0_wasm32.whl", hash = "sha256:a090bb2c68df85450502e3e20d665e3a5af9c65a84d6508ed477badd49166fd3"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-win32.whl", hash = "sha256:2b7b3bbfb4fe8ef40600792d762fbaa9057559f9d3fad209525b7a22b99e91fd"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-win_amd64.whl", hash = "sha256:78456a747de8dc58360ffa581f30a002baf5aa28cb262536545e91f113ed7639"}, + {file = "charset_normalizer-3.5.2-cp313-cp313-win_arm64.whl", hash = "sha256:11912e4bb14baae7c5d8791aa55ba0a3a03ec6729073307b0f57270abaa713d3"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:1afb975bd5d68d5ce9f6b6d44fdf2f7e34b895a35e95708a7a91b20a3b51d187"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-android_24_x86_64.whl", hash = "sha256:bbbfc8e28816f19d7c0f1816664980c0a9875d01b27cdf8eedddb639d9e108ad"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7967d08cf06dee78443b874f98c98036f624f3a4e73e11f9f64f5be4d25393cf"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:4c2b5031f63e331e3839b40aed2dd6f191e9c07edbde303e7876846ea1946995"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:fcff63213e8e6e47770541a4607175404f47cbb3ebea7b6058cc82d524a0e424"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8d86d6fc60743dc916eb79e2eb1ec4818e21e427731543af40a3021851174a13"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:7a881931aa470808df94a8c380eed2bbbc76cd9dc622310f99665658c821eb6d"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8024d00c3faf3fc0c16e07a69f4405e8eac7cc0ab15f65fe6cf43827c4cf72b4"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4d48f2d08b9de5864e2c8744d4461b862fb149a18274abc8b698c45975573438"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34276fd796040bf0993ab33a369aa572e6979c7aab225a88893667ad8eac8f7a"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0521c5665880b33d603717defa76c094048900010897909952397feb3039da56"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:eff0ac9dbe711a4aee69bf04a83896aa9b85f19641264053a9f6d48573abb7dd"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:1503bccbeb36d5527790c3930327704c39af22de3112f1b1666a9f3ce15ee204"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:52aa6992700996af31f375de0c6bacd402b0097fe40b53c426b9f51a90ebabc7"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:e09a3942ecbdee5cce73ea9d42da82b81b72ac1bf031ce069b93b5adf4eac8cd"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:c7c9ab723cde841fefb34efbad91e87f00a674b1fe1cd0784fde742bf2c154dc"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ddc7dacc8ece3a182e7f15cb862d1fd616b46d076cb1ae9dd232b2c38b655874"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:ee43c17b173d46a3212baa6ead3ae258eeabdae48c263a01ccf0218c366dd655"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-win32.whl", hash = "sha256:4f87960d57feabfb618e4e0af6e7371645fa26a277860739d6e5d6e0012c92f0"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-win_amd64.whl", hash = "sha256:e4e81e09c1578b8df602e3db08b0b3ea0a6947ad612f52bf8dc5ea8d47691f0c"}, + {file = "charset_normalizer-3.5.2-cp314-cp314-win_arm64.whl", hash = "sha256:80d02b6f04e92601a081dd97b23d3128033098bff5d35d392ddcc0476ea11253"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:dca9ab98072a5a54ebacebdc45f53e645336b320c667410b061be1ca588ae709"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f0aa869112ef88429ae17820d99c3dd9504c9e9c671d3c246f3d7442cb051084"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c0afc6800ba57ccc350374c5bd6150419915d95ce93cdbab2d783d75eaf30ecb"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7dcd882da75ef9adf94903b1e3b9419e8aa8fb4c7396822b834b9ef7fb96954f"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2e06a3a98f916dd41d27f3105e02e7a40181c98c94b9158733d03a6f80506c09"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6bd128f206a7752ae1f2ab6c61bf8a24ba28913a10df8b14c2637b973ff97a80"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c8f3d67aeaf55f017982b73683f0e7342ba2f6635a78f69ce89ebb26aa411e5c"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:fe9753dfee015c570d73df76f899f18444d41388bffcde097deba51c4fadbb9f"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:92888bb3187c5ba50500b00b3b310c9f2c651709d28036077680cb5255450a03"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:d008d90a7f2471519aef0c90dfbe73b3e6e4d5e66ac48e19154c17e89e98b604"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:31f3930700408d211f13378ccbe1c40845d8da54bd0681fac3a9b5aae81c7aa8"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:2a925889534b3748302dae5dead07cc13480de1dac3aea80a941b729b471ef93"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f5ec61164adcec446f8969a3358ec3f9b26bbda3b9213e5586d219afa8df2915"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-win32.whl", hash = "sha256:598a11a2c7ebaa5334bf698bf29568c9c390abac6a154d8170fedecd1cea38c5"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-win_amd64.whl", hash = "sha256:7fdde2c9fd9e3eca40631e024664cf2584272cc8f96308cbe5fdfc930f51d8bc"}, + {file = "charset_normalizer-3.5.2-cp314-cp314t-win_arm64.whl", hash = "sha256:d1befeed746d247c81127bb14de9dc3d30edb6e5976d34f83f86ed262b1d9105"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:87475fabc8d9996fd9c27debb395e642e8c838d78a00b6e932227a0e06b81e26"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9409a8bf35cf78353942504b24a57de3d75b708997a1e4bd8db71ac8633ce364"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:498dc3188ca05a68231ac3fdbfc7f57eb67e1343c30e0fea17f8218c1599b253"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e242bb1c5e76e97dfa9e7f209a71e93a01d7f19ffdd5cfbb2e2d55b4f08f8ab0"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:def79fa35ef0cef8d2accec024f4fdc7ead3012ff02f5215c783f39f03ef8cfc"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3df041de8887954562c9b261cba85ca0e9ded74048daf125f45edcfaa4832229"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:04851f73ae72b8413dddadb16a49dfee95263553741fd42d546f7d66907e6be5"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:183b88127acdb4fabe59d951ab424faf1af7b63cdbb5f776186c1ea2ffcaed98"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:16fa0eccf81304b79c5cd87f9271c3b85dd9dd99245e4422ae9c0dd45e0f99d3"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:7441d755b7ab94f8d4eb3e43ec05482d760842fd263d003a99102d742cd835e2"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:ca403d7e4798f525fdfc78e258820419cbbd0f0ecbab9de7840e3c017cf6b8cf"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_s390x.whl", hash = "sha256:df29a0a7107f7011e77f4eebdddec4c7331e24d787a0b21a46d63bdf7445da95"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:f3c96f633825733f735c5a9cf21d21a257d8e1edf0b1cee0a064b9c424ca0f7d"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-win32.whl", hash = "sha256:281cb91036248400f4cc957495cccd44c275c2e0c5854f7e45ac5cf7dc193847"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-win_amd64.whl", hash = "sha256:89b53f3cda69831909888e0494f4fa0bcd3537e3e138dabeb620bd6ad946bae8"}, + {file = "charset_normalizer-3.5.2-cp315-cp315-win_arm64.whl", hash = "sha256:6be488a102b8cf28d0391d8c4ba7748938ae28b78ad901f8585520fca33ead1a"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:915563965d418f986e7e145accc592eae9e1a1be3566ff98a05d7a9ec42a76e1"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:65cd72beeeca9d3aaea1201e5923859f308f952f9c71de93f06063c79f0f7a3b"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b7fd005a73d9e657273b7a10dc71a9e03c8fb9ee6999798d6918ce095b81ac7f"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e54da4baf05720032d527874d40b65fa4d7e5c6c6a43d0c3adbeffcaf275a2b3"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:124fbf1a8ff966d87ae05bb8bd45a71f966055ed8bba320d0c7cf450bc5f4d0e"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:28b4f0d66fb834ff90f28209ac7bce77868c45d8c93e26f906709d9b7c2e1af9"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:58ca3755ee7ff7f59b57789ec9833c9de9ea275405cdd240eda1f193112e398a"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:443eae2bf318abeaf6f15d785138f71fd6de770e99a92158b8b814265e079115"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:58f361dcbab699cf8f42db3f47c8e7fd1036f138c23a5d08de9fde5f425a730c"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:1b4cbc7c3491ccb4aa17fcd8165649d01cf39f76de1696da8631b5f71b85401d"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:ba0b1d2620edf869789c3879223f52bf2afc5d31b3cb47cc57b3a12c05e2aa9d"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_s390x.whl", hash = "sha256:5e2b6b57e9733d39f0c9fd3185efa6b8e29652c4cd8fe94180272cf6ed9a78c4"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:51cf45226a9b588d0d2b4880c62d686934b63ab0bd79ca23ab0e9762eb27441b"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-win32.whl", hash = "sha256:5fb29fb8cd1a46c27a1bf9613ad5ec2599310d46b4025d9556404a6b6a292800"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-win_amd64.whl", hash = "sha256:a192e2c40070d92c3ccf777e3a5c4ff515573cd2bb7ed0c537fdadbbec5bbf21"}, + {file = "charset_normalizer-3.5.2-cp315-cp315t-win_arm64.whl", hash = "sha256:749e97e1b32313717a565abbe321bc2190bc8b35f1a67e4cdbc7c56c8d8ffe58"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:4275811936e2f06feff5e598fb42a1b7ae852da8e39605211892b56b81a34efd"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:1c50fe28bbc2ced33386f298650d91218076c05420e6cbd790b913adc41659e7"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d19fbd981a488e22cd04883659ca6b08f50b5974f9fd7c95655ef6a043e5893f"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:0fed1d06615f022ee3b13caf5e8b180cfea32bb2c5aded8a9d44277afc040f93"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:838dcc90063569a0448120554591a1d6c4a4ffe11babf048908793154ab86ade"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2ce45c6627b22c47e390bc91a41c3d13032192e699fa0bea96e9671b373d69b0"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0774bf9bf620249fee3e0b8b9fd3065de213be30f3aa94ce2494b3b638949e26"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:1db38f4c5496827c1a501846d64d14c3b80c7e6714e406cd7dc36a9899fa1011"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:304d8e4d493af723536393eee0c689eb7813f4a474c8b479dee63f1fdd98f621"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:9b7f416ff0978e2f2249330527f0ad6fa02f4932e6199692d3b52da2048c19e4"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:01077390b03f7988f11d700a2194e69b119741a86b1a638b1db88891e3eced8e"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_s390x.whl", hash = "sha256:7e841fb9010836c992c9f12fcbd43a831de93a5f726fc1ccd8ca1d0268c5014c"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9cae88599c7219005d879f98e5ed53341e9a122af585e1091200358a3003d2a0"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-win32.whl", hash = "sha256:01b0c0d2262a9e28e8484a278c7e1b5d650e3ac8cf2683d2967e25899f208bdf"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-win_amd64.whl", hash = "sha256:9f56f72050826f63dcee7a7f55b0a77168cb3bfc553fd405e7f8f9ece75a4036"}, + {file = "charset_normalizer-3.5.2-cp37-abi3-win_arm64.whl", hash = "sha256:40ab6bffa02ae10a0581e6c198be7d2d8ca5c2a0c64e4ed3465d766df457573e"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:75a3ceed0724d625d64b86ca20aba182e4df462e04c2414fc941c0f523f06aac"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0891b9d3903c5571c03771ca669a4b0ec5618ca722a5c957d3d29cd4e5062848"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:fc14a032f813bf5fe624d991960ea83e9715adc27e4c1830a2361eb1d02ac341"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8b2bfab86aa71ae13aa41a6a26aab338e0db2b8bc75434b05aea89e011ff35a4"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:9bde855991b7e362c146535e3136a50bfaffc0487d38b33ca7e5edefc6e23849"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:55ea99acb17b9325618de155a0cd6a2e8f5d10be008113e1d433bbb58db543b2"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:68eb192d85ab8e5f6ec69c2bc6ac0179fbf04a5ac1569d12fbef74883fe102d0"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:d913de495d90407cd859d263bee2e5d1a4ed3eb6573c04e70d9ec619a7cbed7f"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:3ddacd27458c45bdacd6bd6db644bfb730efbf9e830310186e3045c9c5be8fb2"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:588461c2e8384d309bd63e5826019b6977bc66d629b99ac8737bb795d7b2cb5a"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_riscv64.whl", hash = "sha256:e80e6c2f55656b4824d72065abb4ddd6a525c74bd78a0aab5d9fc2cf4fb5af50"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:d4a7319f304a774bed22115bc891618e45f85065ab44ea6acd07d274e750519a"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:fd1fbe0f116b6e55da77aca2c6ddcddcfac2186cbf78bdebf40fc156efca389d"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-win32.whl", hash = "sha256:93223adc95033dd47133a46ccfc316a0139176fd79085762e27202ec56018f03"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-win_amd64.whl", hash = "sha256:15bb4005af6320d259dc7593ca84a38d7fe06a421dbcf7b910ae23979101e787"}, + {file = "charset_normalizer-3.5.2-cp39-cp39-win_arm64.whl", hash = "sha256:2cc961b171b3f3440f410489ab3573e86aea8736134ebbb40ea1338b7f0831bc"}, + {file = "charset_normalizer-3.5.2-py3-none-any.whl", hash = "sha256:b6b751274acb69d77b3323d6b7dbaa3c7fdfc1eb829b7eb61d262f32e1af9685"}, + {file = "charset_normalizer-3.5.2.tar.gz", hash = "sha256:39de2a259fc954455c57274dc94c79d5842774e1247a016aff30bc0efed0f4ef"}, +] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.3.1" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598"}, + {file = "exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""} + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "execnet" +version = "2.1.2" +description = "execnet: rapid multi-Python deployment" +optional = false +python-versions = ">=3.8" +files = [ + {file = "execnet-2.1.2-py3-none-any.whl", hash = "sha256:67fba928dd5a544b783f6056f449e5e3931a5c378b128bc18501f7ea79e296ec"}, + {file = "execnet-2.1.2.tar.gz", hash = "sha256:63d83bfdd9a23e35b9c6a3261412324f964c2ec8dcd8d3c6916ee9373e0befcd"}, +] + +[package.extras] +testing = ["hatch", "pre-commit", "pytest", "tox"] + +[[package]] +name = "h11" +version = "0.16.0" +description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" +optional = false +python-versions = ">=3.8" +files = [ + {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, + {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, +] + +[[package]] +name = "httpcore" +version = "1.0.9" +description = "A minimal low-level HTTP client." +optional = false +python-versions = ">=3.8" +files = [ + {file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"}, + {file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"}, +] + +[package.dependencies] +certifi = "*" +h11 = ">=0.16" + +[package.extras] +asyncio = ["anyio (>=4.0,<5.0)"] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] +trio = ["trio (>=0.22.0,<1.0)"] + +[[package]] +name = "httpx" +version = "0.28.1" +description = "The next generation HTTP client." +optional = false +python-versions = ">=3.8" +files = [ + {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, + {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, +] + +[package.dependencies] +anyio = "*" +certifi = "*" +httpcore = "==1.*" +idna = "*" + +[package.extras] +brotli = ["brotli", "brotlicffi"] +cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] +zstd = ["zstandard (>=0.18.0)"] + +[[package]] +name = "idna" +version = "3.15" +description = "Internationalized Domain Names in Applications (IDNA)" +optional = false +python-versions = ">=3.8" +files = [ + {file = "idna-3.15-py3-none-any.whl", hash = "sha256:048adeaf8c2d788c40fee287673ccaa74c24ffd8dcf09ffa555a2fbb59f10ac8"}, + {file = "idna-3.15.tar.gz", hash = "sha256:ca962446ea538f7092a95e057da437618e886f4d349216d2b1e294abfdb65fdc"}, +] + +[package.extras] +all = ["mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"] + +[[package]] +name = "iniconfig" +version = "2.1.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.8" +files = [ + {file = "iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760"}, + {file = "iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7"}, +] + +[[package]] +name = "mypy" +version = "1.13.0" +description = "Optional static typing for Python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "mypy-1.13.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:6607e0f1dd1fb7f0aca14d936d13fd19eba5e17e1cd2a14f808fa5f8f6d8f60a"}, + {file = "mypy-1.13.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8a21be69bd26fa81b1f80a61ee7ab05b076c674d9b18fb56239d72e21d9f4c80"}, + {file = "mypy-1.13.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7b2353a44d2179846a096e25691d54d59904559f4232519d420d64da6828a3a7"}, + {file = "mypy-1.13.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:0730d1c6a2739d4511dc4253f8274cdd140c55c32dfb0a4cf8b7a43f40abfa6f"}, + {file = "mypy-1.13.0-cp310-cp310-win_amd64.whl", hash = "sha256:c5fc54dbb712ff5e5a0fca797e6e0aa25726c7e72c6a5850cfd2adbc1eb0a372"}, + {file = "mypy-1.13.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:581665e6f3a8a9078f28d5502f4c334c0c8d802ef55ea0e7276a6e409bc0d82d"}, + {file = "mypy-1.13.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3ddb5b9bf82e05cc9a627e84707b528e5c7caaa1c55c69e175abb15a761cec2d"}, + {file = "mypy-1.13.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:20c7ee0bc0d5a9595c46f38beb04201f2620065a93755704e141fcac9f59db2b"}, + {file = "mypy-1.13.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3790ded76f0b34bc9c8ba4def8f919dd6a46db0f5a6610fb994fe8efdd447f73"}, + {file = "mypy-1.13.0-cp311-cp311-win_amd64.whl", hash = "sha256:51f869f4b6b538229c1d1bcc1dd7d119817206e2bc54e8e374b3dfa202defcca"}, + {file = "mypy-1.13.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:5c7051a3461ae84dfb5dd15eff5094640c61c5f22257c8b766794e6dd85e72d5"}, + {file = "mypy-1.13.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:39bb21c69a5d6342f4ce526e4584bc5c197fd20a60d14a8624d8743fffb9472e"}, + {file = "mypy-1.13.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:164f28cb9d6367439031f4c81e84d3ccaa1e19232d9d05d37cb0bd880d3f93c2"}, + {file = "mypy-1.13.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a4c1bfcdbce96ff5d96fc9b08e3831acb30dc44ab02671eca5953eadad07d6d0"}, + {file = "mypy-1.13.0-cp312-cp312-win_amd64.whl", hash = "sha256:a0affb3a79a256b4183ba09811e3577c5163ed06685e4d4b46429a271ba174d2"}, + {file = "mypy-1.13.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a7b44178c9760ce1a43f544e595d35ed61ac2c3de306599fa59b38a6048e1aa7"}, + {file = "mypy-1.13.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5d5092efb8516d08440e36626f0153b5006d4088c1d663d88bf79625af3d1d62"}, + {file = "mypy-1.13.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:de2904956dac40ced10931ac967ae63c5089bd498542194b436eb097a9f77bc8"}, + {file = "mypy-1.13.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:7bfd8836970d33c2105562650656b6846149374dc8ed77d98424b40b09340ba7"}, + {file = "mypy-1.13.0-cp313-cp313-win_amd64.whl", hash = "sha256:9f73dba9ec77acb86457a8fc04b5239822df0c14a082564737833d2963677dbc"}, + {file = "mypy-1.13.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:100fac22ce82925f676a734af0db922ecfea991e1d7ec0ceb1e115ebe501301a"}, + {file = "mypy-1.13.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7bcb0bb7f42a978bb323a7c88f1081d1b5dee77ca86f4100735a6f541299d8fb"}, + {file = "mypy-1.13.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bde31fc887c213e223bbfc34328070996061b0833b0a4cfec53745ed61f3519b"}, + {file = "mypy-1.13.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:07de989f89786f62b937851295ed62e51774722e5444a27cecca993fc3f9cd74"}, + {file = "mypy-1.13.0-cp38-cp38-win_amd64.whl", hash = "sha256:4bde84334fbe19bad704b3f5b78c4abd35ff1026f8ba72b29de70dda0916beb6"}, + {file = "mypy-1.13.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:0246bcb1b5de7f08f2826451abd947bf656945209b140d16ed317f65a17dc7dc"}, + {file = "mypy-1.13.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7f5b7deae912cf8b77e990b9280f170381fdfbddf61b4ef80927edd813163732"}, + {file = "mypy-1.13.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7029881ec6ffb8bc233a4fa364736789582c738217b133f1b55967115288a2bc"}, + {file = "mypy-1.13.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:3e38b980e5681f28f033f3be86b099a247b13c491f14bb8b1e1e134d23bb599d"}, + {file = "mypy-1.13.0-cp39-cp39-win_amd64.whl", hash = "sha256:a6789be98a2017c912ae6ccb77ea553bbaf13d27605d2ca20a76dfbced631b24"}, + {file = "mypy-1.13.0-py3-none-any.whl", hash = "sha256:9c250883f9fd81d212e0952c92dbfcc96fc237f4b7c92f56ac81fd48460b3e5a"}, + {file = "mypy-1.13.0.tar.gz", hash = "sha256:0291a61b6fbf3e6673e3405cfcc0e7650bebc7939659fdca2702958038bd835e"}, +] + +[package.dependencies] +mypy-extensions = ">=1.0.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = ">=4.6.0" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +faster-cache = ["orjson"] +install-types = ["pip"] +mypyc = ["setuptools (>=50)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.1.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.8" +files = [ + {file = "mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505"}, + {file = "mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"}, +] + +[[package]] +name = "packaging" +version = "26.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "packaging-26.2-py3-none-any.whl", hash = "sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e"}, + {file = "packaging-26.2.tar.gz", hash = "sha256:ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661"}, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pyaudio" +version = "0.2.14" +description = "Cross-platform audio I/O with PortAudio" +optional = true +python-versions = "*" +files = [ + {file = "PyAudio-0.2.14-cp310-cp310-win32.whl", hash = "sha256:126065b5e82a1c03ba16e7c0404d8f54e17368836e7d2d92427358ad44fefe61"}, + {file = "PyAudio-0.2.14-cp310-cp310-win_amd64.whl", hash = "sha256:2a166fc88d435a2779810dd2678354adc33499e9d4d7f937f28b20cc55893e83"}, + {file = "PyAudio-0.2.14-cp311-cp311-win32.whl", hash = "sha256:506b32a595f8693811682ab4b127602d404df7dfc453b499c91a80d0f7bad289"}, + {file = "PyAudio-0.2.14-cp311-cp311-win_amd64.whl", hash = "sha256:bbeb01d36a2f472ae5ee5e1451cacc42112986abe622f735bb870a5db77cf903"}, + {file = "PyAudio-0.2.14-cp312-cp312-win32.whl", hash = "sha256:5fce4bcdd2e0e8c063d835dbe2860dac46437506af509353c7f8114d4bacbd5b"}, + {file = "PyAudio-0.2.14-cp312-cp312-win_amd64.whl", hash = "sha256:12f2f1ba04e06ff95d80700a78967897a489c05e093e3bffa05a84ed9c0a7fa3"}, + {file = "PyAudio-0.2.14-cp313-cp313-win32.whl", hash = "sha256:95328285b4dab57ea8c52a4a996cb52be6d629353315be5bfda403d15932a497"}, + {file = "PyAudio-0.2.14-cp313-cp313-win_amd64.whl", hash = "sha256:692d8c1446f52ed2662120bcd9ddcb5aa2b71f38bda31e58b19fb4672fffba69"}, + {file = "PyAudio-0.2.14-cp38-cp38-win32.whl", hash = "sha256:858caf35b05c26d8fc62f1efa2e8f53d5fa1a01164842bd622f70ddc41f55000"}, + {file = "PyAudio-0.2.14-cp38-cp38-win_amd64.whl", hash = "sha256:2dac0d6d675fe7e181ba88f2de88d321059b69abd52e3f4934a8878e03a7a074"}, + {file = "PyAudio-0.2.14-cp39-cp39-win32.whl", hash = "sha256:f745109634a7c19fa4d6b8b7d6967c3123d988c9ade0cd35d4295ee1acdb53e9"}, + {file = "PyAudio-0.2.14-cp39-cp39-win_amd64.whl", hash = "sha256:009f357ee5aa6bc8eb19d69921cd30e98c42cddd34210615d592a71d09c4bd57"}, + {file = "PyAudio-0.2.14.tar.gz", hash = "sha256:78dfff3879b4994d1f4fc6485646a57755c6ee3c19647a491f790a0895bd2f87"}, +] + +[package.extras] +test = ["numpy"] + +[[package]] +name = "pydantic" +version = "2.10.6" +description = "Data validation using Python type hints" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic-2.10.6-py3-none-any.whl", hash = "sha256:427d664bf0b8a2b34ff5dd0f5a18df00591adcee7198fbd71981054cef37b584"}, + {file = "pydantic-2.10.6.tar.gz", hash = "sha256:ca5daa827cce33de7a42be142548b0096bf05a7e7b365aebfa5f8eeec7128236"}, +] + +[package.dependencies] +annotated-types = ">=0.6.0" +pydantic-core = "2.27.2" +typing-extensions = ">=4.12.2" + +[package.extras] +email = ["email-validator (>=2.0.0)"] +timezone = ["tzdata"] + +[[package]] +name = "pydantic-core" +version = "2.27.2" +description = "Core functionality for Pydantic validation and serialization" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pydantic_core-2.27.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:2d367ca20b2f14095a8f4fa1210f5a7b78b8a20009ecced6b12818f455b1e9fa"}, + {file = "pydantic_core-2.27.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:491a2b73db93fab69731eaee494f320faa4e093dbed776be1a829c2eb222c34c"}, + {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7969e133a6f183be60e9f6f56bfae753585680f3b7307a8e555a948d443cc05a"}, + {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3de9961f2a346257caf0aa508a4da705467f53778e9ef6fe744c038119737ef5"}, + {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e2bb4d3e5873c37bb3dd58714d4cd0b0e6238cebc4177ac8fe878f8b3aa8e74c"}, + {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:280d219beebb0752699480fe8f1dc61ab6615c2046d76b7ab7ee38858de0a4e7"}, + {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47956ae78b6422cbd46f772f1746799cbb862de838fd8d1fbd34a82e05b0983a"}, + {file = "pydantic_core-2.27.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:14d4a5c49d2f009d62a2a7140d3064f686d17a5d1a268bc641954ba181880236"}, + {file = "pydantic_core-2.27.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:337b443af21d488716f8d0b6164de833e788aa6bd7e3a39c005febc1284f4962"}, + {file = "pydantic_core-2.27.2-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:03d0f86ea3184a12f41a2d23f7ccb79cdb5a18e06993f8a45baa8dfec746f0e9"}, + {file = "pydantic_core-2.27.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7041c36f5680c6e0f08d922aed302e98b3745d97fe1589db0a3eebf6624523af"}, + {file = "pydantic_core-2.27.2-cp310-cp310-win32.whl", hash = "sha256:50a68f3e3819077be2c98110c1f9dcb3817e93f267ba80a2c05bb4f8799e2ff4"}, + {file = "pydantic_core-2.27.2-cp310-cp310-win_amd64.whl", hash = "sha256:e0fd26b16394ead34a424eecf8a31a1f5137094cabe84a1bcb10fa6ba39d3d31"}, + {file = "pydantic_core-2.27.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:8e10c99ef58cfdf2a66fc15d66b16c4a04f62bca39db589ae8cba08bc55331bc"}, + {file = "pydantic_core-2.27.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:26f32e0adf166a84d0cb63be85c562ca8a6fa8de28e5f0d92250c6b7e9e2aff7"}, + {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c19d1ea0673cd13cc2f872f6c9ab42acc4e4f492a7ca9d3795ce2b112dd7e15"}, + {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5e68c4446fe0810e959cdff46ab0a41ce2f2c86d227d96dc3847af0ba7def306"}, + {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d9640b0059ff4f14d1f37321b94061c6db164fbe49b334b31643e0528d100d99"}, + {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:40d02e7d45c9f8af700f3452f329ead92da4c5f4317ca9b896de7ce7199ea459"}, + {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1c1fd185014191700554795c99b347d64f2bb637966c4cfc16998a0ca700d048"}, + {file = "pydantic_core-2.27.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d81d2068e1c1228a565af076598f9e7451712700b673de8f502f0334f281387d"}, + {file = "pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:1a4207639fb02ec2dbb76227d7c751a20b1a6b4bc52850568e52260cae64ca3b"}, + {file = "pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:3de3ce3c9ddc8bbd88f6e0e304dea0e66d843ec9de1b0042b0911c1663ffd474"}, + {file = "pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:30c5f68ded0c36466acede341551106821043e9afaad516adfb6e8fa80a4e6a6"}, + {file = "pydantic_core-2.27.2-cp311-cp311-win32.whl", hash = "sha256:c70c26d2c99f78b125a3459f8afe1aed4d9687c24fd677c6a4436bc042e50d6c"}, + {file = "pydantic_core-2.27.2-cp311-cp311-win_amd64.whl", hash = "sha256:08e125dbdc505fa69ca7d9c499639ab6407cfa909214d500897d02afb816e7cc"}, + {file = "pydantic_core-2.27.2-cp311-cp311-win_arm64.whl", hash = "sha256:26f0d68d4b235a2bae0c3fc585c585b4ecc51382db0e3ba402a22cbc440915e4"}, + {file = "pydantic_core-2.27.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:9e0c8cfefa0ef83b4da9588448b6d8d2a2bf1a53c3f1ae5fca39eb3061e2f0b0"}, + {file = "pydantic_core-2.27.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:83097677b8e3bd7eaa6775720ec8e0405f1575015a463285a92bfdfe254529ef"}, + {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:172fce187655fece0c90d90a678424b013f8fbb0ca8b036ac266749c09438cb7"}, + {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:519f29f5213271eeeeb3093f662ba2fd512b91c5f188f3bb7b27bc5973816934"}, + {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:05e3a55d124407fffba0dd6b0c0cd056d10e983ceb4e5dbd10dda135c31071d6"}, + {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9c3ed807c7b91de05e63930188f19e921d1fe90de6b4f5cd43ee7fcc3525cb8c"}, + {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fb4aadc0b9a0c063206846d603b92030eb6f03069151a625667f982887153e2"}, + {file = "pydantic_core-2.27.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:28ccb213807e037460326424ceb8b5245acb88f32f3d2777427476e1b32c48c4"}, + {file = "pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:de3cd1899e2c279b140adde9357c4495ed9d47131b4a4eaff9052f23398076b3"}, + {file = "pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:220f892729375e2d736b97d0e51466252ad84c51857d4d15f5e9692f9ef12be4"}, + {file = "pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a0fcd29cd6b4e74fe8ddd2c90330fd8edf2e30cb52acda47f06dd615ae72da57"}, + {file = "pydantic_core-2.27.2-cp312-cp312-win32.whl", hash = "sha256:1e2cb691ed9834cd6a8be61228471d0a503731abfb42f82458ff27be7b2186fc"}, + {file = "pydantic_core-2.27.2-cp312-cp312-win_amd64.whl", hash = "sha256:cc3f1a99a4f4f9dd1de4fe0312c114e740b5ddead65bb4102884b384c15d8bc9"}, + {file = "pydantic_core-2.27.2-cp312-cp312-win_arm64.whl", hash = "sha256:3911ac9284cd8a1792d3cb26a2da18f3ca26c6908cc434a18f730dc0db7bfa3b"}, + {file = "pydantic_core-2.27.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7d14bd329640e63852364c306f4d23eb744e0f8193148d4044dd3dacdaacbd8b"}, + {file = "pydantic_core-2.27.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:82f91663004eb8ed30ff478d77c4d1179b3563df6cdb15c0817cd1cdaf34d154"}, + {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:71b24c7d61131bb83df10cc7e687433609963a944ccf45190cfc21e0887b08c9"}, + {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fa8e459d4954f608fa26116118bb67f56b93b209c39b008277ace29937453dc9"}, + {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce8918cbebc8da707ba805b7fd0b382816858728ae7fe19a942080c24e5b7cd1"}, + {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eda3f5c2a021bbc5d976107bb302e0131351c2ba54343f8a496dc8783d3d3a6a"}, + {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bd8086fa684c4775c27f03f062cbb9eaa6e17f064307e86b21b9e0abc9c0f02e"}, + {file = "pydantic_core-2.27.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8d9b3388db186ba0c099a6d20f0604a44eabdeef1777ddd94786cdae158729e4"}, + {file = "pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7a66efda2387de898c8f38c0cf7f14fca0b51a8ef0b24bfea5849f1b3c95af27"}, + {file = "pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:18a101c168e4e092ab40dbc2503bdc0f62010e95d292b27827871dc85450d7ee"}, + {file = "pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ba5dd002f88b78a4215ed2f8ddbdf85e8513382820ba15ad5ad8955ce0ca19a1"}, + {file = "pydantic_core-2.27.2-cp313-cp313-win32.whl", hash = "sha256:1ebaf1d0481914d004a573394f4be3a7616334be70261007e47c2a6fe7e50130"}, + {file = "pydantic_core-2.27.2-cp313-cp313-win_amd64.whl", hash = "sha256:953101387ecf2f5652883208769a79e48db18c6df442568a0b5ccd8c2723abee"}, + {file = "pydantic_core-2.27.2-cp313-cp313-win_arm64.whl", hash = "sha256:ac4dbfd1691affb8f48c2c13241a2e3b60ff23247cbcf981759c768b6633cf8b"}, + {file = "pydantic_core-2.27.2-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:d3e8d504bdd3f10835468f29008d72fc8359d95c9c415ce6e767203db6127506"}, + {file = "pydantic_core-2.27.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:521eb9b7f036c9b6187f0b47318ab0d7ca14bd87f776240b90b21c1f4f149320"}, + {file = "pydantic_core-2.27.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:85210c4d99a0114f5a9481b44560d7d1e35e32cc5634c656bc48e590b669b145"}, + {file = "pydantic_core-2.27.2-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d716e2e30c6f140d7560ef1538953a5cd1a87264c737643d481f2779fc247fe1"}, + {file = "pydantic_core-2.27.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f66d89ba397d92f840f8654756196d93804278457b5fbede59598a1f9f90b228"}, + {file = "pydantic_core-2.27.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:669e193c1c576a58f132e3158f9dfa9662969edb1a250c54d8fa52590045f046"}, + {file = "pydantic_core-2.27.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fdbe7629b996647b99c01b37f11170a57ae675375b14b8c13b8518b8320ced5"}, + {file = "pydantic_core-2.27.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d262606bf386a5ba0b0af3b97f37c83d7011439e3dc1a9298f21efb292e42f1a"}, + {file = "pydantic_core-2.27.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:cabb9bcb7e0d97f74df8646f34fc76fbf793b7f6dc2438517d7a9e50eee4f14d"}, + {file = "pydantic_core-2.27.2-cp38-cp38-musllinux_1_1_armv7l.whl", hash = "sha256:d2d63f1215638d28221f664596b1ccb3944f6e25dd18cd3b86b0a4c408d5ebb9"}, + {file = "pydantic_core-2.27.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:bca101c00bff0adb45a833f8451b9105d9df18accb8743b08107d7ada14bd7da"}, + {file = "pydantic_core-2.27.2-cp38-cp38-win32.whl", hash = "sha256:f6f8e111843bbb0dee4cb6594cdc73e79b3329b526037ec242a3e49012495b3b"}, + {file = "pydantic_core-2.27.2-cp38-cp38-win_amd64.whl", hash = "sha256:fd1aea04935a508f62e0d0ef1f5ae968774a32afc306fb8545e06f5ff5cdf3ad"}, + {file = "pydantic_core-2.27.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:c10eb4f1659290b523af58fa7cffb452a61ad6ae5613404519aee4bfbf1df993"}, + {file = "pydantic_core-2.27.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ef592d4bad47296fb11f96cd7dc898b92e795032b4894dfb4076cfccd43a9308"}, + {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c61709a844acc6bf0b7dce7daae75195a10aac96a596ea1b776996414791ede4"}, + {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:42c5f762659e47fdb7b16956c71598292f60a03aa92f8b6351504359dbdba6cf"}, + {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4c9775e339e42e79ec99c441d9730fccf07414af63eac2f0e48e08fd38a64d76"}, + {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:57762139821c31847cfb2df63c12f725788bd9f04bc2fb392790959b8f70f118"}, + {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0d1e85068e818c73e048fe28cfc769040bb1f475524f4745a5dc621f75ac7630"}, + {file = "pydantic_core-2.27.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:097830ed52fd9e427942ff3b9bc17fab52913b2f50f2880dc4a5611446606a54"}, + {file = "pydantic_core-2.27.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:044a50963a614ecfae59bb1eaf7ea7efc4bc62f49ed594e18fa1e5d953c40e9f"}, + {file = "pydantic_core-2.27.2-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:4e0b4220ba5b40d727c7f879eac379b822eee5d8fff418e9d3381ee45b3b0362"}, + {file = "pydantic_core-2.27.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5e4f4bb20d75e9325cc9696c6802657b58bc1dbbe3022f32cc2b2b632c3fbb96"}, + {file = "pydantic_core-2.27.2-cp39-cp39-win32.whl", hash = "sha256:cca63613e90d001b9f2f9a9ceb276c308bfa2a43fafb75c8031c4f66039e8c6e"}, + {file = "pydantic_core-2.27.2-cp39-cp39-win_amd64.whl", hash = "sha256:77d1bca19b0f7021b3a982e6f903dcd5b2b06076def36a652e3907f596e29f67"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:2bf14caea37e91198329b828eae1618c068dfb8ef17bb33287a7ad4b61ac314e"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:b0cb791f5b45307caae8810c2023a184c74605ec3bcbb67d13846c28ff731ff8"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:688d3fd9fcb71f41c4c015c023d12a79d1c4c0732ec9eb35d96e3388a120dcf3"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3d591580c34f4d731592f0e9fe40f9cc1b430d297eecc70b962e93c5c668f15f"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:82f986faf4e644ffc189a7f1aafc86e46ef70372bb153e7001e8afccc6e54133"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:bec317a27290e2537f922639cafd54990551725fc844249e64c523301d0822fc"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:0296abcb83a797db256b773f45773da397da75a08f5fcaef41f2044adec05f50"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:0d75070718e369e452075a6017fbf187f788e17ed67a3abd47fa934d001863d9"}, + {file = "pydantic_core-2.27.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:7e17b560be3c98a8e3aa66ce828bdebb9e9ac6ad5466fba92eb74c4c95cb1151"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:c33939a82924da9ed65dab5a65d427205a73181d8098e79b6b426bdf8ad4e656"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:00bad2484fa6bda1e216e7345a798bd37c68fb2d97558edd584942aa41b7d278"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c817e2b40aba42bac6f457498dacabc568c3b7a986fc9ba7c8d9d260b71485fb"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:251136cdad0cb722e93732cb45ca5299fb56e1344a833640bf93b2803f8d1bfd"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d2088237af596f0a524d3afc39ab3b036e8adb054ee57cbb1dcf8e09da5b29cc"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:d4041c0b966a84b4ae7a09832eb691a35aec90910cd2dbe7a208de59be77965b"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:8083d4e875ebe0b864ffef72a4304827015cff328a1be6e22cc850753bfb122b"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f141ee28a0ad2123b6611b6ceff018039df17f32ada8b534e6aa039545a3efb2"}, + {file = "pydantic_core-2.27.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7d0c8399fcc1848491f00e0314bd59fb34a9c008761bcb422a057670c3f65e35"}, + {file = "pydantic_core-2.27.2.tar.gz", hash = "sha256:eb026e5a4c1fee05726072337ff51d1efb6f59090b7da90d30ea58625b1ffb39"}, +] + +[package.dependencies] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" + +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +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 = "pytest-xdist" +version = "3.6.1" +description = "pytest xdist plugin for distributed testing, most importantly across multiple CPUs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pytest_xdist-3.6.1-py3-none-any.whl", hash = "sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7"}, + {file = "pytest_xdist-3.6.1.tar.gz", hash = "sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d"}, +] + +[package.dependencies] +execnet = ">=2.1" +pytest = ">=7.0.0" + +[package.extras] +psutil = ["psutil (>=3.0)"] +setproctitle = ["setproctitle"] +testing = ["filelock"] + +[[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 = "requests" +version = "2.32.4" +description = "Python HTTP for Humans." +optional = false +python-versions = ">=3.8" +files = [ + {file = "requests-2.32.4-py3-none-any.whl", hash = "sha256:27babd3cda2a6d50b30443204ee89830707d396671944c998b5975b031ac2b2c"}, + {file = "requests-2.32.4.tar.gz", hash = "sha256:27d0316682c8a29834d3264820024b62a36942083d52caf2f14c0591336d3422"}, +] + +[package.dependencies] +certifi = ">=2017.4.17" +charset_normalizer = ">=2,<4" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<3" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] + +[[package]] +name = "ruff" +version = "0.11.5" +description = "An extremely fast Python linter and code formatter, written in Rust." +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.11.5-py3-none-linux_armv6l.whl", hash = "sha256:2561294e108eb648e50f210671cc56aee590fb6167b594144401532138c66c7b"}, + {file = "ruff-0.11.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ac12884b9e005c12d0bd121f56ccf8033e1614f736f766c118ad60780882a077"}, + {file = "ruff-0.11.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:4bfd80a6ec559a5eeb96c33f832418bf0fb96752de0539905cf7b0cc1d31d779"}, + {file = "ruff-0.11.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0947c0a1afa75dcb5db4b34b070ec2bccee869d40e6cc8ab25aca11a7d527794"}, + {file = "ruff-0.11.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ad871ff74b5ec9caa66cb725b85d4ef89b53f8170f47c3406e32ef040400b038"}, + {file = "ruff-0.11.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e6cf918390cfe46d240732d4d72fa6e18e528ca1f60e318a10835cf2fa3dc19f"}, + {file = "ruff-0.11.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:56145ee1478582f61c08f21076dc59153310d606ad663acc00ea3ab5b2125f82"}, + {file = "ruff-0.11.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e5f66f8f1e8c9fc594cbd66fbc5f246a8d91f916cb9667e80208663ec3728304"}, + {file = "ruff-0.11.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:80b4df4d335a80315ab9afc81ed1cff62be112bd165e162b5eed8ac55bfc8470"}, + {file = "ruff-0.11.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3068befab73620b8a0cc2431bd46b3cd619bc17d6f7695a3e1bb166b652c382a"}, + {file = "ruff-0.11.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:f5da2e710a9641828e09aa98b92c9ebbc60518fdf3921241326ca3e8f8e55b8b"}, + {file = "ruff-0.11.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:ef39f19cb8ec98cbc762344921e216f3857a06c47412030374fffd413fb8fd3a"}, + {file = "ruff-0.11.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:b2a7cedf47244f431fd11aa5a7e2806dda2e0c365873bda7834e8f7d785ae159"}, + {file = "ruff-0.11.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:81be52e7519f3d1a0beadcf8e974715b2dfc808ae8ec729ecfc79bddf8dbb783"}, + {file = "ruff-0.11.5-py3-none-win32.whl", hash = "sha256:e268da7b40f56e3eca571508a7e567e794f9bfcc0f412c4b607931d3af9c4afe"}, + {file = "ruff-0.11.5-py3-none-win_amd64.whl", hash = "sha256:6c6dc38af3cfe2863213ea25b6dc616d679205732dc0fb673356c2d69608f800"}, + {file = "ruff-0.11.5-py3-none-win_arm64.whl", hash = "sha256:67e241b4314f4eacf14a601d586026a962f4002a475aa702c69980a38087aa4e"}, + {file = "ruff-0.11.5.tar.gz", hash = "sha256:cae2e2439cb88853e421901ec040a758960b576126dab520fa08e9de431d1bef"}, +] + +[[package]] +name = "six" +version = "1.17.0" +description = "Python 2 and 3 compatibility utilities" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, + {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, +] + +[[package]] +name = "sniffio" +version = "1.3.1" +description = "Sniff out which async library your code is running under" +optional = false +python-versions = ">=3.7" +files = [ + {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, + {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, +] + +[[package]] +name = "tomli" +version = "2.5.0" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.8" +files = [ + {file = "tomli-2.5.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c4dc1c1781f2f716de763d1e9a7b34c6a894e167e291c7c5d16c72f7a9538545"}, + {file = "tomli-2.5.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:eff8babca5a7999bc137acbc7482a8b7e17ffca5075ab41f5d770ab408c7bfef"}, + {file = "tomli-2.5.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:86665cee9c4835b7a7f1e8ec2c719b5258d4dc782887aded5a8ae7352a96843b"}, + {file = "tomli-2.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d7e369fd63331746182360977b1892bfc215476a30d61612d732425311639f56"}, + {file = "tomli-2.5.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:7ad1ea345759240d6463efa0ed1c704402752e49aa21476620738d74d72d8aa1"}, + {file = "tomli-2.5.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:96243987194634bd411066ce40c952e108f86af04db533ecd8ac3ff2a85b1885"}, + {file = "tomli-2.5.0-cp311-cp311-win32.whl", hash = "sha256:610b27d99f28ec5f191c7064a48f3ddb179a1fe6ca73d571483ae859f57b605e"}, + {file = "tomli-2.5.0-cp311-cp311-win_amd64.whl", hash = "sha256:c804ae44fe7b4bab5da295e4f980a1ff04670bca9d23fe0a4e887e08ebd741a8"}, + {file = "tomli-2.5.0-cp311-cp311-win_arm64.whl", hash = "sha256:cfac177ebd6236003846ea339981f71457cb6eb748f23381eb257e45092e3980"}, + {file = "tomli-2.5.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:1f4a40d03fb9f63424f0979855bdeaf44dd7696b8d59501822c10ed30ba532df"}, + {file = "tomli-2.5.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9ebf8d19b17bd0daeb7b7dec81a946a439b753942fd0210d6e96c532249eea6b"}, + {file = "tomli-2.5.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bf0b5e8e0f68ebb494356e577c06c139161efd8d3b9050f93b39b7c26cc54ff0"}, + {file = "tomli-2.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6cf74416bdc94ae458b14e37286c1073081850ac8459a00d0c5efef5d44294c6"}, + {file = "tomli-2.5.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:61ea1ebe1e55a34ea8199cc8dbff398d35027b82271c8ac4802fd3a1fd5b1bcc"}, + {file = "tomli-2.5.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ed53f7e89bb04f6d9e8e7799112360b0c4d5cbff067de0814c98c37c39b920f7"}, + {file = "tomli-2.5.0-cp312-cp312-win32.whl", hash = "sha256:e7ad033e27a516a233bea839cdb77b80146facb3b4f40bf02cd0cac165cdd5c2"}, + {file = "tomli-2.5.0-cp312-cp312-win_amd64.whl", hash = "sha256:bd05de8c1698f8413dd7d869492693a0bf2211543b787ac78cd5e7536af1a6d7"}, + {file = "tomli-2.5.0-cp312-cp312-win_arm64.whl", hash = "sha256:069435bd5480429b98c5e5afb02ab21c219b6f0064680671c6dc0d46817346ea"}, + {file = "tomli-2.5.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:943276cf269e0071948d9ff697159c1735e623c1151d88abb09b74659ef0cbea"}, + {file = "tomli-2.5.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:463b16086865b97facd8d0b3fb4cb7c544e3f58d2a69dc3113d6db9653fdb043"}, + {file = "tomli-2.5.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1245a6638fc4bb0a60af38a7d45413db34a13842027c77597c712c998c62fdf0"}, + {file = "tomli-2.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5d8bac3d603c97e6854424e5b2b5b741bdbde387e09f162fb0446812b4a8362b"}, + {file = "tomli-2.5.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:21e4cae4114aba25aa0d4f85cdf486d290fb35c0954d7bba536248da64d43066"}, + {file = "tomli-2.5.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:bbaefc84548d754be821bba7c4141c4787dda182f9e77f2f87b71213529efa7b"}, + {file = "tomli-2.5.0-cp313-cp313-win32.whl", hash = "sha256:abdbf6313b8d9efe157edeb7ab6eae4de064b1300ad31abf73755154b30abe68"}, + {file = "tomli-2.5.0-cp313-cp313-win_amd64.whl", hash = "sha256:fd4dc129784e0c5335bd4e61dfcc4487499a013419e655cf2da1d091b7e0efdc"}, + {file = "tomli-2.5.0-cp313-cp313-win_arm64.whl", hash = "sha256:69491c143d2fe063046e0301e62a810bed338fa4d1ce0fd870c27dc1e09b0d84"}, + {file = "tomli-2.5.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:d3182ee2d887e507bd67319a0a61105d1dd33facc111329559a233b772c1a105"}, + {file = "tomli-2.5.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:521345fd1f19d45b8df87657aaa38b6f2ca3800059fadf428e7ebf479a383646"}, + {file = "tomli-2.5.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6e95c7614e705bfe2b04b27aa124adec59752d15813df37e2156747cab3a006b"}, + {file = "tomli-2.5.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7ac2027d37c3afbdf4bdd377f2676f6f1d2122a5be1f1137b49dced590b37e75"}, + {file = "tomli-2.5.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c414be4ed9d3cac80c42e348fa5a956117d1a48227f48026e31f59cb4a7671eb"}, + {file = "tomli-2.5.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:9b03d7dc168353b4132965bde20feceabaa470e570c6f59660dfae59b1f9eeb3"}, + {file = "tomli-2.5.0-cp314-cp314-win32.whl", hash = "sha256:6f041843c4d3a37245c0c056fd955b186bf8b1fb85690cbe40b81230891dc34b"}, + {file = "tomli-2.5.0-cp314-cp314-win_amd64.whl", hash = "sha256:f4b653094e18f9031102d3a1da5c729c8f222d85225b18037dac621695e46e1a"}, + {file = "tomli-2.5.0-cp314-cp314-win_arm64.whl", hash = "sha256:3f89d10c1ff6a38d992c27fc8a4816af71a909e08a40ec66934240b1e74347c3"}, + {file = "tomli-2.5.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:e9e15b4a6c7dd6b85b5fbab29488a73f1f70de516942308daa266bf0e0aeb0d4"}, + {file = "tomli-2.5.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e12bbcd32897272fb05929110362ae9ff4c1b9bb26bd9e971e71dcd3275b4c3d"}, + {file = "tomli-2.5.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:20aa36de8f2cf87237143bc1fa1aae8d6612c09118f4da21c6a684db5dd1f6f9"}, + {file = "tomli-2.5.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:22185fad8a1e622f064e78008018a0dd3323550dcb479cb7a1d296888d74024f"}, + {file = "tomli-2.5.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:984012f71908165449a951de2050d52f276bfe3aa5d5f570f63ddad814370374"}, + {file = "tomli-2.5.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f79203b3965b4000e91808aaa7c040206093f2b8bf86f455982f2274c9ccf442"}, + {file = "tomli-2.5.0-cp314-cp314t-win32.whl", hash = "sha256:91294a9fb94a75542f6e46e4a2ae709bd8d9b51134098cae5cf3bea5478b6d03"}, + {file = "tomli-2.5.0-cp314-cp314t-win_amd64.whl", hash = "sha256:f15e3e0b835a6d68b10c86bf80a3149780498d6911c93c3ffd1861d19f9200f1"}, + {file = "tomli-2.5.0-cp314-cp314t-win_arm64.whl", hash = "sha256:6664b7ae7af7294256c53960a6103077f4914cec8ff98479c352f622c6f6b2f0"}, + {file = "tomli-2.5.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:a525685c2f97da40762b8695eb7aa0af4c8344ca1905c73e4e29cb04d34607dc"}, + {file = "tomli-2.5.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:9dbb18c1cfb2f6517942fc9314437f66aa06d94436ffb1f06102ef3572f35276"}, + {file = "tomli-2.5.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:752e8b1aa6a4367ef8bf6a1a1e005540f7ed055ba36d7193796812ca5404eb52"}, + {file = "tomli-2.5.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c47300f9bf791808f77d82747691c4bb09cb14bdf3060cca99b42cdc4361d5a7"}, + {file = "tomli-2.5.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:19b0dd8749f4ea2f112c5fcfb3c5248390c899d7e2e173f1d91abee1fa0ff391"}, + {file = "tomli-2.5.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:57b1c3b01fab802e2899bc3d168dca320e14165e2fd9fd584760fb4ca5826859"}, + {file = "tomli-2.5.0-cp315-cp315-win32.whl", hash = "sha256:667e521b37a6c5ccaa044202c235b530f90177ffe2cd4a64ecc213c7dd535feb"}, + {file = "tomli-2.5.0-cp315-cp315-win_amd64.whl", hash = "sha256:d747252933c8a65ef6bd8da0fbb7ce28a90eb6119d8cd00772cd528aa07b68d5"}, + {file = "tomli-2.5.0-cp315-cp315-win_arm64.whl", hash = "sha256:75dbcde8751b0a960aa3de173aa5e894d590755c6d7758b7e774c06f1dc3cbdd"}, + {file = "tomli-2.5.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:2419c2a189551987b59d80e63ec355671283336f41c6b9b89462df679c7d0c57"}, + {file = "tomli-2.5.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:0dc598040da8d42cf20f0be588ed7004f46db12a0ac6c32e03a59dccedaaadcd"}, + {file = "tomli-2.5.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:49096930c8d886c9bbdab62d2d0d17ce823ddeea522309a190b36245d5b49e01"}, + {file = "tomli-2.5.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b8ade5023067f99fe72b88accd30d0ea05a158e9e32a11f124e731ea9695313f"}, + {file = "tomli-2.5.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:b69564772b5c8f22ea5f498dff08cfa825045b4d4c4400529000bdf818aa3b2a"}, + {file = "tomli-2.5.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:8ff3a2ca028c7eee0c777f9a092038d0a594a9fa04e215f929a22c329e2cb142"}, + {file = "tomli-2.5.0-cp315-cp315t-win32.whl", hash = "sha256:62fc1bc8eb03e3a9cadfca713d65614ed8e09d974a283295ffe3a831976b4dc5"}, + {file = "tomli-2.5.0-cp315-cp315t-win_amd64.whl", hash = "sha256:f3fcbc57b1791fa6cbe5d8434179d51de12be1a4811469529f47f6e7487a2571"}, + {file = "tomli-2.5.0-cp315-cp315t-win_arm64.whl", hash = "sha256:d2ba24db8a9376921b5e87b4762b9adb0f3f1deaea68f2b8b0bb2c11efb9c3e7"}, + {file = "tomli-2.5.0-py3-none-any.whl", hash = "sha256:32a7b79ac57a2e83670ce329ccf675798bc5a2094783a63676866b70503f2e2b"}, + {file = "tomli-2.5.0.tar.gz", hash = "sha256:264507556cd8b8c8e7c6ee037cdf443a463f03f4c958e57195e3d369711b8ff6"}, +] + +[[package]] +name = "types-pyaudio" +version = "0.2.16.20240516" +description = "Typing stubs for pyaudio" +optional = false +python-versions = ">=3.8" +files = [ + {file = "types-pyaudio-0.2.16.20240516.tar.gz", hash = "sha256:f1c419ccc78b00d26c6c1ae4fcb17f7e4f08af2c2b9b73b12fcbc4a4ffa3a2c7"}, + {file = "types_pyaudio-0.2.16.20240516-py3-none-any.whl", hash = "sha256:40063f13ae15a422cbd4a2a783653eb3e1091bdd23fc7ab8ca3abc21ad0d13f8"}, +] + +[[package]] +name = "types-python-dateutil" +version = "2.9.0.20241206" +description = "Typing stubs for python-dateutil" +optional = false +python-versions = ">=3.8" +files = [ + {file = "types_python_dateutil-2.9.0.20241206-py3-none-any.whl", hash = "sha256:e248a4bc70a486d3e3ec84d0dc30eec3a5f979d6e7ee4123ae043eedbb987f53"}, + {file = "types_python_dateutil-2.9.0.20241206.tar.gz", hash = "sha256:18f493414c26ffba692a72369fea7a154c502646301ebfe3d56a04b3767284cb"}, +] + +[[package]] +name = "typing-extensions" +version = "4.13.2" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.13.2-py3-none-any.whl", hash = "sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c"}, + {file = "typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"}, +] + +[[package]] +name = "urllib3" +version = "2.2.3" +description = "HTTP library with thread-safe connection pooling, file post, and more." +optional = false +python-versions = ">=3.8" +files = [ + {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, + {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +h2 = ["h2 (>=4,<5)"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] + +[[package]] +name = "websockets" +version = "13.1" +description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" +optional = false +python-versions = ">=3.8" +files = [ + {file = "websockets-13.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f48c749857f8fb598fb890a75f540e3221d0976ed0bf879cf3c7eef34151acee"}, + {file = "websockets-13.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:c7e72ce6bda6fb9409cc1e8164dd41d7c91466fb599eb047cfda72fe758a34a7"}, + {file = "websockets-13.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f779498eeec470295a2b1a5d97aa1bc9814ecd25e1eb637bd9d1c73a327387f6"}, + {file = "websockets-13.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4676df3fe46956fbb0437d8800cd5f2b6d41143b6e7e842e60554398432cf29b"}, + {file = "websockets-13.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7affedeb43a70351bb811dadf49493c9cfd1ed94c9c70095fd177e9cc1541fa"}, + {file = "websockets-13.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1971e62d2caa443e57588e1d82d15f663b29ff9dfe7446d9964a4b6f12c1e700"}, + {file = "websockets-13.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:5f2e75431f8dc4a47f31565a6e1355fb4f2ecaa99d6b89737527ea917066e26c"}, + {file = "websockets-13.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:58cf7e75dbf7e566088b07e36ea2e3e2bd5676e22216e4cad108d4df4a7402a0"}, + {file = "websockets-13.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c90d6dec6be2c7d03378a574de87af9b1efea77d0c52a8301dd831ece938452f"}, + {file = "websockets-13.1-cp310-cp310-win32.whl", hash = "sha256:730f42125ccb14602f455155084f978bd9e8e57e89b569b4d7f0f0c17a448ffe"}, + {file = "websockets-13.1-cp310-cp310-win_amd64.whl", hash = "sha256:5993260f483d05a9737073be197371940c01b257cc45ae3f1d5d7adb371b266a"}, + {file = "websockets-13.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:61fc0dfcda609cda0fc9fe7977694c0c59cf9d749fbb17f4e9483929e3c48a19"}, + {file = "websockets-13.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ceec59f59d092c5007e815def4ebb80c2de330e9588e101cf8bd94c143ec78a5"}, + {file = "websockets-13.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c1dca61c6db1166c48b95198c0b7d9c990b30c756fc2923cc66f68d17dc558fd"}, + {file = "websockets-13.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:308e20f22c2c77f3f39caca508e765f8725020b84aa963474e18c59accbf4c02"}, + {file = "websockets-13.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62d516c325e6540e8a57b94abefc3459d7dab8ce52ac75c96cad5549e187e3a7"}, + {file = "websockets-13.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:87c6e35319b46b99e168eb98472d6c7d8634ee37750d7693656dc766395df096"}, + {file = "websockets-13.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5f9fee94ebafbc3117c30be1844ed01a3b177bb6e39088bc6b2fa1dc15572084"}, + {file = "websockets-13.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:7c1e90228c2f5cdde263253fa5db63e6653f1c00e7ec64108065a0b9713fa1b3"}, + {file = "websockets-13.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:6548f29b0e401eea2b967b2fdc1c7c7b5ebb3eeb470ed23a54cd45ef078a0db9"}, + {file = "websockets-13.1-cp311-cp311-win32.whl", hash = "sha256:c11d4d16e133f6df8916cc5b7e3e96ee4c44c936717d684a94f48f82edb7c92f"}, + {file = "websockets-13.1-cp311-cp311-win_amd64.whl", hash = "sha256:d04f13a1d75cb2b8382bdc16ae6fa58c97337253826dfe136195b7f89f661557"}, + {file = "websockets-13.1-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:9d75baf00138f80b48f1eac72ad1535aac0b6461265a0bcad391fc5aba875cfc"}, + {file = "websockets-13.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:9b6f347deb3dcfbfde1c20baa21c2ac0751afaa73e64e5b693bb2b848efeaa49"}, + {file = "websockets-13.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:de58647e3f9c42f13f90ac7e5f58900c80a39019848c5547bc691693098ae1bd"}, + {file = "websockets-13.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1b54689e38d1279a51d11e3467dd2f3a50f5f2e879012ce8f2d6943f00e83f0"}, + {file = "websockets-13.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf1781ef73c073e6b0f90af841aaf98501f975d306bbf6221683dd594ccc52b6"}, + {file = "websockets-13.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d23b88b9388ed85c6faf0e74d8dec4f4d3baf3ecf20a65a47b836d56260d4b9"}, + {file = "websockets-13.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3c78383585f47ccb0fcf186dcb8a43f5438bd7d8f47d69e0b56f71bf431a0a68"}, + {file = "websockets-13.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:d6d300f8ec35c24025ceb9b9019ae9040c1ab2f01cddc2bcc0b518af31c75c14"}, + {file = "websockets-13.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a9dcaf8b0cc72a392760bb8755922c03e17a5a54e08cca58e8b74f6902b433cf"}, + {file = "websockets-13.1-cp312-cp312-win32.whl", hash = "sha256:2f85cf4f2a1ba8f602298a853cec8526c2ca42a9a4b947ec236eaedb8f2dc80c"}, + {file = "websockets-13.1-cp312-cp312-win_amd64.whl", hash = "sha256:38377f8b0cdeee97c552d20cf1865695fcd56aba155ad1b4ca8779a5b6ef4ac3"}, + {file = "websockets-13.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:a9ab1e71d3d2e54a0aa646ab6d4eebfaa5f416fe78dfe4da2839525dc5d765c6"}, + {file = "websockets-13.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:b9d7439d7fab4dce00570bb906875734df13d9faa4b48e261c440a5fec6d9708"}, + {file = "websockets-13.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:327b74e915cf13c5931334c61e1a41040e365d380f812513a255aa804b183418"}, + {file = "websockets-13.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:325b1ccdbf5e5725fdcb1b0e9ad4d2545056479d0eee392c291c1bf76206435a"}, + {file = "websockets-13.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:346bee67a65f189e0e33f520f253d5147ab76ae42493804319b5716e46dddf0f"}, + {file = "websockets-13.1-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:91a0fa841646320ec0d3accdff5b757b06e2e5c86ba32af2e0815c96c7a603c5"}, + {file = "websockets-13.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:18503d2c5f3943e93819238bf20df71982d193f73dcecd26c94514f417f6b135"}, + {file = "websockets-13.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:a9cd1af7e18e5221d2878378fbc287a14cd527fdd5939ed56a18df8a31136bb2"}, + {file = "websockets-13.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:70c5be9f416aa72aab7a2a76c90ae0a4fe2755c1816c153c1a2bcc3333ce4ce6"}, + {file = "websockets-13.1-cp313-cp313-win32.whl", hash = "sha256:624459daabeb310d3815b276c1adef475b3e6804abaf2d9d2c061c319f7f187d"}, + {file = "websockets-13.1-cp313-cp313-win_amd64.whl", hash = "sha256:c518e84bb59c2baae725accd355c8dc517b4a3ed8db88b4bc93c78dae2974bf2"}, + {file = "websockets-13.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:c7934fd0e920e70468e676fe7f1b7261c1efa0d6c037c6722278ca0228ad9d0d"}, + {file = "websockets-13.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:149e622dc48c10ccc3d2760e5f36753db9cacf3ad7bc7bbbfd7d9c819e286f23"}, + {file = "websockets-13.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:a569eb1b05d72f9bce2ebd28a1ce2054311b66677fcd46cf36204ad23acead8c"}, + {file = "websockets-13.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:95df24ca1e1bd93bbca51d94dd049a984609687cb2fb08a7f2c56ac84e9816ea"}, + {file = "websockets-13.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d8dbb1bf0c0a4ae8b40bdc9be7f644e2f3fb4e8a9aca7145bfa510d4a374eeb7"}, + {file = "websockets-13.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:035233b7531fb92a76beefcbf479504db8c72eb3bff41da55aecce3a0f729e54"}, + {file = "websockets-13.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:e4450fc83a3df53dec45922b576e91e94f5578d06436871dce3a6be38e40f5db"}, + {file = "websockets-13.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:463e1c6ec853202dd3657f156123d6b4dad0c546ea2e2e38be2b3f7c5b8e7295"}, + {file = "websockets-13.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:6d6855bbe70119872c05107e38fbc7f96b1d8cb047d95c2c50869a46c65a8e96"}, + {file = "websockets-13.1-cp38-cp38-win32.whl", hash = "sha256:204e5107f43095012b00f1451374693267adbb832d29966a01ecc4ce1db26faf"}, + {file = "websockets-13.1-cp38-cp38-win_amd64.whl", hash = "sha256:485307243237328c022bc908b90e4457d0daa8b5cf4b3723fd3c4a8012fce4c6"}, + {file = "websockets-13.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:9b37c184f8b976f0c0a231a5f3d6efe10807d41ccbe4488df8c74174805eea7d"}, + {file = "websockets-13.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:163e7277e1a0bd9fb3c8842a71661ad19c6aa7bb3d6678dc7f89b17fbcc4aeb7"}, + {file = "websockets-13.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4b889dbd1342820cc210ba44307cf75ae5f2f96226c0038094455a96e64fb07a"}, + {file = "websockets-13.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:586a356928692c1fed0eca68b4d1c2cbbd1ca2acf2ac7e7ebd3b9052582deefa"}, + {file = "websockets-13.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7bd6abf1e070a6b72bfeb71049d6ad286852e285f146682bf30d0296f5fbadfa"}, + {file = "websockets-13.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6d2aad13a200e5934f5a6767492fb07151e1de1d6079c003ab31e1823733ae79"}, + {file = "websockets-13.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:df01aea34b6e9e33572c35cd16bae5a47785e7d5c8cb2b54b2acdb9678315a17"}, + {file = "websockets-13.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:e54affdeb21026329fb0744ad187cf812f7d3c2aa702a5edb562b325191fcab6"}, + {file = "websockets-13.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:9ef8aa8bdbac47f4968a5d66462a2a0935d044bf35c0e5a8af152d58516dbeb5"}, + {file = "websockets-13.1-cp39-cp39-win32.whl", hash = "sha256:deeb929efe52bed518f6eb2ddc00cc496366a14c726005726ad62c2dd9017a3c"}, + {file = "websockets-13.1-cp39-cp39-win_amd64.whl", hash = "sha256:7c65ffa900e7cc958cd088b9a9157a8141c991f8c53d11087e6fb7277a03f81d"}, + {file = "websockets-13.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:5dd6da9bec02735931fccec99d97c29f47cc61f644264eb995ad6c0c27667238"}, + {file = "websockets-13.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:2510c09d8e8df777177ee3d40cd35450dc169a81e747455cc4197e63f7e7bfe5"}, + {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1c3cf67185543730888b20682fb186fc8d0fa6f07ccc3ef4390831ab4b388d9"}, + {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bcc03c8b72267e97b49149e4863d57c2d77f13fae12066622dc78fe322490fe6"}, + {file = "websockets-13.1-pp310-pypy310_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:004280a140f220c812e65f36944a9ca92d766b6cc4560be652a0a3883a79ed8a"}, + {file = "websockets-13.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:e2620453c075abeb0daa949a292e19f56de518988e079c36478bacf9546ced23"}, + {file = "websockets-13.1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl", hash = "sha256:9156c45750b37337f7b0b00e6248991a047be4aa44554c9886fe6bdd605aab3b"}, + {file = "websockets-13.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:80c421e07973a89fbdd93e6f2003c17d20b69010458d3a8e37fb47874bd67d51"}, + {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82d0ba76371769d6a4e56f7e83bb8e81846d17a6190971e38b5de108bde9b0d7"}, + {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e9875a0143f07d74dc5e1ded1c4581f0d9f7ab86c78994e2ed9e95050073c94d"}, + {file = "websockets-13.1-pp38-pypy38_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a11e38ad8922c7961447f35c7b17bffa15de4d17c70abd07bfbe12d6faa3e027"}, + {file = "websockets-13.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:4059f790b6ae8768471cddb65d3c4fe4792b0ab48e154c9f0a04cefaabcd5978"}, + {file = "websockets-13.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:25c35bf84bf7c7369d247f0b8cfa157f989862c49104c5cf85cb5436a641d93e"}, + {file = "websockets-13.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:83f91d8a9bb404b8c2c41a707ac7f7f75b9442a0a876df295de27251a856ad09"}, + {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a43cfdcddd07f4ca2b1afb459824dd3c6d53a51410636a2c7fc97b9a8cf4842"}, + {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:48a2ef1381632a2f0cb4efeff34efa97901c9fbc118e01951ad7cfc10601a9bb"}, + {file = "websockets-13.1-pp39-pypy39_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:459bf774c754c35dbb487360b12c5727adab887f1622b8aed5755880a21c4a20"}, + {file = "websockets-13.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:95858ca14a9f6fa8413d29e0a585b31b278388aa775b8a81fa24830123874678"}, + {file = "websockets-13.1-py3-none-any.whl", hash = "sha256:a9a396a6ad26130cdae92ae10c36af09d9bfe6cafe69670fd3b6da9b07b4044f"}, + {file = "websockets-13.1.tar.gz", hash = "sha256:a3b3366087c1bc0a2795111edcadddb8b3b59509d5db5d7ea3fdd69f954a8878"}, +] + +[extras] +pyaudio = ["pyaudio"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.8" +content-hash = "88b375777d2a14ecbfbce27674ed77a8264c175d514119b668caaf4f911ba2c7" diff --git a/data/pyproject.toml b/data/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..13b1f844de151b3a5446f02a66148b4cb65110e2 --- /dev/null +++ b/data/pyproject.toml @@ -0,0 +1,97 @@ +[project] +name = "elevenlabs" +dynamic = ["version"] + +[tool.poetry] +name = "elevenlabs" +version = "2.74.1" +description = "" +readme = "README.md" +authors = [] +keywords = [] +license = "MIT" +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", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", + "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", + "License :: OSI Approved :: MIT License" +] +packages = [ + { include = "elevenlabs", from = "src"} +] + +[tool.poetry.urls] +Repository = 'https://github.com/elevenlabs/elevenlabs-python' + +[tool.poetry.dependencies] +python = "^3.8" +httpx = ">=0.21.2" +pyaudio = { version = ">=0.2.14", optional = true} +pydantic = ">= 1.9.2" +pydantic-core = ">=2.18.2" +requests = ">=2.20" +typing_extensions = ">= 4.0.0" +websockets = ">=13.0" + +[tool.poetry.group.dev.dependencies] +mypy = "==1.13.0" +pytest = "^7.4.0" +pytest-asyncio = "^0.23.5" +pytest-xdist = "^3.6.1" +python-dateutil = "^2.9.0" +types-python-dateutil = "^2.9.0.20240316" +ruff = "==0.11.5" +types-pyaudio = "^0.2.16.20240516" + +[tool.pytest.ini_options] +testpaths = [ "tests" ] +asyncio_mode = "auto" + +[tool.mypy] +plugins = ["pydantic.mypy"] + +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +select = [ + "E", # pycodestyle errors + "F", # pyflakes + "I", # isort +] +ignore = [ + "E402", # Module level import not at top of file + "E501", # Line too long + "E711", # Comparison to `None` should be `cond is not None` + "E712", # Avoid equality comparisons to `True`; use `if ...:` checks + "E721", # Use `is` and `is not` for type comparisons, or `isinstance()` for insinstance checks + "E722", # Do not use bare `except` + "E731", # Do not assign a `lambda` expression, use a `def` + "F821", # Undefined name + "F841" # Local variable ... is assigned to but never used +] + +[tool.ruff.lint.isort] +section-order = ["future", "standard-library", "third-party", "first-party"] + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry.extras] +pyaudio=["pyaudio"] diff --git a/data/reference.md b/data/reference.md new file mode 100644 index 0000000000000000000000000000000000000000..10a1539085a89256763838e26900c0509a4e4b66 --- /dev/null +++ b/data/reference.md @@ -0,0 +1,41559 @@ +# Reference +## History +
client.history.list(...) -> GetSpeechHistoryResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of your generated audio (e.g. text to speech, speech to speech, Studio, dubbing). Music and SFX generations are not included and cannot currently be retrieved via the API. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.history.list( + page_size=1, + start_after_history_item_id="start_after_history_item_id", + voice_id="voice_id", + model_id="model_id", + date_before_unix=1, + date_after_unix=1, + sort_direction="asc", + search="search", + source="TTS", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many history items to return at maximum. Can not exceed 1000, defaults to 100. + +
+
+ +
+
+ +**start_after_history_item_id:** `typing.Optional[str]` — After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. + +
+
+ +
+
+ +**voice_id:** `typing.Optional[str]` — ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Search term used for filtering history items. If provided, source becomes required. + +
+
+ +
+
+ +**date_before_unix:** `typing.Optional[int]` — Unix timestamp to filter history items before this date (exclusive). + +
+
+ +
+
+ +**date_after_unix:** `typing.Optional[int]` — Unix timestamp to filter history items after this date (inclusive). + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[HistoryListRequestSortDirection]` — Sort direction for the results. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — search term used for filtering + +
+
+ +
+
+ +**source:** `typing.Optional[HistoryListRequestSource]` — Source of the generated history item + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.history.get(...) -> SpeechHistoryItemResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a history item. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.history.get( + history_item_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**history_item_id:** `str` — ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.history.delete(...) -> DeleteHistoryItemResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a history item by its ID +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.history.delete( + history_item_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**history_item_id:** `str` — ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.history.get_audio(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the audio of an history item. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.history.get_audio( + history_item_id="history_item_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**history_item_id:** `str` — ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.history.download(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.history.download( + history_item_ids=[ + "history_item_ids", + "history_item_ids" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**history_item_ids:** `typing.List[str]` — A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. + +
+
+ +
+
+ +**output_format:** `typing.Optional[str]` — Output format to transcode the audio file, can be wav or default. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## TextToSoundEffects +
client.text_to_sound_effects.convert(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Turn text into sound effects for your videos, voice-overs or video games using the most advanced sound effects models in the world. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_sound_effects.convert( + text="Spacious braam suitable for high-impact movie trailer moments", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**text:** `str` — The text that will get converted into a sound effect. + +
+
+ +
+
+ +**output_format:** `typing.Optional[TextToSoundEffectsConvertRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**loop:** `typing.Optional[bool]` — Whether to create a sound effect that loops smoothly. Only available for the 'eleven_text_to_sound_v2 model'. + +
+
+ +
+
+ +**duration_seconds:** `typing.Optional[float]` — The duration of the sound which will be generated in seconds. Must be at least 0.5 and at most 30. If set to None we will guess the optimal duration using the prompt. Defaults to None. + +
+
+ +
+
+ +**prompt_influence:** `typing.Optional[float]` — A higher prompt influence makes your generation follow the prompt more closely while also making generations less variable. Must be a value between 0 and 1. Defaults to 0.3. + +
+
+ +
+
+ +**model_id:** `typing.Optional[SfxModelId]` — The model ID to use for the sound generation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## AudioIsolation +
client.audio_isolation.convert(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes background noise from audio. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +client.audio_isolation.convert(...) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**audio:** `core.File` — The audio file from which vocals/speech will be isolated from. + +
+
+ +
+
+ +**file_format:** `typing.Optional[AudioIsolationRequestFileFormat]` — The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + +
+
+ +
+
+ +**preview_b_64:** `typing.Optional[str]` — Optional preview image base64 for tracking this generation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.audio_isolation.list(...) -> GetAudioIsolationHistoryResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of all your audio isolation generations. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.audio_isolation.list( + page_size=1, + page=1, + search="search", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many history items to return at maximum. Defaults to 100. + +
+
+ +
+
+ +**page:** `typing.Optional[int]` — Page number for search pagination (1-based). Only used when search is provided. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Optional search term used for filtering audio isolation history (title/text). + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.audio_isolation.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a specific audio isolation history item and the associated media files. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.audio_isolation.delete( + history_item_id="history_item_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**history_item_id:** `str` — Identifier of the audio isolation history item. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.audio_isolation.stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes background noise from audio. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +client.audio_isolation.stream(...) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**audio:** `core.File` — The audio file from which vocals/speech will be isolated from. + +
+
+ +
+
+ +**file_format:** `typing.Optional[AudioIsolationStreamRequestFileFormat]` — The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## AudioEffects +
client.audio_effects.get_catalog() -> AudioEffectsCatalogResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the filter presets, reverb environments, and background noises that `audio_effects` can reference in Text to Speech, Text to Dialogue, and agent configurations. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.audio_effects.get_catalog() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Samples +
client.samples.delete(...) -> DeleteSampleResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes a sample by its ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.samples.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## TextToSpeech +
client.text_to_speech.convert(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Converts text into speech using a voice of your choice and returns audio. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_speech.convert( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**text:** `str` — The text that will get converted into speech. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**optimize_streaming_latency:** `typing.Optional[int]` + +You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: +0 - default mode (no latency optimizations) +1 - normal latency optimizations (about 50% of possible latency improvement of option 3) +2 - strong latency optimizations (about 75% of possible latency improvement of option 3) +3 - max latency optimizations +4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + +Defaults to None. + +
+
+ +
+
+ +**output_format:** `typing.Optional[TextToSpeechConvertRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + +
+
+ +
+
+ +**voice_settings:** `typing.Optional[VoiceSettings]` — Voice settings overriding stored settings for the given voice. They are applied only on the given request. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[PronunciationDictionaryVersionLocator]]` — A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**previous_text:** `typing.Optional[str]` — The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + +
+
+ +
+
+ +**next_text:** `typing.Optional[str]` — The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + +
+
+ +
+
+ +**previous_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + +
+
+ +
+
+ +**next_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + +
+
+ +
+
+ +**use_pvc_as_ivc:** `typing.Optional[bool]` — Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyTextToSpeechFullApplyTextNormalization]` — This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + +
+
+ +
+
+ +**apply_language_text_normalization:** `typing.Optional[bool]` — This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + +
+
+ +
+
+ +**audio_effects:** `typing.Optional[EffectsSpecInput]` — Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_speech.convert_with_timestamps(...) -> AudioWithTimestampsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Generate speech from text with precise character-level timing information for audio-text synchronization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_speech.convert_with_timestamps( + voice_id="21m00Tcm4TlvDq8ikWAM", + enable_logging=True, + optimize_streaming_latency=1, + output_format="alaw_8000", + text="This is a test for the API of ElevenLabs.", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**text:** `str` — The text that will get converted into speech. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**optimize_streaming_latency:** `typing.Optional[int]` + +You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: +0 - default mode (no latency optimizations) +1 - normal latency optimizations (about 50% of possible latency improvement of option 3) +2 - strong latency optimizations (about 75% of possible latency improvement of option 3) +3 - max latency optimizations +4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + +Defaults to None. + +
+
+ +
+
+ +**output_format:** `typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + +
+
+ +
+
+ +**voice_settings:** `typing.Optional[VoiceSettings]` — Voice settings overriding stored settings for the given voice. They are applied only on the given request. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[PronunciationDictionaryVersionLocator]]` — A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**previous_text:** `typing.Optional[str]` — The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + +
+
+ +
+
+ +**next_text:** `typing.Optional[str]` — The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + +
+
+ +
+
+ +**previous_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + +
+
+ +
+
+ +**next_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + +
+
+ +
+
+ +**use_pvc_as_ivc:** `typing.Optional[bool]` — Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization]` — This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + +
+
+ +
+
+ +**apply_language_text_normalization:** `typing.Optional[bool]` — This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + +
+
+ +
+
+ +**audio_effects:** `typing.Optional[EffectsSpecInput]` — Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_speech.stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Converts text into speech using a voice of your choice and returns audio as an audio stream. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_speech.stream( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**text:** `str` — The text that will get converted into speech. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**optimize_streaming_latency:** `typing.Optional[int]` + +You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: +0 - default mode (no latency optimizations) +1 - normal latency optimizations (about 50% of possible latency improvement of option 3) +2 - strong latency optimizations (about 75% of possible latency improvement of option 3) +3 - max latency optimizations +4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + +Defaults to None. + +
+
+ +
+
+ +**output_format:** `typing.Optional[TextToSpeechStreamRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + +
+
+ +
+
+ +**voice_settings:** `typing.Optional[VoiceSettings]` — Voice settings overriding stored settings for the given voice. They are applied only on the given request. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[PronunciationDictionaryVersionLocator]]` — A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**previous_text:** `typing.Optional[str]` — The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + +
+
+ +
+
+ +**next_text:** `typing.Optional[str]` — The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + +
+
+ +
+
+ +**previous_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + +
+
+ +
+
+ +**next_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + +
+
+ +
+
+ +**use_pvc_as_ivc:** `typing.Optional[bool]` — Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyTextToSpeechStreamApplyTextNormalization]` — This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + +
+
+ +
+
+ +**apply_language_text_normalization:** `typing.Optional[bool]` — This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + +
+
+ +
+
+ +**audio_effects:** `typing.Optional[EffectsSpecInput]` — Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_speech.stream_with_timestamps(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Converts text into speech using a voice of your choice and returns a stream of JSONs containing audio as a base64 encoded string together with information on when which character was spoken. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_speech.stream_with_timestamps( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**text:** `str` — The text that will get converted into speech. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**optimize_streaming_latency:** `typing.Optional[int]` + +You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: +0 - default mode (no latency optimizations) +1 - normal latency optimizations (about 50% of possible latency improvement of option 3) +2 - strong latency optimizations (about 75% of possible latency improvement of option 3) +3 - max latency optimizations +4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + +Defaults to None. + +
+
+ +
+
+ +**output_format:** `typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + +
+
+ +
+
+ +**voice_settings:** `typing.Optional[VoiceSettings]` — Voice settings overriding stored settings for the given voice. They are applied only on the given request. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[PronunciationDictionaryVersionLocator]]` — A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**previous_text:** `typing.Optional[str]` — The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + +
+
+ +
+
+ +**next_text:** `typing.Optional[str]` — The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + +
+
+ +
+
+ +**previous_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + +
+
+ +
+
+ +**next_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + +
+
+ +
+
+ +**use_pvc_as_ivc:** `typing.Optional[bool]` — Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization]` — This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + +
+
+ +
+
+ +**apply_language_text_normalization:** `typing.Optional[bool]` — This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + +
+
+ +
+
+ +**audio_effects:** `typing.Optional[EffectsSpecInput]` — Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## TextToDialogue +
client.text_to_dialogue.convert(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Converts a list of text and voice ID pairs into speech (dialogue) and returns audio. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DialogueInput +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_dialogue.convert( + inputs=[ + DialogueInput( + text="[giggling] Knock knock", + voice_id="JBFqnCBsd6RMkjVDRZzb", + ), + DialogueInput( + text="[curious] Who is there?", + voice_id="Aw4FAjKCGjjNkVhN1Xmq", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**inputs:** `typing.List[DialogueInput]` — A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + +
+
+ +
+
+ +**output_format:** `typing.Optional[TextToDialogueConvertRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + +
+
+ +
+
+ +**settings:** `typing.Optional[ToDialogueSettingsResponseModel]` — Settings controlling the dialogue generation. + +
+
+ +
+
+ +**previous_text:** `typing.Optional[str]` — The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + +
+
+ +
+
+ +**future_text:** `typing.Optional[str]` — The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[PronunciationDictionaryVersionLocator]]` — A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization]` — This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + +
+
+ +
+
+ +**use_pvc_as_ivc:** `typing.Optional[bool]` — Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + +
+
+ +
+
+ +**previous_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + +
+
+ +
+
+ +**next_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + +
+
+ +
+
+ +**audio_effects:** `typing.Optional[EffectsSpecInput]` — Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_dialogue.stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Converts a list of text and voice ID pairs into speech (dialogue) and returns an audio stream. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DialogueInput +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_dialogue.stream( + inputs=[ + DialogueInput( + text="[giggling] Knock knock", + voice_id="JBFqnCBsd6RMkjVDRZzb", + ), + DialogueInput( + text="[curious] Who is there?", + voice_id="Aw4FAjKCGjjNkVhN1Xmq", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**inputs:** `typing.List[DialogueInput]` — A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + +
+
+ +
+
+ +**output_format:** `typing.Optional[AllowedOutputFormats]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + +
+
+ +
+
+ +**settings:** `typing.Optional[ToDialogueSettingsResponseModel]` — Settings controlling the dialogue generation. + +
+
+ +
+
+ +**previous_text:** `typing.Optional[str]` — The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + +
+
+ +
+
+ +**future_text:** `typing.Optional[str]` — The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[PronunciationDictionaryVersionLocator]]` — A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization]` — This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + +
+
+ +
+
+ +**use_pvc_as_ivc:** `typing.Optional[bool]` — Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + +
+
+ +
+
+ +**previous_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + +
+
+ +
+
+ +**next_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + +
+
+ +
+
+ +**audio_effects:** `typing.Optional[EffectsSpecInput]` — Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_dialogue.stream_with_timestamps(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Converts a list of text and voice ID pairs into speech (dialogue) and returns a stream of JSON blobs containing audio as a base64 encoded string and timestamps +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DialogueInput +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_dialogue.stream_with_timestamps( + output_format="mp3_22050_32", + enable_logging=True, + inputs=[ + DialogueInput( + text="Hello, how are you?", + voice_id="bYTqZQo3Jz7LQtmGTgwi", + ), + DialogueInput( + text="I\'m doing well, thank you!", + voice_id="6lCwbsX1yVjD49QmpkTR", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**inputs:** `typing.List[DialogueInput]` — A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + +
+
+ +
+
+ +**output_format:** `typing.Optional[AllowedOutputFormats]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + +
+
+ +
+
+ +**settings:** `typing.Optional[ToDialogueSettingsResponseModel]` — Settings controlling the dialogue generation. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[PronunciationDictionaryVersionLocator]]` — A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization]` — This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + +
+
+ +
+
+ +**use_pvc_as_ivc:** `typing.Optional[bool]` — Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + +
+
+ +
+
+ +**previous_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + +
+
+ +
+
+ +**next_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + +
+
+ +
+
+ +**previous_text:** `typing.Optional[str]` — The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + +
+
+ +
+
+ +**future_text:** `typing.Optional[str]` — The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + +
+
+ +
+
+ +**audio_effects:** `typing.Optional[EffectsSpecInput]` — Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_dialogue.convert_with_timestamps(...) -> AudioWithTimestampsAndVoiceSegmentsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Generate dialogue from text with precise character-level timing information for audio-text synchronization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DialogueInput +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_dialogue.convert_with_timestamps( + output_format="alaw_8000", + enable_logging=True, + inputs=[ + DialogueInput( + text="Hello, how are you?", + voice_id="bYTqZQo3Jz7LQtmGTgwi", + ), + DialogueInput( + text="I\'m doing well, thank you!", + voice_id="6lCwbsX1yVjD49QmpkTR", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**inputs:** `typing.List[DialogueInput]` — A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + +
+
+ +
+
+ +**output_format:** `typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + +
+
+ +
+
+ +**settings:** `typing.Optional[ToDialogueSettingsResponseModel]` — Settings controlling the dialogue generation. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[PronunciationDictionaryVersionLocator]]` — A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization]` — This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + +
+
+ +
+
+ +**use_pvc_as_ivc:** `typing.Optional[bool]` — Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + +
+
+ +
+
+ +**previous_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + +
+
+ +
+
+ +**next_request_ids:** `typing.Optional[typing.List[str]]` — A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + +
+
+ +
+
+ +**previous_text:** `typing.Optional[str]` — The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + +
+
+ +
+
+ +**future_text:** `typing.Optional[str]` — The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + +
+
+ +
+
+ +**audio_effects:** `typing.Optional[EffectsSpecInput]` — Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## SpeechToSpeech +
client.speech_to_speech.convert(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Transform audio from one voice to another. Maintain full control over emotion, timing and delivery. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_to_speech.convert( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + audio="example_audio", + model_id="eleven_multilingual_sts_v2", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**audio:** `core.File` — The audio file which holds the content and emotion that will control the generated speech. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**optimize_streaming_latency:** `typing.Optional[int]` + +You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: +0 - default mode (no latency optimizations) +1 - normal latency optimizations (about 50% of possible latency improvement of option 3) +2 - strong latency optimizations (about 75% of possible latency improvement of option 3) +3 - max latency optimizations +4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + +Defaults to None. + +
+
+ +
+
+ +**output_format:** `typing.Optional[SpeechToSpeechConvertRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + +
+
+ +
+
+ +**voice_settings:** `typing.Optional[str]` — Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**remove_background_noise:** `typing.Optional[bool]` — If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + +
+
+ +
+
+ +**file_format:** `typing.Optional[SpeechToSpeechRequestFileFormat]` — The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.speech_to_speech.stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Stream audio from one voice to another. Maintain full control over emotion, timing and delivery. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_to_speech.stream( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + audio="example_audio", + model_id="eleven_multilingual_sts_v2", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**audio:** `core.File` — The audio file which holds the content and emotion that will control the generated speech. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**optimize_streaming_latency:** `typing.Optional[int]` + +You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: +0 - default mode (no latency optimizations) +1 - normal latency optimizations (about 50% of possible latency improvement of option 3) +2 - strong latency optimizations (about 75% of possible latency improvement of option 3) +3 - max latency optimizations +4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + +Defaults to None. + +
+
+ +
+
+ +**output_format:** `typing.Optional[SpeechToSpeechStreamRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + +
+
+ +
+
+ +**voice_settings:** `typing.Optional[str]` — Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + +
+
+ +
+
+ +**remove_background_noise:** `typing.Optional[bool]` — If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + +
+
+ +
+
+ +**file_format:** `typing.Optional[SpeechToSpeechStreamRequestFileFormat]` — The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## TextToVoice +
client.text_to_voice.create_previews(...) -> VoiceDesignPreviewResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a voice from a text prompt. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_voice.create_previews( + output_format="mp3_22050_32", + voice_description="A sassy squeaky mouse", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_description:** `str` — Description to use for the created voice. + +
+
+ +
+
+ +**output_format:** `typing.Optional[AllowedOutputFormats]` — The output format of the generated audio. + +
+
+ +
+
+ +**text:** `typing.Optional[str]` — Text to generate, text length has to be between 100 and 1000. + +
+
+ +
+
+ +**auto_generate_text:** `typing.Optional[bool]` — Whether to automatically generate a text suitable for the voice description. + +
+
+ +
+
+ +**loudness:** `typing.Optional[float]` — Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + +
+
+ +
+
+ +**quality:** `typing.Optional[float]` — Higher quality results in better voice output but less variety. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — Random number that controls the voice generation. Same seed with same inputs produces same voice. + +
+
+ +
+
+ +**guidance_scale:** `typing.Optional[float]` — Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + +
+
+ +
+
+ +**should_enhance:** `typing.Optional[bool]` — Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_voice.create(...) -> Voice +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a voice from previously generated voice preview. This endpoint should be called after you fetched a generated_voice_id using POST /v1/text-to-voice/design or POST /v1/text-to-voice/:voice_id/remix. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_voice.create( + voice_name="Sassy squeaky mouse", + voice_description="A sassy squeaky mouse", + generated_voice_id="37HceQefKmEi3bGovXjL", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_name:** `str` — Name to use for the created voice. + +
+
+ +
+
+ +**voice_description:** `str` — Description to use for the created voice. + +
+
+ +
+
+ +**generated_voice_id:** `str` — The generated_voice_id to create; obtain it from POST /v1/text-to-voice/design, POST /v1/text-to-voice/:voice_id/remix, or the response headers when generating previews. + +
+
+ +
+
+ +**labels:** `typing.Optional[typing.Dict[str, typing.Optional[str]]]` — Optional, metadata to add to the created voice. Defaults to None. + +
+
+ +
+
+ +**played_not_selected_voice_ids:** `typing.Optional[typing.List[str]]` — List of voice ids that the user has played but not selected. Used for RLHF. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_voice.design(...) -> VoiceDesignPreviewResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Design a voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_voice.design( + output_format="mp3_22050_32", + voice_description="A sassy squeaky mouse", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_description:** `str` — Description to use for the created voice. + +
+
+ +
+
+ +**output_format:** `typing.Optional[AllowedOutputFormats]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**model_id:** `typing.Optional[VoiceDesignRequestModelModelId]` — Model to use for the voice generation. Possible values: eleven_multilingual_ttv_v2, eleven_ttv_v3. + +
+
+ +
+
+ +**text:** `typing.Optional[str]` — Text to generate, text length has to be between 100 and 1000. + +
+
+ +
+
+ +**auto_generate_text:** `typing.Optional[bool]` — Whether to automatically generate a text suitable for the voice description. + +
+
+ +
+
+ +**loudness:** `typing.Optional[float]` — Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — Random number that controls the voice generation. Same seed with same inputs produces same voice. + +
+
+ +
+
+ +**guidance_scale:** `typing.Optional[float]` — Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + +
+
+ +
+
+ +**stream_previews:** `typing.Optional[bool]` — Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + +
+
+ +
+
+ +**should_enhance:** `typing.Optional[bool]` — Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + +
+
+ +
+
+ +**remixing_session_id:** `typing.Optional[str]` — The remixing session id. + +
+
+ +
+
+ +**remixing_session_iteration_id:** `typing.Optional[str]` — The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + +
+
+ +
+
+ +**quality:** `typing.Optional[float]` — Higher quality results in better voice output but less variety. + +
+
+ +
+
+ +**reference_audio_base_64:** `typing.Optional[str]` — Reference audio to use for the voice generation. The audio should be base64 encoded. Only supported when using the eleven_ttv_v3 model. + +
+
+ +
+
+ +**prompt_strength:** `typing.Optional[float]` — Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.text_to_voice.remix(...) -> VoiceDesignPreviewResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remix an existing voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_voice.remix( + voice_id="21m00Tcm4TlvDq8ikWAM", + output_format="mp3_22050_32", + voice_description="Make the voice have a higher pitch.", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**voice_description:** `str` — Description of the changes to make to the voice. + +
+
+ +
+
+ +**output_format:** `typing.Optional[AllowedOutputFormats]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**text:** `typing.Optional[str]` — Text to generate, text length has to be between 100 and 1000. + +
+
+ +
+
+ +**auto_generate_text:** `typing.Optional[bool]` — Whether to automatically generate a text suitable for the voice description. + +
+
+ +
+
+ +**loudness:** `typing.Optional[float]` — Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — Random number that controls the voice generation. Same seed with same inputs produces same voice. + +
+
+ +
+
+ +**guidance_scale:** `typing.Optional[float]` — Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + +
+
+ +
+
+ +**stream_previews:** `typing.Optional[bool]` — Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + +
+
+ +
+
+ +**remixing_session_id:** `typing.Optional[str]` — The remixing session id. + +
+
+ +
+
+ +**remixing_session_iteration_id:** `typing.Optional[str]` — The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + +
+
+ +
+
+ +**prompt_strength:** `typing.Optional[float]` — Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## User +
client.user.get() -> User +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets information about the user +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.user.get() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices +
client.voices.get_all(...) -> GetVoicesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of all available voices for a user. Stops working once the user's workspace exceeds 500 voices. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.get_all( + show_legacy=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**show_legacy:** `typing.Optional[bool]` — If set to true, legacy premade voices will be included in responses from /v1/voices + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.get(...) -> Voice +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns metadata about a specific voice. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + with_settings=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**with_settings:** `typing.Optional[bool]` — This parameter is now deprecated. It is ignored and will be removed in a future version. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.delete(...) -> DeleteVoiceResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a voice by its ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.update(...) -> EditVoiceResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit a voice created by you. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + files=["example_files"], + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**name:** `str` — The name that identifies this voice. This will be displayed in the dropdown of the website. + +
+
+ +
+
+ +**files:** `typing.Optional[typing.List[core.File]]` — Audio files to add to the voice + +
+
+ +
+
+ +**remove_background_noise:** `typing.Optional[bool]` — If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — A description of the voice. + +
+
+ +
+
+ +**labels:** `typing.Optional[EditVoiceRequestLabels]` — Labels for the voice. Keys can be language, accent, gender, or age. + +
+
+ +
+
+ +**moderate_metadata:** `typing.Optional[bool]` — Run synchronous LLM moderation over the voice name and description when they change. Has no effect unless the voice_library_metadata_moderation feature flag is enabled for the user. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.search(...) -> GetVoicesV2Response +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets a list of all available voices for a user with search, filtering and pagination. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.search( + next_page_token="next_page_token", + page_size=1, + search="search", + sort="sort", + sort_direction="sort_direction", + voice_type="voice_type", + category="category", + fine_tuning_state="fine_tuning_state", + collection_id="collection_id", + gender="gender", + age="age", + language=[ + "language" + ], + accent="accent", + use_cases=[ + "use_cases" + ], + min_notice_period_days=1, + include_custom_rates=True, + include_live_moderated=True, + high_quality=True, + include_total_count=True, + voice_ids=[ + "voice_ids" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**next_page_token:** `typing.Optional[str]` — The next page token to use for pagination. Returned from the previous request. Use this in combination with the has_more flag for reliable pagination. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many voices to return at maximum. Can not exceed 100, defaults to 10. Page 0 may include more voices due to default voices being included. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Search term to filter voices by. Searches in name, description, labels, category. + +
+
+ +
+
+ +**sort:** `typing.Optional[str]` — Which field to sort by, one of 'created_at_unix' or 'name'. 'created_at_unix' may not be available for older voices. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[str]` — Which direction to sort the voices in. 'asc' or 'desc'. + +
+
+ +
+
+ +**voice_type:** `typing.Optional[str]` — Type of the voice to filter by. One of 'personal', 'community', 'default', 'workspace', 'non-default', 'non-community', 'saved'. 'non-default' is equal to all but 'default'. 'non-community' is equal to 'personal' and 'workspace' combined (excludes library copies). 'saved' is equal to non-default, but includes default voices if they have been added to a collection. + +
+
+ +
+
+ +**category:** `typing.Optional[str]` — Category of the voice to filter by. One of 'premade', 'cloned', 'generated', 'professional' + +
+
+ +
+
+ +**fine_tuning_state:** `typing.Optional[str]` — State of the voice's fine tuning to filter by. Applicable only to professional voices clones. One of 'draft', 'not_verified', 'not_started', 'queued', 'fine_tuning', 'fine_tuned', 'failed', 'delayed' + +
+
+ +
+
+ +**collection_id:** `typing.Optional[str]` — Collection ID to filter voices by. + +
+
+ +
+
+ +**gender:** `typing.Optional[str]` — Gender used for filtering, based on the voice's 'gender' label. + +
+
+ +
+
+ +**age:** `typing.Optional[str]` — Age used for filtering, based on the voice's 'age' label. + +
+
+ +
+
+ +**language:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Languages used for filtering, based on the voice's 'language' label. Voices matching any of the given languages are returned. + +
+
+ +
+
+ +**accent:** `typing.Optional[str]` — Accent used for filtering, based on the voice's 'accent' label. + +
+
+ +
+
+ +**use_cases:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Use cases used for filtering, based on the voice's 'use_case' label. Voices matching any of the given use cases are returned. + +
+
+ +
+
+ +**min_notice_period_days:** `typing.Optional[int]` — Filter to voices whose sharing notice period is at least the given number of days. + +
+
+ +
+
+ +**include_custom_rates:** `typing.Optional[bool]` — Whether to include voices that have a custom sharing rate. Defaults to including them. + +
+
+ +
+
+ +**include_live_moderated:** `typing.Optional[bool]` — Whether to include voices that have live moderation enabled. Defaults to including them. + +
+
+ +
+
+ +**high_quality:** `typing.Optional[bool]` — When true, only return studio-quality voices (those whose category is 'high_quality'). + +
+
+ +
+
+ +**include_total_count:** `typing.Optional[bool]` — Whether to include the total count of voices found in the response. NOTE: The total_count value is a live snapshot and may change between requests as users create, modify, or delete voices. For pagination, rely on the has_more flag instead. Only enable this when you actually need the total count (e.g., for display purposes), as it incurs a performance cost. + +
+
+ +
+
+ +**voice_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Voice IDs to lookup by. Maximum 100 voice IDs. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.replicate_to_isolated_environment(...) -> ReplicateVoiceToIsolatedEnvironmentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Replicates an Instant Voice Clone or Voice Design voice to a workspace in a different data residency. The target workspace must belong to the same consolidated billing group. The user must have VOICES_WRITE in the source workspace, and be an admin on the source voice. Human users (i.e. not service accounts) must also have VOICES_WRITE in the target workspace. This endpoint is available on the central environment only. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.replicate_to_isolated_environment( + voice_id="21m00Tcm4TlvDq8ikWAM", + target_workspace_id="target_workspace_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**target_workspace_id:** `str` — ID of the workspace to replicate the voice into. It must belong to the same consolidated billing group as the calling workspace; the target's data residency is derived from that link. + +
+
+ +
+
+ +**preserve_voice_id:** `typing.Optional[bool]` — When true (default) the replicated voice keeps the same voice ID in the target residency; set to false to assign a new voice ID. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.share(...) -> AddVoiceResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a shared voice to your collection of Voices +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.share( + public_user_id="63e06b7e7cafdc46be4d2e0b3f045940231ae058d508589653d74d1265a574ca", + voice_id="21m00Tcm4TlvDq8ikWAM", + new_name="John Smith", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**public_user_id:** `str` — Public user ID used to publicly identify ElevenLabs users. + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**new_name:** `str` — The name that identifies this voice. This will be displayed in the dropdown of the website. + +
+
+ +
+
+ +**bookmarked:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.find_similar_voices(...) -> GetLibraryVoicesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of shared voices similar to the provided audio sample. If neither similarity_threshold nor top_k is provided, we will apply default values. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.find_similar_voices( + audio_file="example_audio_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**audio_file:** `typing.Optional[core.File]` + +
+
+ +
+
+ +**similarity_threshold:** `typing.Optional[float]` — Threshold for voice similarity between provided sample and library voices. Values range from 0 to 2. The smaller the value the more similar voices will be returned. + +
+
+ +
+
+ +**top_k:** `typing.Optional[int]` — Number of most similar voices to return. If similarity_threshold is provided, less than this number of voices may be returned. Values range from 1 to 100. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.get_shared(...) -> GetLibraryVoicesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of shared voices. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.get_shared( + page_size=1, + category="professional", + gender="gender", + age="age", + accent="accent", + language="language", + locale="locale", + search="search", + use_cases=[ + "use_cases" + ], + descriptives=[ + "descriptives" + ], + featured=True, + min_notice_period_days=1, + include_custom_rates=True, + include_live_moderated=True, + reader_app_enabled=True, + owner_id="owner_id", + sort="created_date", + page=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many shared voices to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**category:** `typing.Optional[VoicesGetSharedRequestCategory]` — Voice category used for filtering + +
+
+ +
+
+ +**gender:** `typing.Optional[str]` — Gender used for filtering + +
+
+ +
+
+ +**age:** `typing.Optional[str]` — Age used for filtering + +
+
+ +
+
+ +**accent:** `typing.Optional[str]` — Accent used for filtering + +
+
+ +
+
+ +**language:** `typing.Optional[str]` — Language used for filtering + +
+
+ +
+
+ +**locale:** `typing.Optional[str]` — Locale used for filtering + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Search term used for filtering + +
+
+ +
+
+ +**use_cases:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Use-case used for filtering + +
+
+ +
+
+ +**descriptives:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Search term used for filtering + +
+
+ +
+
+ +**featured:** `typing.Optional[bool]` — Filter featured voices + +
+
+ +
+
+ +**min_notice_period_days:** `typing.Optional[int]` — Filter voices with a minimum notice period of the given number of days. + +
+
+ +
+
+ +**include_custom_rates:** `typing.Optional[bool]` — Include/exclude voices with custom rates + +
+
+ +
+
+ +**include_live_moderated:** `typing.Optional[bool]` — Include/exclude voices that are live moderated + +
+
+ +
+
+ +**reader_app_enabled:** `typing.Optional[bool]` — Filter voices that are enabled for the reader app + +
+
+ +
+
+ +**owner_id:** `typing.Optional[str]` — Filter voices by public owner ID + +
+
+ +
+
+ +**sort:** `typing.Optional[VoicesGetSharedRequestSort]` — Sort criteria. Must be one of: created_date, usage_character_count_1y, trending, cloned_by_count. + +
+
+ +
+
+ +**page:** `typing.Optional[int]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Studio +
client.studio.create_podcast(...) -> PodcastProjectResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create and auto-convert a podcast project. Currently, the LLM cost is covered by us but you will still be charged for the audio generation. In the future, you will be charged for both the LLM and audio generation costs. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, PodcastConversationModeData, PodcastTextSource +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.create_podcast( + model_id="eleven_multilingual_v2", + mode={ + "type": "conversation", + "conversation": PodcastConversationModeData( + host_voice_id="aw1NgEzBg83R7vgmiJt6", + guest_voice_id="aw1NgEzBg83R7vgmiJt7", + ) + }, + source=PodcastTextSource( + type="text", + text="This is a test podcast.", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**model_id:** `str` — The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + +
+
+ +
+
+ +**mode:** `BodyCreatePodcastV1StudioPodcastsPostMode` — The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue. + +
+
+ +
+
+ +**source:** `BodyCreatePodcastV1StudioPodcastsPostSource` — The source content for the Podcast. + +
+
+ +
+
+ +**safety_identifier:** `typing.Optional[str]` — Used for moderation. Your workspace must be allowlisted to use this feature. + +
+
+ +
+
+ +**quality_preset:** `typing.Optional[QualityPresetType]` + +Output quality of the generated audio. Must be one of: +'standard' - standard output format, 128kbps with 44.1kHz sample rate. +'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. +'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. +'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. +If not provided, defaults to the highest quality preset available on your subscription tier. + +
+
+ +
+
+ +**duration_scale:** `typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale]` + +Duration of the generated podcast. Must be one of: +short - produces podcasts shorter than 3 minutes. +default - produces podcasts roughly between 3-7 minutes. +long - produces podcasts longer than 7 minutes. + +
+
+ +
+
+ +**language:** `typing.Optional[str]` — An optional language of the Studio project. Two-letter language code (ISO 639-1). + +
+
+ +
+
+ +**intro:** `typing.Optional[str]` — The intro text that will always be added to the beginning of the podcast. + +
+
+ +
+
+ +**outro:** `typing.Optional[str]` — The outro text that will always be added to the end of the podcast. + +
+
+ +
+
+ +**instructions_prompt:** `typing.Optional[str]` — Additional instructions prompt for the podcast generation used to adjust the podcast's style and tone. + +
+
+ +
+
+ +**highlights:** `typing.Optional[typing.List[str]]` — A brief summary or highlights of the Studio project's content, providing key points or themes. This should be between 10 and 70 characters. + +
+
+ +
+
+ +**callback_url:** `typing.Optional[str]` + + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization]` + + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## dubbing +
client.dubbing.list(...) -> DubbingMetadataPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the dubs you have access to. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.list( + cursor="cursor", + page_size=1, + dubbing_status="dubbing", + dubbing_statuses=[ + "queued" + ], + dubbing_models=[ + "dubbing_v1" + ], + target_language_codes=[ + "target_language_codes" + ], + creation_sources=[ + "flow_node" + ], + filter_by_creator="personal", + order_by="created_at", + order_direction="DESCENDING", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many dubs to return at maximum. Can not exceed 200, defaults to 100. + +
+
+ +
+
+ +**dubbing_status:** `typing.Optional[DubbingListRequestDubbingStatus]` — What state the dub is currently in. + +
+
+ +
+
+ +**dubbing_statuses:** `typing.Optional[typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]]]` — Filter by dubbing status. + +
+
+ +
+
+ +**dubbing_models:** `typing.Optional[typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]]]` — Filter by dubbing model generation. + +
+
+ +
+
+ +**target_language_codes:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter by target language code. + +
+
+ +
+
+ +**creation_sources:** `typing.Optional[typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]]]` — Filter by dubbing creation source. + +
+
+ +
+
+ +**filter_by_creator:** `typing.Optional[DubbingListRequestFilterByCreator]` — Filters who created the resources being listed, whether it was the user running the request or someone else that shared the resource with them. + +
+
+ +
+
+ +**order_by:** `typing.Optional[DubbingListRequestOrderBy]` — The field to use for ordering results from this query. + +
+
+ +
+
+ +**order_direction:** `typing.Optional[DubbingListRequestOrderDirection]` — The order direction to use for results from this query. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.create(...) -> DoDubbingResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Dubs a provided audio or video file into given language. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.create( + file="example_file", + csv_file="example_csv_file", + foreground_audio_file="example_foreground_audio_file", + background_audio_file="example_background_audio_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**file:** `typing.Optional[core.File]` — A list of file paths to audio recordings intended for voice cloning + +
+
+ +
+
+ +**csv_file:** `typing.Optional[core.File]` — CSV file containing transcription/translation metadata + +
+
+ +
+
+ +**foreground_audio_file:** `typing.Optional[core.File]` — For use only with csv input + +
+
+ +
+
+ +**background_audio_file:** `typing.Optional[core.File]` — For use only with csv input + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — Name of the dubbing project. + +
+
+ +
+
+ +**source_url:** `typing.Optional[str]` — URL of the source video/audio file. + +
+
+ +
+
+ +**source_lang:** `typing.Optional[str]` — Source language. Expects a valid iso639-1 or iso639-3 language code. + +
+
+ +
+
+ +**target_lang:** `typing.Optional[str]` — The Target language to dub the content into. Expects a valid iso639-1 or iso639-3 language code. + +
+
+ +
+
+ +**target_accent:** `typing.Optional[str]` — [Experimental] An accent to apply when selecting voices from the library and to use to inform translation of the dialect to prefer. + +
+
+ +
+
+ +**num_speakers:** `typing.Optional[int]` — Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers + +
+
+ +
+
+ +**watermark:** `typing.Optional[bool]` — Whether to apply watermark to the output video. + +
+
+ +
+
+ +**start_time:** `typing.Optional[int]` — Start time of the source video/audio file. + +
+
+ +
+
+ +**end_time:** `typing.Optional[int]` — End time of the source video/audio file. + +
+
+ +
+
+ +**highest_resolution:** `typing.Optional[bool]` — Whether to use the highest resolution available. + +
+
+ +
+
+ +**drop_background_audio:** `typing.Optional[bool]` — An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. + +
+
+ +
+
+ +**use_profanity_filter:** `typing.Optional[bool]` — [BETA] Whether transcripts should have profanities censored with the words '[censored]' + +
+
+ +
+
+ +**dubbing_studio:** `typing.Optional[bool]` — Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. + +
+
+ +
+
+ +**disable_voice_cloning:** `typing.Optional[bool]` — Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. Voices used from the library will contribute towards a workspace's custom voices limit, and if there aren't enough available slots the dub will fail. Using this feature requires the caller to have the 'add_voice_from_voice_library' permission on their workspace to access new voices. + +
+
+ +
+
+ +**mode:** `typing.Optional[DubRequestMode]` — The mode in which to run this Dubbing job. Defaults to automatic, use manual if specifically providing a CSV transcript to use. Note that manual mode is experimental and production use is strongly discouraged. + +
+
+ +
+
+ +**csv_fps:** `typing.Optional[float]` — Frames per second to use when parsing a CSV file for dubbing. If not provided, FPS will be inferred from timecodes. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.get(...) -> DubbingMetadataResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns metadata about a dubbing project, including whether it's still in progress or not +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.get( + dubbing_id="dubbing_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.delete(...) -> DeleteDubbingResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a dubbing project. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.delete( + dubbing_id="dubbing_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Models +
client.models.list() -> typing.List[Model] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets a list of available models. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.models.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## AudioNative +
client.audio_native.create(...) -> AudioNativeCreateProjectResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.audio_native.create( + file="example_file", + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — Project name. + +
+
+ +
+
+ +**image:** `typing.Optional[str]` — (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used. + +
+
+ +
+
+ +**author:** `typing.Optional[str]` — Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + +
+
+ +
+
+ +**small:** `typing.Optional[bool]` — (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used. + +
+
+ +
+
+ +**text_color:** `typing.Optional[str]` — Text color used in the player. If not provided, default text color set in the Player settings is used. + +
+
+ +
+
+ +**background_color:** `typing.Optional[str]` — Background color used in the player. If not provided, default background color set in the Player settings is used. + +
+
+ +
+
+ +**sessionization:** `typing.Optional[int]` — (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + +
+
+ +
+
+ +**voice_id:** `typing.Optional[str]` — Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + +
+
+ +
+
+ +**file:** `typing.Optional[core.File]` — Either txt or HTML input file containing the article content. HTML should be formatted as follows '<html><body><div><p>Your content</p><h3>More of your content</h3><p>Some more of your content</p></div></body></html>' + +
+
+ +
+
+ +**auto_convert:** `typing.Optional[bool]` — Whether to auto convert the project to audio or not. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[AudioNativeCreateRequestApplyTextNormalization]` + + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[str]]` — A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"Vmd4Zor6fplcA7WrINey\",\"version_id\":\"hRPaxjlTdR7wFMhV4w0b\"}"' --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"JzWtcGQMJ6bnlWwyMo7e\",\"version_id\":\"lbmwxiLu4q6txYxgdZqn\"}"'. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.audio_native.get_settings(...) -> GetAudioNativeProjectSettingsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get player settings for the specific project. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.audio_native.get_settings( + project_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the Studio project. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.audio_native.update(...) -> AudioNativeEditContentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates content for the specific AudioNative Project. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.audio_native.update( + project_id="21m00Tcm4TlvDq8ikWAM", + file="example_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**file:** `typing.Optional[core.File]` — Either txt or HTML input file containing the article content. HTML should be formatted as follows '<html><body><div><p>Your content</p><h5>More of your content</h5><p>Some more of your content</p></div></body></html>' + +
+
+ +
+
+ +**auto_convert:** `typing.Optional[bool]` — Whether to auto convert the project to audio or not. + +
+
+ +
+
+ +**auto_publish:** `typing.Optional[bool]` — Whether to auto publish the new project snapshot after it's converted. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.audio_native.update_content_from_url(...) -> AudioNativeEditContentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Finds an AudioNative project matching the provided URL, extracts content from the URL, updates the project content, and queues it for conversion and auto-publishing. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.audio_native.update_content_from_url( + url="https://elevenlabs.io/blog/the_first_ai_that_can_laugh/", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**url:** `str` — URL of the page to extract content from. + +
+
+ +
+
+ +**author:** `typing.Optional[str]` — Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Usage +
client.usage.get(...) -> UsageCharactersResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +(Deprecated) This endpoint is deprecated. Use /v1/workspace/analytics/query/usage-by-product-over-time instead, which exposes the bucket size as `interval_seconds` (an integer in seconds) rather than `aggregation_interval`. Returns the usage metrics for the current user or the entire workspace they are part of. The response provides a time axis based on the specified aggregation interval (default: day), with usage values for each interval along that axis. Usage is broken down by the selected breakdown type. For example, breakdown type "voice" will return the usage of each voice for each interval along the time axis. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.usage.get( + start_unix=1, + end_unix=1, + include_workspace_metrics=True, + breakdown_type="none", + aggregation_interval="hour", + aggregation_bucket_size=1, + metric="credits", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**start_unix:** `int` — UTC Unix timestamp for the start of the usage window, in milliseconds. To include the first day of the window, the timestamp should be at 00:00:00 of that day. + +
+
+ +
+
+ +**end_unix:** `int` — UTC Unix timestamp for the end of the usage window, in milliseconds. To include the last day of the window, the timestamp should be at 23:59:59 of that day. + +
+
+ +
+
+ +**include_workspace_metrics:** `typing.Optional[bool]` — Whether or not to include the statistics of the entire workspace. + +
+
+ +
+
+ +**breakdown_type:** `typing.Optional[BreakdownTypes]` — How to break down the information. Cannot be "user" if include_workspace_metrics is False. + +
+
+ +
+
+ +**aggregation_interval:** `typing.Optional[UsageAggregationInterval]` — How to aggregate usage data over time. Can be "hour", "day", "week", "month", or "cumulative". + +
+
+ +
+
+ +**aggregation_bucket_size:** `typing.Optional[int]` — Aggregation bucket size in seconds. Overrides the aggregation interval. + +
+
+ +
+
+ +**metric:** `typing.Optional[MetricType]` — Which metric to aggregate. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## PronunciationDictionaries +
client.pronunciation_dictionaries.create_from_file(...) -> AddPronunciationDictionaryResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new pronunciation dictionary from a lexicon .PLS file +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.create_from_file( + file="example_file", + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — The name of the pronunciation dictionary, used for identification only. + +
+
+ +
+
+ +**file:** `typing.Optional[core.File]` — A lexicon .pls file which we will use to initialize the project with. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — A description of the pronunciation dictionary, used for identification only. + +
+
+ +
+
+ +**workspace_access:** `typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess]` — Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.pronunciation_dictionaries.create_from_rules(...) -> AddPronunciationDictionaryResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new pronunciation dictionary from provided rules. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.create_from_rules( + rules=[ + { + "type": "alias", + "string_to_replace": "Thailand", + "case_sensitive": True, + "word_boundaries": True, + "alias": "tie-land" + } + ], + name="My Dictionary", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**rules:** `typing.List[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem]` + +List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + +
+
+ +
+
+ +**name:** `str` — The name of the pronunciation dictionary, used for identification only. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — A description of the pronunciation dictionary, used for identification only. + +
+
+ +
+
+ +**workspace_access:** `typing.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess]` — Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.pronunciation_dictionaries.get(...) -> GetPronunciationDictionaryWithRulesResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get metadata for a pronunciation dictionary +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.get( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pronunciation_dictionary_id:** `str` — The id of the pronunciation dictionary + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.pronunciation_dictionaries.update(...) -> GetPronunciationDictionaryMetadataResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Partially update the pronunciation dictionary without changing the version +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.update( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pronunciation_dictionary_id:** `str` — The id of the pronunciation dictionary + +
+
+ +
+
+ +**archived:** `typing.Optional[bool]` — Whether to archive the pronunciation dictionary. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — The name of the pronunciation dictionary, used for identification only. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.pronunciation_dictionaries.download(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a PLS file with a pronunciation dictionary version rules +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.download( + dictionary_id="dictionary_id", + version_id="version_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dictionary_id:** `str` — The id of the pronunciation dictionary + +
+
+ +
+
+ +**version_id:** `str` — The id of the pronunciation dictionary version + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.pronunciation_dictionaries.list(...) -> GetPronunciationDictionariesMetadataResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of the pronunciation dictionaries you have access to and their metadata +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.list( + cursor="cursor", + page_size=1, + sort="creation_time_unix", + sort_direction="sort_direction", + include_archived=False, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many pronunciation dictionaries to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**sort:** `typing.Optional[PronunciationDictionariesListRequestSort]` — Which field to sort by, one of 'created_at_unix' or 'name'. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[str]` — Which direction to sort the voices in. 'ascending' or 'descending'. + +
+
+ +
+
+ +**include_archived:** `typing.Optional[bool]` — Whether to include archived pronunciation dictionaries in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace +
client.workspace.set_third_party_disabling_policy(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Set the workspace-wide Third-Party Disabling policy. When set, it forces, for every API key in the workspace, whether the holder of a key (potentially a third party who found it) may disable it via the self-disable endpoint or when it leaks publicly — overriding each key's own setting. Pass `true` to allow it for all keys, `false` to forbid it for all keys, or `null` to clear the override so per-key values and the plan default apply again. Workspace admins only. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.set_third_party_disabling_policy() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**third_party_disable_allowed:** `typing.Optional[bool]` — `true` forces every key in the workspace to be disable-able by its holder; `false` forbids it for every key; `null` clears the override (per-key values and the plan default apply). + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ServiceAccounts +
client.service_accounts.list() -> WorkspaceServiceAccountListResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List all service accounts in the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.service_accounts.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.service_accounts.create(...) -> WorkspaceCreateServiceAccountResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new service account in the workspace. By default, a workspace can have up to 20 service accounts. Enterprise customers may request an increase to this limit, up to 100. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.service_accounts.create( + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` + +
+
+ +
+
+ +**default_sharing_groups:** `typing.Optional[typing.List[DefaultSharingGroupConfig]]` — List of groups with their permission levels to share with by default. Each entry should specify a group_id and a permission_level (admin, editor, or viewer). + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Webhooks +
client.webhooks.list(...) -> WorkspaceWebhookListResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List all webhooks for a workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.webhooks.list( + include_usages=False, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**include_usages:** `typing.Optional[bool]` — Whether to include active usages of the webhook, only usable by admins + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.create(...) -> WorkspaceCreateWebhookResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new webhook for the workspace with the specified authentication type. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, WebhookHmacSettings +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.webhooks.create( + settings=WebhookHmacSettings( + auth_type="hmac", + name="name", + webhook_url="webhook_url", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**settings:** `WebhookHmacSettings` — Webhook settings object containing auth_type and corresponding configuration + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.delete(...) -> DeleteWorkspaceWebhookResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete the specified workspace webhook +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.webhooks.delete( + webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**webhook_id:** `str` — The unique ID for the webhook + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.webhooks.update(...) -> PatchWorkspaceWebhookResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the specified workspace webhook +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.webhooks.update( + webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K", + is_disabled=True, + name="My Callback Webhook", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**webhook_id:** `str` — The unique ID for the webhook + +
+
+ +
+
+ +**is_disabled:** `bool` — Whether to disable or enable the webhook + +
+
+ +
+
+ +**name:** `str` — The display name of the webhook (used for display purposes only). + +
+
+ +
+
+ +**retry_enabled:** `typing.Optional[bool]` — Whether to enable automatic retries for transient failures (5xx, 429, timeout) + +
+
+ +
+
+ +**request_headers:** `typing.Optional[typing.Dict[str, typing.Optional[str]]]` — A list of request headers to include with the webhook delivery (optional) + +
+
+ +
+
+ +**events:** `typing.Optional[typing.List[WorkspaceWebhookEventType]]` — The complete set of workspace-level events this webhook should be subscribed to. The webhook is added to the events in the list and removed from any not in the list. Omit to leave the current event subscriptions unchanged. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Music +
client.music.video_to_music(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Generate background music from one or more video files. Videos are combined in order. Optional description and style tags influence the generated music. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +client.music.video_to_music(...) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**videos:** `typing.List[core.File]` + + + One or more video files sent via FormData array (multipart/form-data). They will be combined into one codec in order. + A maximum of 10 videos is allowed, where the total size of the combined video is limited to 200MB. + In total, the video can be up to 600 seconds long. Note that combining multiple videos may increase the request duration significantly. If possible, combine the videos beforehand. + + +
+
+ +
+
+ +**output_format:** `typing.Optional[AllowedOutputFormats]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — Optional text description of the music you want. A maximum of 4100 characters is allowed. + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.List[str]]` — Optional list of style tags (e.g. ['upbeat', 'cinematic']). A maximum of 10 tags is allowed. + +
+
+ +
+
+ +**model_id:** `typing.Optional[MusicModelId]` — The model to use for the generation. + +
+
+ +
+
+ +**add_sfx:** `typing.Optional[bool]` — When true, incorporate SFX cues from the video. + +
+
+ +
+
+ +**separate_tracks:** `typing.Optional[bool]` — When true, return a ZIP with separate music and SFX audio tracks instead of a single mixed file. Use this for more flexibility to layer the tracks. + +
+
+ +
+
+ +**use_audio_as_reference:** `typing.Optional[bool]` — When true, analyze the video's audio track and use its genres, BPM, instrumentation, mood, and arc as reference characteristics for music generation. + +
+
+ +
+
+ +**sign_with_c_2_pa:** `typing.Optional[bool]` — Whether to sign the generated song with C2PA. Applicable only for mp3 files. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.compose(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Compose a song from a prompt or a composition plan. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.compose() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**output_format:** `typing.Optional[MusicComposeRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**prompt:** `typing.Optional[str]` — A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + +
+
+ +
+
+ +**composition_plan:** `typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan]` — A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + +
+
+ +
+
+ +**music_length_ms:** `typing.Optional[int]` — The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + +
+
+ +
+
+ +**model_id:** `typing.Optional[MusicModelId]` — The model to use for the generation. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + +
+
+ +
+
+ +**force_instrumental:** `typing.Optional[bool]` — If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + +
+
+ +
+
+ +**finetune_id:** `typing.Optional[str]` — The ID of the finetune to use for the generation + +
+
+ +
+
+ +**respect_sections_durations:** `typing.Optional[bool]` — Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + +
+
+ +
+
+ +**store_for_inpainting:** `typing.Optional[bool]` — Whether to store the generated song for inpainting. + +
+
+ +
+
+ +**sign_with_c_2_pa:** `typing.Optional[bool]` — Whether to sign the generated song with C2PA. Applicable only for mp3 files. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.compose_detailed(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Compose a song from a prompt or a composition plan. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.compose_detailed() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**output_format:** `typing.Optional[MusicComposeDetailedRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**prompt:** `typing.Optional[str]` — A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + +
+
+ +
+
+ +**composition_plan:** `typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan]` — A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + +
+
+ +
+
+ +**music_length_ms:** `typing.Optional[int]` — The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + +
+
+ +
+
+ +**model_id:** `typing.Optional[MusicModelId]` — The model to use for the generation. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + +
+
+ +
+
+ +**force_instrumental:** `typing.Optional[bool]` — If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + +
+
+ +
+
+ +**finetune_id:** `typing.Optional[str]` — The ID of the finetune to use for the generation + +
+
+ +
+
+ +**respect_sections_durations:** `typing.Optional[bool]` — Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + +
+
+ +
+
+ +**store_for_inpainting:** `typing.Optional[bool]` — Whether to store the generated song for inpainting. + +
+
+ +
+
+ +**with_timestamps:** `typing.Optional[bool]` — Whether to return the timestamps of the words in the generated song. + +
+
+ +
+
+ +**with_waveform_visual:** `typing.Optional[bool]` — Whether to return the visual waveform of the generated song. + +
+
+ +
+
+ +**sign_with_c_2_pa:** `typing.Optional[bool]` — Whether to sign the generated song with C2PA. Applicable only for mp3 files. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.compose_detailed_stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Stream a song and its detailed metadata using Server-Sent Events (SSE). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.compose_detailed_stream( + output_format="auto", + enable_logging=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**output_format:** `typing.Optional[MusicComposeDetailedStreamRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**prompt:** `typing.Optional[str]` — A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + +
+
+ +
+
+ +**composition_plan:** `typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan]` — A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + +
+
+ +
+
+ +**music_length_ms:** `typing.Optional[int]` — The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + +
+
+ +
+
+ +**model_id:** `typing.Optional[MusicModelId]` — The model to use for the generation. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + +
+
+ +
+
+ +**force_instrumental:** `typing.Optional[bool]` — If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + +
+
+ +
+
+ +**finetune_id:** `typing.Optional[str]` — The ID of the finetune to use for the generation + +
+
+ +
+
+ +**store_for_inpainting:** `typing.Optional[bool]` — Whether to store the generated song for inpainting. + +
+
+ +
+
+ +**with_timestamps:** `typing.Optional[bool]` — Whether to return the timestamps of the words in the generated song. + +
+
+ +
+
+ +**with_waveform_visual:** `typing.Optional[bool]` — Whether to return the visual waveform of the generated song. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Stream a composed song from a prompt or a composition plan. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.stream() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**output_format:** `typing.Optional[MusicStreamRequestOutputFormat]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**prompt:** `typing.Optional[str]` — A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + +
+
+ +
+
+ +**composition_plan:** `typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan]` — A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + +
+
+ +
+
+ +**music_length_ms:** `typing.Optional[int]` — The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + +
+
+ +
+
+ +**model_id:** `typing.Optional[MusicModelId]` — The model to use for the generation. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + +
+
+ +
+
+ +**force_instrumental:** `typing.Optional[bool]` — If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + +
+
+ +
+
+ +**finetune_id:** `typing.Optional[str]` — The ID of the finetune to use for the generation + +
+
+ +
+
+ +**store_for_inpainting:** `typing.Optional[bool]` — Whether to store the generated song for inpainting. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.upload(...) -> MusicUploadResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Upload a music file to be later used for inpainting. Price for uploading is the same as the one for song generation. All uploaded content gets inspected for copyright infringement. If copyrighted content is detected, half of the request cost is still charged. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.upload( + file="example_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**file:** `core.File` — The audio file to upload. + +
+
+ +
+
+ +**extract_composition_plan:** `typing.Optional[MusicUploadRequestExtractCompositionPlan]` — Whether to generate and return the composition plan for the uploaded song. Pass a model id (`music_v1`, `music_v2` or `music_v2_5`) to control which composition plan format is returned. Passing `true`/`false` is deprecated; `true` defaults to the `music_v1` plan format. Enabling this will increase the latency. + +
+
+ +
+
+ +**with_timestamps:** `typing.Optional[bool]` — Whether to transcribe the uploaded song and return word-level timestamps. If True, the response will include words_timestamps but will increase the latency. + +
+
+ +
+
+ +**with_waveform_visual:** `typing.Optional[bool]` — Whether to return the visual waveform of the uploaded song. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.separate_stems(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Separate an audio file into individual stems. This endpoint might have high latency, depending on the length of the audio file. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +client.music.separate_stems(...) +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**file:** `core.File` — The audio file to separate into stems. + +
+
+ +
+
+ +**output_format:** `typing.Optional[AllowedOutputFormats]` — Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**stem_variation_id:** `typing.Optional[MusicSeparateStemsRequestStemVariationId]` — The id of the stem variation to use. + +
+
+ +
+
+ +**sign_with_c_2_pa:** `typing.Optional[bool]` — Whether to sign the generated song with C2PA. Applicable only for mp3 files. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## SpeechToText +
client.speech_to_text.convert(...) -> SpeechToTextConvertResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Transcribe an audio or video file. If webhook is set to true, the request will be processed asynchronously and results sent to configured webhooks. When use_multi_channel is true and the provided audio has multiple channels, a 'transcripts' object with separate transcripts for each channel is returned; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Otherwise, returns a single transcript. The optional webhook_metadata parameter allows you to attach custom data that will be included in webhook responses for request correlation and tracking. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_to_text.convert( + token="token", + enable_logging=True, + file="example_file", + model_id="scribe_v2", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**model_id:** `str` — The ID of the model to use for transcription. + +
+
+ +
+
+ +**token:** `typing.Optional[str]` — A single-use authentication token created via POST /v1/single-use-token/batch_scribe. This token can only be used once and expires after 15 minutes. Alternative to API key or bearer token authentication for frontend clients. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. This will mean log and transcript storage features are unavailable for this request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**file:** `typing.Optional[core.File]` — The file to transcribe (100ms minimum audio length). All major audio and video formats are supported. Exactly one of the file or cloud_storage_url parameters must be provided. The file size must be less than 5.0GB. + +
+
+ +
+
+ +**language_code:** `typing.Optional[str]` — An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. Can sometimes improve transcription performance if known beforehand. Defaults to null, in this case the language is predicted automatically. + +
+
+ +
+
+ +**transcript_edit:** `typing.Optional[str]` — Natural-language instruction applied to the final transcript (max 2000 characters). The edited text is returned in 'edited_transcript' alongside the original transcript. Cannot be combined with entity_detection, entity_redaction or use_multi_channel. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost, billed for at least 10 seconds of audio. + +
+
+ +
+
+ +**tag_audio_events:** `typing.Optional[bool]` — Whether to tag audio events like (laughter), (footsteps), etc. in the transcription. + +
+
+ +
+
+ +**num_speakers:** `typing.Optional[int]` — The maximum amount of speakers talking in the uploaded file. Can help with predicting who speaks when. The maximum amount of speakers that can be predicted is 32. Defaults to null, in this case the amount of speakers is set to the maximum value the model supports. + +
+
+ +
+
+ +**timestamps_granularity:** `typing.Optional[SpeechToTextConvertRequestTimestampsGranularity]` — The granularity of the timestamps in the transcription. 'word' provides word-level timestamps and 'character' provides character-level timestamps per word. + +
+
+ +
+
+ +**diarize:** `typing.Optional[bool]` — Whether to annotate which speaker is currently talking in the uploaded file. + +
+
+ +
+
+ +**diarization_threshold:** `typing.Optional[float]` — Diarization threshold to apply during speaker diarization. A higher value means there will be a lower chance of one speaker being diarized as two different speakers but also a higher chance of two different speakers being diarized as one speaker (less total speakers predicted). A low value means there will be a higher chance of one speaker being diarized as two different speakers but also a lower chance of two different speakers being diarized as one speaker (more total speakers predicted). Can only be set when diarize=True and num_speakers=None. Defaults to None, in which case we will choose a threshold based on the model_id (0.22 usually). + +
+
+ +
+
+ +**additional_formats:** `typing.Optional[AdditionalFormats]` — A list of additional formats to export the transcript to. + +
+
+ +
+
+ +**file_format:** `typing.Optional[SpeechToTextConvertRequestFileFormat]` — The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + +
+
+ +
+
+ +**cloud_storage_url:** `typing.Optional[str]` — [Deprecated] This parameter is deprecated and will be removed in the future. Use 'source_url' instead.The HTTPS URL of the file to transcribe. Exactly one of the file or cloud_storage_url parameters must be provided. The file must be accessible via HTTPS and the file size must be less than 2GB. Any valid HTTPS URL is accepted, including URLs from cloud storage providers (AWS S3, Google Cloud Storage, Cloudflare R2, etc.), CDNs, or any other HTTPS source. URLs can be pre-signed or include authentication tokens in query parameters. + +
+
+ +
+
+ +**source_url:** `typing.Optional[str]` — The URL of an audio or video file to transcribe. Supports hosted video or audio files, YouTube video URLs, TikTok video URLs, and other video hosting services. + +
+
+ +
+
+ +**webhook:** `typing.Optional[bool]` — Whether to send the transcription result to configured speech-to-text webhooks. If set the request will return early without the transcription, which will be delivered later via webhook. + +
+
+ +
+
+ +**webhook_id:** `typing.Optional[str]` — Optional specific webhook ID to send the transcription result to. Only valid when webhook is set to true. If not provided, transcription will be sent to all configured speech-to-text webhooks. + +
+
+ +
+
+ +**temperature:** `typing.Optional[float]` — Controls the randomness of the transcription output. Accepts values between 0.0 and 2.0, where higher values result in more diverse and less deterministic results. If omitted, we will use a temperature based on the model you selected which is usually 0. + +
+
+ +
+
+ +**seed:** `typing.Optional[int]` — If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be an integer between 0 and 2147483647. + +
+
+ +
+
+ +**use_multi_channel:** `typing.Optional[bool]` — Whether the audio file contains multiple channels where each channel contains a single speaker. When enabled, each channel is transcribed independently. By default a separate transcript is returned per channel; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Each word in the response includes a 'channel_index' field indicating which channel it was spoken on. A maximum of 5 channels is supported. Each channel is billed independently at the full audio duration, so cost scales linearly with the number of channels. + +
+
+ +
+
+ +**multichannel_output_style:** `typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle]` — Controls the response shape when use_multi_channel is enabled. 'separate' (default) returns one transcript per channel under 'transcripts'. 'combined' merges all channels into a single transcript whose words are sorted by start time, each carrying a 'channel_index' - matching the single-channel response shape. 'combined' requires timestamps (timestamps_granularity must not be 'none') and does not support entity detection or redaction. + +
+
+ +
+
+ +**webhook_metadata:** `typing.Optional[SpeechToTextConvertRequestWebhookMetadata]` — Optional metadata to be included in the webhook response. This should be a JSON string representing an object with a maximum depth of 2 levels and maximum size of 16KB. Useful for tracking internal IDs, job references, or other contextual information. + +
+
+ +
+
+ +**entity_detection:** `typing.Optional[SpeechToTextConvertRequestEntityDetection]` — Detect entities in the transcript. Can be 'all' to detect all entities, a single entity type or category string, or a list of entity types/categories. Categories include 'pii', 'phi', 'pci', 'other', 'offensive_language'. When enabled, detected entities will be returned in the 'entities' field with their text, type, and character positions. + +
+
+ +
+
+ +**no_verbatim:** `typing.Optional[bool]` — If true, the transcription will not have any filler words, false starts and non-speech sounds. Only supported with scribe_v2 model. + +
+
+ +
+
+ +**use_speaker_library:** `typing.Optional[bool]` — Whether to use the speaker library for identifying known speakers during diarization. When enabled and diarize is true, detected speakers will be matched against registered speakers in the workspace's speaker library. + +
+
+ +
+
+ +**detect_speaker_roles:** `typing.Optional[bool]` — Whether to detect speaker roles (agent vs customer). Requires diarize=true. Cannot be used with use_multi_channel=true. When enabled, speaker_id values will be 'agent' and 'customer' instead of 'speaker_0', 'speaker_1', etc. Usage incurs an additional 10% surcharge on base transcription cost. + +
+
+ +
+
+ +**entity_redaction:** `typing.Optional[SpeechToTextConvertRequestEntityRedaction]` — Redact entities from the transcript text. Accepts the same format as entity_detection: 'all', a category ('pii', 'phi'), or specific entity types. Must be a subset of entity_detection. When redaction is enabled, the entities field will not be returned. + +
+
+ +
+
+ +**entity_redaction_mode:** `typing.Optional[str]` — How to format redacted entities. 'redacted' replaces with {REDACTED}, 'entity_type' replaces with {ENTITY_TYPE}, 'enumerated_entity_type' replaces with {ENTITY_TYPE_N} where N enumerates each occurrence. Only used when entity_redaction is set. + +
+
+ +
+
+ +**keyterms:** `typing.Optional[typing.List[str]]` — A list of keyterms to bias the transcription towards. The keyterms are words or phrases you want the model to recognise more accurately. The number of keyterms cannot exceed 1000. The length of each keyterm must be less than 50 characters. Keyterms can contain at most 5 words (after normalisation). For example ["hello", "world", "technical term"]. The following characters are not supported: `<`, `>`, `{`, `}`, `[`, `]`, `\`. Usage of this parameter will incur an additional 20% surcharge on the base transcription cost. When more than 100 keyterms are provided, a minimum billable duration of 20 seconds applies per request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ForcedAlignment +
client.forced_alignment.create(...) -> ForcedAlignmentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.forced_alignment.create( + file="example_file", + text="text", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**file:** `core.File` — The file to align. All major audio formats are supported. The file size must be less than 1GB. + +
+
+ +
+
+ +**text:** `str` — The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi +
client.conversational_ai.add_to_knowledge_base(...) -> AddKnowledgeBaseResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Upload a file or webpage URL to create a knowledge base document.
After creating the document, update the agent's knowledge base by calling [Update agent](/docs/api-reference/agents/update). +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.add_to_knowledge_base( + agent_id="agent_id", + file="example_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — A custom, human-readable name for the document. + +
+
+ +
+
+ +**url:** `typing.Optional[str]` — URL to a page of documentation that the agent will have access to in order to interact with users. + +
+
+ +
+
+ +**file:** `typing.Optional[core.File]` — Documentation that the agent will have access to in order to interact with users. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.rag_index_overview() -> RagIndexOverviewResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides total size and other information of RAG indexes used by knowledgebase documents +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.rag_index_overview() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.get_document_rag_indexes(...) -> RagDocumentIndexesResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Provides information about all RAG indexes of the specified knowledgebase document. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.get_document_rag_indexes( + documentation_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.delete_document_rag_index(...) -> RagDocumentIndexResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete RAG index for the knowledgebase document. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.delete_document_rag_index( + documentation_id="21m00Tcm4TlvDq8ikWAM", + rag_index_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**rag_index_id:** `str` — The id of RAG index of document from the knowledge base. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Speech Engine +
client.speech_engine.list(...) -> ListSpeechEnginesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a paginated list of Speech Engine resources. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_engine.list( + page_size=1, + search="search", + sort_direction="asc", + sort_by="name", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many Speech Engines to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Search term to filter Speech Engines by name + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[SortDirection]` — The direction to sort the results + +
+
+ +
+
+ +**sort_by:** `typing.Optional[AgentSortBy]` — The field to sort the results by + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.speech_engine.create(...) -> SpeechEngineResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new Speech Engine resource +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, SpeechEngineConfig +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_engine.create( + speech_engine=SpeechEngineConfig( + ws_url="ws_url", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**speech_engine:** `SpeechEngineConfig` — Speech engine WebSocket configuration + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — Name of the speech engine + +
+
+ +
+
+ +**asr:** `typing.Optional[AsrConversationalConfig]` — ASR configuration + +
+
+ +
+
+ +**tts:** `typing.Optional[TtsConversationalConfigInput]` — TTS configuration + +
+
+ +
+
+ +**turn:** `typing.Optional[BaseTurnConfig]` — Turn detection configuration + +
+
+ +
+
+ +**vad:** `typing.Optional[VadConfig]` — Configuration for voice activity detection + +
+
+ +
+
+ +**conversation:** `typing.Optional[ConversationConfigInput]` — Conversation configuration (client events, etc.) + +
+
+ +
+
+ +**privacy:** `typing.Optional[PrivacyConfigInput]` — Privacy settings (recording, retention, zero retention mode) + +
+
+ +
+
+ +**call_limits:** `typing.Optional[AgentCallLimits]` — Concurrency and daily conversation limits for this speech engine + +
+
+ +
+
+ +**language:** `typing.Optional[str]` — Language for the speech engine + +
+
+ +
+
+ +**cascade_timeout_seconds:** `typing.Optional[float]` — Time in seconds to wait for the upstream speech engine endpoint to respond before the attempt is abandoned and retried. Must be between 2 and 15 seconds. + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.List[str]]` — Tags for categorization + +
+
+ +
+
+ +**overrides:** `typing.Optional[SpeechEngineConversationInitiationClientDataConfig]` — Override settings the client may set during conversation initiation + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.speech_engine.get(...) -> SpeechEngineResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a Speech Engine resource +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_engine.get( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**speech_engine_id:** `str` — The speech engine ID (accepts seng_ or agent_ prefix) + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.speech_engine.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a Speech Engine resource +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_engine.delete( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**speech_engine_id:** `str` — The speech engine ID (accepts seng_ or agent_ prefix) + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.speech_engine.update(...) -> SpeechEngineResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a Speech Engine resource (partial update) +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_engine.update( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**speech_engine_id:** `str` — The speech engine ID (accepts seng_ or agent_ prefix) + +
+
+ +
+
+ +**name:** `typing.Optional[str]` + +
+
+ +
+
+ +**speech_engine:** `typing.Optional[SpeechEngineConfig]` + +
+
+ +
+
+ +**asr:** `typing.Optional[AsrConversationalConfig]` + +
+
+ +
+
+ +**tts:** `typing.Optional[TtsConversationalConfigInput]` + +
+
+ +
+
+ +**turn:** `typing.Optional[BaseTurnConfig]` + +
+
+ +
+
+ +**vad:** `typing.Optional[VadConfig]` + +
+
+ +
+
+ +**conversation:** `typing.Optional[ConversationConfigInput]` + +
+
+ +
+
+ +**privacy:** `typing.Optional[PrivacyConfigInput]` + +
+
+ +
+
+ +**call_limits:** `typing.Optional[AgentCallLimits]` + +
+
+ +
+
+ +**language:** `typing.Optional[str]` + +
+
+ +
+
+ +**cascade_timeout_seconds:** `typing.Optional[float]` — Time in seconds to wait for the upstream speech engine endpoint to respond before the attempt is abandoned and retried. Must be between 2 and 15 seconds. + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.List[str]]` + +
+
+ +
+
+ +**overrides:** `typing.Optional[SpeechEngineConversationInitiationClientDataConfig]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.speech_engine.duplicate(...) -> SpeechEngineResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new Speech Engine resource by duplicating an existing one +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DuplicateSpeechEngineRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_engine.duplicate( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", + request=DuplicateSpeechEngineRequest(), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**speech_engine_id:** `str` — The speech engine ID (accepts seng_ or agent_ prefix) + +
+
+ +
+
+ +**request:** `typing.Optional[DuplicateSpeechEngineRequest]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## EnvironmentVariables +
client.environment_variables.list(...) -> EnvironmentVariablesListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List all environment variables for the workspace with optional filtering +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.environment_variables.list( + cursor="cursor", + page_size=1, + label="label", + environment="environment", + type="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Pagination cursor from previous response + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of items to return (1-100) + +
+
+ +
+
+ +**label:** `typing.Optional[str]` — Filter by exact label match + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` — Filter to only return variables that have this environment. When specified, the values dict in the response will only contain this environment. + +
+
+ +
+
+ +**type:** `typing.Optional[EnvironmentVariablesListRequestType]` — Filter by variable type + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.environment_variables.create(...) -> EnvironmentVariableResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new environment variable for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.environment_variables.create( + request={ + "type": "string", + "label": "label", + "values": { + "key": "value" + } + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `EnvironmentVariablesCreateRequestBody` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.environment_variables.get(...) -> EnvironmentVariableResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a specific environment variable by ID +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.environment_variables.get( + env_var_id="env_var_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**env_var_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.environment_variables.update(...) -> EnvironmentVariableResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Replace an environment variable's values. Use null to remove its value for an environment (except production); delete an environment with DELETE /v1/convai/environments/{environment}. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.environment_variables.update( + env_var_id="env_var_id", + values={}, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**env_var_id:** `str` + +
+
+ +
+
+ +**values:** `typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]]` — Values to replace. Set to null to remove the value for an environment (except 'production'). + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Environments +
client.environments.list() -> EnvironmentsListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the workspace environments, including 'production'. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.environments.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.environments.create(...) -> EnvironmentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a workspace environment. Variables without a value for it fall back to their production value. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.environments.create( + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — Unique name of the environment, e.g. 'staging'. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.environments.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a workspace environment and remove its values from all environment variables. 'production' cannot be deleted. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.environments.delete( + environment="environment", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**environment:** `str` — Name of the environment to delete, e.g. 'staging'. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Assets +
client.assets.list(...) -> AssetListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List assets in the workspace, most recently created first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.assets.list( + page_size=1, + cursor="cursor", + search="search", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of assets to return. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Token from a previous response's `next_cursor`. Omit to fetch the first page. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Optional free-text search filter over asset names. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.assets.create(...) -> AssetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Upload a new asset. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.assets.create( + asset="example_asset", + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**asset:** `core.File` — The file to upload. + +
+
+ +
+
+ +**name:** `str` — Display name for the asset. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.assets.get(...) -> AssetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a single asset by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.assets.get( + asset_id="5xM2KqOnZyce22SPZ9d4", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**asset_id:** `str` — ID of the asset. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.assets.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete an asset by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.assets.delete( + asset_id="5xM2KqOnZyce22SPZ9d4", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**asset_id:** `str` — ID of the asset. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Conversations +
client.conversational_ai.conversations.get_signed_url(...) -> ConversationSignedUrlResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a signed url to start a conversation with an agent with an agent that requires authorization +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.get_signed_url( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + include_conversation_id=True, + branch_id="branch_id", + version_id="version_id", + environment="environment", + debug_events_request=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + +
+
+ +
+
+ +**include_conversation_id:** `typing.Optional[bool]` — Whether to include a conversation_id with the response. If included, the conversation_signature cannot be used again. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — The ID of the branch to use + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — The ID of the version to use + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` — The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + +
+
+ +
+
+ +**debug_events_request:** `typing.Optional[bool]` — Whether to enable debug events. Only available for users with editor access to the agent. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.get_webrtc_token(...) -> TokenResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a WebRTC session token for real-time communication. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.get_webrtc_token( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + participant_name="participant_name", + branch_id="branch_id", + version_id="version_id", + environment="environment", + debug_events_request=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + +
+
+ +
+
+ +**participant_name:** `typing.Optional[str]` — Optional custom participant name. If not provided, user ID will be used + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — The ID of the branch to use + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — The ID of the version to use + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` — The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + +
+
+ +
+
+ +**debug_events_request:** `typing.Optional[bool]` — Whether to enable debug events. Only available for users with editor access to the agent. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.list(...) -> GetConversationsPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all conversations of agents that user owns. With option to restrict to a specific agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.list( + cursor="cursor", + agent_id="agent_id", + visited_agent_ids=[ + "visited_agent_ids" + ], + visited_agent_branch_ids=[ + "visited_agent_branch_ids" + ], + triggered_procedure_ids=[ + "triggered_procedure_ids" + ], + call_successful="success", + call_start_before_unix=1, + call_start_after_unix=1, + call_duration_min_secs=1, + call_duration_max_secs=1, + rating_max=1, + rating_min=1, + has_feedback_comment=True, + user_id="user_id", + evaluation_params=[ + "evaluation_params" + ], + data_collection_params=[ + "data_collection_params" + ], + dynamic_variable_params=[ + "dynamic_variable_params" + ], + data_collection_ids=[ + "data_collection_ids" + ], + evaluation_criteria_ids=[ + "evaluation_criteria_ids" + ], + tool_names=[ + "tool_names" + ], + tool_names_successful=[ + "tool_names_successful" + ], + tool_names_errored=[ + "tool_names_errored" + ], + include_invalid_tool_calls=True, + main_languages=[ + "main_languages" + ], + page_size=1, + summary_mode="exclude", + search="search", + conversation_initiation_source="unknown", + text_only=True, + conversation_product_type="agents", + branch_id="branch_id", + version_id="version_id", + parent_conversation_id="parent_conversation_id", + topic_ids=[ + "topic_ids" + ], + exclude_statuses=[ + "initiated" + ], + tag_ids=[ + "tag_ids" + ], + workflow_node_entered_id="workflow_node_entered_id", + termination_reasons=[ + "termination_reasons" + ], + guardrail_types=[ + "custom" + ], + custom_guardrail_names=[ + "custom_guardrail_names" + ], + sort_direction="asc", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + +
+
+ +
+
+ +**visited_agent_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations where any of these agents participated. Can not exceed 50 values. + +
+
+ +
+
+ +**visited_agent_branch_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations where any of these agent branches participated. Can not exceed 50 values. + +
+
+ +
+
+ +**triggered_procedure_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + +
+
+ +
+
+ +**call_successful:** `typing.Optional[EvaluationResultFilter]` — The result of the success evaluation + +
+
+ +
+
+ +**call_start_before_unix:** `typing.Optional[int]` — Unix timestamp (in seconds) to filter conversations up to this start date. + +
+
+ +
+
+ +**call_start_after_unix:** `typing.Optional[int]` — Unix timestamp (in seconds) to filter conversations after to this start date. + +
+
+ +
+
+ +**call_duration_min_secs:** `typing.Optional[int]` — Minimum call duration in seconds. + +
+
+ +
+
+ +**call_duration_max_secs:** `typing.Optional[int]` — Maximum call duration in seconds. + +
+
+ +
+
+ +**rating_max:** `typing.Optional[int]` — Maximum overall rating (1-5). + +
+
+ +
+
+ +**rating_min:** `typing.Optional[int]` — Minimum overall rating (1-5). + +
+
+ +
+
+ +**has_feedback_comment:** `typing.Optional[bool]` — Filter conversations with user feedback comments. + +
+
+ +
+
+ +**user_id:** `typing.Optional[str]` — Filter conversations by the user ID who initiated them. + +
+
+ +
+
+ +**evaluation_params:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + +
+
+ +
+
+ +**data_collection_params:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + +
+
+ +
+
+ +**dynamic_variable_params:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + +
+
+ +
+
+ +**data_collection_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Data collection field IDs to include in each conversation summary. Repeat param. When omitted, data_collection_results is not returned. + +
+
+ +
+
+ +**evaluation_criteria_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Evaluation criteria IDs to include in each conversation summary. Repeat param. When omitted, evaluation_criteria_results is not returned. + +
+
+ +
+
+ +**tool_names:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by tool names used during the call. + +
+
+ +
+
+ +**tool_names_successful:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by tool names that had successful calls. + +
+
+ +
+
+ +**tool_names_errored:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by tool names that had errored calls. + +
+
+ +
+
+ +**include_invalid_tool_calls:** `typing.Optional[bool]` — Also match tool calls that never ran. + +
+
+ +
+
+ +**main_languages:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by detected main language (language code). + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many conversations to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**summary_mode:** `typing.Optional[ConversationsListRequestSummaryMode]` — Whether to include transcript summaries in the response. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Full-text or fuzzy search over transcript messages + +
+
+ +
+
+ +**conversation_initiation_source:** `typing.Optional[ConversationInitiationSource]` + +
+
+ +
+
+ +**text_only:** `typing.Optional[bool]` + +
+
+ +
+
+ +**conversation_product_type:** `typing.Optional[ConversationProduct]` — Restrict results to a single conversation product surface. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Filter conversations by branch ID. + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — Filter conversations by version ID. + +
+
+ +
+
+ +**parent_conversation_id:** `typing.Optional[str]` — Filter conversations by parent conversation ID for subagent conversations. + +
+
+ +
+
+ +**topic_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by topic IDs assigned during topic discovery. + +
+
+ +
+
+ +**exclude_statuses:** `typing.Optional[typing.Union[ConversationsListRequestExcludeStatusesItem, typing.Sequence[ConversationsListRequestExcludeStatusesItem]]]` — Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + +
+
+ +
+
+ +**tag_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by conversation tag IDs assigned via the conversation-tags endpoints. + +
+
+ +
+
+ +**workflow_node_entered_id:** `typing.Optional[str]` — Filter conversations to only those that entered the given node. + +
+
+ +
+
+ +**termination_reasons:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + +
+
+ +
+
+ +**guardrail_types:** `typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]]` — Filter to conversations where a guardrail of any of these types triggered (metadata.triggered_guardrails.guardrail_type). Repeat param to match any of several. + +
+
+ +
+
+ +**custom_guardrail_names:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter to conversations where a custom guardrail with any of these names triggered (metadata.triggered_guardrails.guardrail_name). Only custom guardrails carry a name. Repeat param to match any of several. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[SortDirection]` — The direction to sort conversations by call start time. Defaults to descending (newest first). + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.resolve(...) -> GetConversationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Resolve a conversation URL (a Slack message URL or a Zendesk ticket URL) to the deterministic conversation ID for the given agent, then confirm the conversation exists. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.resolve( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + reference="https://your-domain.zendesk.com/agent/tickets/12345", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + +
+
+ +
+
+ +**reference:** `str` — A Slack message URL or a Zendesk ticket URL. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.get(...) -> GetConversationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the details of a particular conversation +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.get( + conversation_id="21m00Tcm4TlvDq8ikWAM", + format="json", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — The id of the conversation you're taking the action on. + +
+
+ +
+
+ +**format:** `typing.Optional[ConversationsGetRequestFormat]` — Response format. Defaults to 'json'. Set to 'opentelemetry' for an OTLP-compatible trace payload using the same structure as the post-call webhook. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a particular conversation +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.delete( + conversation_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — The id of the conversation you're taking the action on. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.get_summary(...) -> GetConversationSummaryResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a lightweight summary of a conversation: its title, the generated transcript summary, whether the call was successful, and — only when the conversation is short — the plain chat messages. Tool calls, tool results, and contextual updates are omitted so the response stays small. Use this instead of the full conversation endpoint when you only need the gist (e.g. an agent reading many conversations); use GET /v1/convai/conversations/{conversation_id} when you need the full transcript with tool calls and contextual updates. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.get_summary( + conversation_id="21m00Tcm4TlvDq8ikWAM", + max_messages=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — The id of the conversation you're taking the action on. + +
+
+ +
+
+ +**max_messages:** `typing.Optional[int]` — Maximum number of chat message turns to include inline. When the conversation has more than this, the messages are omitted and messages_omitted is set. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.get_sip_messages(...) -> GetSipLogMessagesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get SIP messages associated with a conversation's phone call +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.get_sip_messages( + conversation_id="21m00Tcm4TlvDq8ikWAM", + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — The id of the conversation you're taking the action on. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Twilio +
client.conversational_ai.twilio.outbound_call(...) -> TwilioOutboundCallResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Handle an outbound call via Twilio +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.twilio.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**agent_phone_number_id:** `str` + +
+
+ +
+
+ +**to_number:** `str` + +
+
+ +
+
+ +**conversation_initiation_client_data:** `typing.Optional[ConversationInitiationClientDataRequestInput]` + +
+
+ +
+
+ +**call_recording_enabled:** `typing.Optional[bool]` — Whether let Twilio record the call. + +
+
+ +
+
+ +**telephony_call_config:** `typing.Optional[TelephonyCallConfigInput]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.twilio.register_call(...) -> str +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Register a Twilio call and return TwiML to connect the call +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.twilio.register_call( + agent_id="agent_id", + from_number="from_number", + to_number="to_number", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**from_number:** `str` + +
+
+ +
+
+ +**to_number:** `str` + +
+
+ +
+
+ +**direction:** `typing.Optional[TelephonyDirection]` + +
+
+ +
+
+ +**conversation_initiation_client_data:** `typing.Optional[ConversationInitiationClientDataRequestInput]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Exotel +
client.conversational_ai.exotel.outbound_call(...) -> ExotelOutboundCallResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Handle an outbound call via Exotel Connect API +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.exotel.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**agent_phone_number_id:** `str` + +
+
+ +
+
+ +**to_number:** `str` + +
+
+ +
+
+ +**conversation_initiation_client_data:** `typing.Optional[ConversationInitiationClientDataRequestInput]` + +
+
+ +
+
+ +**telephony_call_config:** `typing.Optional[TelephonyCallConfigInput]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Whatsapp +
client.conversational_ai.whatsapp.outbound_call(...) -> WhatsAppOutboundCallResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Make an outbound call via WhatsApp +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.whatsapp.outbound_call( + whatsapp_phone_number_id="whatsapp_phone_number_id", + whatsapp_user_id="whatsapp_user_id", + whatsapp_call_permission_request_template_name="whatsapp_call_permission_request_template_name", + whatsapp_call_permission_request_template_language_code="whatsapp_call_permission_request_template_language_code", + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**whatsapp_phone_number_id:** `str` + +
+
+ +
+
+ +**whatsapp_user_id:** `str` + +
+
+ +
+
+ +**whatsapp_call_permission_request_template_name:** `str` + +
+
+ +
+
+ +**whatsapp_call_permission_request_template_language_code:** `str` + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**conversation_initiation_client_data:** `typing.Optional[ConversationInitiationClientDataRequestInput]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.whatsapp.outbound_message(...) -> WhatsAppOutboundMessageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Send an outbound message via WhatsApp +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, WhatsAppTemplateTextParam +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.whatsapp.outbound_message( + whatsapp_phone_number_id="whatsapp_phone_number_id", + whatsapp_user_id="whatsapp_user_id", + template_name="template_name", + template_language_code="template_language_code", + template_params=[ + { + "type": "body", + "parameters": [ + WhatsAppTemplateTextParam( + text="text", + ) + ] + } + ], + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**whatsapp_phone_number_id:** `str` + +
+
+ +
+
+ +**whatsapp_user_id:** `str` + +
+
+ +
+
+ +**template_name:** `str` + +
+
+ +
+
+ +**template_language_code:** `str` + +
+
+ +
+
+ +**template_params:** `typing.List[BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem]` + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**conversation_initiation_client_data:** `typing.Optional[ConversationInitiationClientDataRequestInput]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents +
client.conversational_ai.agents.create(...) -> CreateAgentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create an agent from a config object +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, ConversationalConfig +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.create( + enable_versioning=True, + conversation_config=ConversationalConfig(), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_config:** `ConversationalConfig` — Conversation configuration for an agent + +
+
+ +
+
+ +**enable_versioning:** `typing.Optional[bool]` — Deprecated: all agents are versioned. This parameter is ignored. + +
+
+ +
+
+ +**platform_settings:** `typing.Optional[AgentPlatformSettingsRequestModel]` — Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + +
+
+ +
+
+ +**workflow:** `typing.Optional[AgentWorkflowRequestModel]` — Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — A name to make the agent easier to find + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.List[str]]` — Tags to help classify and filter the agent + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.get(...) -> GetAgentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve config for an agent +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + version_id="version_id", + branch_id="branch_id", + include_procedure_generated_workflow_elements=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — The ID of the agent version to use + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — The ID of the branch to use + +
+
+ +
+
+ +**include_procedure_generated_workflow_elements:** `typing.Optional[bool]` — Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete an agent +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + force=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**force:** `typing.Optional[bool]` — If set to true, the agent is deleted even if other agents use it as a subagent, and it is removed from those agents and their branches. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.update(...) -> GetAgentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Patches an Agent settings +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + enable_versioning_if_not_enabled=True, + branch_id="branch_id", + include_procedure_generated_workflow_elements=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**enable_versioning_if_not_enabled:** `typing.Optional[bool]` — Deprecated: all agents are versioned. This parameter is ignored. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — The ID of the branch to use + +
+
+ +
+
+ +**include_procedure_generated_workflow_elements:** `typing.Optional[bool]` — Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + +
+
+ +
+
+ +**conversation_config:** `typing.Optional[ConversationalConfig]` — Conversation configuration for an agent + +
+
+ +
+
+ +**platform_settings:** `typing.Optional[AgentPlatformSettingsRequestModel]` — Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + +
+
+ +
+
+ +**workflow:** `typing.Optional[AgentWorkflowRequestModel]` — Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — A name to make the agent easier to find + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.List[str]]` — Tags to help classify and filter the agent + +
+
+ +
+
+ +**version_description:** `typing.Optional[str]` — Description for this version when publishing changes (only applicable for versioned agents) + +
+
+ +
+
+ +**procedures:** `typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]]` — Procedure versions to publish, keyed by procedure_id. When provided, this map replaces the procedures from the current draft or branch tip. When omitted or null, unpublished procedure edits are used if present; otherwise, the branch tip's procedures are retained. Pass an empty object to remove all procedures. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.list(...) -> GetAgentsPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of your agents and their metadata. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.list( + page_size=1, + search="search", + archived=True, + show_only_owned_agents=True, + created_by_user_id="created_by_user_id", + tags=[ + "tags" + ], + sort_direction="asc", + sort_by="name", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many Agents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Search by agents name. + +
+
+ +
+
+ +**archived:** `typing.Optional[bool]` — Filter agents by archived status + +
+
+ +
+
+ +**show_only_owned_agents:** `typing.Optional[bool]` — If set to true, the endpoint will omit any agents that were shared with you by someone else and include only the ones you own. Deprecated: use created_by_user_id instead. + +
+
+ +
+
+ +**created_by_user_id:** `typing.Optional[str]` — Filter agents by creator user ID. When set, only agents created by this user are returned. Takes precedence over show_only_owned_agents. Use '@me' to refer to the authenticated user. + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter agents by tag. Repeat the parameter to match any of several tags. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[SortDirection]` — The direction to sort the results + +
+
+ +
+
+ +**sort_by:** `typing.Optional[AgentSortBy]` — The field to sort the results by + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.duplicate(...) -> CreateAgentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new agent by duplicating an existing one. The new agent gets a copy of every unarchived branch of the source agent, each with the same name and description and starting from the latest version on that branch. Version history, drafts, archived branches and traffic deployments are not copied, so the new agent routes all traffic to its main branch. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.duplicate( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — A name to make the agent easier to find + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.simulate_conversation(...) -> AgentSimulatedChatTestResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, ConversationSimulationSpecification, AgentConfig +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.simulate_conversation( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + simulation_specification=ConversationSimulationSpecification( + simulated_user_config=AgentConfig( + first_message="Hello, how can I help you today?", + language="en", + disable_first_message_interruptions=False, + ), + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**simulation_specification:** `ConversationSimulationSpecification` — A specification detailing how the conversation should be simulated + +
+
+ +
+
+ +**extra_evaluation_criteria:** `typing.Optional[typing.List[PromptEvaluationCriteria]]` — A list of evaluation criteria to test + +
+
+ +
+
+ +**new_turns_limit:** `typing.Optional[int]` — Maximum number of new turns to generate in the conversation simulation + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.simulate_conversation_stream(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user and stream back the response. Response is streamed back as partial lists of messages that should be concatenated and once the conversation has complete a single final message with the conversation analysis will be sent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, ConversationSimulationSpecification, AgentConfig +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.simulate_conversation_stream( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + simulation_specification=ConversationSimulationSpecification( + simulated_user_config=AgentConfig( + first_message="Hello, how can I help you today?", + language="en", + disable_first_message_interruptions=False, + ), + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**simulation_specification:** `ConversationSimulationSpecification` — A specification detailing how the conversation should be simulated + +
+
+ +
+
+ +**extra_evaluation_criteria:** `typing.Optional[typing.List[PromptEvaluationCriteria]]` — A list of evaluation criteria to test + +
+
+ +
+
+ +**new_turns_limit:** `typing.Optional[int]` — Maximum number of new turns to generate in the conversation simulation + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.run_tests(...) -> GetTestSuiteInvocationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Run selected tests on the agent with provided configuration. If the agent configuration is provided, it will be used to override default agent configuration. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, SingleTestRunRequestModel +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.run_tests( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + tests=[ + SingleTestRunRequestModel( + test_id="test_id", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**tests:** `typing.List[SingleTestRunRequestModel]` — List of tests to run on the agent + +
+
+ +
+
+ +**agent_config_override:** `typing.Optional[AdhocAgentConfigOverrideForTestRequestModel]` — Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + +
+
+ +
+
+ +**repeat_count:** `typing.Optional[int]` — Number of times to run each test. When greater than 1, results are grouped and summarized. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Tests +
client.conversational_ai.tests.create(...) -> CreateAgentTestResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new agent response test. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.create( + request={ + "type": "llm", + "name": "name" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `TestsCreateRequestBody` — Create Chat Response Test Request Information + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.move(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Moves multiple tests or folders from one folder to another. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.move( + entity_ids=[ + "entity_ids" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**entity_ids:** `typing.List[str]` — The IDs of tests or folders to move. + +
+
+ +
+
+ +**move_to:** `typing.Optional[str]` — The folder to move the entities to. If not set, the entities will be moved to the root folder. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.get(...) -> TestsGetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets an agent response test by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.get( + test_id="TeaqRRdTcIfIu2i7BYfT", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**test_id:** `str` — The id of a chat response test. This is returned on test creation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.update(...) -> TestsUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an agent response test by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.update( + test_id="TeaqRRdTcIfIu2i7BYfT", + request={ + "type": "llm", + "name": "name" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**test_id:** `str` — The id of a chat response test. This is returned on test creation. + +
+
+ +
+
+ +**request:** `TestsUpdateRequestBody` — Agent test to update + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an agent response test by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.delete( + test_id="TeaqRRdTcIfIu2i7BYfT", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**test_id:** `str` — The id of a chat response test. This is returned on test creation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.summaries(...) -> GetTestsSummariesByIdsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets agent response test summaries for the requested test IDs. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.summaries( + test_ids=[ + "test_id_1", + "test_id_2" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**test_ids:** `typing.List[str]` — List of test IDs to fetch. No duplicates allowed. Prefer at most 1000 IDs per request. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.list(...) -> GetTestsPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all agent response tests with pagination support and optional search filtering. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.list( + cursor="cursor", + page_size=1, + search="search", + parent_folder_id="parent_folder_id", + types=[ + "llm" + ], + include_folders=True, + sort_mode="default", + sharing_mode="all", + created_by_user_id="created_by_user_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many Tests to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Search query to filter tests and folders by name. + +
+
+ +
+
+ +**parent_folder_id:** `typing.Optional[str]` — Filter by parent folder ID. Use 'root' to get items in the root folder. + +
+
+ +
+
+ +**types:** `typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]]` — If present, the endpoint will return only tests/folders of the given types. + +
+
+ +
+
+ +**include_folders:** `typing.Optional[bool]` — Deprecated. Use the `types` query param and include `folder` instead. + +
+
+ +
+
+ +**sort_mode:** `typing.Optional[TestsListRequestSortMode]` — Sort mode for listing tests. Use 'folders_first' to place folders before tests. + +
+
+ +
+
+ +**sharing_mode:** `typing.Optional[TestSharingMode]` — Filter test visibility. Use `shared_with_me` to return only tests/folders shared with the current user that they did not create. + +
+
+ +
+
+ +**created_by_user_id:** `typing.Optional[str]` — Filter tests and folders by creator user ID. Use '@me' to refer to the authenticated user. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Users +
client.conversational_ai.users.list(...) -> GetConversationUsersPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get distinct users from conversations with pagination. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.users.list( + agent_id="agent_id", + branch_id="branch_id", + call_start_before_unix=1, + call_start_after_unix=1, + search="search", + page_size=1, + sort_by="last_contact_unix_secs", + sort_direction="asc", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Filter conversations by branch ID. + +
+
+ +
+
+ +**call_start_before_unix:** `typing.Optional[int]` — Unix timestamp (in seconds) to filter conversations up to this start date. + +
+
+ +
+
+ +**call_start_after_unix:** `typing.Optional[int]` — Unix timestamp (in seconds) to filter conversations after to this start date. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Search/filter by user ID (exact match). + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many users to return at maximum. Defaults to 30. + +
+
+ +
+
+ +**sort_by:** `typing.Optional[UsersSortBy]` — The field to sort the results by. Defaults to last_contact_unix_secs. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[SortDirection]` — The direction to sort the results + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi TriageTickets +
client.conversational_ai.triage_tickets.list(...) -> GetAgentConversationTicketsPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List an agent's conversation triage tickets, ordered by most recently created first unless sorted by priority. These are tickets about the agent's own performance on a conversation (for triage with Architect), not tickets an agent opens for end users. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.list( + agent_id="agent_id", + page_size=1, + conversation_id="conversation_id", + status="open", + sources=[ + "qa" + ], + priorities=[ + "low" + ], + sort_by="created_at", + owner_user_id="owner_user_id", + assignee_user_id="assignee_user_id", + issue_type="knowledge_gap", + label="label", + merged_into_ticket_id="merged_into_ticket_id", + search="search", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many agent conversation tickets to return. Can not exceed 100. + +
+
+ +
+
+ +**conversation_id:** `typing.Optional[str]` — Filter tickets by conversation id. + +
+
+ +
+
+ +**status:** `typing.Optional[AgentConversationTicketStatus]` — Filter tickets by status. + +
+
+ +
+
+ +**sources:** `typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]]` — Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + +
+
+ +
+
+ +**priorities:** `typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]]` — Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + +
+
+ +
+
+ +**sort_by:** `typing.Optional[AgentConversationTicketSortBy]` — Order by most recently created, or by priority (most urgent first, then most recently created). + +
+
+ +
+
+ +**owner_user_id:** `typing.Optional[str]` — Filter tickets by creator. Use 'agent' for agent-raised tickets. + +
+
+ +
+
+ +**assignee_user_id:** `typing.Optional[str]` — Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + +
+
+ +
+
+ +**issue_type:** `typing.Optional[AgentConversationTicketIssueType]` — Filter clusters by issue type. + +
+
+ +
+
+ +**label:** `typing.Optional[str]` — Filter tickets by an exact label. + +
+
+ +
+
+ +**merged_into_ticket_id:** `typing.Optional[str]` — Filter tickets merged into this ticket. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.create_manual(...) -> AgentConversationTicketResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Manually raise a follow-up ticket against an agent, not tied to any conversation (for example a task like 'add the KB about X'). Without a title, one is derived from the comment. Requires viewer access to the agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.create_manual( + agent_id="agent_id", + qa_comment="qa_comment", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**qa_comment:** `str` — What the ticket is about, e.g. a follow-up task for the agent. + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — One-line headline shown in the triage list. Defaults to one derived from qa_comment. + +
+
+ +
+
+ +**priority:** `typing.Optional[AgentConversationTicketPriority]` — How urgently the ticket needs attention. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.list_for_workspace(...) -> GetAgentConversationTicketsPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List conversation triage tickets across every agent in the workspace, ordered by most recently created first. Use this to build a workspace-wide view (for example, tickets assigned to the caller). Supports the same filters, sorting and search as the per-agent endpoint. Tickets for agents the caller cannot access are omitted. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.list_for_workspace( + page_size=1, + agent_id="agent_id", + status="open", + sources=[ + "qa" + ], + priorities=[ + "low" + ], + sort_by="created_at", + owner_user_id="owner_user_id", + assignee_user_id="assignee_user_id", + issue_type="knowledge_gap", + label="label", + merged_into_ticket_id="merged_into_ticket_id", + search="search", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many agent conversation tickets to return. Can not exceed 100. + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Only tickets for this agent. + +
+
+ +
+
+ +**status:** `typing.Optional[AgentConversationTicketStatus]` — Filter tickets by status. + +
+
+ +
+
+ +**sources:** `typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]]` — Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + +
+
+ +
+
+ +**priorities:** `typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]]` — Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + +
+
+ +
+
+ +**sort_by:** `typing.Optional[AgentConversationTicketSortBy]` — Order by most recently created, or by priority (most urgent first, then most recently created). + +
+
+ +
+
+ +**owner_user_id:** `typing.Optional[str]` — Filter tickets by creator. Use 'agent' for agent-raised tickets. + +
+
+ +
+
+ +**assignee_user_id:** `typing.Optional[str]` — Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + +
+
+ +
+
+ +**issue_type:** `typing.Optional[AgentConversationTicketIssueType]` — Filter clusters by issue type. + +
+
+ +
+
+ +**label:** `typing.Optional[str]` — Filter tickets by an exact label. + +
+
+ +
+
+ +**merged_into_ticket_id:** `typing.Optional[str]` — Filter tickets merged into this ticket. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.create(...) -> AgentConversationTicketResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Raise a ticket about an agent's performance on a conversation, for triage with Architect. Provide an overall comment and/or turn-level comments describing what went wrong. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.create( + conversation_id="conversation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — Conversation this ticket is about. + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — One-line headline shown in the triage list. Defaults to one derived from the comments, falling back to the conversation's summary title. Ignored when the comment is added to the conversation's open ticket. + +
+
+ +
+
+ +**qa_comment:** `typing.Optional[str]` — The issue this ticket is about, covering the whole conversation rather than a single turn. + +
+
+ +
+
+ +**turn_comments:** `typing.Optional[typing.List[TurnCommentRequestModel]]` — Optional turn-level comments on what went wrong. + +
+
+ +
+
+ +**priority:** `typing.Optional[AgentConversationTicketPriority]` — How urgently the ticket needs attention. If the conversation already has an open ticket, it is raised to this priority when lower. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.list_assignable_users(...) -> typing.List[AssignableUserResponseModel] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +All non-service-account workspace members, each flagged with whether they currently have at least viewer access to the agent. Members without access are included (not filtered out) so the UI can offer them as an assignee and prompt to grant access first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.list_assignable_users( + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.get(...) -> AgentConversationTicketResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get an agent conversation ticket by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.get( + agentqa_ticket_id="agentqa_ticket_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agentqa_ticket_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete an agent conversation ticket. Restricted to the ticket creator or a workspace admin. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.delete( + agentqa_ticket_id="agentqa_ticket_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agentqa_ticket_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.update(...) -> AgentConversationTicketResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a ticket's title, comment, status, priority, and/or assignee. Requires editor access to the ticket's agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.update( + agentqa_ticket_id="agentqa_ticket_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agentqa_ticket_id:** `str` + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — If provided, updates the ticket title. Omit to leave unchanged. + +
+
+ +
+
+ +**status:** `typing.Optional[AgentConversationTicketStatus]` — If provided, updates the ticket status. Omit to leave unchanged. + +
+
+ +
+
+ +**assignee_user_id:** `typing.Optional[str]` — If provided, updates who is responsible for resolving this ticket. Must be a workspace member with at least viewer access to the agent. Pass null to unassign. Omit to leave unchanged. + +
+
+ +
+
+ +**priority:** `typing.Optional[AgentConversationTicketPriority]` — If provided, updates how urgently the ticket needs attention. Pass null to clear it. Omit to leave unchanged. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.add_comment(...) -> AgentConversationTicketResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Append a comment discussing how to resolve the ticket. Requires viewer access to the ticket's agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.add_comment( + agentqa_ticket_id="agentqa_ticket_id", + comment="comment", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agentqa_ticket_id:** `str` + +
+
+ +
+
+ +**comment:** `str` — A comment discussing how to resolve the ticket. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.merge(...) -> AgentConversationTicketResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Merge other open tickets of the same agent into this pending, in-progress, or resolved one. Their conversations move onto this ticket, its priority is raised to the highest among them, and they are kept with status 'merged'. Requires viewer access to the ticket's agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.merge( + agentqa_ticket_id="agentqa_ticket_id", + source_ticket_ids=[ + "source_ticket_ids" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agentqa_ticket_id:** `str` + +
+
+ +
+
+ +**source_ticket_ids:** `typing.List[str]` — Open tickets of the same agent to fold into this one. They are kept with status 'merged', pointing at this ticket. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.triage_tickets.add_turn_comment(...) -> AgentConversationTicketResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Append a turn-level comment to a ticket. Requires viewer access to the ticket's agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.triage_tickets.add_turn_comment( + agentqa_ticket_id="agentqa_ticket_id", + turn_index=1, + comment="comment", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agentqa_ticket_id:** `str` + +
+
+ +
+
+ +**turn_index:** `int` — Zero-based index of the transcript turn this comment refers to. + +
+
+ +
+
+ +**comment:** `str` — What went wrong at this turn. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi PhoneNumbers +
client.conversational_ai.phone_numbers.list(...) -> typing.List[PhoneNumbersListResponseItem] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve all Phone Numbers +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.phone_numbers.list( + provider="twilio", + agent_id="agent_id", + branch_id="branch_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**provider:** `typing.Optional[TelephonyProvider]` — Filter by telephony provider + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Filter by assigned agent ID + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Filter by assigned branch ID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.phone_numbers.create(...) -> CreatePhoneNumberResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Import Phone Number from provider configuration (Twilio, Exotel, or SIP trunk) +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.phone_numbers.create( + request={ + "provider": "twilio", + "phone_number": "phone_number", + "label": "label", + "sid": "sid", + "token": "token" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `PhoneNumbersCreateRequestBody` — Create Phone Request Information + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.phone_numbers.get(...) -> PhoneNumbersGetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve Phone Number details by ID +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.phone_numbers.get( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number_id:** `str` — The phone number ID. This is returned when a phone number is imported. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.phone_numbers.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete Phone Number by ID +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.phone_numbers.delete( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number_id:** `str` — The phone number ID. This is returned when a phone number is imported. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.phone_numbers.update(...) -> PhoneNumbersUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update assigned agent of a phone number +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.phone_numbers.update( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number_id:** `str` — The phone number ID. This is returned when a phone number is imported. + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**label:** `typing.Optional[str]` + +
+
+ +
+
+ +**inbound_trunk_config:** `typing.Optional[InboundSipTrunkConfigRequestModel]` + +
+
+ +
+
+ +**outbound_trunk_config:** `typing.Optional[OutboundSipTrunkConfigRequestModel]` + +
+
+ +
+
+ +**livekit_stack:** `typing.Optional[LivekitStackType]` + +
+
+ +
+
+ +**store_sip_messages:** `typing.Optional[bool]` + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` — Environment to use for resolving environment variables on calls to this number. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Agent branch to use for calls to this number. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.phone_numbers.list_v_2(...) -> GetPhoneNumbersPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a page of Phone Numbers +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.phone_numbers.list_v_2( + page_size=1, + search="search", + label="label", + phone_number="phone_number", + provider="twilio", + supports_outbound=True, + agent_id="agent_id", + branch_id="branch_id", + sort_by="label", + sort_direction="asc", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of phone numbers per page + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Filter by phone number ID, label, or phone number. A phone number ID must match exactly; label and phone number matching is a case-insensitive substring. + +
+
+ +
+
+ +**label:** `typing.Optional[str]` — Filter by label. Matching is a case-insensitive substring. + +
+
+ +
+
+ +**phone_number:** `typing.Optional[str]` — Filter by phone number + +
+
+ +
+
+ +**provider:** `typing.Optional[TelephonyProvider]` — Filter by telephony provider + +
+
+ +
+
+ +**supports_outbound:** `typing.Optional[bool]` — Filter by whether the phone number can place outbound calls + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Filter by assigned agent ID + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Filter by assigned branch ID + +
+
+ +
+
+ +**sort_by:** `typing.Optional[PhoneNumberSortBy]` — The field to sort the results by + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[SortDirection]` — The direction to sort the results + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.phone_numbers.get_sip_messages(...) -> GetSipLogMessagesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get SIP messages for a phone number +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.phone_numbers.get_sip_messages( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number_id:** `str` — The phone number ID. This is returned when a phone number is imported. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi LlmUsage +
client.conversational_ai.llm_usage.calculate(...) -> LlmUsageCalculatorResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of LLM models and the expected cost for using them based on the provided values. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.llm_usage.calculate( + prompt_length=1, + number_of_pages=1, + rag_enabled=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**prompt_length:** `int` — Length of the prompt in characters. + +
+
+ +
+
+ +**number_of_pages:** `int` — Pages of content in PDF documents or URLs in the agent's knowledge base. + +
+
+ +
+
+ +**rag_enabled:** `bool` — Whether RAG is enabled. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Llm +
client.conversational_ai.llm.list() -> LlmListResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of available LLM models that can be used with agents, including their capabilities and any deprecation status. The response is filtered based on the data residency of the deployment and any compliance requirements (e.g. HIPAA) of the workspace subscription. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.llm.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi KnowledgeBase +
client.conversational_ai.knowledge_base.list(...) -> GetKnowledgeBaseListResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of available knowledge base documents +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.list( + page_size=1, + search="search", + show_only_owned_documents=True, + created_by_user_id="created_by_user_id", + types=[ + "file" + ], + parent_folder_id="parent_folder_id", + ancestor_folder_id="ancestor_folder_id", + folders_first=True, + sort_direction="asc", + sort_by="name", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — If specified, the endpoint returns only such knowledge base documents whose names start with this string. + +
+
+ +
+
+ +**show_only_owned_documents:** `typing.Optional[bool]` — If set to true, the endpoint will return only documents owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + +
+
+ +
+
+ +**created_by_user_id:** `typing.Optional[str]` — Filter documents by creator user ID. When set, only documents created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + +
+
+ +
+
+ +**types:** `typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]]` — If present, the endpoint will return only documents of the given types. + +
+
+ +
+
+ +**parent_folder_id:** `typing.Optional[str]` — If set, the endpoint will return only documents that are direct children of the given folder. + +
+
+ +
+
+ +**ancestor_folder_id:** `typing.Optional[str]` — If set, the endpoint will return only documents that are descendants of the given folder. + +
+
+ +
+
+ +**folders_first:** `typing.Optional[bool]` — Whether folders should be returned first in the list of documents. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[SortDirection]` — The direction to sort the results + +
+
+ +
+
+ +**sort_by:** `typing.Optional[KnowledgeBaseSortBy]` — The field to sort the results by + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.get_or_create_rag_indexes(...) -> typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves and/or creates RAG indexes for multiple knowledge base documents in a single request. Maximum 100 items per request. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, GetOrCreateRagIndexRequestModel +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.get_or_create_rag_indexes( + items=[ + GetOrCreateRagIndexRequestModel( + document_id="document_id", + create_if_missing=True, + model="e5_mistral_7b_instruct", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**items:** `typing.List[GetOrCreateRagIndexRequestModel]` — List of requested RAG indexes. Minimum 1, maximum 100 items. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.search(...) -> KnowledgeBaseContentSearchResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fuzzy text search over knowledge base document content +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.search( + query="query", + page_size=1, + types=[ + "file" + ], + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `str` — The search query text + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**types:** `typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]]` — If present, the endpoint will return only documents of the given types. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Tools +
client.conversational_ai.tools.list(...) -> ToolsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all available tools in the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tools.list( + search="search", + page_size=1, + show_only_owned_documents=True, + created_by_user_id="created_by_user_id", + types=[ + "webhook" + ], + sort_direction="asc", + sort_by="name", + used_by_agent_id="used_by_agent_id", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — If specified, the endpoint returns only tools whose names start with this string. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**show_only_owned_documents:** `typing.Optional[bool]` — If set to true, the endpoint will return only tools owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + +
+
+ +
+
+ +**created_by_user_id:** `typing.Optional[str]` — Filter tools by creator user ID. When set, only tools created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + +
+
+ +
+
+ +**types:** `typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]]` — If present, the endpoint will return only tools of the given types. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[SortDirection]` — The direction to sort the results + +
+
+ +
+
+ +**sort_by:** `typing.Optional[ToolSortBy]` — The field to sort the results by + +
+
+ +
+
+ +**used_by_agent_id:** `typing.Optional[str]` — Filter to tools referenced by this agent's main branch: tools attached to the agent, tools on authored workflow nodes, and tools referenced by procedures. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tools.create(...) -> ToolResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a new tool to the available tools in the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, ToolRequestModel +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tools.create( + request=ToolRequestModel( + tool_config={ + "type": "client", + "name": "name", + "description": "description", + "expects_response": False + }, + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ToolRequestModel` — A tool that an agent can provide to LLM. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tools.get(...) -> ToolResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get tool that is available in the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tools.get( + tool_id="tool_id", + environment="environment", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tool_id:** `str` — ID of the requested tool. + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` — Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tools.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete tool from the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tools.delete( + tool_id="tool_id", + force=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tool_id:** `str` — ID of the requested tool. + +
+
+ +
+
+ +**force:** `typing.Optional[bool]` — If set to true, the tool will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents and branches. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tools.update(...) -> ToolResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update tool that is available in the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, ToolRequestModel +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tools.update( + tool_id="tool_id", + request=ToolRequestModel( + tool_config={ + "type": "client", + "name": "name", + "description": "description", + "expects_response": False + }, + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tool_id:** `str` — ID of the requested tool. + +
+
+ +
+
+ +**request:** `ToolRequestModel` — A tool that an agent can provide to LLM. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tools.get_dependent_agents(...) -> GetToolDependentAgentsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of agents depending on this tool +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tools.get_dependent_agents( + tool_id="tool_id", + cursor="cursor", + page_size=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tool_id:** `str` — ID of the requested tool. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Settings +
client.conversational_ai.settings.get() -> GetConvAiSettingsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve Convai settings for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.settings.get() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.settings.update(...) -> GetConvAiSettingsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update Convai settings for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.settings.update() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_initiation_client_data_webhook:** `typing.Optional[ConversationInitiationClientDataWebhook]` + +
+
+ +
+
+ +**webhooks:** `typing.Optional[ConvAiWebhooks]` + +
+
+ +
+
+ +**can_use_mcp_servers:** `typing.Optional[bool]` — Whether the workspace can use MCP servers + +
+
+ +
+
+ +**rag_retention_period_days:** `typing.Optional[int]` + +
+
+ +
+
+ +**conversation_embedding_retention_days:** `typing.Optional[int]` — Days to retain conversation embeddings. None means use the system default (30 days). + +
+
+ +
+
+ +**default_livekit_stack:** `typing.Optional[LivekitStackType]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Secrets +
client.conversational_ai.secrets.list(...) -> GetWorkspaceSecretsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all workspace secrets for the user +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.secrets.list( + page_size=1, + dependency_limit=1, + search="search", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100. If not provided, returns all secrets. + +
+
+ +
+
+ +**dependency_limit:** `typing.Optional[int]` — Maximum number of dependent resources (tools, agents, phone numbers) to return per secret. Can not exceed 100. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — If specified, returns only secrets whose names start with this string. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.secrets.create(...) -> PostWorkspaceSecretResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new secret for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.secrets.create( + name="name", + value="value", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**type:** `typing.Literal` + +
+
+ +
+
+ +**name:** `str` + +
+
+ +
+
+ +**value:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.secrets.get(...) -> ConvAiWorkspaceStoredSecretConfig +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a workspace secret by ID +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.secrets.get( + secret_id="secret_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**secret_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.secrets.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a workspace secret if it's not in use +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.secrets.delete( + secret_id="secret_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**secret_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.secrets.update(...) -> PostWorkspaceSecretResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update an existing secret for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.secrets.update( + secret_id="secret_id", + name="name", + value="value", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**secret_id:** `str` + +
+
+ +
+
+ +**type:** `typing.Literal` + +
+
+ +
+
+ +**name:** `str` + +
+
+ +
+
+ +**value:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.secrets.get_dependencies(...) -> GetSecretDependenciesResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get paginated list of resources that depend on a specific secret, filtered by resource type. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.secrets.get_dependencies( + secret_id="secret_id", + resource_type="tools", + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**secret_id:** `str` + +
+
+ +
+
+ +**resource_type:** `SecretDependencyResourceType` + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many dependency items to return per page. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi BatchCalls +
client.conversational_ai.batch_calls.create(...) -> BatchCallResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Submit a batch call request to schedule calls for multiple recipients. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, OutboundCallRecipient +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.batch_calls.create( + call_name="call_name", + agent_id="agent_id", + recipients=[ + OutboundCallRecipient() + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**call_name:** `str` + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**recipients:** `typing.List[OutboundCallRecipient]` + +
+
+ +
+
+ +**scheduled_time_unix:** `typing.Optional[int]` + +
+
+ +
+
+ +**agent_phone_number_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**whatsapp_params:** `typing.Optional[BatchCallWhatsAppParams]` + +
+
+ +
+
+ +**timezone:** `typing.Optional[str]` + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` + +
+
+ +
+
+ +**telephony_call_config:** `typing.Optional[TelephonyCallConfigInput]` + +
+
+ +
+
+ +**target_concurrency_limit:** `typing.Optional[int]` — Maximum number of simultaneous calls for this batch. When set, dispatch is governed by this limit rather than workspace/agent capacity percentages. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.batch_calls.list(...) -> WorkspaceBatchCallsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all batch calls for the current workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.batch_calls.list( + limit=1, + last_doc="last_doc", + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` + +
+
+ +
+
+ +**last_doc:** `typing.Optional[str]` + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Filter batch calls to a single agent. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.batch_calls.get(...) -> BatchCallDetailedResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get detailed information about a batch call including all recipients. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.batch_calls.get( + batch_id="batch_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**batch_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.batch_calls.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Permanently delete a batch call and all recipient records. Conversations remain in history. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.batch_calls.delete( + batch_id="batch_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**batch_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.batch_calls.cancel(...) -> BatchCallResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancel a running batch call and set all recipients to cancelled status. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.batch_calls.cancel( + batch_id="batch_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**batch_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.batch_calls.retry(...) -> BatchCallResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retry a batch call, calling failed and no-response recipients again. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.batch_calls.retry( + batch_id="batch_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**batch_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.batch_calls.export(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Download all recipients and conversation results for a terminal batch call as CSV. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.batch_calls.export( + batch_id="batch_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**batch_id:** `str` + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Only export the first N recipients; used to preview the columns. Omit to export every recipient. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi SipTrunk +
client.conversational_ai.sip_trunk.outbound_call(...) -> SipTrunkOutboundCallResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Handle an outbound call via SIP trunk +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.sip_trunk.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**agent_phone_number_id:** `str` + +
+
+ +
+
+ +**to_number:** `str` + +
+
+ +
+
+ +**conversation_initiation_client_data:** `typing.Optional[ConversationInitiationClientDataRequestInput]` + +
+
+ +
+
+ +**telephony_call_config:** `typing.Optional[TelephonyCallConfigInput]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi McpServers +
client.conversational_ai.mcp_servers.list() -> McpServersResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve all MCP server configurations available in the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.mcp_servers.create(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new MCP server configuration in the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, McpServerConfigInput +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.create( + config=McpServerConfigInput( + url="url", + name="name", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**config:** `McpServerConfigInput` — Configuration details for the MCP Server. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.mcp_servers.get(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a specific MCP server configuration from the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.get( + mcp_server_id="mcp_server_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.mcp_servers.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a specific MCP server configuration from the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.delete( + mcp_server_id="mcp_server_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.mcp_servers.update(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the configuration settings for an MCP server. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.update( + mcp_server_id="mcp_server_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**approval_policy:** `typing.Optional[McpApprovalPolicy]` — The approval mode to set for the MCP server + +
+
+ +
+
+ +**force_pre_tool_speech:** `typing.Optional[bool]` — DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + +
+
+ +
+
+ +**pre_tool_speech:** `typing.Optional[PreToolSpeechMode]` — If set, overrides the server's pre_tool_speech setting for this tool. + +
+
+ +
+
+ +**disable_interruptions:** `typing.Optional[bool]` — DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + +
+
+ +
+
+ +**interruption_mode:** `typing.Optional[ToolInterruptionMode]` — If set, overrides the server's interruption_mode setting for this tool. + +
+
+ +
+
+ +**tool_call_sound:** `typing.Optional[ToolCallSoundType]` — Predefined tool call sound type to play during tool execution for all tools from this MCP server + +
+
+ +
+
+ +**tool_call_sound_behavior:** `typing.Optional[ToolCallSoundBehavior]` — Determines when the tool call sound should play for all tools from this MCP server + +
+
+ +
+
+ +**execution_mode:** `typing.Optional[ToolExecutionMode]` — If set, overrides the server's execution_mode setting for this tool + +
+
+ +
+
+ +**response_timeout_secs:** `typing.Optional[int]` — The maximum time in seconds to wait for each MCP tool call to complete. + +
+
+ +
+
+ +**request_headers:** `typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]]]` — The headers to include in requests to the MCP server + +
+
+ +
+
+ +**request_meta:** `typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]]]` — Entries sent in the MCP `_meta` field of tools/call requests. Values may be JSON scalars, or references to a workspace secret, dynamic variable, or environment variable resolved per call. + +
+
+ +
+
+ +**disable_compression:** `typing.Optional[bool]` — Whether to disable HTTP compression for this MCP server + +
+
+ +
+
+ +**secret_token:** `typing.Optional[ConvAiSecretLocator]` — Optional secret token for authentication with this MCP server + +
+
+ +
+
+ +**auth_connection:** `typing.Optional[McpServerConfigUpdateRequestModelAuthConnection]` — Optional auth connection to use for authentication with this MCP server + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi WhatsappAccounts +
client.conversational_ai.whatsapp_accounts.get(...) -> GetWhatsAppAccountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a WhatsApp account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.whatsapp_accounts.get( + phone_number_id="phone_number_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.whatsapp_accounts.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a WhatsApp account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.whatsapp_accounts.delete( + phone_number_id="phone_number_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.whatsapp_accounts.update(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a WhatsApp account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.whatsapp_accounts.update( + phone_number_id="phone_number_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**phone_number_id:** `str` + +
+
+ +
+
+ +**assigned_agent_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**enable_messaging:** `typing.Optional[bool]` + +
+
+ +
+
+ +**enable_audio_message_response:** `typing.Optional[bool]` + +
+
+ +
+
+ +**enable_typing_indicator:** `typing.Optional[bool]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.whatsapp_accounts.list(...) -> ListWhatsAppAccountsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List all WhatsApp accounts +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.whatsapp_accounts.list( + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Filter by assigned agent ID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Realtime +
client.conversational_ai.realtime.create_client_secret(...) -> ClientSecretResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create an ephemeral client secret for authenticating browser-based Realtime API sessions. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, CreateClientSecretRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.realtime.create_client_secret( + request=CreateClientSecretRequest(), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Optional[CreateClientSecretRequest]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Summaries +
client.conversational_ai.agents.summaries.get(...) -> typing.Dict[str, SummariesGetResponseValue] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns summaries for the specified agents. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.summaries.get( + agent_ids=[ + "agent_ids" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — List of agent IDs to fetch summaries for + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Widget +
client.conversational_ai.agents.widget.get(...) -> GetAgentEmbedResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the widget configuration for an agent +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.widget.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + conversation_signature="conversation_signature", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**conversation_signature:** `typing.Optional[str]` — An expiring token that enables a websocket conversation to start. These can be generated for an agent using the /v1/convai/conversation/get_signed_url endpoint + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Link +
client.conversational_ai.agents.link.get(...) -> GetAgentLinkResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the current link used to share the agent with others +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.link.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents HoldAudio +
client.conversational_ai.agents.hold_audio.create(...) -> PostAgentHoldAudioResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sets the custom hold audio played on loop to callers waiting in the agent's concurrency wait queue. Replaces any previously uploaded clip. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.hold_audio.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + hold_audio_file="example_hold_audio_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**hold_audio_file:** `core.File` — An MP3 or WAV file played on loop to callers waiting in the agent's concurrency wait queue. Maximum size 40 MB, maximum duration 180 seconds. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.hold_audio.delete(...) -> DeleteAgentHoldAudioResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes the agent's custom hold audio; queued callers hear the default hold tone again. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.hold_audio.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents KnowledgeBase +
client.conversational_ai.agents.knowledge_base.size(...) -> GetAgentKnowledgebaseSizeResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the number of pages in the agent's knowledge base. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.knowledge_base.size( + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents LlmUsage +
client.conversational_ai.agents.llm_usage.calculate(...) -> LlmUsageCalculatorResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Calculates expected number of LLM tokens needed for the specified agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.llm_usage.calculate( + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` + +
+
+ +
+
+ +**prompt_length:** `typing.Optional[int]` — Length of the prompt in characters. + +
+
+ +
+
+ +**number_of_pages:** `typing.Optional[int]` — Pages of content in pdf documents OR urls in agent's Knowledge Base. + +
+
+ +
+
+ +**rag_enabled:** `typing.Optional[bool]` — Whether RAG is enabled. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Branches +
client.conversational_ai.agents.branches.list(...) -> ListResponseAgentBranchSummary +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of branches an agent has +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.branches.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + include_archived=True, + limit=1, + include_commit_status=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**include_archived:** `typing.Optional[bool]` — Whether archived branches should be included + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — How many results at most should be returned + +
+
+ +
+
+ +**include_commit_status:** `typing.Optional[bool]` — Whether to compute how far each branch has diverged from main (commits_ahead/commits_behind). This walks the version DAG of every branch, so it is slow on agents with long histories and is off by default, leaving those fields null. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.branches.create(...) -> CreateAgentBranchResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new branch from a given version of any branch +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.branches.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + parent_version_id="parent_version_id", + name="name", + description="description", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**parent_version_id:** `str` — ID of the version to branch from + +
+
+ +
+
+ +**name:** `str` — Name of the branch. It is unique within the agent. + +
+
+ +
+
+ +**description:** `str` — Description for the branch + +
+
+ +
+
+ +**conversation_config:** `typing.Optional[typing.Dict[str, typing.Any]]` — Changes to apply to conversation config + +
+
+ +
+
+ +**platform_settings:** `typing.Optional[typing.Dict[str, typing.Any]]` — Changes to apply to platform settings + +
+
+ +
+
+ +**workflow:** `typing.Optional[AgentWorkflowRequestModel]` — Updated workflow definition + +
+
+ +
+
+ +**include_draft:** `typing.Optional[bool]` — When true, the new branch uses the caller's draft procedure set instead of the branch tip. Requires parent_version_id to be the branch tip. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.branches.get(...) -> AgentBranchResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get information about a single agent branch +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.branches.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**branch_id:** `str` — Unique identifier for the branch. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.branches.update(...) -> AgentBranchResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update agent branch properties such as name, description, archiving status, protection level, and auto-rebase onto main +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.branches.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**branch_id:** `str` — Unique identifier for the branch. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — New name for the branch. Must be unique within the agent. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — New description for the branch. Pass an empty string to clear it. + +
+
+ +
+
+ +**is_archived:** `typing.Optional[bool]` — Whether the branch should be archived + +
+
+ +
+
+ +**protection_status:** `typing.Optional[BranchProtectionStatus]` — The protection level for the branch + +
+
+ +
+
+ +**auto_rebase:** `typing.Optional[bool]` — When true, rebase this branch onto main automatically after each new main version. Cannot be enabled on the main branch. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.branches.preview_merge(...) -> MergePreviewResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the result of merging the source branch into the target branch without performing the merge. Useful for showing an accurate diff before confirming. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.branches.preview_merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + target_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + force=True, + include_procedure_generated_workflow_elements=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**source_branch_id:** `str` — Unique identifier for the source branch to merge from. + +
+
+ +
+
+ +**target_branch_id:** `str` — The ID of the target branch to merge into. + +
+
+ +
+
+ +**force:** `typing.Optional[bool]` — When true, source branch changes always win conflicts regardless of timestamps + +
+
+ +
+
+ +**include_procedure_generated_workflow_elements:** `typing.Optional[bool]` — Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.branches.merge(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Merge a branch into a target branch +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.branches.merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + target_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**source_branch_id:** `str` — Unique identifier for the source branch to merge from. + +
+
+ +
+
+ +**target_branch_id:** `str` — The ID of the target branch to merge into. + +
+
+ +
+
+ +**archive_source_branch:** `typing.Optional[bool]` — Whether to archive the source branch after merging + +
+
+ +
+
+ +**force:** `typing.Optional[bool]` — Force source branch changes onto the target, overriding timestamp-based conflict resolution + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.branches.preview_rebase(...) -> MergePreviewResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the result of pulling changes from a source branch (defaults to main) into the given branch without performing it, preserving the given branch's own changes. Useful for showing an accurate diff before confirming. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.branches.preview_rebase( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + source_branch_id="source_branch_id", + include_procedure_generated_workflow_elements=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**branch_id:** `str` — Unique identifier for the source branch to merge from. + +
+
+ +
+
+ +**source_branch_id:** `typing.Optional[str]` — The ID of the branch to pull changes from. Defaults to the agent's main branch. + +
+
+ +
+
+ +**include_procedure_generated_workflow_elements:** `typing.Optional[bool]` — Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.branches.rebase(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Pull changes from a source branch (defaults to main) into this branch as a new version, preserving this branch's own changes on conflicts. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.branches.rebase( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + source_branch_id="source_branch_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**branch_id:** `str` — Unique identifier for the source branch to merge from. + +
+
+ +
+
+ +**source_branch_id:** `typing.Optional[str]` — The ID of the branch to pull changes from. Defaults to the agent's main branch. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Versions +
client.conversational_ai.agents.versions.get(...) -> AgentVersionMetadata +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get metadata for a specific agent version +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.versions.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + version_id="agtvrsn_0901k4aafjxxfxt93gd841r7tv5t", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**version_id:** `str` — Unique identifier for the version. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Deployments +
client.conversational_ai.agents.deployments.list(...) -> ListResponseAgentDeploymentHistoryItem +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the traffic split history of an agent, newest first +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.deployments.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + page=1, + page_size=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**page:** `typing.Optional[int]` — Page number, starting at 1 + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many results at most should be returned + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.deployments.create(...) -> AgentDeploymentResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new deployment for an agent +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, AgentDeploymentRequest, AgentDeploymentRequestItem, AgentDeploymentPercentageStrategy +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.deployments.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + deployment_request=AgentDeploymentRequest( + requests=[ + AgentDeploymentRequestItem( + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + deployment_strategy=AgentDeploymentPercentageStrategy( + type="percentage", + traffic_percentage=0.5, + ), + ) + ], + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**deployment_request:** `AgentDeploymentRequest` — Request to create a new deployment + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Drafts +
client.conversational_ai.agents.drafts.create(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new draft for an agent +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, AgentWorkflowRequestModel, WorkflowEdgeModelInput +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.drafts.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + conversation_config={ + "key": "value" + }, + platform_settings={ + "key": "value" + }, + workflow=AgentWorkflowRequestModel( + edges={ + "entry_to_tool_a": WorkflowEdgeModelInput( + source="entry_node", + target="tool_node_a", + forward_condition={ + "type": "expression", + "expression": { + "type": "and_operator", + "children": [] + } + }, + ), + "start_to_entry": WorkflowEdgeModelInput( + source="start_node", + target="entry_node", + forward_condition={ + "type": "expression", + "expression": { + "type": "and_operator", + "children": [] + } + }, + ), + "tool_a_to_failure": WorkflowEdgeModelInput( + source="tool_node_a", + target="failure_node", + forward_condition={ + "type": "expression", + "expression": { + "type": "and_operator", + "children": [] + } + }, + ), + "tool_a_to_tool_b": WorkflowEdgeModelInput( + source="tool_node_a", + target="tool_node_b", + forward_condition={ + "type": "expression", + "expression": { + "type": "and_operator", + "children": [] + } + }, + ), + "tool_b_to_agent_transfer": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_transfer", + forward_condition={ + "type": "expression", + "expression": { + "type": "and_operator", + "children": [] + } + }, + ), + "tool_b_to_conversation": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_conversation", + forward_condition={ + "type": "expression", + "expression": { + "type": "and_operator", + "children": [] + } + }, + ), + "tool_b_to_end": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_end", + forward_condition={ + "type": "expression", + "expression": { + "type": "and_operator", + "children": [] + } + }, + ), + "tool_b_to_phone": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_phone", + forward_condition={ + "type": "expression", + "expression": { + "type": "and_operator", + "children": [] + } + }, + ) + }, + nodes={ + "entry_node": { + "type": "end" + }, + "failure_node": { + "type": "end" + }, + "start_node": { + "type": "end" + }, + "success_conversation": { + "type": "end" + }, + "success_end": { + "type": "end" + }, + "success_phone": { + "type": "end" + }, + "success_transfer": { + "type": "end" + }, + "tool_node_a": { + "type": "end" + }, + "tool_node_b": { + "type": "end" + } + }, + ), + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**branch_id:** `str` — The ID of the agent branch to use + +
+
+ +
+
+ +**conversation_config:** `typing.Dict[str, typing.Any]` — Conversation config for the draft + +
+
+ +
+
+ +**platform_settings:** `typing.Dict[str, typing.Any]` — Platform settings for the draft + +
+
+ +
+
+ +**workflow:** `AgentWorkflowRequestModel` — Workflow for the draft + +
+
+ +
+
+ +**name:** `str` — Name for the draft + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.List[str]]` — Tags to help classify and filter the agent + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.drafts.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a draft for an agent +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.drafts.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**branch_id:** `str` — The ID of the agent branch to use + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents MergeProposals +
client.conversational_ai.agents.merge_proposals.list(...) -> PaginatedResultAgentMergeProposalResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the proposals for an agent, newest first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.merge_proposals.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + status="open", + source_branch_id="source_branch_id", + target_branch_id="target_branch_id", + search="search", + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**status:** `typing.Optional[MergeProposalStatus]` — Only return proposals with this status. + +
+
+ +
+
+ +**source_branch_id:** `typing.Optional[str]` — Only return proposals with this source branch. + +
+
+ +
+
+ +**target_branch_id:** `typing.Optional[str]` — Only return proposals with this target branch. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Case-insensitive substring match over title and description. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many results at most should be returned + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.merge_proposals.create(...) -> CreateAgentMergeProposalResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Record a request to merge a source branch into a target branch. Anyone with edit access can open one; merging it later is gated on write access to the target branch, so this is how a change reaches a protected branch the author cannot merge into themselves. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.merge_proposals.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="source_branch_id", + target_branch_id="target_branch_id", + title="title", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**source_branch_id:** `str` — Branch whose changes should be merged. + +
+
+ +
+
+ +**target_branch_id:** `str` — Branch that should receive the changes. + +
+
+ +
+
+ +**title:** `str` — Short title for the merge_proposal. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — Optional longer description for reviewers. + +
+
+ +
+
+ +**requested_reviewer_user_ids:** `typing.Optional[typing.List[str]]` — User IDs to request a review from. + +
+
+ +
+
+ +**triage_ticket_id:** `typing.Optional[str]` — Triage ticket of this agent that the merge_proposal resolves. Merging it resolves the ticket if still open. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.merge_proposals.get(...) -> AgentMergeProposalResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a single merge_proposal. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.merge_proposals.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**merge_proposal_id:** `str` — Unique identifier for the merge_proposal. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.merge_proposals.update(...) -> AgentMergeProposalResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit an open merge_proposal's title or description, or close it. The author closing it is recorded as withdrawn; anyone else as rejected. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.merge_proposals.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**merge_proposal_id:** `str` — Unique identifier for the merge_proposal. + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — New title for the merge_proposal. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — New description for the merge_proposal. + +
+
+ +
+
+ +**requested_reviewer_user_ids:** `typing.Optional[typing.List[str]]` — Replacement list of user IDs to request a review from. + +
+
+ +
+
+ +**close:** `typing.Optional[bool]` — When true, close the merge_proposal without merging. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.merge_proposals.submit_review(...) -> AgentMergeProposalResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Approve a merge_proposal or request changes on it. A user's latest review replaces their previous one. Non-admins need an approval from another user before the merge is allowed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.merge_proposals.submit_review( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + state="approved", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**merge_proposal_id:** `str` — Unique identifier for the merge_proposal. + +
+
+ +
+
+ +**state:** `MergeProposalReviewState` — The review verdict. + +
+
+ +
+
+ +**comment:** `typing.Optional[str]` — Optional comment to leave with the review. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.merge_proposals.add_comment(...) -> AgentMergeProposalResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Leave a comment on a merge_proposal without recording a review verdict. Unlike reviews, comments accumulate and can still be added once the merge_proposal is merged or closed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.merge_proposals.add_comment( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + body="body", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**merge_proposal_id:** `str` — Unique identifier for the merge_proposal. + +
+
+ +
+
+ +**body:** `str` — The comment text. Markdown is supported. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.merge_proposals.merge(...) -> AgentMergeProposalResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Execute the merge. The caller must have write access to the target branch (admins only, for a protected branch), so this is where a reviewer approves and merges a request opened by someone who could not. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.merge_proposals.merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**merge_proposal_id:** `str` — Unique identifier for the merge_proposal. + +
+
+ +
+
+ +**archive_source_branch:** `typing.Optional[bool]` — Whether to archive the source branch after merging. + +
+
+ +
+
+ +**force:** `typing.Optional[bool]` — Force source branch changes onto the target, overriding timestamp-based conflict resolution. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Procedures +
client.conversational_ai.agents.procedures.list(...) -> ListProceduresResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the procedures attached to this agent branch. By default, unpublished drafts take precedence over the latest committed version. Pass agent_version_id to list a published snapshot instead. has_draft is true when a procedure has unpublished draft changes on this branch. Procedure content is not included; use Get Procedure to read a procedure's body. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.procedures.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + agent_version_id="agent_version_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to get the procedure draft from + +
+
+ +
+
+ +**branch_id:** `str` — Branch ID to get the procedure draft from + +
+
+ +
+
+ +**agent_version_id:** `typing.Optional[str]` — The agent version ID to retrieve the procedure for. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.procedures.create(...) -> CreateProcedureResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new procedure for the agent on a branch. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, CreateProcedureRequestModel +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.procedures.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + request=CreateProcedureRequestModel(), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to get the procedure draft from + +
+
+ +
+
+ +**branch_id:** `str` — Branch ID to get the procedure draft from + +
+
+ +
+
+ +**request:** `typing.Optional[CreateProcedureRequestModel]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.procedures.compile(...) -> CompileProceduresResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Legacy. Do not use. Saving an agent draft (`POST /v1/convai/agents/{agent_id}/drafts`) and publishing an agent (`PATCH /v1/convai/agents/{agent_id}`) compile structured procedures into workflow nodes and edges, save the compiled workflow with the draft or version, and return validation errors, so a separate compile call is no longer needed. This endpoint remains available for the time being so existing callers do not break, as a dry-run that compiles the current procedure drafts into a workflow without persisting anything. It will eventually be deprecated. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.procedures.compile( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to get the procedure draft from + +
+
+ +
+
+ +**branch_id:** `str` — Branch ID to get the procedure draft from + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.procedures.get(...) -> ProcedureAtVersionResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a procedure at a specific version or the current branch HEAD. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.procedures.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + version_id="version_id", + agent_version_id="agent_version_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to get the procedure draft from + +
+
+ +
+
+ +**branch_id:** `str` — Branch ID to get the procedure draft from + +
+
+ +
+
+ +**procedure_id:** `str` — The procedure ID + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — The version ID to retrieve. If omitted, returns the version at branch HEAD. + +
+
+ +
+
+ +**agent_version_id:** `typing.Optional[str]` — The agent version ID to retrieve the procedure for. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.procedures.remove(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove a procedure from the agent's draft working set. Removing a folder cascades to its entire subtree, rejected if any procedure outside the subtree hands off into it. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.procedures.remove( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to get the procedure draft from + +
+
+ +
+
+ +**branch_id:** `str` — Branch ID to get the procedure draft from + +
+
+ +
+
+ +**procedure_id:** `str` — The procedure ID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Procedures Drafts +
client.conversational_ai.agents.procedures.drafts.get(...) -> ProcedureDraftResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get user's draft for a procedure +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.procedures.drafts.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to get the procedure draft from + +
+
+ +
+
+ +**branch_id:** `str` — Branch ID to get the procedure draft from + +
+
+ +
+
+ +**procedure_id:** `str` — The procedure ID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.procedures.drafts.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete user's draft for a procedure, resetting to the committed version +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.procedures.drafts.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to get the procedure draft from + +
+
+ +
+
+ +**branch_id:** `str` — Branch ID to get the procedure draft from + +
+
+ +
+
+ +**procedure_id:** `str` — The procedure ID + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.agents.procedures.drafts.update(...) -> ProcedureDraftResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create or update user's draft for a procedure +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.procedures.drafts.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + name="name", + content="content", + type="free_form", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to get the procedure draft from + +
+
+ +
+
+ +**branch_id:** `str` — Branch ID to get the procedure draft from + +
+
+ +
+
+ +**procedure_id:** `str` — The procedure ID + +
+
+ +
+
+ +**name:** `str` — Procedure name + +
+
+ +
+
+ +**content:** `str` — Procedure content + +
+
+ +
+
+ +**type:** `ProcedureType` — Procedure type + +
+
+ +
+
+ +**trigger:** `typing.Optional[str]` — When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. Omit this field (or send null) to keep the stored trigger, which is empty on create. Send `""` to clear it. `description` is accepted as an alias. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Agents Widget Avatar +
client.conversational_ai.agents.widget.avatar.create(...) -> PostAgentAvatarResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sets the avatar for an agent displayed in the widget +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.agents.widget.avatar.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + avatar_file="example_avatar_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — The id of an agent. This is returned on agent creation. + +
+
+ +
+
+ +**avatar_file:** `core.File` — An image file to be used as the agent's avatar. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Analytics LiveCount +
client.conversational_ai.analytics.live_count.get(...) -> GetLiveCountResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the live count of the ongoing conversations. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.analytics.live_count.get( + agent_id="agent_id", + agent_ids=[ + "agent_ids" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — The id of an agent to restrict the analytics to. + +
+
+ +
+
+ +**agent_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Restrict analytics to the union of the given agents. Takes precedence over `agent_id` when both are supplied. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Conversations Audio +
client.conversational_ai.conversations.audio.get(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the audio recording of a particular conversation +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.audio.get( + conversation_id="conversation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — The id of the conversation you're taking the action on. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Conversations Feedback +
client.conversational_ai.conversations.feedback.create(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Send the feedback for the given conversation +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.feedback.create( + conversation_id="21m00Tcm4TlvDq8ikWAM", + feedback="like", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — The id of the conversation you're taking the action on. + +
+
+ +
+
+ +**feedback:** `typing.Optional[UserFeedbackScore]` — Either 'like' or 'dislike' to indicate the feedback for the conversation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Conversations Messages +
client.conversational_ai.conversations.messages.text_search(...) -> MessagesSearchResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Search through conversation transcript messages by full-text and fuzzy search +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.messages.text_search( + text_query="refund policy", + agent_id="agent_id", + visited_agent_ids=[ + "visited_agent_ids" + ], + visited_agent_branch_ids=[ + "visited_agent_branch_ids" + ], + triggered_procedure_ids=[ + "triggered_procedure_ids" + ], + call_successful="success", + call_start_before_unix=1, + call_start_after_unix=1, + call_duration_min_secs=1, + call_duration_max_secs=1, + rating_max=1, + rating_min=1, + has_feedback_comment=True, + user_id="user_id", + evaluation_params=[ + "evaluation_params" + ], + data_collection_params=[ + "data_collection_params" + ], + dynamic_variable_params=[ + "dynamic_variable_params" + ], + tool_names=[ + "tool_names" + ], + tool_names_successful=[ + "tool_names_successful" + ], + tool_names_errored=[ + "tool_names_errored" + ], + include_invalid_tool_calls=True, + main_languages=[ + "main_languages" + ], + exclude_statuses=[ + "initiated" + ], + termination_reasons=[ + "termination_reasons" + ], + page_size=1, + summary_mode="exclude", + conversation_initiation_source="unknown", + text_only=True, + conversation_product_type="agents", + branch_id="branch_id", + version_id="version_id", + topic_ids=[ + "topic_ids" + ], + sort_by="search_score", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**text_query:** `str` — The search query text for full-text and fuzzy matching + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + +
+
+ +
+
+ +**visited_agent_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations where any of these agents participated. Can not exceed 50 values. + +
+
+ +
+
+ +**visited_agent_branch_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations where any of these agent branches participated. Can not exceed 50 values. + +
+
+ +
+
+ +**triggered_procedure_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + +
+
+ +
+
+ +**call_successful:** `typing.Optional[EvaluationResultFilter]` — The result of the success evaluation + +
+
+ +
+
+ +**call_start_before_unix:** `typing.Optional[int]` — Unix timestamp (in seconds) to filter conversations up to this start date. + +
+
+ +
+
+ +**call_start_after_unix:** `typing.Optional[int]` — Unix timestamp (in seconds) to filter conversations after to this start date. + +
+
+ +
+
+ +**call_duration_min_secs:** `typing.Optional[int]` — Minimum call duration in seconds. + +
+
+ +
+
+ +**call_duration_max_secs:** `typing.Optional[int]` — Maximum call duration in seconds. + +
+
+ +
+
+ +**rating_max:** `typing.Optional[int]` — Maximum overall rating (1-5). + +
+
+ +
+
+ +**rating_min:** `typing.Optional[int]` — Minimum overall rating (1-5). + +
+
+ +
+
+ +**has_feedback_comment:** `typing.Optional[bool]` — Filter conversations with user feedback comments. + +
+
+ +
+
+ +**user_id:** `typing.Optional[str]` — Filter conversations by the user ID who initiated them. + +
+
+ +
+
+ +**evaluation_params:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + +
+
+ +
+
+ +**data_collection_params:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + +
+
+ +
+
+ +**dynamic_variable_params:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + +
+
+ +
+
+ +**tool_names:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by tool names used during the call. + +
+
+ +
+
+ +**tool_names_successful:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by tool names that had successful calls. + +
+
+ +
+
+ +**tool_names_errored:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by tool names that had errored calls. + +
+
+ +
+
+ +**include_invalid_tool_calls:** `typing.Optional[bool]` — Also match tool calls that never ran. + +
+
+ +
+
+ +**main_languages:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by detected main language (language code). + +
+
+ +
+
+ +**exclude_statuses:** `typing.Optional[typing.Union[MessagesTextSearchRequestExcludeStatusesItem, typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem]]]` — Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + +
+
+ +
+
+ +**termination_reasons:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of results per page. Max 50. + +
+
+ +
+
+ +**summary_mode:** `typing.Optional[MessagesTextSearchRequestSummaryMode]` — Whether to include transcript summaries in the response. + +
+
+ +
+
+ +**conversation_initiation_source:** `typing.Optional[ConversationInitiationSource]` + +
+
+ +
+
+ +**text_only:** `typing.Optional[bool]` + +
+
+ +
+
+ +**conversation_product_type:** `typing.Optional[ConversationProduct]` — Restrict results to a single conversation product surface. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Filter conversations by branch ID. + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — Filter conversations by version ID. + +
+
+ +
+
+ +**topic_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Filter conversations by topic IDs assigned during topic discovery. + +
+
+ +
+
+ +**sort_by:** `typing.Optional[MessageSearchSortBy]` — Sort order for search results. 'search_score' sorts by search score, 'created_at' sorts by conversation start time. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.messages.search(...) -> MessagesSearchResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Search conversation transcripts by semantic similarity to surface relevant messages based on meaning and intent, rather than exact keyword matches +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.messages.search( + text_query="Customer asking to cancel and get money back", + agent_id="agent_id", + branch_id="branch_id", + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**text_query:** `str` — The search query text for semantic similarity matching + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Filter conversations by branch ID. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of results per page. Max 50. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Conversations Tags +
client.conversational_ai.conversations.tags.assign(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Assign one or more conversation tags to a conversation. Tags that are already assigned are ignored. Tags must belong to the same workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.tags.assign( + conversation_id="conversation_id", + tag_ids=[ + "tag_ids" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` + +
+
+ +
+
+ +**tag_ids:** `typing.List[str]` — Tag IDs to add to the conversation. Re-assigning an existing tag is a no-op. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.tags.unassign(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove a single conversation tag from a conversation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.tags.unassign( + conversation_id="conversation_id", + tag_id="tag_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` + +
+
+ +
+
+ +**tag_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.tags.list(...) -> GetConversationTagsPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List conversation tags for the workspace, ordered by most recently created first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.tags.list( + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many conversation tags to return. Can not exceed 100. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.tags.create(...) -> ConversationTagResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new conversation tag for the workspace. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.tags.create( + title="title", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**title:** `str` — Display title of the tag. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — Optional free-text description. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.tags.get(...) -> ConversationTagResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a conversation tag by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.tags.get( + tag_id="tag_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tag_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.tags.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a conversation tag. Restricted to the tag owner or a workspace admin. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.tags.delete( + tag_id="tag_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tag_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.tags.update(...) -> ConversationTagResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a conversation tag's title and/or description. Restricted to the tag owner or a workspace admin. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.tags.update( + tag_id="tag_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tag_id:** `str` + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — If provided, replaces the tag title. Omit to leave unchanged. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — If provided, replaces the tag description. Omit to leave unchanged. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Conversations Files +
client.conversational_ai.conversations.files.create(...) -> ConvAiFileUploadResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Upload an image, PDF, or text file for a conversation. Returns a unique file ID that can be used to reference the file in the conversation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.files.create( + conversation_id="conversation_id", + file="example_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` + +
+
+ +
+
+ +**file:** `core.File` — Image, PDF, or text file to upload + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.files.delete(...) -> ConvAiFileUploadResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove a file upload from a conversation. Only possible if the file hasn't already been used in the conversation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.files.delete( + conversation_id="conversation_id", + file_id="file_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` + +
+
+ +
+
+ +**file_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Conversations Topics +
client.conversational_ai.conversations.topics.get(...) -> GetAgentTopicsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the latest topic discovery run results for a given agent. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.topics.get( + agent_id="agent_id", + page_size=1, + sort_by="conversations", + sort_direction="asc", + from_unix_secs=1, + to_unix_secs=1, + include_evaluation_criteria=True, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `str` — ID of the agent + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of top-level topic groups to return. + +
+
+ +
+
+ +**sort_by:** `typing.Optional[TopicSortBy]` — Column to rank topics by. Use conversations for volume, sentiment with sort_direction=asc for the most negative topics, and frustration with sort_direction=desc for the most frustrated ones. Topics with no score are always ranked last. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[SortDirection]` — Direction to sort topics. + +
+
+ +
+
+ +**from_unix_secs:** `typing.Optional[int]` — Start of the window to view topics for. When set with to_unix_secs, the completed daily topic-discovery runs in the range are aggregated together, so the window scopes the metrics as well as the topic set. Floored to the start of its UTC day because runs cover whole UTC days; aggregated_run_count reports how many runs were summed. Omit both bounds to get the single latest run. + +
+
+ +
+
+ +**to_unix_secs:** `typing.Optional[int]` — End of the window to view topics for. + +
+
+ +
+
+ +**include_evaluation_criteria:** `typing.Optional[bool]` — Include the per-criteria evaluation breakdown on each topic's metrics. Pass false to drop it: it dominates the payload and the weighted success_rate is returned either way. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Conversations Analysis +
client.conversational_ai.conversations.analysis.run(...) -> GetConversationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Run the analysis for a conversation using the agent's current evaluation criteria and data collection settings. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.analysis.run( + conversation_id="conversation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — ID of the conversation + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.conversations.analysis.run_evaluation(...) -> GetConversationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Rerun a specific evaluation for a conversation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.conversations.analysis.run_evaluation( + conversation_id="conversation_id", + evaluation_id="evaluation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**conversation_id:** `str` — ID of the conversation + +
+
+ +
+
+ +**evaluation_id:** `str` — ID of the single evaluation criterion to rerun. + +
+
+ +
+
+ +**scope:** `typing.Optional[AnalysisScope]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Dashboard Settings +
client.conversational_ai.dashboard.settings.get() -> GetConvAiDashboardSettingsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve Convai dashboard settings for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.dashboard.settings.get() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.dashboard.settings.update(...) -> GetConvAiDashboardSettingsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update Convai dashboard settings for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.dashboard.settings.update() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**charts:** `typing.Optional[typing.List[PatchConvAiDashboardSettingsRequestChartsItem]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi KnowledgeBase Documents +
client.conversational_ai.knowledge_base.documents.create_from_url(...) -> AddKnowledgeBaseResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a knowledge base document generated by scraping the given webpage. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.create_from_url( + url="url", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**url:** `str` — URL to a page of documentation that the agent will have access to in order to interact with users. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — A custom, human-readable name for the document. + +
+
+ +
+
+ +**parent_folder_id:** `typing.Optional[str]` — If set, the created document or folder will be placed inside the given folder. + +
+
+ +
+
+ +**enable_auto_sync:** `typing.Optional[bool]` — Whether to enable auto-sync for this URL document. + +
+
+ +
+
+ +**auto_remove:** `typing.Optional[bool]` — Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + +
+
+ +
+
+ +**minimum_frequency_days:** `typing.Optional[int]` — Minimum frequency (in days) at which the document is refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.create_from_file(...) -> AddKnowledgeBaseResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a knowledge base document generated form the uploaded file. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.create_from_file( + file="example_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**file:** `core.File` — Documentation that the agent will have access to in order to interact with users. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — A custom, human-readable name for the document. + +
+
+ +
+
+ +**parent_folder_id:** `typing.Optional[str]` — If set, the created document or folder will be placed inside the given folder. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.create_from_text(...) -> AddKnowledgeBaseResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a knowledge base document containing the provided text. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.create_from_text( + text="text", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**text:** `str` — Text content to be added to the knowledge base. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — A custom, human-readable name for the document. + +
+
+ +
+
+ +**parent_folder_id:** `typing.Optional[str]` — If set, the created document or folder will be placed inside the given folder. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.create_folder(...) -> AddKnowledgeBaseResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a folder used for grouping documents together. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.create_folder( + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — A custom, human-readable name for the document. + +
+
+ +
+
+ +**parent_folder_id:** `typing.Optional[str]` — If set, the created document or folder will be placed inside the given folder. + +
+
+ +
+
+ +**enable_auto_sync:** `typing.Optional[bool]` — Whether to enable auto-sync for this URL document. + +
+
+ +
+
+ +**auto_remove:** `typing.Optional[bool]` — Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + +
+
+ +
+
+ +**minimum_frequency_days:** `typing.Optional[int]` — Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.get(...) -> DocumentsGetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get details about a specific documentation making up the agent's knowledge base +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.get( + documentation_id="21m00Tcm4TlvDq8ikWAM", + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a document or folder from the knowledge base. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.delete( + documentation_id="21m00Tcm4TlvDq8ikWAM", + force=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**force:** `typing.Optional[bool]` — If set to true, the document or folder will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.update(...) -> DocumentsUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the name and/or content of a document. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.update( + documentation_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — A custom, human-readable name for the document. + +
+
+ +
+
+ +**content:** `typing.Optional[str]` — Updated content for the document. Only supported for text documents, URL documents with auto-sync disabled, and file documents that are not synced from an external source. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.get_agents(...) -> GetKnowledgeBaseDependentAgentsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of agents depending on this knowledge base document +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.get_agents( + documentation_id="21m00Tcm4TlvDq8ikWAM", + dependent_type="direct", + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**dependent_type:** `typing.Optional[KnowledgeBaseDependentType]` — Type of dependent agents to return. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.get_bulk_agents(...) -> GetKnowledgeBaseDependentAgentsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of agents depending on any of the given knowledge base documents. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.get_bulk_agents( + dependent_type="direct", + page_size=1, + cursor="cursor", + document_ids=[ + "21m00Tcm4TlvDq8ikWAM", + "31m00Tcm4TlvDq8ikWBM" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**document_ids:** `typing.List[str]` — The ids of documents or folders from the knowledge base. + +
+
+ +
+
+ +**dependent_type:** `typing.Optional[KnowledgeBaseDependentType]` — Type of dependent agents to return. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.get_content(...) -> str +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get the entire content of a document from the knowledge base +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.get_content( + documentation_id="documentation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.get_source_file_url(...) -> KnowledgeBaseSourceFileUrlResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a signed URL to download the original source file of a file-type document from the knowledge base +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.get_source_file_url( + documentation_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.move(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Moves the entity from one folder to another. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.move( + document_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**document_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**move_to:** `typing.Optional[str]` — The folder to move the entities to. If not set, the entities will be moved to the root folder. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.bulk_move(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Moves multiple entities from one folder to another. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.bulk_move( + document_ids=[ + "21m00Tcm4TlvDq8ikWAM", + "31m00Tcm4TlvDq8ikWBM" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**document_ids:** `typing.List[str]` — The ids of documents or folders from the knowledge base. + +
+
+ +
+
+ +**move_to:** `typing.Optional[str]` — The folder to move the entities to. If not set, the entities will be moved to the root folder. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.documents.bulk_delete(...) -> typing.Dict[str, DocumentsBulkDeleteResponseValue] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete multiple documents or folders from the knowledge base. Each id succeeds or fails independently. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.bulk_delete( + document_ids=[ + "21m00Tcm4TlvDq8ikWAM", + "31m00Tcm4TlvDq8ikWBM" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**document_ids:** `typing.List[str]` — The ids of documents or folders from the knowledge base. + +
+
+ +
+
+ +**force:** `typing.Optional[bool]` — If set to true, documents or folders will be deleted regardless of whether they are used by any agents and will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi KnowledgeBase CrawlJobs +
client.conversational_ai.knowledge_base.crawl_jobs.list(...) -> ListCrawlJobsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a list of ongoing and recent crawl jobs for the user. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.crawl_jobs.list( + include_job_ids=[ + "include_job_ids" + ], + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**include_job_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — Ids of additional crawl jobs to retrieve + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.crawl_jobs.create(...) -> CreateCrawlJobResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a crawl job to crawl the given URL with specified depth and page limits. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.crawl_jobs.create( + url="url", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**url:** `str` — URL to a page of documentation that the agent will have access to in order to interact with users. + +
+
+ +
+
+ +**max_depth:** `typing.Optional[int]` — Deprecated - this field is a no-op and will be removed in a future version. + +
+
+ +
+
+ +**max_pages:** `typing.Optional[int]` — Maximum number of pages to crawl (1-10,000), defaults to 1000. + +
+
+ +
+
+ +**pattern:** `typing.Optional[str]` — If set, only URLs that match this pattern are included. + +
+
+ +
+
+ +**sitemap_urls:** `typing.Optional[typing.List[str]]` — List of URLs to crawl from sitemap (optional, overrides automatic URL discovery). + +
+
+ +
+
+ +**parent_folder_id:** `typing.Optional[str]` — If set, the created document or folder will be placed inside the given folder. + +
+
+ +
+
+ +**enable_auto_sync:** `typing.Optional[bool]` — Whether to enable auto-sync for this URL document. + +
+
+ +
+
+ +**auto_remove:** `typing.Optional[bool]` — Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + +
+
+ +
+
+ +**auto_discover:** `typing.Optional[bool]` — Automatically discover and add new pages linked from already-crawled pages during auto-sync. Requires enable_auto_sync=true. + +
+
+ +
+
+ +**minimum_frequency_days:** `typing.Optional[int]` — Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.crawl_jobs.get(...) -> GetCrawlJobResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get details about a specific crawl job including status and progress. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.crawl_jobs.get( + crawl_job_id="crawl_job_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**crawl_job_id:** `str` — The id of the crawl job to retrieve + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.crawl_jobs.cancel(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancel a crawl job and delete all associated documents and folders. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.crawl_jobs.cancel( + crawl_job_id="crawl_job_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**crawl_job_id:** `str` — The id of the crawl job to retrieve + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi KnowledgeBase Document +
client.conversational_ai.knowledge_base.document.update_file(...) -> DocumentUpdateFileResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the source file of a file document. The document name, content, and metadata are updated to reflect the new file. Any manual content edits will be overwritten. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.document.update_file( + documentation_id="21m00Tcm4TlvDq8ikWAM", + file="example_file", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**file:** `core.File` — Documentation that the agent will have access to in order to interact with users. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.document.refresh(...) -> DocumentRefreshResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Manually refresh a URL document by re-fetching its content from the source URL. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.document.refresh( + documentation_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.knowledge_base.document.compute_rag_index(...) -> RagDocumentIndexResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +In case the document is not RAG indexed, it triggers rag indexing task, otherwise it just returns the current status. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.document.compute_rag_index( + documentation_id="21m00Tcm4TlvDq8ikWAM", + model="e5_mistral_7b_instruct", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**model:** `EmbeddingModelEnum` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi KnowledgeBase Documents Summaries +
client.conversational_ai.knowledge_base.documents.summaries.get(...) -> typing.Dict[str, SummariesGetResponseValue] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets multiple knowledge base document summaries by their IDs. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.summaries.get( + document_ids=[ + "21m00Tcm4TlvDq8ikWAM", + "31n11Udm5UmwEr9jkXBN" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**document_ids:** `typing.Optional[typing.Union[str, typing.Sequence[str]]]` — The ids of knowledge base documents. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi KnowledgeBase Documents Chunk +
client.conversational_ai.knowledge_base.documents.chunk.get(...) -> KnowledgeBaseDocumentChunkResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get details about a specific documentation part used by RAG. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.chunk.get( + documentation_id="21m00Tcm4TlvDq8ikWAM", + chunk_id="chunk_id", + embedding_model="e5_mistral_7b_instruct", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**chunk_id:** `str` — The id of a document RAG chunk from the knowledge base. + +
+
+ +
+
+ +**embedding_model:** `typing.Optional[EmbeddingModelEnum]` — The embedding model used to retrieve the chunk. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi KnowledgeBase Documents Chunks +
client.conversational_ai.knowledge_base.documents.chunks.list(...) -> KnowledgeBaseDocumentChunksResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all RAG chunks for a specific knowledge base document. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.knowledge_base.documents.chunks.list( + documentation_id="21m00Tcm4TlvDq8ikWAM", + embedding_model="e5_mistral_7b_instruct", + page_size=1, + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**documentation_id:** `str` — The id of a document from the knowledge base. This is returned on document addition. + +
+
+ +
+
+ +**embedding_model:** `EmbeddingModelEnum` — The embedding model used to retrieve the chunk. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi McpServers Tools +
client.conversational_ai.mcp_servers.tools.list(...) -> ListMcpToolsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve all tools available for a specific MCP server configuration. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.tools.list( + mcp_server_id="mcp_server_id", + environment="environment", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` — Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi McpServers ApprovalPolicy +
client.conversational_ai.mcp_servers.approval_policy.update(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update the approval policy configuration for an MCP server. DEPRECATED: Use PATCH /mcp-servers/{id} endpoint instead. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.approval_policy.update( + mcp_server_id="mcp_server_id", + approval_policy="auto_approve_all", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**approval_policy:** `McpApprovalPolicy` — The approval mode to set for the MCP server + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi McpServers ToolApprovals +
client.conversational_ai.mcp_servers.tool_approvals.create(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add approval for a specific MCP tool when using per-tool approval mode. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.tool_approvals.create( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + tool_description="tool_description", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**tool_name:** `str` — The name of the MCP tool + +
+
+ +
+
+ +**tool_description:** `str` — The description of the MCP tool + +
+
+ +
+
+ +**input_schema:** `typing.Optional[typing.Dict[str, typing.Any]]` — The input schema of the MCP tool (the schema defined on the MCP server before ElevenLabs does any extra processing) + +
+
+ +
+
+ +**approval_policy:** `typing.Optional[McpToolApprovalPolicy]` — The tool-level approval policy + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.mcp_servers.tool_approvals.delete(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove approval for a specific MCP tool when using per-tool approval mode. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.tool_approvals.delete( + mcp_server_id="mcp_server_id", + tool_name="tool_name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**tool_name:** `str` — Name of the MCP tool to remove approval for. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi McpServers ToolConfigs +
client.conversational_ai.mcp_servers.tool_configs.create(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create configuration overrides for a specific MCP tool. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.tool_configs.create( + mcp_server_id="mcp_server_id", + environment="environment", + tool_name="tool_name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**tool_name:** `str` — The name of the MCP tool + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` — Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + +
+
+ +
+
+ +**force_pre_tool_speech:** `typing.Optional[bool]` — DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + +
+
+ +
+
+ +**pre_tool_speech:** `typing.Optional[PreToolSpeechMode]` — If set, overrides the server's pre_tool_speech setting for this tool. + +
+
+ +
+
+ +**disable_interruptions:** `typing.Optional[bool]` — DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + +
+
+ +
+
+ +**interruption_mode:** `typing.Optional[ToolInterruptionMode]` — If set, overrides the server's interruption_mode setting for this tool. + +
+
+ +
+
+ +**tool_call_sound:** `typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound]` — Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + +
+
+ +
+
+ +**tool_call_sound_behavior:** `typing.Optional[ToolCallSoundBehavior]` — If set, overrides the server's tool_call_sound_behavior setting for this tool + +
+
+ +
+
+ +**execution_mode:** `typing.Optional[ToolExecutionMode]` — If set, overrides the server's execution_mode setting for this tool + +
+
+ +
+
+ +**response_timeout_secs:** `typing.Optional[int]` — If set, overrides the server's response timeout for this MCP tool. + +
+
+ +
+
+ +**assignments:** `typing.Optional[typing.List[DynamicVariableAssignment]]` — Dynamic variable assignments for this MCP tool + +
+
+ +
+
+ +**input_overrides:** `typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]]` — Mapping of json path to input override configuration + +
+
+ +
+
+ +**response_mocks:** `typing.Optional[typing.List[ToolResponseMockConfigInput]]` — Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.mcp_servers.tool_configs.get(...) -> McpToolConfigOverrideOutput +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve configuration overrides for a specific MCP tool. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.tool_configs.get( + mcp_server_id="mcp_server_id", + tool_name="tool_name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**tool_name:** `str` — Name of the MCP tool to retrieve config overrides for. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.mcp_servers.tool_configs.delete(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove configuration overrides for a specific MCP tool. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.tool_configs.delete( + mcp_server_id="mcp_server_id", + tool_name="tool_name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**tool_name:** `str` — Name of the MCP tool to remove config overrides for. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.mcp_servers.tool_configs.update(...) -> McpServerResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update configuration overrides for a specific MCP tool. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.mcp_servers.tool_configs.update( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + environment="environment", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**mcp_server_id:** `str` — ID of the MCP Server. + +
+
+ +
+
+ +**tool_name:** `str` — Name of the MCP tool to update config overrides for. + +
+
+ +
+
+ +**environment:** `typing.Optional[str]` — Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + +
+
+ +
+
+ +**force_pre_tool_speech:** `typing.Optional[bool]` — DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + +
+
+ +
+
+ +**pre_tool_speech:** `typing.Optional[PreToolSpeechMode]` — If set, overrides the server's pre_tool_speech setting for this tool. + +
+
+ +
+
+ +**disable_interruptions:** `typing.Optional[bool]` — DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + +
+
+ +
+
+ +**interruption_mode:** `typing.Optional[ToolInterruptionMode]` — If set, overrides the server's interruption_mode setting for this tool. + +
+
+ +
+
+ +**tool_call_sound:** `typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound]` — Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + +
+
+ +
+
+ +**tool_call_sound_behavior:** `typing.Optional[ToolCallSoundBehavior]` — If set, overrides the server's tool_call_sound_behavior setting for this tool + +
+
+ +
+
+ +**execution_mode:** `typing.Optional[ToolExecutionMode]` — If set, overrides the server's execution_mode setting for this tool + +
+
+ +
+
+ +**response_timeout_secs:** `typing.Optional[int]` — If set, overrides the server's response timeout for this MCP tool. + +
+
+ +
+
+ +**assignments:** `typing.Optional[typing.List[DynamicVariableAssignment]]` — Dynamic variable assignments for this MCP tool + +
+
+ +
+
+ +**input_overrides:** `typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]]` — Mapping of json path to input override configuration + +
+
+ +
+
+ +**response_mocks:** `typing.Optional[typing.List[ToolResponseMockConfigInput]]` — Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Tests Folders +
client.conversational_ai.tests.folders.create(...) -> CreateAgentTestFolderResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a folder for organizing agent tests. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.folders.create( + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — The name of the folder to create + +
+
+ +
+
+ +**parent_folder_id:** `typing.Optional[str]` — The ID of the parent folder. If not provided, the folder will be created at the root level. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.folders.get(...) -> GetAgentTestFolderResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets an agent test folder by ID, including its folder path. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.folders.get( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**folder_id:** `str` — The folder ID. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.folders.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes an agent test folder by ID. Use force=true to delete a non-empty folder and all its contents. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.folders.delete( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", + force=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**folder_id:** `str` — The folder ID. + +
+
+ +
+
+ +**force:** `typing.Optional[bool]` — Force delete. Required for deleting non-empty folders. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.folders.update(...) -> GetAgentTestFolderResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an agent test folder. Currently only supports updating the folder name. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.folders.update( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**folder_id:** `str` — The folder ID. + +
+
+ +
+
+ +**name:** `str` — The new name for the folder + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Tests Invocations +
client.conversational_ai.tests.invocations.list(...) -> GetTestInvocationsPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all test invocations with pagination support and optional search filtering. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.invocations.list( + agent_id="agent_id", + branch_id="branch_id", + test_id="test_id", + start_time=1, + end_time=1, + version_id="version_id", + page_size=1, + search="search", + cursor="cursor", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Filter by agent ID + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Filter by branch ID + +
+
+ +
+
+ +**test_id:** `typing.Optional[str]` — Filter to invocations that include a run of this test id + +
+
+ +
+
+ +**start_time:** `typing.Optional[int]` — Inclusive lower bound on created_at, in unix seconds + +
+
+ +
+
+ +**end_time:** `typing.Optional[int]` — Inclusive upper bound on created_at, in unix seconds + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — Filter by the agent version the tests ran against + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many Tests to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Search query to filter tests and folders by name. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.invocations.get(...) -> GetTestSuiteInvocationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets a test invocation by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.invocations.get( + test_invocation_id="test_invocation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**test_invocation_id:** `str` — The id of a test invocation. This is returned when tests are run. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.invocations.cancel(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Cancels all pending runs in a test invocation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.invocations.cancel( + test_invocation_id="test_invocation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**test_invocation_id:** `str` — The id of a test invocation. This is returned when tests are run. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.conversational_ai.tests.invocations.resubmit(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Resubmits specific test runs from a test invocation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tests.invocations.resubmit( + test_invocation_id="test_invocation_id", + test_run_ids=[ + "test_run_ids" + ], + agent_id="agent_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**test_invocation_id:** `str` — The id of a test invocation. This is returned when tests are run. + +
+
+ +
+
+ +**test_run_ids:** `typing.List[str]` — List of test run IDs to resubmit + +
+
+ +
+
+ +**agent_id:** `str` — Agent ID to resubmit tests for + +
+
+ +
+
+ +**agent_config_override:** `typing.Optional[AdhocAgentConfigOverrideForTestRequestModel]` — Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ConversationalAi Tools Executions +
client.conversational_ai.tools.executions.get(...) -> GetToolExecutionsPageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get paginated list of tool executions for a specific tool. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.conversational_ai.tools.executions.get( + tool_id="tool_id", + cursor="cursor", + page_size=1, + is_error=True, + agent_id="agent_id", + branch_id="branch_id", + start_time=1.1, + end_time=1.1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**tool_id:** `str` — ID of the requested tool. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching next page. Cursor is returned in the response. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many documents to return at maximum. Can not exceed 100, defaults to 30. + +
+
+ +
+
+ +**is_error:** `typing.Optional[bool]` — Filter by error status. If not provided, returns all executions. + +
+
+ +
+
+ +**agent_id:** `typing.Optional[str]` — Filter by agent ID. + +
+
+ +
+
+ +**branch_id:** `typing.Optional[str]` — Filter by agent branch ID. + +
+
+ +
+
+ +**start_time:** `typing.Optional[float]` — Filter executions from this Unix timestamp (inclusive). + +
+
+ +
+
+ +**end_time:** `typing.Optional[float]` — Filter executions until this Unix timestamp (inclusive). + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Project +
client.dubbing.project.list(...) -> DubbingProjectListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the dubbing projects in your workspace that you can access, newest first, cursor-paginated. Listed projects carry no `language_ids`; fetch a project, or list its language targets, to see them. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.list( + page_size=20, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of projects per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + +
+
+ +
+
+ +**status:** `typing.Optional[str]` — Filter to projects in this status: `queued`, `preparing`, `ready`, or `failed`. Omit to return every status. + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[ProjectListRequestSortDirection]` — Sort by creation time; newest first by default. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.create(...) -> DubbingProjectResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a dubbing project from an uploaded file (`file`) or a source URL (`source_url`). + +Returns as soon as the project record exists, before the source has been fetched: the project starts `queued` and reaches `ready` once its source has been transcribed. Add a language target to it for each language you want, or pass `target_language` to queue the first one here. + +Creating a project incurs a minimum charge of one language: you are charged for at least one language's dubbing when the project is created, before any output exists. This charge prepays the first language target — the first target you add, or the one queued via `target_language`, consumes it — and each additional language is charged separately. + +Preparation can take minutes on a long source, so we recommend passing `webhook_ids` to be notified when the project turns `ready` or `failed`, rather than polling for it. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.create( + file="example_file", + transcript="example_transcript", + source_url="https://example.com/promo.mp4", + reference="Q3 marketing video", + source_language="en", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**file:** `typing.Optional[core.File]` — The source media file to dub: an audio or video file of at most 3 GiB. Provide this or `source_url`, not both. + +
+
+ +
+
+ +**source_url:** `typing.Optional[str]` — Public HTTP(S) URL the source media is fetched from server-side, subject to the same size and format limits as an upload. Provide this or `file`, not both. + +
+
+ +
+
+ +**reference:** `typing.Optional[str]` — Optional free-form string (at most 500 characters) to identify the project on your end. Stored and echoed back verbatim; it does not affect the dub. + +
+
+ +
+
+ +**source_language:** `typing.Optional[str]` — BCP-47 language tag of the source media; must be a language the transcription model supports. Any region or script subtag is ignored, since transcription is per-language. Omit to auto-detect. + +
+
+ +
+
+ +**model_id:** `typing.Optional[ProjectCreateRequestModelId]` — Dubbing model (`dubbing_v1` or `dubbing_v2`) every language target of this project is dubbed with. Defaults to `dubbing_v2`. Fixed at create time — the source is prepared for this model, so neither the project nor an individual target can change it later. + +
+
+ +
+
+ +**keyterms:** `typing.Optional[typing.List[str]]` — Key terms to bias transcription and translation toward (for example, product or brand names). At most 1,000 terms; each term at most 50 characters and 5 words; the characters `<>{}[]\` are not allowed. Terms are trimmed and deduplicated. Repeat the field once per term, or pass a single JSON array. + +
+
+ +
+
+ +**webhook_ids:** `typing.Optional[typing.List[str]]` — IDs of workspace webhooks to notify as this project progresses — the alternative to polling, and what we recommend. Each receives a `dubbing_project_ready` or `dubbing_project_failed` event for the project, and a `dubbing_language_completed` or `dubbing_language_failed` event for every language under it; `dubbing_language_completed` carries the output download URLs. At most 3 IDs, each already configured in your workspace — see [Webhooks](https://elevenlabs.io/docs/eleven-api/resources/webhooks) for how to create one and verify its signature. Repeat the field once per ID, or pass a single JSON array or comma-separated string. Delivery is best-effort and can repeat, so we recommend handling events idempotently. + +
+
+ +
+
+ +**target_language:** `typing.Optional[str]` — Optional shortcut: also create a language target in this BCP-47 language, queued to start once the project is ready — equivalent to creating the project and then creating one language target. Must be one of the [languages the dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. This is the first language target, so it consumes the project's minimum charge rather than adding to it. Its ID is returned in `language_ids`. + +
+
+ +
+
+ +**transcript:** `typing.Optional[core.File]` — Enterprise only. Optional JSON transcript to use instead of transcribing the source: a `{"segments": [...]}` document, at most 20,000 segments and 4 MiB. See [Bring your own transcript](https://elevenlabs.io/docs/eleven-api/guides/how-to/dubbing/bring-your-own-transcript) for the segment fields and their constraints. `source_language` is required whenever a transcript is provided. If any segment carries a `translation`, `target_language` is required and every segment must carry one; those translations seed the target created via `target_language`, which then skips machine translation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.get(...) -> DubbingProjectResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Full project detail, including the IDs of every language target under it. To follow a project to `ready`, we recommend a `webhook_ids` subscription rather than polling this endpoint. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project to fetch. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a project, every language target under it, and their stored media and outputs. This cannot be undone, and a dub already running is still billed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.delete( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project to delete. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Resource +
client.dubbing.resource.get(...) -> DubbingResource +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.get( + dubbing_id="dubbing_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.resource.migrate_segments(...) -> SegmentMigrationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Change the attribution of one or more segments to a different speaker. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.migrate_segments( + dubbing_id="dubbing_id", + segment_ids=[ + "segment_ids" + ], + speaker_id="speaker_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**segment_ids:** `typing.List[str]` + +
+
+ +
+
+ +**speaker_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.resource.transcribe(...) -> SegmentTranscriptionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.transcribe( + dubbing_id="dubbing_id", + segments=[ + "segments" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**segments:** `typing.List[str]` — Transcribe this specific list of segments. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.resource.translate(...) -> SegmentTranslationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.translate( + dubbing_id="dubbing_id", + segments=[ + "segments" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**segments:** `typing.List[str]` — Translate only this list of segments. + +
+
+ +
+
+ +**languages:** `typing.Optional[typing.List[str]]` — Translate only these languages for each segment. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.resource.dub(...) -> SegmentDubResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.dub( + dubbing_id="dubbing_id", + segments=[ + "segments" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**segments:** `typing.List[str]` — Dub only this list of segments. + +
+
+ +
+
+ +**languages:** `typing.Optional[typing.List[str]]` — Dub only these languages for each segment. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.resource.render(...) -> DubbingRenderResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Regenerate the output media for a language using the latest Studio state. Please ensure all segments have been dubbed before rendering, otherwise they will be omitted. Renders are generated asynchronously, and to check the status of all renders please use the 'Get Dubbing Resource' endpoint. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.render( + dubbing_id="dubbing_id", + language="language", + render_type="mp4", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**language:** `str` — The target language code to render, eg. 'es'. To render the source track use 'original'. + +
+
+ +
+
+ +**render_type:** `RenderType` — The type of the render. One of ['mp4', 'aac', 'mp3', 'wav', 'aaf', 'tracks_zip', 'clips_zip'] + +
+
+ +
+
+ +**normalize_volume:** `typing.Optional[bool]` — Whether to normalize the volume of the rendered audio. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Audio +
client.dubbing.audio.get(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.audio.get( + dubbing_id="dubbing_id", + language_code="language_code", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**language_code:** `str` — ID of the language. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Transcript +
client.dubbing.transcript.get_transcript_for_dub(...) -> TranscriptGetTranscriptForDubResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns transcript for the dub as an SRT or WEBVTT file. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.transcript.get_transcript_for_dub( + dubbing_id="dubbing_id", + language_code="source", + format_type="srt", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**language_code:** `str` — ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + +
+
+ +
+
+ +**format_type:** `typing.Optional[TranscriptGetTranscriptForDubRequestFormatType]` — Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Transcripts +
client.dubbing.transcripts.get(...) -> DubbingTranscriptsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetch the transcript for one of the languages in a dub. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.transcripts.get( + dubbing_id="dubbing_id", + language_code="source", + format_type="srt", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**language_code:** `str` — ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + +
+
+ +
+
+ +**format_type:** `TranscriptsGetRequestFormatType` — Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Project Language +
client.dubbing.project.language.list(...) -> DubbingLanguageListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List a project's language targets, cursor-paginated, each with signed output URLs once it has produced an output. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.language.list( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + page_size=20, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the parent dubbing project. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Number of language targets per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + +
+
+ +
+
+ +**status:** `typing.Optional[str]` — Filter to targets in this status: `queued`, `processing`, `completed`, `stale`, or `failed`. Omit to return every status. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.language.create(...) -> DubbingLanguageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add a language to dub a project into, and queue the dub. + +This is the call that produces dubbed audio, and it is billed per generation. The target is created `queued` and starts as soon as the project is `ready`, so it can be added at any point after the project is created. It inherits the project's dubbing model and cannot pick another. + +A project created with `webhook_ids` sends a `dubbing_language_completed` event carrying the output download URLs, so we recommend subscribing rather than polling this target to completion. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.language.create( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + target_language="es", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the parent dubbing project. + +
+
+ +
+
+ +**target_language:** `str` — BCP-47 language tag to dub the project into (for example, `fr` or `es-MX`). Must be one of the [languages the project's dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. + +
+
+ +
+
+ +**voice_settings:** `typing.Optional[VoiceSettings]` — Voice settings applied to every speaker in this language. Omit to use the defaults. + +
+
+ +
+
+ +**translations:** `typing.Optional[typing.Dict[str, typing.Optional[str]]]` — Enterprise only. Optional translations to use instead of machine translation. A map from each source segment's `external_id` (or its `id`, if you supplied none) to the translated text; every source segment must be covered exactly once. At most 20,000 entries, totaling at most 4 MiB of text. See [Bring your own transcript](https://elevenlabs.io/docs/eleven-api/guides/how-to/dubbing/bring-your-own-transcript). + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.language.get(...) -> DubbingLanguageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Full language-target detail. Once the target reports `completed`, `outputs` carries the signed download URLs. To learn when that happens, we recommend the project's `webhook_ids` subscription rather than polling this endpoint; fetch here when a delivered URL has expired, or to reconcile after an edit. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.language.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the parent dubbing project. + +
+
+ +
+
+ +**language_id:** `str` — Identifier of the language target to fetch. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.language.delete(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a language target and its outputs, leaving the project and its other languages intact. This cannot be undone, and a dub already running is still billed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.language.delete( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the parent dubbing project. + +
+
+ +
+
+ +**language_id:** `str` — Identifier of the language target to delete. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Project Transcript +
client.dubbing.project.transcript.get(...) -> DubbingSourceTranscriptResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +The project's source transcript, as editable segments. Available once the project is `ready`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.transcript.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.transcript.delete_segment(...) -> DubbingTranscriptRevisionResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enterprise only. Remove a source segment from the transcript so it is no longer dubbed. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.transcript.delete_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**segment_id:** `str` — Identifier of the segment to remove. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.transcript.update_segment(...) -> DubbingSourceSegmentUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enterprise only. Edit a source segment's text, speaker, or timing. Omitted fields are left unchanged. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DubbingSegmentUpdateRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.transcript.update_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", + request=DubbingSegmentUpdateRequest( + text="Welcome to our latest product demo.", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**segment_id:** `str` — Identifier of the segment to edit. + +
+
+ +
+
+ +**request:** `DubbingSegmentUpdateRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.transcript.update_segments(...) -> DubbingBulkSourceSegmentUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enterprise only. Edit several source segments' text, speaker, or timing in one atomic request: every edit applies or none does. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DubbingSegmentUpdateRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.transcript.update_segments( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segments={ + "0199a3f0-1c2d-7abc-8def-0123456789ab": DubbingSegmentUpdateRequest( + text="Welcome to our latest product demo.", + ), + "0199a3f0-3e4f-7abc-8def-0123456789cd": DubbingSegmentUpdateRequest( + speaker_id="narrator", + ) + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**segments:** `typing.Dict[str, DubbingSegmentUpdateRequest]` — Map of segment ID to the partial update to apply to that segment. At least one entry and at most 500. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.transcript.create_segment(...) -> DubbingSourceSegmentUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enterprise only. Add a new source segment to the transcript. Its span must lie within the source media, last between 0.1 and 25 seconds, and not overlap another segment by the same speaker. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.transcript.create_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + text="Thanks for watching.", + speaker_id="default_speaker", + start_s=42, + end_s=44, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**text:** `str` — The text of the new segment. + +
+
+ +
+
+ +**speaker_id:** `str` — Identifier of the segment's speaker. + +
+
+ +
+
+ +**start_s:** `float` — Start time of the segment, in seconds. + +
+
+ +
+
+ +**end_s:** `float` — End time of the segment, in seconds. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Project Language Transcript +
client.dubbing.project.language.transcript.get(...) -> DubbingTargetTranscriptResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +A language target's transcript: source segments with their translations. Available once the target has produced an output. Returns a conflict while the target is still on its first dub, since it has no translations to return yet. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.language.transcript.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**language_id:** `str` — Identifier of the language target. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.language.transcript.update_segment(...) -> DubbingTargetSegmentUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enterprise only. Edit a segment's translation for a language target. Omitted fields are left unchanged; an explicit null clears the field. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DubbingTargetSegmentUpdateRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.language.transcript.update_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", + request=DubbingTargetSegmentUpdateRequest( + translation="Bienvenido a nuestra última demostración de producto.", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**language_id:** `str` — Identifier of the language target. + +
+
+ +
+
+ +**segment_id:** `str` — Identifier of the segment to edit. + +
+
+ +
+
+ +**request:** `DubbingTargetSegmentUpdateRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.language.transcript.update_segments(...) -> DubbingBulkTargetSegmentUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enterprise only. Edit several segments' translations for a language target in one atomic request: every edit applies or none does. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, DubbingTargetSegmentUpdateRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.language.transcript.update_segments( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + segments={ + "0199a3f0-1c2d-7abc-8def-0123456789ab": DubbingTargetSegmentUpdateRequest( + translation="Bienvenido a nuestra última demostración de producto.", + ), + "0199a3f0-3e4f-7abc-8def-0123456789cd": DubbingTargetSegmentUpdateRequest( + translation="Empecemos.", + ) + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**language_id:** `str` — Identifier of the language target. + +
+
+ +
+
+ +**segments:** `typing.Dict[str, DubbingTargetSegmentUpdateRequest]` — Map of segment ID to the translation edit to apply to that segment. At least one entry and at most 500. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.project.language.transcript.regenerate(...) -> DubbingRegenerateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Enterprise only. Re-dub a target from its edited transcript, re-synthesizing only the edited regions (charged like a generation, less the free-regeneration allowance). Accepted asynchronously: the target returns to `processing` and sends a `dubbing_language_completed` event to the project's `webhook_ids` when the re-dub lands, carrying the new output URLs. Returns a conflict when the target has no edits to apply — nothing is dispatched and nothing is charged. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.project.language.transcript.regenerate( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — Identifier of the dubbing project. + +
+
+ +
+
+ +**language_id:** `str` — Identifier of the language target. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Resource Language +
client.dubbing.resource.language.add(...) -> LanguageAddedResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.language.add( + dubbing_id="dubbing_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**language:** `typing.Optional[str]` — The Target language. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Resource Segment +
client.dubbing.resource.segment.update(...) -> SegmentUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.segment.update( + dubbing_id="dubbing_id", + segment_id="segment_id", + language="language", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**segment_id:** `str` — ID of the segment + +
+
+ +
+
+ +**language:** `str` — ID of the language. + +
+
+ +
+
+ +**start_time:** `typing.Optional[float]` + +
+
+ +
+
+ +**end_time:** `typing.Optional[float]` + +
+
+ +
+
+ +**text:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.resource.segment.delete(...) -> SegmentDeleteResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a single segment from the dubbing. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.segment.delete( + dubbing_id="dubbing_id", + segment_id="segment_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**segment_id:** `str` — ID of the segment + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Resource Speaker +
client.dubbing.resource.speaker.update(...) -> SpeakerUpdatedResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.speaker.update( + dubbing_id="dubbing_id", + speaker_id="speaker_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**speaker_id:** `str` — ID of the speaker. + +
+
+ +
+
+ +**speaker_name:** `typing.Optional[str]` — Name to attribute to this speaker. + +
+
+ +
+
+ +**voice_id:** `typing.Optional[str]` — Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + +
+
+ +
+
+ +**voice_stability:** `typing.Optional[float]` — For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + +
+
+ +
+
+ +**voice_similarity:** `typing.Optional[float]` — For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + +
+
+ +
+
+ +**voice_style:** `typing.Optional[float]` — For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + +
+
+ +
+
+ +**languages:** `typing.Optional[typing.List[str]]` — Languages to apply these changes to. If empty, will apply to all languages. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.resource.speaker.create(...) -> SpeakerCreatedResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new speaker in a dubbing resource. The speaker is added to every available language and can optionally be associated with an ElevenLabs voice and voice settings. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.speaker.create( + dubbing_id="dubbing_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**speaker_name:** `typing.Optional[str]` — Name to attribute to this speaker. + +
+
+ +
+
+ +**voice_id:** `typing.Optional[str]` — Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + +
+
+ +
+
+ +**voice_stability:** `typing.Optional[float]` — For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + +
+
+ +
+
+ +**voice_similarity:** `typing.Optional[float]` — For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + +
+
+ +
+
+ +**voice_style:** `typing.Optional[float]` — For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.dubbing.resource.speaker.find_similar_voices(...) -> SimilarVoicesForSpeakerResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.speaker.find_similar_voices( + dubbing_id="dubbing_id", + speaker_id="speaker_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**speaker_id:** `str` — ID of the speaker. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Dubbing Resource Speaker Segment +
client.dubbing.resource.speaker.segment.create(...) -> SegmentCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.dubbing.resource.speaker.segment.create( + dubbing_id="dubbing_id", + speaker_id="speaker_id", + start_time=1.1, + end_time=1.1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**dubbing_id:** `str` — ID of the dubbing project. + +
+
+ +
+
+ +**speaker_id:** `str` — ID of the speaker. + +
+
+ +
+
+ +**start_time:** `float` + +
+
+ +
+
+ +**end_time:** `float` + +
+
+ +
+
+ +**text:** `typing.Optional[str]` + +
+
+ +
+
+ +**translations:** `typing.Optional[typing.Dict[str, typing.Optional[str]]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Flows Video +
client.flows.video.list(...) -> MediaGenerationListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the video generations created through this API, newest first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.video.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many generations to return per page. + +
+
+ +
+
+ +**status:** `typing.Optional[VideoListRequestStatus]` — Only return generations with this lifecycle status. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Only return generations of this model. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.video.create(...) -> MediaGenerationCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Start a video generation with the selected model. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.video.create( + request={ + "model_id": "bytedance-seedance-v2", + "prompt": "A corgi rides a tiny surfboard across a sunlit wave at golden hour, cinematic" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `VideoGenerationRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.video.get(...) -> MediaGenerationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the status of a video generation, and retrieve its output URL once completed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.video.get( + generation_id="generation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**generation_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Flows Image +
client.flows.image.list(...) -> MediaGenerationListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the image generations created through this API, newest first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.image.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many generations to return per page. + +
+
+ +
+
+ +**status:** `typing.Optional[ImageListRequestStatus]` — Only return generations with this lifecycle status. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Only return generations of this model. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.image.create(...) -> MediaGenerationCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Start an image generation with the selected model. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.image.create( + request={ + "model_id": "bytedance-seedream-5-lite", + "prompt": "A corgi in a tiny lifeguard chair on a sunlit beach at golden hour, photorealistic" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ImageGenerationRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.image.get(...) -> MediaGenerationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the status of an image generation, and retrieve its output URL once completed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.image.get( + generation_id="generation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**generation_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Flows TextToSpeech +
client.flows.text_to_speech.list(...) -> MediaGenerationListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the speech generations created through this API, newest first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.text_to_speech.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many generations to return per page. + +
+
+ +
+
+ +**status:** `typing.Optional[TextToSpeechListRequestStatus]` — Only return generations with this lifecycle status. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — Only return generations of this model. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.text_to_speech.create(...) -> MediaGenerationCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Start a speech generation with the selected model. Charged per character via text-to-speech billing. Use this over `/v1/text-to-speech` for the asynchronous generation lifecycle or for models not offered there; for direct, synchronous speech synthesis, prefer `/v1/text-to-speech`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.text_to_speech.create( + request={ + "model_id": "eleven_flash_v2_5", + "text": "The first move is what sets everything in motion.", + "voice": "JBFqnCBsd6RMkjVDRZzb" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `TextToSpeechGenerationRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.text_to_speech.get(...) -> MediaGenerationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the status of a speech generation, and retrieve its output URL once completed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.text_to_speech.get( + generation_id="generation_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**generation_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Flows Templates +
client.flows.templates.list(...) -> TemplateListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List the published flows templates in your workspace, together with each runnable version's inputs and outputs. Use the ids here as `template_id` / `version_id` on `POST /v1/flows/templates/{template_id}/runs`. Versions built on models that are not available to you through the API are left out, so `versions` is empty when none of a template's published versions is runnable through this API. Templates shared with you by link, or published to Explore from another workspace, are not listed but can still be fetched and run by `template_id`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.templates.list( + cursor="cursor", + page_size=1, + versions_per_template=1, + search="search", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many templates to return per page. Lower than the run list's ceiling because each row expands its versions' input and output schemas. + +
+
+ +
+
+ +**versions_per_template:** `typing.Optional[int]` — How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + +
+
+ +
+
+ +**search:** `typing.Optional[str]` — Only return templates whose name or description contains this text. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.templates.get(...) -> TemplateSummary +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve one flows template, together with each runnable version's inputs and outputs. `versions` is empty when no published version is runnable through this API. Works for any template you can open, including templates shared with you by link or published to Explore from another workspace, which `GET /v1/flows/templates` does not list. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.templates.get( + template_id="template_id", + versions_per_template=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**template_id:** `str` — The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + +
+
+ +
+
+ +**versions_per_template:** `typing.Optional[int]` — How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Flows Templates Runs +
client.flows.templates.runs.list(...) -> TemplateRunListResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List this template's runs created through this API, newest first. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.templates.runs.list( + template_id="template_id", + cursor="cursor", + page_size=1, + version_id="version_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**template_id:** `str` — The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many runs to return per page. + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — Only return runs of this template version id. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.templates.runs.create(...) -> TemplateRunResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Start a run of a flows template. Pass `version_id` to pin a snapshot, or omit it / pass `latest` to run the latest published version. Set input values under `inputs`, keyed by input port id. The response is the run in its initial state, with every output already listed under its port id in `outputs`. Include `webhook` to receive a `flows_template_run` event carrying the finished run once its `status` is `completed` or `failed`; this is the recommended way to wait. Without one, fetch `GET /v1/flows/templates/{template_id}/runs/{run_id}` at a modest interval until the `status` is terminal. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.templates.runs.create( + template_id="template_id", + inputs={ + "prompt": "a corgi on a surfboard", + "reference": { + "type": "asset", + "asset_id": "5xM2KqOnZyce22SPZ9d4" + } + }, + version_id="latest", + webhook={ + "type": "all" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**template_id:** `str` — The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + +
+
+ +
+
+ +**inputs:** `typing.Dict[str, TemplateRunInput]` — Input values keyed by input port id. Every input port of the version being run must be given; a missing or unknown id is rejected. Pass `{}` for a template with no inputs. + +
+
+ +
+
+ +**version_id:** `typing.Optional[str]` — The template snapshot to run. Pass a specific version id to pin that snapshot, or `latest` (the default when omitted) to run the template's most recently published version. Only published versions can be pinned, except by the template's owner, who may also pin an unpublished saved snapshot to try it out before publishing. The live draft is never run through this API. + +
+
+ +
+
+ +**webhook:** `typing.Optional[WebhookTarget]` — Include to send the run's result to the workspace's configured flows webhooks once the run's `status` reaches `completed` or `failed`. One event for the whole run: the `flows_template_run` event's `data` matches the terminal response of `GET /v1/flows/templates/{template_id}/runs/{run_id}`. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.flows.templates.runs.get(...) -> TemplateRunResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a template run: its `status`, rolled up from its outputs, and each output's own status and download URL once completed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.flows.templates.runs.get( + template_id="template_id", + run_id="run_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**template_id:** `str` — The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + +
+
+ +
+
+ +**run_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Music CompositionPlan +
client.music.composition_plan.create(...) -> CompositionPlanCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.composition_plan.create( + enable_logging=True, + prompt="prompt", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**prompt:** `str` — A simple text prompt to compose a plan from. + +
+
+ +
+
+ +**enable_logging:** `typing.Optional[bool]` — When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + +
+
+ +
+
+ +**music_length_ms:** `typing.Optional[int]` — The length of the composition plan to generate in milliseconds. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + +
+
+ +
+
+ +**source_composition_plan:** `typing.Optional[BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan]` — An optional composition plan to use as a source for the new composition plan. + +
+
+ +
+
+ +**model_id:** `typing.Optional[MusicModelId]` — The model to use for the generation. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Music Finetunes +
client.music.finetunes.list(...) -> MusicFinetunePageResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +List music finetunes accessible to you (your own, workspace-shared, and ElevenLabs-curated), with optional filtering, sorting, and cursor pagination. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.finetunes.list( + cursor="cursor", + page_size=1, + visibility="private", + created_by="self", + sort="created_at", + sort_direction="asc", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Used for fetching the next page. Cursor is returned in the response. + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — How many finetunes to return. Max 150, default 50. + +
+
+ +
+
+ +**visibility:** `typing.Optional[FinetuneVisibility]` — Filter by visibility. 'private' returns private finetunes; 'workspace' returns workspace-shared finetunes; 'public' returns public finetunes, which are currently ElevenLabs curated finetunes. Omit to return all accessible finetunes. + +
+
+ +
+
+ +**created_by:** `typing.Optional[FinetuneCreatedBy]` — Filter by creator. 'self' returns finetunes you created; 'workspace' returns finetunes created by workspace teammates; 'elevenlabs' returns ElevenLabs curated finetunes. Omit to return finetunes from all creators. + +
+
+ +
+
+ +**sort:** `typing.Optional[FinetunesListRequestSort]` — Sort by field (created_at or name) + +
+
+ +
+
+ +**sort_direction:** `typing.Optional[FinetunesListRequestSortDirection]` — Sort direction (asc or desc) + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.finetunes.create(...) -> MusicFinetuneResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new music finetune +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.finetunes.create( + files=["example_files"], + name="name", + primary_genre="primary_genre", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — Name for the finetune (5-200 characters). + +
+
+ +
+
+ +**primary_genre:** `str` — Primary musical genre of the finetune. + +
+
+ +
+
+ +**files:** `typing.Optional[typing.List[core.File]]` — Audio files to train on. + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.List[str]]` — Tags to associate with the finetune. + +
+
+ +
+
+ +**visibility:** `typing.Optional[FinetunesCreateRequestVisibility]` — Finetune visibility. Only 'private' and 'workspace' can be set. + +
+
+ +
+
+ +**model_id:** `typing.Optional[MusicModelId]` — The model to create a finetune for. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.finetunes.get(...) -> MusicFinetuneResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get a music finetune. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.finetunes.get( + finetune_id="finetune_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**finetune_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.finetunes.delete(...) -> MusicFinetuneResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a music finetune +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.finetunes.delete( + finetune_id="finetune_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**finetune_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.music.finetunes.update(...) -> MusicFinetuneResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a music finetune. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.music.finetunes.update( + finetune_id="finetune_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**finetune_id:** `str` + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — Updated name for the finetune. + +
+
+ +
+
+ +**tags:** `typing.Optional[typing.List[str]]` — Replacement set of tags. + +
+
+ +
+
+ +**primary_genre:** `typing.Optional[str]` — Updated primary musical genre. + +
+
+ +
+
+ +**visibility:** `typing.Optional[UpdateMusicFinetuneRequestModelVisibility]` — Finetune visibility. Only 'private' and 'workspace' can be set. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Productions Orders +
client.productions.orders.list(...) -> ListOrdersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists Productions orders in the workspace. Supports filtering by status and date range, with pagination. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment +import datetime + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.list( + page_size=1, + offset=1, + status=[ + "open" + ], + start_date=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), + end_date=datetime.datetime.fromisoformat("2024-01-15T09:30:00+00:00"), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**page_size:** `typing.Optional[int]` — Maximum number of orders to return per page. + +
+
+ +
+
+ +**offset:** `typing.Optional[int]` — Number of orders to skip for pagination. + +
+
+ +
+
+ +**status:** `typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]]` — Filter orders by one or more statuses. + +
+
+ +
+
+ +**start_date:** `typing.Optional[datetime.datetime]` — Filter orders created on or after this date. + +
+
+ +
+
+ +**end_date:** `typing.Optional[datetime.datetime]` — Filter orders created on or before this date. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.productions.orders.create(...) -> CreateOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new Productions order in the workspace. The order starts in the open state and can be configured with items before submission. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, CreateOrderRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.create( + request=CreateOrderRequest( + sandbox=False, + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Optional[CreateOrderRequest]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.productions.orders.get(...) -> OrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves full details for a Productions order. + +Quote and pricing information may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until it is ready. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.get( + order_id="order_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_id:** `OrderId` — The ID of the order. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.productions.orders.update(...) -> UpdateOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates an open order. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, UpdateOrderRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.update( + order_id="order_id", + request=UpdateOrderRequest( + name="Spanish Dubs", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_id:** `OrderId` — The ID of the order. + +
+
+ +
+
+ +**request:** `UpdateOrderRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.productions.orders.submit(...) -> SubmitOrderResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Submits an open order for processing. The order must have at least one item. Once submitted, items can no longer be modified. + +Upon submission, the workspace will be charged for the order. The quote is based on information extracted from the uploaded media, such as its duration. The quote may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until the quote is ready. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.submit( + order_id="order_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_id:** `OrderId` — The ID of the order. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Productions Orders Media +
client.productions.orders.media.register(...) -> RegisterMediaResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Registers a media file with an order, either by uploading it directly or by providing a URL to fetch it from. Exactly one of `media` or `media_url` must be provided. The registered media can then be referenced when adding order items. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.media.register( + order_id="order_id", + media="example_media", + declared_language="declared_language", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_id:** `OrderId` — The ID of the order to which this media will be attached. + +
+
+ +
+
+ +**declared_language:** `str` — The language code of the media content (e.g. 'en', 'es-ES'). Must be a supported source language for some order item kind. + +
+
+ +
+
+ +**media:** `typing.Optional[core.File]` — The media file to upload. Mutually exclusive with media_url. + +
+
+ +
+
+ +**media_url:** `typing.Optional[str]` — A URL to fetch the media file from. Mutually exclusive with media. + +
+
+ +
+
+ +**media_url_filename:** `typing.Optional[str]` — The filename for URL-sourced media (e.g. 'example.mp4'). Required when using media_url. + +
+
+ +
+
+ +**media_url_content_type:** `typing.Optional[str]` — The MIME type for URL-sourced media (e.g. 'video/mp4'). Required when using media_url. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.productions.orders.media.get(...) -> OrderMediaResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves metadata and a time-limited download URL for a previously uploaded media file. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.media.get( + order_id="order_id", + media_id="media_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_id:** `OrderId` — The ID of the order. + +
+
+ +
+
+ +**media_id:** `MediaId` — The ID of the media file. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Productions Orders Items +
client.productions.orders.items.upsert(...) -> UpsertOrderItemResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds or updates an order item on an open order. Returns the item ID and the quoted price. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, UpsertOrderItemRequest +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.items.upsert( + order_id="order_id", + request=UpsertOrderItemRequest( + item={ + "kind": "dub", + "media_id": "prodmedia_01jgatk6h0fwxrtbjade61yqhx", + "source_language": "en", + "destination_languages": [ + "hi", + "fr-FR", + "de" + ], + "include_captions": True, + "include_source_captions": False, + "instructions": "Voices don\'t need to match the originals, prioritize native-sounding voices", + "captions_sdh": False + }, + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_id:** `OrderId` — The ID of the order. + +
+
+ +
+
+ +**request:** `UpsertOrderItemRequest` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.productions.orders.items.remove(...) -> RemoveOrderItemResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes an order item from an open order. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.items.remove( + order_id="order_id", + item_id="item_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_id:** `OrderId` — The ID of the order. + +
+
+ +
+
+ +**item_id:** `ItemId` — The ID of the order item. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Productions Orders Deliverables +
client.productions.orders.deliverables.list(...) -> OrderDeliverablesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves the delivered files for a completed order. Returns an empty list if the order is not yet completed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.deliverables.list( + order_id="order_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_id:** `OrderId` — The ID of the order. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Productions Orders Languages +
client.productions.orders.languages.list(...) -> LanguagesResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the available languages for a given order item kind. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.productions.orders.languages.list( + order_item_kind="dub", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**order_item_kind:** `OrderItemKind` — The kind of order item. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## PronunciationDictionaries Rules +
client.pronunciation_dictionaries.rules.set(...) -> PronunciationDictionaryRulesResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Replaces all existing rules on the pronunciation dictionary with the provided ones. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.rules.set( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rules=[ + { + "type": "alias", + "string_to_replace": "Thailand", + "case_sensitive": True, + "word_boundaries": True, + "alias": "tie-land" + } + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pronunciation_dictionary_id:** `str` — The id of the pronunciation dictionary + +
+
+ +
+
+ +**rules:** `typing.List[BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem]` + +List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.pronunciation_dictionaries.rules.add(...) -> PronunciationDictionaryRulesResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add rules to the pronunciation dictionary. If a rule with the same string_to_replace already exists, it will be replaced. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.rules.add( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rules=[ + { + "type": "alias", + "string_to_replace": "Thailand", + "case_sensitive": True, + "word_boundaries": True, + "alias": "tie-land" + } + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pronunciation_dictionary_id:** `str` — The id of the pronunciation dictionary + +
+
+ +
+
+ +**rules:** `typing.List[PronunciationDictionaryRule]` + +List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.pronunciation_dictionaries.rules.remove(...) -> PronunciationDictionaryRulesResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Remove rules from the pronunciation dictionary +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.pronunciation_dictionaries.rules.remove( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rule_strings=[ + "rule_strings" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**pronunciation_dictionary_id:** `str` — The id of the pronunciation dictionary + +
+
+ +
+
+ +**rule_strings:** `typing.List[str]` — List of strings to remove from the pronunciation dictionary. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ServiceAccounts ApiKeys +
client.service_accounts.api_keys.list(...) -> WorkspaceApiKeyListResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all API keys for a service account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.service_accounts.api_keys.list( + service_account_user_id="service_account_user_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**service_account_user_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.service_accounts.api_keys.create(...) -> WorkspaceCreateApiKeyResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new API key for a service account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.service_accounts.api_keys.create( + service_account_user_id="service_account_user_id", + name="name", + permissions="all", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**service_account_user_id:** `str` + +
+
+ +
+
+ +**name:** `str` + +
+
+ +
+
+ +**permissions:** `BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions` — The permissions of the XI API. + +
+
+ +
+
+ +**character_limit:** `typing.Optional[int]` — The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + +
+
+ +
+
+ +**allowed_ips:** `typing.Optional[typing.List[str]]` — List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + +
+
+ +
+
+ +**third_party_disable_allowed:** `typing.Optional[bool]` — Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + +
+
+ +
+
+ +**tts_concurrency_limit:** `typing.Optional[int]` — Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + +
+
+ +
+
+ +**dubbing_concurrency_limit:** `typing.Optional[int]` — Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + +
+
+ +
+
+ +**music_concurrency_limit:** `typing.Optional[int]` — Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.service_accounts.api_keys.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete an existing API key for a service account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.service_accounts.api_keys.delete( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**service_account_user_id:** `str` + +
+
+ +
+
+ +**api_key_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.service_accounts.api_keys.update(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update an existing API key for a service account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.service_accounts.api_keys.update( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**service_account_user_id:** `str` + +
+
+ +
+
+ +**api_key_id:** `str` + +
+
+ +
+
+ +**is_enabled:** `typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled]` — Whether to enable or disable the API key. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — The name of the XI API key to use (used for identification purposes only). + +
+
+ +
+
+ +**permissions:** `typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions]` — The permissions of the XI API. + +
+
+ +
+
+ +**character_limit:** `typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit]` — The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + +
+
+ +
+
+ +**allowed_ips:** `typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps]` — List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + +
+
+ +
+
+ +**third_party_disable_allowed:** `typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed]` — Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + +
+
+ +
+
+ +**tts_concurrency_limit:** `typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit]` — Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + +
+
+ +
+
+ +**dubbing_concurrency_limit:** `typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit]` — Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + +
+
+ +
+
+ +**music_concurrency_limit:** `typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit]` — Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.service_accounts.api_keys.disable(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Disable an existing API key for a service account without changing its other settings. This stays available after a workspace downgrades off a plan that includes service accounts. Turning the key back on still requires that plan. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.service_accounts.api_keys.disable( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**service_account_user_id:** `str` + +
+
+ +
+
+ +**api_key_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## SpeechToText Transcripts +
client.speech_to_text.transcripts.get(...) -> TranscriptsGetResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve a previously generated transcript by its ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_to_text.transcripts.get( + transcription_id="transcription_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**transcription_id:** `str` — The unique ID of the transcript to retrieve + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.speech_to_text.transcripts.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a previously generated transcript by its ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.speech_to_text.transcripts.delete( + transcription_id="transcription_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**transcription_id:** `str` — The unique ID of the transcript to delete + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Studio Projects +
client.studio.projects.list() -> GetProjectsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of your Studio projects with metadata. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.create(...) -> AddProjectResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new Studio project, it can be either initialized as blank, from a document or from a URL. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.create( + from_document="example_from_document", + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — The name of the Studio project, used for identification only. + +
+
+ +
+
+ +**default_title_voice_id:** `typing.Optional[str]` — The voice_id that corresponds to the default voice used for new titles. + +
+
+ +
+
+ +**default_paragraph_voice_id:** `typing.Optional[str]` — The voice_id that corresponds to the default voice used for new paragraphs. + +
+
+ +
+
+ +**default_model_id:** `typing.Optional[str]` — The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + +
+
+ +
+
+ +**from_url:** `typing.Optional[str]` — An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + +
+
+ +
+
+ +**from_document:** `typing.Optional[core.File]` — An optional .epub, .pdf, .txt or similar file can be provided. If provided, we will initialize the Studio project with its content. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + +
+
+ +
+
+ +**from_content_json:** `typing.Optional[str]` + + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + +
+
+ +
+
+ +**quality_preset:** `typing.Optional[QualityPresetType]` + +Output quality of the generated audio. Must be one of: +'standard' - standard output format, 128kbps with 44.1kHz sample rate. +'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. +'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. +'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. +If not provided, defaults to the highest quality preset available on your subscription tier. + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + +
+
+ +
+
+ +**author:** `typing.Optional[str]` — An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — An optional description of the Studio project. + +
+
+ +
+
+ +**genres:** `typing.Optional[typing.List[str]]` — An optional list of genres associated with the Studio project. + +
+
+ +
+
+ +**target_audience:** `typing.Optional[ProjectsCreateRequestTargetAudience]` — An optional target audience of the Studio project. + +
+
+ +
+
+ +**language:** `typing.Optional[str]` — An optional language of the Studio project. Two-letter language code (ISO 639-1). + +
+
+ +
+
+ +**content_type:** `typing.Optional[str]` — An optional content type of the Studio project. + +
+
+ +
+
+ +**original_publication_date:** `typing.Optional[str]` — An optional original publication date of the Studio project, in the format YYYY-MM-DD or YYYY. + +
+
+ +
+
+ +**mature_content:** `typing.Optional[bool]` — An optional specification of whether this Studio project contains mature content. + +
+
+ +
+
+ +**isbn_number:** `typing.Optional[str]` — An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + +
+
+ +
+
+ +**acx_volume_normalization:** `typing.Optional[bool]` — [Deprecated] When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + +
+
+ +
+
+ +**volume_normalization:** `typing.Optional[bool]` — When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.Optional[typing.List[str]]` — A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"Vmd4Zor6fplcA7WrINey\",\"version_id\":\"hRPaxjlTdR7wFMhV4w0b\"}"' --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"JzWtcGQMJ6bnlWwyMo7e\",\"version_id\":\"lbmwxiLu4q6txYxgdZqn\"}"'. + +
+
+ +
+
+ +**callback_url:** `typing.Optional[str]` + + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + +
+
+ +
+
+ +**fiction:** `typing.Optional[ProjectsCreateRequestFiction]` — An optional specification of whether the content of this Studio project is fiction. + +
+
+ +
+
+ +**apply_text_normalization:** `typing.Optional[ProjectsCreateRequestApplyTextNormalization]` + + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + +
+
+ +
+
+ +**auto_convert:** `typing.Optional[bool]` — Whether to auto convert the Studio project to audio or not. + +
+
+ +
+
+ +**auto_assign_voices:** `typing.Optional[bool]` — [Alpha Feature] Whether automatically assign voices to phrases in the create Project. + +
+
+ +
+
+ +**source_type:** `typing.Optional[ProjectsCreateRequestSourceType]` — The type of Studio project to create. + +
+
+ +
+
+ +**voice_settings:** `typing.Optional[typing.List[str]]` + + Optional voice settings overrides for the project, encoded as a list of JSON strings. + + Example: + ["{\"voice_id\": \"21m00Tcm4TlvDq8ikWAM\", \"stability\": 0.7, \"similarity_boost\": 0.8, \"style\": 0.5, \"speed\": 1.0, \"use_speaker_boost\": true}"] + + +
+
+ +
+
+ +**create_publishing_read:** `typing.Optional[bool]` — If true, creates a corresponding read for direct publishing in draft state + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.get(...) -> ProjectExtendedResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns information about a specific Studio project. This endpoint returns more detailed information about a project than `GET /v1/studio`. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.get( + project_id="21m00Tcm4TlvDq8ikWAM", + share_id="share_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**share_id:** `typing.Optional[str]` — The share ID of the project + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.update(...) -> EditProjectResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the specified Studio project by setting the values of the parameters passed. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.update( + project_id="21m00Tcm4TlvDq8ikWAM", + name="Project 1", + default_title_voice_id="21m00Tcm4TlvDq8ikWAM", + default_paragraph_voice_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**name:** `str` — The name of the Studio project, used for identification only. + +
+
+ +
+
+ +**default_title_voice_id:** `str` — The voice_id that corresponds to the default voice used for new titles. + +
+
+ +
+
+ +**default_paragraph_voice_id:** `str` — The voice_id that corresponds to the default voice used for new paragraphs. + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + +
+
+ +
+
+ +**author:** `typing.Optional[str]` — An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + +
+
+ +
+
+ +**isbn_number:** `typing.Optional[str]` — An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + +
+
+ +
+
+ +**volume_normalization:** `typing.Optional[bool]` — When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.delete(...) -> DeleteProjectResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a Studio project. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.delete( + project_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.convert(...) -> ConvertProjectResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Starts conversion of a Studio project and all of its chapters. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.convert( + project_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.get_muted_tracks(...) -> ProjectMutedTracksResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of chapter IDs that have muted tracks in a project. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.get_muted_tracks( + project_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the Studio project. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Studio Projects PronunciationDictionaries +
client.studio.projects.pronunciation_dictionaries.create(...) -> CreatePronunciationDictionaryResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, PronunciationDictionaryVersionLocator +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.pronunciation_dictionaries.create( + project_id="21m00Tcm4TlvDq8ikWAM", + pronunciation_dictionary_locators=[ + PronunciationDictionaryVersionLocator( + pronunciation_dictionary_id="pronunciation_dictionary_id", + version_id=, + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**pronunciation_dictionary_locators:** `typing.List[PronunciationDictionaryVersionLocator]` — A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"Vmd4Zor6fplcA7WrINey\",\"version_id\":\"hRPaxjlTdR7wFMhV4w0b\"}"' --form 'pronunciation_dictionary_locators="{\"pronunciation_dictionary_id\":\"JzWtcGQMJ6bnlWwyMo7e\",\"version_id\":\"lbmwxiLu4q6txYxgdZqn\"}"'. + +
+
+ +
+
+ +**invalidate_affected_text:** `typing.Optional[bool]` — This will automatically mark text in this project for reconversion when the new dictionary applies or the old one no longer does. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Studio Projects Content +
client.studio.projects.content.update(...) -> EditProjectResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates Studio project content. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.content.update( + project_id="21m00Tcm4TlvDq8ikWAM", + from_document="example_from_document", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**from_url:** `typing.Optional[str]` — An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + +
+
+ +
+
+ +**from_document:** `typing.Optional[core.File]` — An optional .epub, .pdf, .txt or similar file can be provided. If provided, we will initialize the Studio project with its content. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + +
+
+ +
+
+ +**from_content_json:** `typing.Optional[str]` + + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + +
+
+ +
+
+ +**auto_convert:** `typing.Optional[bool]` — Whether to auto convert the Studio project to audio or not. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Studio Projects Snapshots +
client.studio.projects.snapshots.list(...) -> ProjectSnapshotsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves a list of snapshots for a Studio project. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.snapshots.list( + project_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the Studio project. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.snapshots.get(...) -> ProjectSnapshotExtendedResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the project snapshot. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.snapshots.get( + project_id="21m00Tcm4TlvDq8ikWAM", + project_snapshot_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the Studio project. + +
+
+ +
+
+ +**project_snapshot_id:** `str` — The ID of the Studio project snapshot. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.snapshots.stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Stream the audio from a Studio project snapshot. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.snapshots.stream( + project_id="project_id", + project_snapshot_id="project_snapshot_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**project_snapshot_id:** `str` — The ID of the Studio project snapshot. + +
+
+ +
+
+ +**convert_to_mpeg:** `typing.Optional[bool]` — Whether to convert the audio to mpeg format. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.snapshots.stream_archive(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a compressed archive of the Studio project's audio. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.snapshots.stream_archive( + project_id="project_id", + project_snapshot_id="project_snapshot_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**project_snapshot_id:** `str` — The ID of the Studio project snapshot. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Studio Projects Chapters +
client.studio.projects.chapters.list(...) -> GetChaptersResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of a Studio project's chapters. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.list( + project_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the Studio project. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.chapters.create(...) -> AddChapterResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new chapter either as blank or from a URL. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.create( + project_id="21m00Tcm4TlvDq8ikWAM", + name="Chapter 1", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the Studio project. + +
+
+ +
+
+ +**name:** `str` — The name of the chapter, used for identification only. + +
+
+ +
+
+ +**from_url:** `typing.Optional[str]` — An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.chapters.get(...) -> ChapterWithContentResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns information about a specific chapter. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.get( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**chapter_id:** `str` — The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.chapters.update(...) -> EditChapterResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates a chapter. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.update( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**chapter_id:** `str` — The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — The name of the chapter, used for identification only. + +
+
+ +
+
+ +**content:** `typing.Optional[ChapterContentInputModel]` — The chapter content to use. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.chapters.delete(...) -> DeleteChapterResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a chapter. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.delete( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**chapter_id:** `str` — The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.chapters.convert(...) -> ConvertChapterResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Starts conversion of a specific chapter. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.convert( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**chapter_id:** `str` — The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Studio Projects Chapters Snapshots +
client.studio.projects.chapters.snapshots.list(...) -> ChapterSnapshotsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets information about all the snapshots of a chapter. Each snapshot can be downloaded as audio. Whenever a chapter is converted a snapshot will automatically be created. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.snapshots.list( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**chapter_id:** `str` — The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.chapters.snapshots.get(...) -> ChapterSnapshotExtendedResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the chapter snapshot. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.snapshots.get( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + chapter_snapshot_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the Studio project. + +
+
+ +
+
+ +**chapter_id:** `str` — The ID of the chapter. + +
+
+ +
+
+ +**chapter_snapshot_id:** `str` — The ID of the chapter snapshot. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.studio.projects.chapters.snapshots.stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Stream the audio from a chapter snapshot. Use `GET /v1/studio/projects/{project_id}/chapters/{chapter_id}/snapshots` to return the snapshots of a chapter. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.studio.projects.chapters.snapshots.stream( + project_id="project_id", + chapter_id="chapter_id", + chapter_snapshot_id="chapter_snapshot_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**project_id:** `str` — The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + +
+
+ +
+
+ +**chapter_id:** `str` — The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + +
+
+ +
+
+ +**chapter_snapshot_id:** `str` — The ID of the chapter snapshot to be used. You can use the [List project chapter snapshots](/docs/api-reference/studio/get-snapshots) endpoint to list all the available snapshots. + +
+
+ +
+
+ +**convert_to_mpeg:** `typing.Optional[bool]` — Whether to convert the audio to mpeg format. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## TextToVoice Preview +
client.text_to_voice.preview.stream(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Stream a voice preview that was created via the /v1/text-to-voice/design endpoint. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.text_to_voice.preview.stream( + generated_voice_id="generated_voice_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**generated_voice_id:** `str` — The generated_voice_id to stream. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Tokens SingleUse +
client.tokens.single_use.create(...) -> SingleUseTokenResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Generate a time limited single-use token with embedded authentication for frontend clients. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.tokens.single_use.create( + token_type="realtime_scribe", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**token_type:** `SingleUseTokenType` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## User Subscription +
client.user.subscription.get() -> Subscription +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets extended information about the users subscription +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.user.subscription.get() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Collections +
client.voices.collections.list() -> GetUserVoiceCollectionsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns all the voice collections the user has access to, sorted by title. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.collections.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.collections.create(...) -> UserVoiceCollectionResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new voice collection. The caller becomes its admin. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.collections.create( + title="title", + icon="icon", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**title:** `str` — Title of the collection to create/update. + +
+
+ +
+
+ +**icon:** `str` — Icon of the collection to create/update. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.collections.get(...) -> UserVoiceCollectionResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a voice collection the user has access to. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.collections.get( + collection_id="collection_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collection_id:** `str` — Collection ID. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.collections.delete(...) -> DeleteUserVoiceCollectionResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Deletes a voice collection. The voices in it are not deleted. Requires admin access to the collection. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.collections.delete( + collection_id="collection_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collection_id:** `str` — Collection ID. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.collections.update(...) -> UserVoiceCollectionResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates the title and icon of a voice collection. Fields that are omitted are left unchanged. Requires editor access to the collection. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.collections.update( + collection_id="collection_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collection_id:** `str` — Collection ID. + +
+
+ +
+
+ +**title:** `typing.Optional[str]` — Title of the collection to create/update. + +
+
+ +
+
+ +**icon:** `typing.Optional[str]` — Icon of the collection to create/update. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.collections.add_voice(...) -> AddVoiceToUserVoiceCollectionResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds a voice to a voice collection. Adding a voice that is already in the collection succeeds without changes. Requires editor access to the collection. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.collections.add_voice( + collection_id="collection_id", + voice_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collection_id:** `str` — Collection ID. + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.collections.remove_voice(...) -> RemoveVoiceFromUserVoiceCollectionResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes a voice from a voice collection. The voice itself is not deleted. Requires editor access to the collection. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.collections.remove_voice( + collection_id="collection_id", + voice_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**collection_id:** `str` — Collection ID. + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Settings +
client.voices.settings.get_default() -> VoiceSettings +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.settings.get_default() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.settings.get(...) -> VoiceSettings +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.settings.get( + voice_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.settings.update(...) -> EditVoiceSettingsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit your settings for a specific voice. "similarity_boost" corresponds to "Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs, VoiceSettings +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.settings.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + request=VoiceSettings( + stability=1, + use_speaker_boost=True, + similarity_boost=1, + style=0, + speed=1, + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**request:** `VoiceSettings` — The settings for a specific voice. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Accents +
client.voices.accents.get(...) -> GetVoiceAccentsResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets the list of available accents in the shared voice library. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.accents.get( + language="language", + model_id="model_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**language:** `typing.Optional[str]` — If provided, only accents for this language code are returned. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — If provided, returns the accents available for this model. Defaults to the most complete accent list when omitted. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Ivc +
client.voices.ivc.create(...) -> AddVoiceIvcResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a voice clone and add it to your Voices +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.ivc.create( + files=["example_files"], + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — The name that identifies this voice. This will be displayed in the dropdown of the website. + +
+
+ +
+
+ +**files:** `typing.List[core.File]` — A list of file paths to audio recordings intended for voice cloning. + +
+
+ +
+
+ +**remove_background_noise:** `typing.Optional[bool]` — If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — A description of the voice. + +
+
+ +
+
+ +**labels:** `typing.Optional[AddVoiceRequestLabels]` — Labels for the voice. Keys can be language, accent, gender, or age. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Pvc +
client.voices.pvc.create(...) -> AddVoiceResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Creates a new PVC voice with metadata but no samples +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.create( + name="John Smith", + language="en", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — The name that identifies this voice. This will be displayed in the dropdown of the website. + +
+
+ +
+
+ +**language:** `str` — Language used in the samples. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — Description to use for the created voice. + +
+
+ +
+
+ +**labels:** `typing.Optional[typing.Dict[str, typing.Optional[str]]]` — Labels for the voice. Keys can be language, accent, gender, or age. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.pvc.update(...) -> AddVoiceResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Edit PVC voice metadata +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.update( + voice_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**name:** `typing.Optional[str]` — The name that identifies this voice. This will be displayed in the dropdown of the website. + +
+
+ +
+
+ +**language:** `typing.Optional[str]` — Language used in the samples. + +
+
+ +
+
+ +**description:** `typing.Optional[str]` — Description to use for the created voice. + +
+
+ +
+
+ +**labels:** `typing.Optional[typing.Dict[str, typing.Optional[str]]]` — Labels for the voice. Keys can be language, accent, gender, or age. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.pvc.train(...) -> StartPvcVoiceTrainingResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Start PVC training process for a voice. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.train( + voice_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**model_id:** `typing.Optional[str]` — The model ID to use for the conversion. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Pvc Samples +
client.voices.pvc.samples.create(...) -> typing.List[VoiceSample] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Add audio samples to a PVC voice +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.samples.create( + voice_id="21m00Tcm4TlvDq8ikWAM", + files=["example_files"], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**files:** `typing.List[core.File]` — Audio files used to create the voice. + +
+
+ +
+
+ +**remove_background_noise:** `typing.Optional[bool]` — If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.pvc.samples.update(...) -> AddVoiceResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update a PVC voice sample - apply noise removal, select speaker, change trim times or file name. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.samples.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — Sample ID to be used + +
+
+ +
+
+ +**remove_background_noise:** `typing.Optional[bool]` — If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + +
+
+ +
+
+ +**selected_speaker_ids:** `typing.Optional[typing.List[str]]` — Speaker IDs to be used for PVC training. Make sure you send all the speaker IDs you want to use for PVC training in one request because the last request will override the previous ones. + +
+
+ +
+
+ +**trim_start_time:** `typing.Optional[int]` — The start time of the audio to be used for PVC training. Time should be in milliseconds + +
+
+ +
+
+ +**trim_end_time:** `typing.Optional[int]` — The end time of the audio to be used for PVC training. Time should be in milliseconds + +
+
+ +
+
+ +**file_name:** `typing.Optional[str]` — The name of the audio file to be used for PVC training. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.pvc.samples.delete(...) -> DeleteVoiceSampleResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a sample from a PVC voice. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.samples.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — Sample ID to be used + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Pvc Verification +
client.voices.pvc.verification.request(...) -> RequestPvcManualVerificationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Request manual verification for a PVC voice. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.verification.request( + voice_id="21m00Tcm4TlvDq8ikWAM", + files=["example_files"], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**files:** `typing.List[core.File]` — Verification documents + +
+
+ +
+
+ +**extra_text:** `typing.Optional[str]` — Extra text to be used in the manual verification process. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Pvc Samples Audio +
client.voices.pvc.samples.audio.get(...) -> VoiceSamplePreviewResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the first 30 seconds of voice sample audio with or without noise removal. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.samples.audio.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + remove_background_noise=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — Sample ID to be used + +
+
+ +
+
+ +**remove_background_noise:** `typing.Optional[bool]` — If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Pvc Samples Waveform +
client.voices.pvc.samples.waveform.get(...) -> VoiceSampleVisualWaveformResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the visual waveform of a voice sample. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.samples.waveform.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — Sample ID to be used + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Pvc Samples Speakers +
client.voices.pvc.samples.speakers.get(...) -> SpeakerSeparationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the status of the speaker separation process and the list of detected speakers if complete. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.samples.speakers.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — Sample ID to be used + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.pvc.samples.speakers.separate(...) -> StartSpeakerSeparationResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Start speaker separation process for a sample +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.samples.speakers.separate( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — Sample ID to be used + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Pvc Samples Speakers Audio +
client.voices.pvc.samples.speakers.audio.get(...) -> SpeakerAudioResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the separated audio for a specific speaker. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.samples.speakers.audio.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + speaker_id="VW7YKqPnjY4h39yTbx2L", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — Sample ID to be used + +
+
+ +
+
+ +**speaker_id:** `str` — Speaker ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id}/samples/{sample_id}/speakers to list all the available speakers for a sample. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Pvc Verification Captcha +
client.voices.pvc.verification.captcha.get(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get captcha for PVC voice verification. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.verification.captcha.get( + voice_id="21m00Tcm4TlvDq8ikWAM", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.voices.pvc.verification.captcha.verify(...) -> VerifyPvcVoiceCaptchaResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Submit captcha verification for PVC voice. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.pvc.verification.captcha.verify( + voice_id="21m00Tcm4TlvDq8ikWAM", + recording="example_recording", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + +
+
+ +
+
+ +**recording:** `core.File` — Audio recording of the user + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Voices Samples Audio +
client.voices.samples.audio.get(...) -> typing.Iterator[bytes] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the audio corresponding to a sample attached to a voice. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.voices.samples.audio.get( + voice_id="voice_id", + sample_id="sample_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**voice_id:** `str` — ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + +
+
+ +
+
+ +**sample_id:** `str` — ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace AuditLogs +
client.workspace.audit_logs.list(...) -> WorkspaceAuditLogsPageResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the audit log for the workspace. Requires enterprise tier and the audit_log_read permission. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.audit_logs.list( + limit=1, + cursor="cursor", + time_from_unix_ms=1, + time_to_unix_ms=1, + actor_uid="actor_uid", + class_name="class_name", + activity_name="activity_name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` — Maximum number of entries per page + +
+
+ +
+
+ +**cursor:** `typing.Optional[str]` — Cursor for the next page (from previous response) + +
+
+ +
+
+ +**time_from_unix_ms:** `typing.Optional[int]` — Only include entries at or after this time (ms since epoch) + +
+
+ +
+
+ +**time_to_unix_ms:** `typing.Optional[int]` — Only include entries at or before this time (ms since epoch) + +
+
+ +
+
+ +**actor_uid:** `typing.Optional[str]` — Filter by actor user ID + +
+
+ +
+
+ +**class_name:** `typing.Optional[str]` — Filter by OCSF event class name (e.g. Account Change) + +
+
+ +
+
+ +**activity_name:** `typing.Optional[str]` — Filter by audit activity name (e.g. Subscription Creation) + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace AuthConnections +
client.workspace.auth_connections.list() -> ListAuthConnectionsResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all auth connections for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.auth_connections.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.auth_connections.create(...) -> AuthConnectionsCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create a new OAuth2 auth connection for the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.auth_connections.create( + request={ + "auth_type": "oauth2_client_credentials", + "name": "name", + "provider": "provider", + "client_id": "client_id", + "token_url": "token_url", + "client_secret": "client_secret" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `AuthConnectionsCreateRequestBody` — Auth connection to create + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.auth_connections.delete(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete an auth connection +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.auth_connections.delete( + auth_connection_id="auth_connection_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**auth_connection_id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.auth_connections.update(...) -> AuthConnectionsUpdateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Update an auth connection +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.auth_connections.update( + auth_connection_id="auth_connection_id", + request={ + "auth_type": "oauth2_client_credentials" + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**auth_connection_id:** `str` + +
+
+ +
+
+ +**request:** `AuthConnectionsUpdateRequestBody` — Updated auth connection fields + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace Groups +
client.workspace.groups.list() -> typing.Dict[str, WorkspaceGroupResponseModel] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get all groups in the workspace +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.groups.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.groups.search(...) -> typing.List[WorkspaceGroupByNameResponseModel] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Searches for user groups in the workspace. Multiple or no groups may be returned. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.groups.search( + name="name", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**name:** `str` — Name of the target group. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace Invites +
client.workspace.invites.create(...) -> AddWorkspaceInviteResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sends an email invitation to join your workspace to the provided email. If the user doesn't have an account they will be prompted to create one. If the user accepts this invite they will be added as a user to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. If the user is already in the workspace a 400 error will be returned. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.invites.create( + email="john.doe@testmail.com", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**email:** `str` — The email of the customer + +
+
+ +
+
+ +**workspace_permission:** `typing.Optional[str]` — The workspace permission of the user. This is deprecated, use `seat_type` instead. + +
+
+ +
+
+ +**seat_type:** `typing.Optional[SeatType]` — The seat type of the user + +
+
+ +
+
+ +**group_ids:** `typing.Optional[typing.List[str]]` — The group ids of the user + +
+
+ +
+
+ +**usage_limit:** `typing.Optional[int]` — Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.invites.create_batch(...) -> AddWorkspaceInviteResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Sends email invitations to join your workspace to the provided emails. Requires all email addresses to be part of a verified domain. If the users don't have an account they will be prompted to create one. If the users accept these invites they will be added as users to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.invites.create_batch( + emails=[ + "emails" + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**emails:** `typing.List[str]` — The email of the customer + +
+
+ +
+
+ +**seat_type:** `typing.Optional[SeatType]` — The seat type of the user + +
+
+ +
+
+ +**group_ids:** `typing.Optional[typing.List[str]]` — The group ids of the user + +
+
+ +
+
+ +**usage_limit:** `typing.Optional[int]` — Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.invites.delete(...) -> DeleteWorkspaceInviteResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Invalidates an existing email invitation. The invitation will still show up in the inbox it has been delivered to, but activating it to join the workspace won't work. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.invites.delete( + email="john.doe@testmail.com", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**email:** `str` — The email of the customer + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace Members +
client.workspace.members.list() -> typing.List[WorkspaceMemberResponseModel] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets a list of all members of the workspace, including locked members. Service accounts are excluded. Requires the workspace_members_read permission. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.members.list() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.members.update(...) -> UpdateWorkspaceMemberResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Updates attributes of a workspace member. Apart from the email identifier, all parameters will remain unchanged unless specified. This endpoint may only be called by workspace administrators. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.members.update( + email="email", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**email:** `str` — Email of the target user. + +
+
+ +
+
+ +**is_locked:** `typing.Optional[bool]` — Whether to lock or unlock the user account. + +
+
+ +
+
+ +**workspace_role:** `typing.Optional[SeatType]` — The workspace role of the user. This is deprecated, use `workspace_seat_type` instead. + +
+
+ +
+
+ +**workspace_seat_type:** `typing.Optional[SeatType]` — The workspace seat type + +
+
+ +
+
+ +**allow_downgrade_to_basic_seat:** `typing.Optional[bool]` — When unlocking a user whose original seat type has no seats available but a basic seat is available, downgrade the user to a basic seat instead of failing. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace Resources +
client.workspace.resources.get(...) -> ResourceMetadataResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Gets the metadata of a resource by ID. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.resources.get( + resource_id="resource_id", + resource_type="voice", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resource_id:** `str` — The ID of the target resource. + +
+
+ +
+
+ +**resource_type:** `WorkspaceResourceType` — Resource type of the target resource. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.resources.share(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Grants a role (one of 'admin', 'editor', 'commenter', or 'viewer') on a workspace resource to a user, group, or workspace (service account) API key. This overrides any existing role the target has on the resource. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be shared with the service account associated with that key. You must have admin access to the resource to share it. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.resources.share( + resource_id="resource_id", + role="admin", + resource_type="voice", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resource_id:** `str` — The ID of the target resource. + +
+
+ +
+
+ +**role:** `BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole` — Role to grant to the target: one of 'admin', 'editor', 'commenter', or 'viewer'. + +
+
+ +
+
+ +**resource_type:** `WorkspaceResourceType` — Resource type of the target resource. + +
+
+ +
+
+ +**user_email:** `typing.Optional[str]` — The email of the user or service account. + +
+
+ +
+
+ +**group_id:** `typing.Optional[str]` — The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + +
+
+ +
+
+ +**workspace_api_key_id:** `typing.Optional[str]` — The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.resources.unshare(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes any existing role on a workspace resource from a user, group, or workspace (service account) API key. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be unshared from the service account associated with that key. You must have admin access to the resource to unshare it. You cannot remove permissions from the user who created the resource. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.resources.unshare( + resource_id="resource_id", + resource_type="voice", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**resource_id:** `str` — The ID of the target resource. + +
+
+ +
+
+ +**resource_type:** `WorkspaceResourceType` — Resource type of the target resource. + +
+
+ +
+
+ +**user_email:** `typing.Optional[str]` — The email of the user or service account. + +
+
+ +
+
+ +**group_id:** `typing.Optional[str]` — The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + +
+
+ +
+
+ +**workspace_api_key_id:** `typing.Optional[str]` — The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace Usage +
client.workspace.usage.get_usage_by_product_over_time(...) -> WorkspaceAnalyticsQueryResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns credit usage broken down by product type over time. The response is a tabular structure with columns, column_types, column_units, and rows. Some id columns also get a display-name column, such as user_label or voice_name, appended after the existing columns. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.usage.get_usage_by_product_over_time( + start_time=1, + end_time=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**start_time:** `int` — Start of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + +
+
+ +
+
+ +**end_time:** `int` — End of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + +
+
+ +
+
+ +**interval_seconds:** `typing.Optional[int]` — Bucket size in seconds. Each row in the response covers this many seconds of the selected time range. For example, pass 3600 for hourly buckets, 86400 for daily buckets, or 604800 for weekly buckets. Whether `time_zone` shifts bucket boundaries depends on this value: week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight; whole-day multiples that are not whole weeks (e.g. 86400) align to local midnight; whole-hour multiples up to 24 hours (e.g. 3600, 14400) align to local hour boundaries from midnight; sub-hour values and other sizes remain UTC-anchored regardless of `time_zone`. + +
+
+ +
+
+ +**group_by:** `typing.Optional[typing.List[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem]]` + +
+
+ +
+
+ +**filters:** `typing.Optional[typing.List[ColumnFilter]]` + +
+
+ +
+
+ +**time_zone:** `typing.Optional[str]` — IANA time zone identifier (e.g. 'America/New_York', 'Europe/London', 'UTC') used to align bucket boundaries for eligible `interval_seconds` values. Week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight. Whole-day multiples that are not whole weeks start at local midnight; whole-hour multiples up to 24 hours align to local hour boundaries from midnight. Sub-hour intervals and other bucket sizes remain UTC-anchored regardless of this setting. Defaults to UTC. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace Analytics Requests +
client.workspace.analytics.requests.get(...) -> WorkspaceAnalyticsQueryResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns a list of API requests. Supports filtering by time range, column filters, and search terms. At least one of start_time or end_time must be provided. An optional sort parameter controls timestamp ordering. Results are ordered by timestamp. Descending if end_time is used, ascending if start_time is used. The response is a tabular structure with columns, column_types, column_units, and rows. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.analytics.requests.get() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**start_time:** `typing.Optional[int]` — Start of the time range as a Unix timestamp in milliseconds. + +
+
+ +
+
+ +**end_time:** `typing.Optional[int]` — End of the time range as a Unix timestamp in milliseconds. + +
+
+ +
+
+ +**limit:** `typing.Optional[int]` + +
+
+ +
+
+ +**sort:** `typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort]` — Optional timestamp sort direction. If omitted, defaults to desc when end_time is provided, otherwise asc. + +
+
+ +
+
+ +**filters:** `typing.Optional[typing.List[ColumnFilter]]` + +
+
+ +
+
+ +**search:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspace Groups Members +
client.workspace.groups.members.remove(...) -> DeleteWorkspaceGroupMemberResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Removes a member from the specified group. Requires `group_members_manage` permission. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.groups.members.remove( + group_id="group_id", + email="email", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_id:** `str` — The ID of the target group. + +
+
+ +
+
+ +**email:** `str` — The email of the target workspace member. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.workspace.groups.members.add(...) -> AddWorkspaceGroupMemberResponseModel +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Adds a member of your workspace to the specified group. Requires `group_members_manage` permission. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspace.groups.members.add( + group_id="group_id", + email="email", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**group_id:** `str` — The ID of the target group. + +
+
+ +
+
+ +**email:** `str` — The email of the target workspace member. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Workspaces ApiKeys +
client.workspaces.api_keys.disable(...) -> typing.Any +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Disable the API key used to authenticate this request. Requires the query parameter `api_key_name=self` as an explicit confirmation. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from elevenlabs import ElevenLabs +from elevenlabs.environment import ElevenLabsEnvironment + +client = ElevenLabs( + environment=ElevenLabsEnvironment.PRODUCTION, +) + +client.workspaces.api_keys.disable( + api_key_name="self", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**api_key_name:** `str` — Must be set to `self` to disable the API key used to authenticate this request. Required as an explicit confirmation to avoid accidentally disabling the wrong key. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ diff --git a/data/requirements.txt b/data/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..7c41db0fa58230416e4f5fdb3e8ad289784f860e --- /dev/null +++ b/data/requirements.txt @@ -0,0 +1,7 @@ +httpx>=0.21.2 +pyaudio>=0.2.14 +pydantic>= 1.9.2 +pydantic-core>=2.18.2 +requests>=2.20 +typing_extensions>= 4.0.0 +websockets>=13.0 diff --git a/data/src/elevenlabs/__init__.py b/data/src/elevenlabs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9a57fd5c8dcd19c5a095351534cd4fe0b56adc39 --- /dev/null +++ b/data/src/elevenlabs/__init__.py @@ -0,0 +1,7710 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import sys +import typing +from importlib import import_module + +if sys.getrecursionlimit() < 10000: + sys.setrecursionlimit(10000) +if typing.TYPE_CHECKING: + from .types import ( + AccountChangeActivityId, + ActorModel, + AddChapterResponseModel, + AddKnowledgeBaseResponseModel, + AddProjectRequest, + AddProjectResponseModel, + AddPronunciationDictionaryResponseModel, + AddPronunciationDictionaryResponseModelPermissionOnResource, + AddSharingVoiceRequest, + AddVoiceIvcResponseModel, + AddVoiceResponseModel, + AddVoiceToUserVoiceCollectionResponseModel, + AddWorkspaceGroupMemberResponseModel, + AddWorkspaceInviteResponseModel, + AdditionalFormatResponseModel, + AdditionalFormats, + AdhocAgentConfigOverrideForTestRequestModel, + Age, + AgentAnalysisItemsInput, + AgentAnalysisItemsInputDataCollectionItem, + AgentAnalysisItemsInputDataCollectionItem_System, + AgentAnalysisItemsInputDataCollectionItem_User, + AgentAnalysisItemsInputEvaluationCriteriaItem, + AgentAnalysisItemsInputEvaluationCriteriaItem_System, + AgentAnalysisItemsInputEvaluationCriteriaItem_User, + AgentAnalysisItemsOutput, + AgentAnalysisItemsOutputDataCollectionItem, + AgentAnalysisItemsOutputDataCollectionItem_System, + AgentAnalysisItemsOutputDataCollectionItem_User, + AgentAnalysisItemsOutputEvaluationCriteriaItem, + AgentAnalysisItemsOutputEvaluationCriteriaItem_System, + AgentAnalysisItemsOutputEvaluationCriteriaItem_User, + AgentBranchBasicInfo, + AgentBranchResponse, + AgentBranchSummary, + AgentCallLimits, + AgentConfig, + AgentConfigApiModelWorkflowOverrideInput, + AgentConfigApiModelWorkflowOverrideOutput, + AgentConfigOverrideConfig, + AgentConfigOverrideInput, + AgentConfigOverrideOutput, + AgentConversationTicketIssueType, + AgentConversationTicketPriority, + AgentConversationTicketResponseModel, + AgentConversationTicketSortBy, + AgentConversationTicketSource, + AgentConversationTicketStatus, + AgentDefinitionSource, + AgentDeploymentHistoryItem, + AgentDeploymentPercentageStrategy, + AgentDeploymentRequest, + AgentDeploymentRequestItem, + AgentDeploymentResponse, + AgentDeploymentSource, + AgentFailureResponseExample, + AgentHoldAudioConfig, + AgentKnowledgeBaseRagChunkResponseModel, + AgentKnowledgeBaseRagQueryRequestModel, + AgentKnowledgeBaseRagQueryResponseModel, + AgentMergeProposalResponse, + AgentMergeProposalResponseOutcome, + AgentMergeProposalResponseOutcome_Closed, + AgentMergeProposalResponseOutcome_Merged, + AgentMergeProposalResponseOutcome_Open, + AgentMetadata, + AgentMetadataDbModel, + AgentMetadataResponseModel, + AgentPlatformSettingsRequestModel, + AgentPlatformSettingsResponseModel, + AgentQueueingConfig, + AgentResponsePayload, + AgentSimulatedChatTestResponseModel, + AgentSmbMetadata, + AgentSortBy, + AgentSuccessfulResponseExample, + AgentSummaryBatchSuccessfulResponseModel, + AgentSummaryResponseModel, + AgentTestEntityType, + AgentTestFolderPathSegmentResponseModel, + AgentTestingSettings, + AgentTopicResponseModel, + AgentTransferInput, + AgentTransferOp, + AgentTransferOpPop, + AgentTransferOpPush, + AgentTransferOpReplace, + AgentTransferOp_Pop, + AgentTransferOp_Push, + AgentTransferOp_Replace, + AgentTransferOutput, + AgentTrustContext, + AgentVersionMetadata, + AgentVersionParents, + AgentWorkflowRequestModel, + AgentWorkflowRequestModelNodesValue, + AgentWorkflowRequestModelNodesValue_End, + AgentWorkflowRequestModelNodesValue_OverrideAgent, + AgentWorkflowRequestModelNodesValue_PhoneNumber, + AgentWorkflowRequestModelNodesValue_Say, + AgentWorkflowRequestModelNodesValue_StandaloneAgent, + AgentWorkflowRequestModelNodesValue_Start, + AgentWorkflowRequestModelNodesValue_Tool, + AgentWorkflowRequestModelNodesValue_UpdateState, + AgentWorkflowResponseModel, + AgentWorkflowResponseModelNodesValue, + AgentWorkflowResponseModelNodesValue_End, + AgentWorkflowResponseModelNodesValue_OverrideAgent, + AgentWorkflowResponseModelNodesValue_PhoneNumber, + AgentWorkflowResponseModelNodesValue_Say, + AgentWorkflowResponseModelNodesValue_StandaloneAgent, + AgentWorkflowResponseModelNodesValue_Start, + AgentWorkflowResponseModelNodesValue_Tool, + AgentWorkflowResponseModelNodesValue_UpdateState, + AgentWorkspaceOverridesInput, + AgentWorkspaceOverridesOutput, + AlertingIntegrationNotifier, + AlertingIntegrationNotifierIntegrationType, + AlertingIntegrationNotifierResponse, + AlertingIntegrationNotifierResponseIntegrationType, + AlertingMonitorConfig, + AlertingPagerDutyNotifier, + AlertingPagerDutyNotifierResponse, + AlertingSettings, + AlertingSettingsNotifiersItem, + AlertingSettingsNotifiersItem_Integration, + AlertingSettingsNotifiersItem_Webhook, + AlertingSettingsResponse, + AlertingSettingsResponseNotifiersItem, + AlertingSettingsResponseNotifiersItem_Integration, + AlertingSettingsResponseNotifiersItem_Webhook, + AlertingSlackNotifier, + AlertingSlackNotifierResponse, + AlertingWebhookHeader, + AlertingWebhookMethod, + AlertingWebhookNotifier, + AlertingWebhookNotifierResponse, + AlertingWebhookSecretHeaderValue, + Alignment, + AllowedOutputFormats, + AllowedValues, + AllowlistItem, + AnalysisCharging, + AnalysisProperty, + AnalysisPropertyConstantValue, + AnalysisPropertyType, + AnalysisRunSnapshot, + AnalysisRunningTotal, + AnalysisScope, + AnalysisType, + ApiIntegrationOAuth2AuthCodeResponse, + ApiIntegrationOAuth2AuthCodeResponseScopeSeparator, + ApiIntegrationOAuth2CustomAppResponse, + ApiIntegrationOAuth2CustomAppResponseScopeSeparator, + ApiIntegrationWebhookOverrides, + ApiIntegrationWebhookOverridesRequestHeadersValue, + ApiIntegrationWebhookOverridesSchemaOverridesValue, + ApiIntegrationWebhookOverridesSchemaOverridesValue_Constant, + ApiIntegrationWebhookOverridesSchemaOverridesValue_DynamicVariable, + ApiIntegrationWebhookOverridesSchemaOverridesValue_Llm, + ApiIntegrationWebhookOverridesSchemaOverridesValue_Omit, + ApiIntegrationWebhookToolConfigInput, + ApiIntegrationWebhookToolConfigOutput, + ArchitectDispatchResponseModel, + ArrayJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInputItems, + ArrayJsonSchemaPropertyInputPropertyKind, + ArrayJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutputItems, + ArraySchema, + AsrConversationalConfig, + AsrConversationalConfigOverride, + AsrConversationalConfigOverrideConfig, + AsrConversationalConfigWorkflowOverride, + AsrInputFormat, + AsrProvider, + AsrQuality, + AssetListResponse, + AssetResponse, + AssetTranscription, + AssetTranscriptionData, + AssetTranscriptionStatus, + AssignableUserResponseModel, + AstAdditionOperatorNodeInput, + AstAdditionOperatorNodeOutput, + AstAndOperatorNodeInput, + AstAndOperatorNodeOutput, + AstBooleanNodeInput, + AstBooleanNodeOutput, + AstConditionalOperatorNodeInput, + AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeInput, + AstDivisionOperatorNodeOutput, + AstDynamicVariableNodeInput, + AstDynamicVariableNodeOutput, + AstEqualsOperatorNodeInput, + AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeInput, + AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeInput, + AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeInput, + AstMultiplicationOperatorNodeOutput, + AstNodeInput, + AstNodeInputLlm, + AstNodeInput_AddOperator, + AstNodeInput_AndOperator, + AstNodeInput_BooleanLiteral, + AstNodeInput_ConditionalOperator, + AstNodeInput_DivOperator, + AstNodeInput_DynamicVariable, + AstNodeInput_EqOperator, + AstNodeInput_GtOperator, + AstNodeInput_GteOperator, + AstNodeInput_Llm, + AstNodeInput_LtOperator, + AstNodeInput_LteOperator, + AstNodeInput_MulOperator, + AstNodeInput_NeqOperator, + AstNodeInput_NullLiteral, + AstNodeInput_NumberLiteral, + AstNodeInput_OrOperator, + AstNodeInput_StringLiteral, + AstNodeInput_SubOperator, + AstNodeOutput, + AstNodeOutput_AddOperator, + AstNodeOutput_AndOperator, + AstNodeOutput_BooleanLiteral, + AstNodeOutput_ConditionalOperator, + AstNodeOutput_DivOperator, + AstNodeOutput_DynamicVariable, + AstNodeOutput_EqOperator, + AstNodeOutput_GtOperator, + AstNodeOutput_GteOperator, + AstNodeOutput_Llm, + AstNodeOutput_LtOperator, + AstNodeOutput_LteOperator, + AstNodeOutput_MulOperator, + AstNodeOutput_NeqOperator, + AstNodeOutput_NullLiteral, + AstNodeOutput_NumberLiteral, + AstNodeOutput_OrOperator, + AstNodeOutput_StringLiteral, + AstNodeOutput_SubOperator, + AstNotEqualsOperatorNodeInput, + AstNotEqualsOperatorNodeOutput, + AstNullNodeInput, + AstNullNodeOutput, + AstNumberNodeInput, + AstNumberNodeInputValue, + AstNumberNodeOutput, + AstNumberNodeOutputValue, + AstOrOperatorNodeInput, + AstOrOperatorNodeOutput, + AstStringNodeInput, + AstStringNodeOutput, + AstSubtractionOperatorNodeInput, + AstSubtractionOperatorNodeOutput, + AstllmNodeInput, + AstllmNodeInputPrompt, + AstllmNodeInputValueSchema, + AstllmNodeOutput, + AsyncConversationMetadata, + AsyncConversationMetadataDeliveryStatus, + AttachedSystemDataCollectionRef, + AttachedSystemEvaluationRef, + AttachedTestModel, + AttachedUserDataCollectionRef, + AttachedUserEvaluationRef, + AudioAnalysis, + AudioAnalysisResult, + AudioAnalysisStatus, + AudioEffectsBackgroundNoiseResponseModel, + AudioEffectsCatalogResponseModel, + AudioEffectsEnvironmentResponseModel, + AudioEffectsFilterPresetResponseModel, + AudioFormatEnum, + AudioInputPacing, + AudioIsolationHistoryItemResponseModel, + AudioKeyMoment, + AudioNativeCreateProjectResponseModel, + AudioNativeEditContentResponseModel, + AudioNativeProjectSettingsResponseModel, + AudioNativeProjectSettingsResponseModelStatus, + AudioOutput, + AudioOutputMulti, + AudioRefChunk, + AudioReference, + AudioReference_Asset, + AudioReference_Generation, + AudioReference_InlineBase64, + AudioSchema, + AudioSegment, + AudioWithTimestampsAndVoiceSegmentsResponseModel, + AudioWithTimestampsResponse, + AuthConnectionDependencies, + AuthConnectionDependenciesMcpServersItem, + AuthConnectionDependenciesMcpServersItem_Available, + AuthConnectionDependenciesMcpServersItem_Unknown, + AuthConnectionDependenciesToolsItem, + AuthConnectionDependenciesToolsItem_Available, + AuthConnectionDependenciesToolsItem_Unknown, + AuthConnectionLocator, + AuthConnectionStatus, + AuthSettings, + AuthenticationActivityId, + AuthorizationMethod, + AutoGenerationMetadata, + AutoSyncInfo, + AvatarContextResponseModel, + BackgroundSoundConfig, + BackgroundSoundConfigWorkflowOverride, + BackgroundSoundPresetId, + BackgroundSoundSourceType, + BackupLlmDefault, + BackupLlmDisabled, + BackupLlmOverride, + BadRequestErrorBody, + BanReasonType, + BaseTurnConfig, + BasicAuthResponse, + BatchCallDetailedResponse, + BatchCallRecipientStatus, + BatchCallResponse, + BatchCallStatus, + BatchCallWhatsAppParams, + BatchCallingCampaignInformation, + BatchFailureResponseModel, + BearerAuthResponse, + BehaviorOverride, + BillingPeriod, + BooleanSchema, + BranchProtectionStatus, + BreakdownTypes, + BucketingStatus, + BuiltInToolsInput, + BuiltInToolsOutput, + BuiltInToolsWorkflowOverrideInput, + BuiltInToolsWorkflowOverrideOutput, + BytedanceSeedance25Request, + BytedanceSeedance25RequestAspectRatio, + BytedanceSeedance25RequestResolution, + BytedanceSeedance2FastRequest, + BytedanceSeedance2FastRequestAspectRatio, + BytedanceSeedance2FastRequestResolution, + BytedanceSeedance2MiniRequest, + BytedanceSeedance2MiniRequestAspectRatio, + BytedanceSeedance2MiniRequestResolution, + BytedanceSeedance2Request, + BytedanceSeedance2RequestAspectRatio, + BytedanceSeedance2RequestResolution, + BytedanceSeedream5LiteRequest, + BytedanceSeedream5LiteRequestAspectRatio, + BytedanceSeedream5LiteRequestResolution, + BytedanceSeedream5ProRequest, + BytedanceSeedream5ProRequestAspectRatio, + BytedanceSeedream5ProRequestResolution, + CallResult, + CampaignConversationType, + CancelCalendarEventParams, + CancelGroupSessionForAllParams, + CancelGroupSessionRegistrationParams, + CancelOrderParams, + CanvasPlacement, + CaptionStyleCharacterAnimationModel, + CaptionStyleCharacterAnimationModelEnterType, + CaptionStyleCharacterAnimationModelExitType, + CaptionStyleHorizontalPlacementModel, + CaptionStyleHorizontalPlacementModelAlign, + CaptionStyleModel, + CaptionStyleModelTextAlign, + CaptionStyleModelTextBlendMode, + CaptionStyleModelTextStyle, + CaptionStyleModelTextTransform, + CaptionStyleModelTextWeight, + CaptionStyleSectionAnimationModel, + CaptionStyleSectionAnimationModelEnterType, + CaptionStyleSectionAnimationModelExitType, + CaptionStyleTemplateModel, + CaptionStyleVerticalPlacementModel, + CaptionStyleVerticalPlacementModelAlign, + CaptionStyleWordAnimationModel, + CaptionStyleWordAnimationModelEnterType, + CaptionStyleWordAnimationModelExitType, + ChapterContentBlockExtendableNodeResponseModel, + ChapterContentBlockInputModel, + ChapterContentBlockInputModelSubType, + ChapterContentBlockResponseModel, + ChapterContentBlockResponseModelNodesItem, + ChapterContentBlockResponseModelNodesItem_Other, + ChapterContentBlockResponseModelNodesItem_TtsNode, + ChapterContentBlockTtsNodeResponseModel, + ChapterContentInputModel, + ChapterContentParagraphTtsNodeInputModel, + ChapterContentResponseModel, + ChapterResponse, + ChapterSnapshotExtendedResponseModel, + ChapterSnapshotResponse, + ChapterSnapshotsResponse, + ChapterState, + ChapterStatisticsResponse, + ChapterWithContentResponseModel, + ChapterWithContentResponseModelState, + CharacterAge, + CharacterAlignmentModel, + CharacterAlignmentResponseModel, + CharacterGender, + CharacterMetadataResponseModel, + CharacterRefreshPeriod, + CharacterResponseModel, + CharacterRole, + CharacterUsageResponse, + ChatSourceMedium, + CheckServiceAvailabilityParams, + ClientEvent, + ClientSecretResponse, + ClientToolConfigInput, + ClientToolConfigOutput, + ClipAnimation, + ClipAnimationEnterEffect, + ClipAnimationExitEffect, + CloseConnection, + CloseContext, + ClosePayload, + CloseSocket, + ClosedOutcome, + ColumnFilter, + ColumnFilterOperation, + ColumnFilterValuesItem, + ColumnUnit, + CommittedTranscriptEntitiesPayload, + CommittedTranscriptPayload, + CommittedTranscriptWithTimestampsPayload, + CompactionSettingsWorkflowOverride, + CompileProceduresResponseModel, + CompileProceduresValidationErrorResponseModel, + CompositionPlan, + CompositionPlanChunksItem, + ComputedUsagePlatformLimit, + ConditionStrength, + ConfigEntityType, + ConflictSection, + ConstantSchemaOverride, + ConstantSchemaOverrideConstantValue, + ContentConfig, + ContentFormat, + ContentGuardrailInput, + ContentGuardrailInputTriggerAction, + ContentGuardrailInputTriggerAction_EndCall, + ContentGuardrailInputTriggerAction_Retry, + ContentGuardrailOutput, + ContentGuardrailOutputTriggerAction, + ContentGuardrailOutputTriggerAction_EndCall, + ContentGuardrailOutputTriggerAction_Retry, + ContentSchema, + ContentSchema_Array, + ContentSchema_Audio, + ContentSchema_Boolean, + ContentSchema_Image, + ContentSchema_Integer, + ContentSchema_Number, + ContentSchema_Object, + ContentSchema_String, + ContentSchema_Video, + ContentSchema_Voice, + ContentThresholdGuardrail, + ContentThresholdGuardrailThreshold, + ContextualUpdateInfo, + Contributor, + ConvAiDynamicVariable, + ConvAiEnvVarLocator, + ConvAiFileUploadResponseModel, + ConvAiSecretLocator, + ConvAiStoredSecretDependencies, + ConvAiStoredSecretDependenciesAgentsItem, + ConvAiStoredSecretDependenciesAgentsItem_Available, + ConvAiStoredSecretDependenciesAgentsItem_Unknown, + ConvAiStoredSecretDependenciesMcpServersItem, + ConvAiStoredSecretDependenciesMcpServersItem_Available, + ConvAiStoredSecretDependenciesMcpServersItem_Unknown, + ConvAiStoredSecretDependenciesToolsItem, + ConvAiStoredSecretDependenciesToolsItem_Available, + ConvAiStoredSecretDependenciesToolsItem_Unknown, + ConvAiUserSecretDbModel, + ConvAiWebhooks, + ConvAiWorkspaceStoredSecretConfig, + ConversationAsrUsageModel, + ConversationChargingCommonModel, + ConversationConfigClientOverrideConfigInput, + ConversationConfigClientOverrideConfigOutput, + ConversationConfigClientOverrideInput, + ConversationConfigClientOverrideOutput, + ConversationConfigInput, + ConversationConfigOutput, + ConversationConfigOverride, + ConversationConfigOverrideConfig, + ConversationConfigWorkflowOverrideInput, + ConversationConfigWorkflowOverrideOutput, + ConversationDeletionSettings, + ConversationErrorType, + ConversationFeedbackType, + ConversationHistoryAnalysisCommonModel, + ConversationHistoryBatchCallModel, + ConversationHistoryElevenAssistantCommonModel, + ConversationHistoryErrorCommonModel, + ConversationHistoryEvaluationCriteriaResultCommonModel, + ConversationHistoryExotelPhoneCallModel, + ConversationHistoryFeedbackCommonModel, + ConversationHistoryMetadataCommonModel, + ConversationHistoryMetadataCommonModelPhoneCall, + ConversationHistoryMetadataCommonModelPhoneCall_Exotel, + ConversationHistoryMetadataCommonModelPhoneCall_SipTrunking, + ConversationHistoryMetadataCommonModelPhoneCall_Twilio, + ConversationHistoryMultivoiceMessageModel, + ConversationHistoryMultivoiceMessagePartModel, + ConversationHistoryRagUsageCommonModel, + ConversationHistoryRedactionConfig, + ConversationHistorySipTrunkingPhoneCallModel, + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput, + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput, + ConversationHistoryTranscriptCommonModelInput, + ConversationHistoryTranscriptCommonModelInputRole, + ConversationHistoryTranscriptCommonModelInputToolResultsItem, + ConversationHistoryTranscriptCommonModelOutput, + ConversationHistoryTranscriptCommonModelOutputRole, + ConversationHistoryTranscriptCommonModelOutputToolResultsItem, + ConversationHistoryTranscriptFileInputResponseModel, + ConversationHistoryTranscriptOtherToolsResultCommonModel, + ConversationHistoryTranscriptOtherToolsResultCommonModelType, + ConversationHistoryTranscriptResponseModel, + ConversationHistoryTranscriptResponseModelRole, + ConversationHistoryTranscriptResponseModelToolResultsItem, + ConversationHistoryTranscriptSystemToolResultCommonModelInput, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_Dummy, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndCallSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseRagSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_LanguageDetectionSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_SkipTurnSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TestingToolResult, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberAmazonConnectSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberExotelSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberSipSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberTwilioSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_VoicemailDetectionSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutput, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_Dummy, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndCallSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseRagSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_LanguageDetectionSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_SkipTurnSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TestingToolResult, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberAmazonConnectSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberExotelSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberSipSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberTwilioSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_VoicemailDetectionSuccess, + ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsInput, + ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsOutput, + ConversationHistoryTranscriptToolCallClientDetails, + ConversationHistoryTranscriptToolCallCommonModelInput, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_ApiIntegrationWebhook, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Client, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Mcp, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Webhook, + ConversationHistoryTranscriptToolCallCommonModelOutput, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_ApiIntegrationWebhook, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Client, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Mcp, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Webhook, + ConversationHistoryTranscriptToolCallMcpDetails, + ConversationHistoryTranscriptToolCallWebhookDetails, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, + ConversationHistoryTwilioPhoneCallModel, + ConversationInitiationClientDataConfigInput, + ConversationInitiationClientDataConfigOutput, + ConversationInitiationClientDataInternal, + ConversationInitiationClientDataRequestInput, + ConversationInitiationClientDataRequestOutput, + ConversationInitiationClientDataWebhook, + ConversationInitiationClientDataWebhookRequestHeadersValue, + ConversationInitiationSource, + ConversationInitiationSourceInfo, + ConversationProduct, + ConversationReasoningModel, + ConversationSentimentAnalysis, + ConversationSentimentAnalysisOverallLabel, + ConversationSignedUrlResponseModel, + ConversationSimulationSpecification, + ConversationSource, + ConversationSummaryMessageModel, + ConversationSummaryMessageModelRole, + ConversationSummaryResponseModel, + ConversationSummaryResponseModelStatus, + ConversationTagResponseModel, + ConversationTokenPurpose, + ConversationTokenResponseModel, + ConversationTtsUsageModel, + ConversationTurnMetrics, + ConversationUserResponseModel, + ConversationVoiceRewardModel, + ConversationVoiceUsageModel, + ConversationalConfig, + ConversationalConfigApiModelWorkflowOverrideInput, + ConversationalConfigApiModelWorkflowOverrideOutput, + ConvertChapterResponseModel, + ConvertProjectResponseModel, + CrawlStatus, + CrawlType, + CreateAgentBranchResponseModel, + CreateAgentMergeProposalResponseModel, + CreateAgentProcedureParams, + CreateAgentResponseModel, + CreateAgentRuleParams, + CreateAgentTestFolderResponseModel, + CreateAgentTestResponseModel, + CreateAssetParams, + CreateAudioNativeProjectRequest, + CreateAuthConnectionEnvironmentVariableRequest, + CreateBasicAuthRequest, + CreateBearerAuthRequest, + CreateClientAppointmentParams, + CreateClientInteractionParams, + CreateClientParams, + CreateClientSecretRequest, + CreateCrawlJobResponseModel, + CreateCustomHeaderAuthRequest, + CreateExotelPhoneNumberRequest, + CreateHolidayParams, + CreateLocationParams, + CreateMtlsAuthRequest, + CreateOAuth2ClientCredsRequest, + CreateOAuth2JwtRequest, + CreateOAuth2JwtRequestAlgorithm, + CreateOAuth2JwtRequestTokenResponseField, + CreateOrderParams, + CreateOrderRequest, + CreateOrderResponse, + CreatePhoneNumberResponseModel, + CreatePreviouslyGeneratedVoiceRequest, + CreatePrivateKeyJwtRequest, + CreatePrivateKeyJwtRequestAlgorithm, + CreateProcedureRequestModel, + CreateProcedureResponseModel, + CreateProductParams, + CreateProductQuoteRequestParams, + CreatePronunciationDictionaryResponseModel, + CreateResponseUnitTestRequest, + CreateSecretEnvironmentVariableRequest, + CreateServiceParams, + CreateServiceQuoteRequestParams, + CreateSimulationTestRequest, + CreateSipTrunkPhoneNumberRequest, + CreateStaffParams, + CreateStringEnvironmentVariableRequest, + CreateToolCallUnitTestRequest, + CreateTranscriptRequest, + CreateTransferRuleParams, + CreateTwilioPhoneNumberRequest, + CreatifyAuroraRequest, + CreatifyAuroraRequestResolution, + CriteriaScoringMode, + CueOptionsRequest, + Currency, + CustomGuardrailConfig, + CustomGuardrailConfigModel, + CustomGuardrailConfigTriggerAction, + CustomGuardrailConfigTriggerAction_EndCall, + CustomGuardrailConfigTriggerAction_Retry, + CustomGuardrailInput, + CustomGuardrailOutput, + CustomGuardrailsConfigInput, + CustomGuardrailsConfigOutput, + CustomHeaderAuthResponse, + CustomLlm, + CustomLlmApiKey, + CustomLlmAuthConnection, + CustomLlmRequestHeadersValue, + CustomLlmapiType, + CustomSipHeader, + CustomSipHeaderWithDynamicVariable, + DashboardCallSuccessChartModel, + DashboardCriteriaChartModel, + DashboardDataCollectionChartModel, + DataCollectionResultCommonModel, + DefaultSharingGroupConfig, + DefaultSharingGroupConfigPermissionLevel, + DefaultSharingGroupResponseModel, + DefaultSharingGroupResponseModelPermissionLevel, + DeleteAgentHoldAudioResponseModel, + DeleteAgentProcedureParams, + DeleteAgentRuleParams, + DeleteAssetParams, + DeleteCalendarEventParams, + DeleteChapterRequest, + DeleteChapterResponseModel, + DeleteClientInteractionParams, + DeleteClientParams, + DeleteDubbingResponseModel, + DeleteGroupSessionParams, + DeleteHistoryItemResponse, + DeleteHolidayParams, + DeleteLocationParams, + DeleteProductParams, + DeleteProjectRequest, + DeleteProjectResponseModel, + DeleteSampleResponse, + DeleteServiceParams, + DeleteStaffParams, + DeleteTransferRuleParams, + DeleteUserVoiceCollectionResponseModel, + DeleteVoiceResponseModel, + DeleteVoiceSampleResponseModel, + DeleteWorkspaceGroupMemberResponseModel, + DeleteWorkspaceInviteResponseModel, + DeleteWorkspaceWebhookResponseModel, + DeliverableInfo, + DependentAvailableAgentIdentifier, + DependentAvailableAgentIdentifierAccessLevel, + DependentAvailableMcpServerIdentifier, + DependentAvailableMcpServerIdentifierAccessLevel, + DependentAvailableToolIdentifier, + DependentAvailableToolIdentifierAccessLevel, + DependentBranchInfo, + DependentIntegrationConnectionIdentifier, + DependentPhoneNumberIdentifier, + DependentUnknownAgentIdentifier, + DependentUnknownMcpServerIdentifier, + DependentUnknownToolIdentifier, + DetailedMusicResponse, + DetailedMusicResponseCompositionPlan, + DetectedEntity, + DeviceModel, + DialogueInput, + DialogueInputResponseModel, + DialogueTextAlignment, + DirectPublishingReadResponseModel, + DirectPublishingReadResponseModelDisplayMode, + DirectPublishingReadResponseModelGenreItem, + DirectPublishingReadResponseModelPayoutType, + DirectPublishingReadResponseModelTargetAudience, + DiscountResponseModel, + DoDubbingResponse, + DocumentUsageModeEnum, + DocxExportOptions, + DtmfInputConfig, + DubOrderItemRequest, + DubbedSegment, + DubbingAudio, + DubbingAudioOutputError, + DubbingAuthError, + DubbingBulkSourceSegmentUpdateResponse, + DubbingBulkTargetSegmentUpdateResponse, + DubbingCommittedTranscript, + DubbingEndOfStream, + DubbingError, + DubbingInputAudioChunk, + DubbingInputError, + DubbingInvalidRequestError, + DubbingLanguageListResponse, + DubbingLanguageOutputs, + DubbingLanguageResponse, + DubbingLanguageResponseStatus, + DubbingMediaMetadata, + DubbingMediaReference, + DubbingMetadataPageResponseModel, + DubbingMetadataResponse, + DubbingPartialTranscript, + DubbingProjectListResponse, + DubbingProjectResponse, + DubbingProjectResponseStatus, + DubbingQueueOverflowError, + DubbingRateLimitedError, + DubbingRegenerateResponse, + DubbingReleaseChannel, + DubbingRenderResponseModel, + DubbingResource, + DubbingSegmentUpdateRequest, + DubbingSessionStarted, + DubbingSourceMediaInfo, + DubbingSourceSegmentUpdateResponse, + DubbingSourceTranscriptResponse, + DubbingStatus, + DubbingStatusStatus, + DubbingTargetSegmentUpdateRequest, + DubbingTargetSegmentUpdateResponse, + DubbingTargetTranscriptResponse, + DubbingTargetTranscriptSegment, + DubbingTranscriberError, + DubbingTranscript, + DubbingTranscriptCharacter, + DubbingTranscriptResponseModel, + DubbingTranscriptRevisionResponse, + DubbingTranscriptSegment, + DubbingTranscriptUtterance, + DubbingTranscriptWord, + DubbingTranscriptsResponseModel, + DubbingTranscriptsResponseModelTranscriptFormat, + DubbingTranslation, + DubbingTranslationError, + DummyToolResultModel, + DuplicateSpeechEngineRequest, + DynamicVariableAssignment, + DynamicVariableInternalValueType, + DynamicVariableNestedValueTypeInput, + DynamicVariableNestedValueTypeOutput, + DynamicVariableSchemaOverride, + DynamicVariableUpdateCommonModel, + DynamicVariablesConfig, + DynamicVariablesConfigWorkflowOverride, + Eagerness, + EditChapterResponseModel, + EditProjectResponseModel, + EditVoiceResponseModel, + EditVoiceSettingsRequest, + EditVoiceSettingsResponseModel, + EditedTranscript, + EffectsSpecInput, + EffectsSpecOutput, + ElevenFlashV25Request, + ElevenFlashV25RequestOutputFormat, + ElevenFlashV25VoiceSettings, + ElevenMultilingualV2Request, + ElevenMultilingualV2RequestOutputFormat, + ElevenV3Request, + ElevenV3RequestOutputFormat, + ElevenV3VoiceSettings, + EmbedVariant, + EmbeddingModelEnum, + EndCallToolConfig, + EndCallToolResultModel, + EndCallTriggerAction, + EndProcedureToolConfig, + EndProcedureToolConfigProceduresValue, + EndProcedureToolErrorStatus, + EndProcedureToolResultErrorModel, + EndProcedureToolResultSuccessModel, + EntityManagementActivityId, + EntryBehavior, + EnvironmentAuthConnectionLocator, + EnvironmentResponse, + EnvironmentVariableAuthConnectionValue, + EnvironmentVariableAuthConnectionValueRequest, + EnvironmentVariableResponse, + EnvironmentVariableResponseType, + EnvironmentVariableResponseValues, + EnvironmentVariableSecretValue, + EnvironmentVariableSecretValueRequest, + EnvironmentVariablesListResponse, + EnvironmentsListResponse, + ErrorPayload, + EvaluationCriteriaSummaryResult, + EvaluationResultFilter, + EvaluationSettingsInput, + EvaluationSettingsOutput, + EvaluationSuccessResult, + ExactParameterEvaluationStrategy, + ExotelApiSubdomain, + ExotelOutboundCallResponse, + ExperimentAssignment, + ExperimentAssignmentSource, + ExpiresAfter, + ExportOptions, + ExportOptions_Docx, + ExportOptions_Html, + ExportOptions_Pdf, + ExportOptions_SegmentedJson, + ExportOptions_Srt, + ExportOptions_Txt, + ExternalFileSyncInfo, + ExternalFolderSyncInfo, + ExternalSyncJobTrigger, + ExternalSyncJobType, + ExternalSyncProvider, + FeatureStatusCommonModel, + FeaturesUsageCommonModel, + FeedbackItem, + FieldConflict, + FileInputConfig, + FileInputConfigWorkflowOverride, + FileRefreshStatus, + FinalOutput, + FinalOutputMulti, + FineTuningResponse, + FineTuningResponseStateValue, + FinetuneCreatedBy, + FinetuneVisibility, + FlushContext, + FocusGuardrail, + ForcedAlignmentCharacterResponseModel, + ForcedAlignmentResponseModel, + ForcedAlignmentWordResponseModel, + FrustratedConversationRef, + FrustratedConversationRefOverallLabel, + Gemini25FlashImageRequest, + Gemini25FlashImageRequestAspectRatio, + Gemini31FlashImageRequest, + Gemini31FlashImageRequestAspectRatio, + Gemini31FlashImageRequestResolution, + Gemini31FlashLiteImageRequest, + Gemini31FlashLiteImageRequestAspectRatio, + Gemini3ProImageRequest, + Gemini3ProImageRequestAspectRatio, + Gemini3ProImageRequestResolution, + Gender, + GenerateVoiceRequest, + GenerationChunkInput, + GenerationChunkInputContextAdherence, + GenerationChunkOutput, + GenerationChunkOutputContextAdherence, + GenerationConfig, + GenerationReference, + GenerationSourceContext, + GenesysBotOutcome, + GenesysRegion, + GetAgentConfigParams, + GetAgentConversationTicketsPageResponseModel, + GetAgentEmbedResponseModel, + GetAgentKnowledgebaseSizeResponseModel, + GetAgentLinkResponseModel, + GetAgentResponseModel, + GetAgentResponseModelPhoneNumbersItem, + GetAgentResponseModelPhoneNumbersItem_Exotel, + GetAgentResponseModelPhoneNumbersItem_SipTrunk, + GetAgentResponseModelPhoneNumbersItem_Twilio, + GetAgentTestFolderResponseModel, + GetAgentTopicsResponseModel, + GetAgentsPageResponseModel, + GetAnalyticsSummaryParams, + GetAppointmentByConfirmationNumberParams, + GetAudioIsolationHistoryResponseModel, + GetAudioNativeProjectSettingsResponseModel, + GetBookingPageSettingsParams, + GetBookingSlugStatusParams, + GetChapterRequest, + GetChapterSnapshotsRequest, + GetChaptersRequest, + GetChaptersResponse, + GetClientAppointmentsParams, + GetClientByPhoneParams, + GetClientOrdersParams, + GetConvAiDashboardSettingsResponseModel, + GetConvAiDashboardSettingsResponseModelChartsItem, + GetConvAiDashboardSettingsResponseModelChartsItem_CallSuccess, + GetConvAiDashboardSettingsResponseModelChartsItem_Criteria, + GetConvAiDashboardSettingsResponseModelChartsItem_DataCollection, + GetConvAiSettingsResponseModel, + GetConversationResponseModel, + GetConversationResponseModelStatus, + GetConversationSummaryResponseModel, + GetConversationSummaryResponseModelStatus, + GetConversationTagsPageResponseModel, + GetConversationUsersPageResponseModel, + GetConversationsPageResponseModel, + GetCrawlJobResponseModel, + GetKnowledgeBaseDependentAgentsResponseModel, + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem, + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Available, + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Unknown, + GetKnowledgeBaseFileResponseModel, + GetKnowledgeBaseFolderResponseModel, + GetKnowledgeBaseListResponseModel, + GetKnowledgeBaseListResponseModelDocumentsItem, + GetKnowledgeBaseListResponseModelDocumentsItem_File, + GetKnowledgeBaseListResponseModelDocumentsItem_Folder, + GetKnowledgeBaseListResponseModelDocumentsItem_Text, + GetKnowledgeBaseListResponseModelDocumentsItem_Url, + GetKnowledgeBaseSummaryFileResponseModel, + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem, + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Unknown, + GetKnowledgeBaseSummaryFolderResponseModel, + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem, + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Unknown, + GetKnowledgeBaseSummaryTextResponseModel, + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem, + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Unknown, + GetKnowledgeBaseSummaryUrlResponseModel, + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem, + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Unknown, + GetKnowledgeBaseTextResponseModel, + GetKnowledgeBaseUrlResponseModel, + GetLibraryVoicesResponse, + GetLiveCountResponse, + GetOrCreateRagIndexRequestModel, + GetOrderByConfirmationNumberParams, + GetPhoneNumberExotelResponseModel, + GetPhoneNumberInboundSipTrunkConfigResponseModel, + GetPhoneNumberOutboundSipTrunkConfigResponseModel, + GetPhoneNumberResponse, + GetPhoneNumberSipTrunkResponseModel, + GetPhoneNumberTwilioResponseModel, + GetPhoneNumbersPageResponseModel, + GetPhoneNumbersPageResponseModelPhoneNumbersItem, + GetPhoneNumbersPageResponseModelPhoneNumbersItem_Exotel, + GetPhoneNumbersPageResponseModelPhoneNumbersItem_SipTrunk, + GetPhoneNumbersPageResponseModelPhoneNumbersItem_Twilio, + GetProjectRequest, + GetProjectsRequest, + GetProjectsResponse, + GetPronunciationDictionariesMetadataResponseModel, + GetPronunciationDictionariesResponse, + GetPronunciationDictionaryMetadataResponse, + GetPronunciationDictionaryMetadataResponsePermissionOnResource, + GetPronunciationDictionaryResponse, + GetPronunciationDictionaryWithRulesResponseModel, + GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource, + GetPronunciationDictionaryWithRulesResponseModelRulesItem, + GetPronunciationDictionaryWithRulesResponseModelRulesItem_Alias, + GetPronunciationDictionaryWithRulesResponseModelRulesItem_Phoneme, + GetResponseUnitTestResponseModel, + GetScheduleParams, + GetSecretDependenciesResponseModel, + GetSecretDependenciesResponseModelDependencies, + GetSecretDependenciesResponseModelDependenciesOneItem, + GetSecretDependenciesResponseModelDependenciesOneItem_Available, + GetSecretDependenciesResponseModelDependenciesOneItem_Unknown, + GetSecretDependenciesResponseModelDependenciesZeroItem, + GetSecretDependenciesResponseModelDependenciesZeroItem_Available, + GetSecretDependenciesResponseModelDependenciesZeroItem_Unknown, + GetSimulationTestResponseModel, + GetSipLogMessagesResponse, + GetSpeechHistoryResponse, + GetTestInvocationsPageResponseModel, + GetTestSuiteInvocationResponseModel, + GetTestsPageResponseModel, + GetTestsSummariesByIdsResponseModel, + GetToolCallUnitTestResponseModel, + GetToolDependentAgentsResponseModel, + GetToolDependentAgentsResponseModelAgentsItem, + GetToolDependentAgentsResponseModelAgentsItem_Available, + GetToolDependentAgentsResponseModelAgentsItem_Unknown, + GetToolExecutionsPageResponseModel, + GetUserVoiceCollectionsResponseModel, + GetVoiceAccentsResponseModel, + GetVoicesResponse, + GetVoicesV2Response, + GetWhatsAppAccountResponse, + GetWorkspacePlanParams, + GetWorkspaceSecretsResponseModel, + GptImage15Request, + GptImage15RequestAspectRatio, + GptImage15RequestBackground, + GptImage15RequestQuality, + GptImage1Request, + GptImage1RequestAspectRatio, + GptImage1RequestBackground, + GptImage1RequestQuality, + GptImage25FlareRequest, + GptImage25FlareRequestAspectRatio, + GptImage25FlareRequestQuality, + GptImage25FlareRequestResolution, + GptImage25SunburstRequest, + GptImage25SunburstRequestAspectRatio, + GptImage25SunburstRequestQuality, + GptImage25SunburstRequestResolution, + GptImage2Request, + GptImage2RequestAspectRatio, + GptImage2RequestQuality, + GptImage2RequestResolution, + GroupManagementActivityId, + GuardrailExecutionMode, + GuardrailType, + GuardrailsResult, + GuardrailsV1Input, + GuardrailsV1Output, + HidingReason, + HistoryAlignmentResponseModel, + HistoryAlignmentsResponseModel, + HistoryItemResponse, + HtmlExportOptions, + HttpRequestModel, + HttpValidationError, + Icon, + IconTheme, + ImageAnalysis, + ImageAnalysisResult, + ImageAnalysisStatus, + ImageAvatar, + ImageGenerationRequest, + ImageGenerationRequest_BytedanceSeedream5Lite, + ImageGenerationRequest_BytedanceSeedream5Pro, + ImageGenerationRequest_Gemini25FlashImage, + ImageGenerationRequest_Gemini31FlashImage, + ImageGenerationRequest_Gemini31FlashLiteImage, + ImageGenerationRequest_Gemini3ProImage, + ImageGenerationRequest_GptImage1, + ImageGenerationRequest_GptImage15, + ImageGenerationRequest_GptImage2, + ImageGenerationRequest_GptImage25Flare, + ImageGenerationRequest_GptImage25Sunburst, + ImageReference, + ImageReference_Asset, + ImageReference_Generation, + ImageReference_InlineBase64, + ImageSchema, + ImageSubject, + InboundSipTrunkConfigRequestModel, + InitPayload, + InitialiseContext, + InitializeConnection, + InitializeConnectionMulti, + InlineAudioReference, + InlineAudioReferenceMimeType, + InlineBase64Reference, + InlineBase64ReferenceMimeType, + InlineImageReference, + InlineImageReferenceMimeType, + InlineVideoReference, + InlineVideoReferenceMimeType, + InputAudioChunkPayload, + IntegerSchema, + IntegrationType, + InteractionBudget, + InternalAlertingWebhookNotifier, + InternalSamplingConfigResponseModel, + InvoiceResponse, + InvoiceResponsePaymentIntentStatus, + InvoiceResponsePaymentIntentStatussesItem, + ItemId, + KbExternalSyncJob, + KeepContextAlive, + KnowledgeBaseBulkDeleteSuccessfulResponseModel, + KnowledgeBaseContentSearchResponseModel, + KnowledgeBaseContentSearchResult, + KnowledgeBaseContentSearchResultDocument, + KnowledgeBaseContentSearchResultDocument_File, + KnowledgeBaseContentSearchResultDocument_Folder, + KnowledgeBaseContentSearchResultDocument_Text, + KnowledgeBaseContentSearchResultDocument_Url, + KnowledgeBaseDeletedResponseModel, + KnowledgeBaseDependentType, + KnowledgeBaseDocumentChunkResponseModel, + KnowledgeBaseDocumentChunksResponseModel, + KnowledgeBaseDocumentMetadataResponseModel, + KnowledgeBaseDocumentType, + KnowledgeBaseFolderPathSegmentResponseModel, + KnowledgeBaseFolderPathSegmentSummaryResponseModel, + KnowledgeBaseLocator, + KnowledgeBaseRagChunkModel, + KnowledgeBaseRagToolConfig, + KnowledgeBaseRagToolResultModel, + KnowledgeBaseRagToolStatus, + KnowledgeBaseSortBy, + KnowledgeBaseSourceFileUrlResponseModel, + KnowledgeBaseSummaryBatchSuccessfulResponseModel, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_File, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Folder, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Text, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Url, + KnowledgeBaseToolConfig, + KnowledgeBaseToolInfo, + KnowledgeBaseToolResultModel, + KnowledgeBaseToolStatus, + LanguageAddedResponse, + LanguageDetectionToolConfig, + LanguageDetectionToolResultModel, + LanguageInfo, + LanguagePairInfo, + LanguagePresetInput, + LanguagePresetOutput, + LanguagePresetTranslation, + LanguageResponse, + LanguagesResponse, + LanguagesResponse_Pair, + LanguagesResponse_Single, + LeaveMessageParams, + LibraryVoiceResponse, + LibraryVoiceResponseCategory, + ListAgentProceduresParams, + ListAgentReferencesParams, + ListAgentRulesParams, + ListAssetsParams, + ListAuthConnectionsResponse, + ListAuthConnectionsResponseAuthConnectionsItem, + ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2AuthCode, + ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2CustomApp, + ListAuthConnectionsResponseAuthConnectionsItem_BasicAuth, + ListAuthConnectionsResponseAuthConnectionsItem_BearerAuth, + ListAuthConnectionsResponseAuthConnectionsItem_CustomHeaderAuth, + ListAuthConnectionsResponseAuthConnectionsItem_Mtls, + ListAuthConnectionsResponseAuthConnectionsItem_Oauth2ClientCredentials, + ListAuthConnectionsResponseAuthConnectionsItem_Oauth2Jwt, + ListAuthConnectionsResponseAuthConnectionsItem_PrivateKeyJwt, + ListAuthConnectionsResponseAuthConnectionsItem_RefreshTokenAuth, + ListAuthConnectionsResponseAuthConnectionsItem_SlackBotAuth, + ListAuthConnectionsResponseAuthConnectionsItem_UrlSecret, + ListAuthConnectionsResponseAuthConnectionsItem_WhatsappAuth, + ListCalendarEventsParams, + ListClientInteractionsParams, + ListClientsParams, + ListCrawlJobsResponseModel, + ListCustomerFacingAgentsParams, + ListGroupSessionsParams, + ListHolidaysParams, + ListLocationsParams, + ListMcpToolsResponseModel, + ListOrdersResponse, + ListProceduresResponseModel, + ListProductsParams, + ListResponseAgentBranchSummary, + ListResponseAgentDeploymentHistoryItem, + ListResponseMeta, + ListServicesParams, + ListSpeechEnginesResponse, + ListStaffParams, + ListTransferRulesParams, + ListWhatsAppAccountsResponse, + LiteralJsonSchemaProperty, + LiteralJsonSchemaPropertyConstantValue, + LiteralJsonSchemaPropertyType, + LivekitStackType, + Llm, + LlmCategoryUsage, + LlmDeprecationConfigModel, + LlmDeprecationInfoModel, + LlmInfoModel, + LlmInputOutputTokensUsage, + LlmListResponseModel, + LlmLiteralJsonSchemaProperty, + LlmLiteralJsonSchemaPropertyType, + LlmParameterEvaluationStrategy, + LlmReasoningEffort, + LlmSchemaOverride, + LlmTokensCategoryUsage, + LlmUsageCalculatorLlmResponseModel, + LlmUsageCalculatorResponseModel, + LlmUsageInput, + LlmUsageOutput, + LoadMemoryEntryToolErrorStatus, + LoadableMemoryEntry, + LockReason, + ManualSource, + ManualVerificationFileResponse, + ManualVerificationResponse, + MatchAnythingParameterEvaluationStrategy, + McpApprovalPolicy, + McpApprovedToolDefinition, + McpServerConfigInput, + McpServerConfigInputAuthConnection, + McpServerConfigInputRequestHeadersValue, + McpServerConfigInputRequestMetaValue, + McpServerConfigInputSecretToken, + McpServerConfigInputUrl, + McpServerConfigOutput, + McpServerConfigOutputAuthConnection, + McpServerConfigOutputRequestHeadersValue, + McpServerConfigOutputRequestMetaValue, + McpServerConfigOutputSecretToken, + McpServerConfigOutputUrl, + McpServerMetadataResponseModel, + McpServerResponseModel, + McpServerResponseModelDependentAgentsItem, + McpServerResponseModelDependentAgentsItem_Available, + McpServerResponseModelDependentAgentsItem_Unknown, + McpServerTransport, + McpServersResponseModel, + McpToolApprovalHash, + McpToolApprovalPolicy, + McpToolApprovalState, + McpToolApprovalStatus, + McpToolConfigOverrideInput, + McpToolConfigOverrideInputInputOverridesValue, + McpToolConfigOverrideInputInputOverridesValue_Constant, + McpToolConfigOverrideInputInputOverridesValue_DynamicVariable, + McpToolConfigOverrideInputInputOverridesValue_Llm, + McpToolConfigOverrideInputInputOverridesValue_Omit, + McpToolConfigOverrideInputToolCallSound, + McpToolConfigOverrideOutput, + McpToolConfigOverrideOutputInputOverridesValue, + McpToolConfigOverrideOutputInputOverridesValue_Constant, + McpToolConfigOverrideOutputInputOverridesValue_DynamicVariable, + McpToolConfigOverrideOutputInputOverridesValue_Llm, + McpToolConfigOverrideOutputInputOverridesValue_Omit, + McpToolConfigOverrideOutputToolCallSound, + MediaCodec, + MediaGenerationCompletedResponse, + MediaGenerationCreateResponse, + MediaGenerationFailedResponse, + MediaGenerationFailedResponseFailureReason, + MediaGenerationInProgressResponse, + MediaGenerationListResponse, + MediaGenerationResponse, + MediaGenerationResponse_Completed, + MediaGenerationResponse_Failed, + MediaGenerationResponse_Generating, + MediaGenerationResponse_Pending, + MediaId, + MemoryEntrySearchResult, + MemoryEntrySearchResultSource, + MergePreviewResponseModel, + MergePreviewResponseModelPhoneNumbersItem, + MergePreviewResponseModelPhoneNumbersItem_Exotel, + MergePreviewResponseModelPhoneNumbersItem_SipTrunk, + MergePreviewResponseModelPhoneNumbersItem_Twilio, + MergeProposalCloseReason, + MergeProposalComment, + MergeProposalReview, + MergeProposalReviewReviewerRole, + MergeProposalReviewState, + MergeProposalStatus, + MergedOutcome, + MessageSearchSortBy, + MessagesSearchResponse, + MessagesSearchResult, + MetricRecord, + MetricType, + MockNoMatchBehavior, + MockingStrategy, + Model, + ModelRatesResponseModel, + ModerationConfig, + ModerationGuardrailInput, + ModerationGuardrailOutput, + ModerationStatusResponseModel, + ModerationStatusResponseModelSafetyStatus, + ModerationStatusResponseModelWarningStatus, + MtlsAuthResponse, + MultichannelSpeechToTextResponseModel, + MultipartMusicResponse, + MusicAllowedOutputFormats, + MusicExploreSongSourceContext, + MusicFinetuneFailureReason, + MusicFinetunePageResponseModel, + MusicFinetuneResponseModel, + MusicFinetuneStatus, + MusicGenerationMode, + MusicModelId, + MusicOnlyOutputFormats, + MusicOutputFormat, + MusicPrompt, + MusicUploadResponse, + MusicUploadResponseCompositionPlan, + NonStreamingOutputFormats, + NormalizedAlignment, + NumberSchema, + NumericDistributionAggregate, + OAuth2ClientCredsResponse, + OAuth2JwtResponse, + OAuth2JwtResponseAlgorithm, + OAuth2JwtResponseTokenResponseField, + OTelAttribute, + OTelAttributeValueValue, + OTelResource, + OTelResourceSpans, + OTelScope, + OTelScopeSpans, + OTelSpan, + OTelStatus, + OTelTracePayload, + ObjectJsonSchemaPropertyInput, + ObjectJsonSchemaPropertyInputPropertiesValue, + ObjectJsonSchemaPropertyInputPropertyKind, + ObjectJsonSchemaPropertyOutput, + ObjectJsonSchemaPropertyOutputPropertiesValue, + ObjectSchema, + OmitSchemaOverride, + OpenAiAudioConfigInput, + OpenAiAudioConfigOutput, + OpenAiAudioFormat, + OpenAiAudioInputConfigInput, + OpenAiAudioInputConfigOutput, + OpenAiAudioInputFormat, + OpenAiAudioInputTranscription, + OpenAiAudioOutputConfigInput, + OpenAiAudioOutputConfigOutput, + OpenAiAudioOutputFormat, + OpenAiFunctionTool, + OpenAiSessionConfigInput, + OpenAiSessionConfigInputMaxResponseOutputTokens, + OpenAiSessionConfigInputToolChoice, + OpenAiSessionConfigInputToolsItem, + OpenAiSessionConfigInputToolsItem_Function, + OpenAiSessionConfigInputToolsItem_Mcp, + OpenAiSessionConfigInputTracing, + OpenAiSessionConfigInputTruncation, + OpenAiSessionConfigInputTurnDetection, + OpenAiSessionConfigOutput, + OpenAiSessionConfigOutputMaxResponseOutputTokens, + OpenAiSessionConfigOutputToolChoice, + OpenAiSessionConfigOutputToolsItem, + OpenAiSessionConfigOutputToolsItem_Function, + OpenAiSessionConfigOutputToolsItem_Mcp, + OpenAiSessionConfigOutputTracing, + OpenAiToolChoiceFunction, + OpenAiToolChoiceFunctionInner, + OpenAiTracingConfiguration, + OpenAiTurnDetection, + OpenAimcpTool, + OpenAimcpToolRequireApproval, + OpenOutcome, + OpenerConfig, + OptInSmsReminderParams, + OptOutSmsReminderParams, + OrbAvatar, + OrchestratorToolMockBehaviorConfig, + OrderDeliverablesResponse, + OrderId, + OrderItemInfo, + OrderItemKind, + OrderItemRequestInput, + OrderItemRequestInput_Dub, + OrderItemRequestInput_Subtitles, + OrderItemRequestInput_Transcription, + OrderItemRequestOutput, + OrderItemRequestOutput_Dub, + OrderItemRequestOutput_Subtitles, + OrderItemRequestOutput_Transcription, + OrderMediaResponse, + OrderResponse, + OrderState, + OrderSummary, + OutboundCallRecipient, + OutboundCallRecipientResponseModel, + OutboundSipTrunkConfigRequestModel, + OutputFormat, + PaginatedResultAgentMergeProposalResponse, + PairedLanguagesResponse, + PartialTranscriptPayload, + PatchWorkspaceWebhookResponseModel, + PdfExportOptions, + PendingBlocksMetadataModel, + PendingCancellationResponseModel, + PendingClipTask, + PendingClipTaskType, + PendingExternalAudiosMetadataModel, + PendingSubscriptionSwitchResponseModel, + PendingSubscriptionSwitchResponseModelNextTier, + PermissionType, + PhoneNumberAgentInfo, + PhoneNumberDynamicVariableTransferDestination, + PhoneNumberSortBy, + PhoneNumberTransfer, + PhoneNumberTransferCustomSipHeadersItem, + PhoneNumberTransferCustomSipHeadersItem_Dynamic, + PhoneNumberTransferCustomSipHeadersItem_Static, + PhoneNumberTransferDestination, + PhoneNumberTransferPostDialDigits, + PhoneNumberTransferPostDialDigits_Dynamic, + PhoneNumberTransferPostDialDigits_Static, + PhoneNumberTransferTransferDestination, + PhoneNumberTransferTransferDestination_Phone, + PhoneNumberTransferTransferDestination_PhoneDynamicVariable, + PhoneNumberTransferTransferDestination_SipUri, + PhoneNumberTransferTransferDestination_SipUriDynamicVariable, + PingPayload, + PlatformCategory, + PlatformCategoryUsage, + PlatformLimits, + PlatformUsage, + PlayDtmfResultErrorModel, + PlayDtmfResultSuccessModel, + PlayDtmfToolConfig, + PodcastBulletinMode, + PodcastBulletinModeData, + PodcastConversationMode, + PodcastConversationModeData, + PodcastProjectResponseModel, + PodcastTextSource, + PodcastUrlSource, + PongPayload, + PositionInput, + PositionOutput, + PostAgentAvatarResponseModel, + PostAgentHoldAudioResponseModel, + PostDialDigitsDynamicVariable, + PostDialDigitsStatic, + PostWorkspaceSecretResponseModel, + PreToolSpeechMode, + PreviewAudioDbModel, + Price, + PrivacyConfigInput, + PrivacyConfigOutput, + PrivateKeyJwtResponse, + PrivateKeyJwtResponseAlgorithm, + ProcedureAtVersionResponseModel, + ProcedureDraftRef, + ProcedureDraftResponseModel, + ProcedureListItemResponseModel, + ProcedureRefResponseModel, + ProcedureType, + ProcedureValidationError, + ProcedureVersionRef, + ProjectCreationMetaResponseModel, + ProjectCreationMetaResponseModelStatus, + ProjectCreationMetaType, + ProjectExtendedResponse, + ProjectExtendedResponseAccessLevel, + ProjectExtendedResponseApplyTextNormalization, + ProjectExtendedResponseAspectRatio, + ProjectExtendedResponseAssetsItem, + ProjectExtendedResponseAssetsItem_Audio, + ProjectExtendedResponseAssetsItem_Image, + ProjectExtendedResponseAssetsItem_Video, + ProjectExtendedResponseFiction, + ProjectExtendedResponseSourceType, + ProjectExtendedResponseTargetAudience, + ProjectExternalAudioResponseModel, + ProjectExternalAudioResponseModelSourceContext, + ProjectExternalAudioResponseModelSourceContext_MusicExploreSong, + ProjectExternalAudioResponseModelSourceContext_Sfx, + ProjectExternalAudioResponseModelSourceContext_Song, + ProjectImageResponseModel, + ProjectMutedTracksResponseModel, + ProjectResponse, + ProjectResponseAccessLevel, + ProjectResponseAspectRatio, + ProjectResponseFiction, + ProjectResponseSourceType, + ProjectResponseTargetAudience, + ProjectSnapshotExtendedResponseModel, + ProjectSnapshotResponse, + ProjectSnapshotsResponse, + ProjectState, + ProjectVideoResponseModel, + ProjectVideoThumbnailSheetResponseModel, + ProjectVoiceResponseModel, + PromptAgent, + PromptAgentApiModelInput, + PromptAgentApiModelInputBackupLlmConfig, + PromptAgentApiModelInputBackupLlmConfig_Default, + PromptAgentApiModelInputBackupLlmConfig_Disabled, + PromptAgentApiModelInputBackupLlmConfig_Override, + PromptAgentApiModelInputToolsItem, + PromptAgentApiModelInputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelInputToolsItem_Client, + PromptAgentApiModelInputToolsItem_Mcp, + PromptAgentApiModelInputToolsItem_Smb, + PromptAgentApiModelInputToolsItem_System, + PromptAgentApiModelInputToolsItem_Webhook, + PromptAgentApiModelOutput, + PromptAgentApiModelOutputBackupLlmConfig, + PromptAgentApiModelOutputBackupLlmConfig_Default, + PromptAgentApiModelOutputBackupLlmConfig_Disabled, + PromptAgentApiModelOutputBackupLlmConfig_Override, + PromptAgentApiModelOutputToolsItem, + PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelOutputToolsItem_Client, + PromptAgentApiModelOutputToolsItem_Mcp, + PromptAgentApiModelOutputToolsItem_Smb, + PromptAgentApiModelOutputToolsItem_System, + PromptAgentApiModelOutputToolsItem_Webhook, + PromptAgentApiModelOverrideConfig, + PromptAgentApiModelOverrideInput, + PromptAgentApiModelOverrideOutput, + PromptAgentApiModelWorkflowOverrideInput, + PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig, + PromptAgentApiModelWorkflowOverrideInputToolsItem, + PromptAgentApiModelWorkflowOverrideInputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Client, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Mcp, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Smb, + PromptAgentApiModelWorkflowOverrideInputToolsItem_System, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook, + PromptAgentApiModelWorkflowOverrideOutput, + PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig, + PromptAgentApiModelWorkflowOverrideOutputToolsItem, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Mcp, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Smb, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_System, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook, + PromptAgentDbModel, + PromptEvaluationCriteria, + PromptInjectionGuardrail, + PronunciationDictionaryAliasRuleRequestModel, + PronunciationDictionaryAliasRuleResponseModel, + PronunciationDictionaryLocator, + PronunciationDictionaryLocatorResponseModel, + PronunciationDictionaryPhonemeRuleRequestModel, + PronunciationDictionaryPhonemeRuleResponseModel, + PronunciationDictionaryRulesResponseModel, + PronunciationDictionaryVersionLocator, + PronunciationDictionaryVersionResponseModel, + PronunciationDictionaryVersionResponseModelPermissionOnResource, + PydanticPronunciationDictionaryVersionLocator, + QualityPresetType, + QueryParamsJsonSchemaInput, + QueryParamsJsonSchemaOutput, + QuoteInfo, + RagChunkMetadata, + RagConfigInput, + RagConfigOutput, + RagConfigWorkflowOverrideInput, + RagConfigWorkflowOverrideOutput, + RagDocumentIndexResponseModel, + RagDocumentIndexUsage, + RagDocumentIndexesResponseModel, + RagIndexBatchSuccessfulResponseModel, + RagIndexOverviewEmbeddingModelResponseModel, + RagIndexOverviewResponseModel, + RagIndexStatus, + RagRetrievalInfo, + ReadLegalTerms, + ReadMetadataChapterDbModel, + ReaderResourceResponseModel, + ReaderResourceResponseModelResourceType, + RealtimeModel, + RealtimeVoiceSettings, + RecordingResponse, + ReferenceVideo, + ReferencedToolCommonModel, + ReferencedToolCommonModelType, + RefreshTokenAuthResponse, + RegexParameterEvaluationStrategy, + RegionConfigRequest, + RegionalProcessingSurchargeInfo, + RegisterForGroupSessionParams, + RegisterMediaResponse, + RemoveMemberFromGroupRequest, + RemoveOrderItemResponse, + RemoveVoiceFromUserVoiceCollectionResponseModel, + Render, + RenderStatus, + RenderType, + ReplicateVoiceToIsolatedEnvironmentResponseModel, + ReportKnowledgeGapParams, + RequestPvcManualVerificationResponseModel, + RequiredConstraint, + RequiredConstraints, + ResourceAccessInfo, + ResourceAccessInfoAccessSource, + ResourceAccessInfoAnonymousAccessLevelOverride, + ResourceAccessInfoRole, + ResourceMetadataResponseModel, + ResourceMetadataResponseModelAnonymousAccessLevelOverride, + ResponseConversationErrorType, + ResponseFilter, + ResponseFilterMode, + ResponseUnitTestModel, + RestoreCalendarEventParams, + RetryTriggerAction, + ReviewResponseModel, + ReviewResponseModelRejectReasonsItem, + ReviewResponseModelReviewStatus, + ReviewStatus, + SafetyCommonModelInput, + SafetyCommonModelOutput, + SafetyEvaluation, + SafetyResponseModel, + SafetyRule, + SampleConfigDbModel, + SampleConfigDbModelParentType, + SaveVoicePreviewRequest, + SayNodeLiteralMessageInput, + SayNodeLiteralMessageOutput, + SayNodePromptMessageInput, + SayNodePromptMessageOutput, + ScheduleGroupSessionParams, + ScimGroupResponseModel, + ScopedAnalysisResult, + ScribeAuthErrorPayload, + ScribeChunkSizeExceededErrorPayload, + ScribeErrorPayload, + ScribeInputErrorPayload, + ScribeInsufficientAudioActivityErrorPayload, + ScribeInvalidRequestError, + ScribeQueueOverflowErrorPayload, + ScribeQuotaExceededErrorPayload, + ScribeRateLimitedErrorPayload, + ScribeResourceExhaustedErrorPayload, + ScribeSessionTimeLimitExceededErrorPayload, + ScribeThrottledErrorPayload, + ScribeTranscriberErrorPayload, + ScribeUnacceptedTermsErrorPayload, + ScribeWarning, + SearchClientsParams, + SearchHighlightSegment, + SearchStrategy, + SeatType, + SecretDependencyResourceType, + SecretDependencyType, + SectionSource, + SegmentCreateResponse, + SegmentDeleteResponse, + SegmentDubResponse, + SegmentMigrationResponse, + SegmentSubtitleFrame, + SegmentTranscriptionResponse, + SegmentTranslationResponse, + SegmentUpdateResponse, + SegmentedJsonExportOptions, + SendCustomEmailParams, + SendText, + SendTextMulti, + SentimentAggregate, + SentimentAnalysisSettings, + SessionStartedPayload, + SessionStartedPayloadConfig, + SessionStartedPayloadConfigCommitStrategy, + SetBookingSlugParams, + SeverityId, + SfxModelId, + SfxSourceContext, + ShareOptionResponseModel, + ShareOptionResponseModelType, + SimilarVoice, + SimilarVoicesForSpeakerResponse, + SimulationLibrarySettings, + SimulationTestModel, + SimulationToolMockBehaviorConfig, + SingleLanguagesResponse, + SingleTestRunRequestModel, + SingleUseTokenResponseModel, + SingleUseTokenType, + SipLogMessage, + SipLogMessageDirection, + SipMediaEncryptionEnum, + SipTrunkCredentialsRequestModel, + SipTrunkOutboundCallResponse, + SipTrunkTransportEnum, + SipUriDynamicVariableTransferDestination, + SipUriTransferDestination, + SkipTurnToolConfig, + SkipTurnToolResponseModel, + SlackBotAuthResponse, + SmbAgentType, + SmbClientAccessConfig, + SmsConversationInfo, + SmsConversationInfoDirection, + SoftTimeoutConfig, + SoftTimeoutConfigOverride, + SoftTimeoutConfigOverrideConfig, + SoftTimeoutConfigWorkflowOverride, + SongMetadata, + SongSection, + SongSourceContext, + SortDirection, + SpeakerAudioResponseModel, + SpeakerCreatedResponse, + SpeakerResponseModel, + SpeakerSegment, + SpeakerSeparationResponseModel, + SpeakerSeparationResponseModelStatus, + SpeakerTrack, + SpeakerUpdatedResponse, + SpeechEngineConfig, + SpeechEngineConfigRequestHeadersValue, + SpeechEngineConversationInitiationClientDataConfig, + SpeechEngineResponse, + SpeechEngineSummaryResponse, + SpeechHistoryItemResponse, + SpeechHistoryItemResponseSource, + SpeechHistoryItemResponseVoiceCategory, + SpeechToTextCharacterResponseModel, + SpeechToTextChunkResponseModel, + SpeechToTextChunkResponseModelEditedTranscript, + SpeechToTextChunkResponseModelEditedTranscript_Error, + SpeechToTextChunkResponseModelEditedTranscript_Transcript, + SpeechToTextWebhookResponseModel, + SpeechToTextWordResponseModel, + SpeechToTextWordResponseModelType, + SpellingPatience, + SrtExportOptions, + StartProcedureToolConfig, + StartProcedureToolConfigProceduresValue, + StartProcedureToolErrorStatus, + StartProcedureToolResultErrorModel, + StartProcedureToolResultSuccessModel, + StartPvcVoiceTrainingResponseModel, + StartSpeakerSeparationResponseModel, + StaticAssetReference, + StatusId, + StoredUsagePlatformLimit, + StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel, + StreamingAudioChunkWithTimestampsResponse, + StringSchema, + StudioAgentSettingsModel, + StudioAgentToolSettingsModel, + StudioClipLocator, + StudioClipLocatorClipType, + StudioTextStyleOutlineModel, + StudioTextStyleShadowModel, + SubmitBusinessInfoParams, + SubmitOrderResponse, + Subscription, + SubscriptionExtrasResponseModel, + SubscriptionMaxCreditLimitExtension, + SubscriptionPendingChange, + SubscriptionResponse, + SubscriptionResponseMaxCreditLimitExtension, + SubscriptionStatusType, + SubscriptionUsageResponseModel, + SubtitleOrderItemRequest, + SuggestedAudioTag, + SupportedVoice, + SystemDataCollectionId, + SystemEvaluationCriteria, + SystemEvaluationId, + SystemToolConfigInput, + SystemToolConfigInputParams, + SystemToolConfigInputParams_EndCall, + SystemToolConfigInputParams_EndProcedure, + SystemToolConfigInputParams_KnowledgeBase, + SystemToolConfigInputParams_KnowledgeBaseRag, + SystemToolConfigInputParams_LanguageDetection, + SystemToolConfigInputParams_PlayKeypadTouchTone, + SystemToolConfigInputParams_SkipTurn, + SystemToolConfigInputParams_StartProcedure, + SystemToolConfigInputParams_TransferToAgent, + SystemToolConfigInputParams_TransferToNumber, + SystemToolConfigInputParams_VoicemailDetection, + SystemToolConfigOutput, + SystemToolConfigOutputParams, + SystemToolConfigOutputParams_EndCall, + SystemToolConfigOutputParams_EndProcedure, + SystemToolConfigOutputParams_KnowledgeBase, + SystemToolConfigOutputParams_KnowledgeBaseRag, + SystemToolConfigOutputParams_LanguageDetection, + SystemToolConfigOutputParams_PlayKeypadTouchTone, + SystemToolConfigOutputParams_SkipTurn, + SystemToolConfigOutputParams_StartProcedure, + SystemToolConfigOutputParams_TransferToAgent, + SystemToolConfigOutputParams_TransferToNumber, + SystemToolConfigOutputParams_VoicemailDetection, + TelephonyCallConfigInput, + TelephonyCallConfigOutput, + TelephonyDirection, + TelephonyProvider, + TemplateArrayOutput, + TemplateArrayOutputFailureReason, + TemplateAudioOutput, + TemplateAudioOutputFailureReason, + TemplateBooleanOutput, + TemplateBooleanOutputFailureReason, + TemplateImageOutput, + TemplateImageOutputFailureReason, + TemplateInputReference, + TemplateInputReference_Asset, + TemplateInputReference_Generation, + TemplateInputReference_InlineBase64, + TemplateInputReference_Voice, + TemplateIntegerOutput, + TemplateIntegerOutputFailureReason, + TemplateListResponse, + TemplateNumberOutput, + TemplateNumberOutputFailureReason, + TemplateObjectOutput, + TemplateObjectOutputFailureReason, + TemplateOutput, + TemplateOutput_Array, + TemplateOutput_Audio, + TemplateOutput_Boolean, + TemplateOutput_Image, + TemplateOutput_Integer, + TemplateOutput_Number, + TemplateOutput_Object, + TemplateOutput_String, + TemplateOutput_Video, + TemplatePort, + TemplateRunInput, + TemplateRunListResponse, + TemplateRunResponse, + TemplateRunStatus, + TemplateStringOutput, + TemplateStringOutputFailureReason, + TemplateSummary, + TemplateVersion, + TemplateVideoOutput, + TemplateVideoOutputFailureReason, + TestConditionRationaleCommonModel, + TestConditionResultCommonModel, + TestFromConversationMetadataInput, + TestFromConversationMetadataOutput, + TestInvocationSummaryResponseModel, + TestRunMetadata, + TestRunMetadataTestType, + TestRunResultBucket, + TestRunResultSummary, + TestRunStatus, + TestSharingMode, + TestToolResultModel, + TestType, + TestsFeatureUsageCommonModel, + TextNormalisationType, + TextToDialogueWebsocketApplyTextNormalizationEnum, + TextToDialogueWebsocketAudioChunk, + TextToDialogueWebsocketAudioChunkMulti, + TextToDialogueWebsocketClientMessage, + TextToDialogueWebsocketClientMessageMulti, + TextToDialogueWebsocketError, + TextToDialogueWebsocketFinal, + TextToDialogueWebsocketFinalAudioForTurn, + TextToDialogueWebsocketFinalAudioForTurnMulti, + TextToDialogueWebsocketFinalMulti, + TextToDialogueWebsocketOutputFormatEnum, + TextToDialogueWebsocketVoiceInput, + TextToDialogueWebsocketVoiceSettings, + TextToSpeechApplyTextNormalizationEnum, + TextToSpeechGenerationRequest, + TextToSpeechGenerationRequest_ElevenFlashV25, + TextToSpeechGenerationRequest_ElevenMultilingualV2, + TextToSpeechGenerationRequest_ElevenV3, + TextToSpeechOutputFormatEnum, + TextToSpeechRequest, + TextToSpeechStreamRequest, + TextToSpeechStreamWithTimestampsRequest, + TextToSpeechWithTimestampsRequest, + ThresholdGuardrail, + TicketCommentResponseModel, + TicketMergeProposalLinkResponseModel, + TicketPriorityChangeResponseModel, + TicketSearchMatchField, + TicketSearchMatchResponseModel, + TicketStatusChangeResponseModel, + TimeRange, + ToDialogueSettingsResponseModel, + TokenResponseModel, + Tool, + ToolAnnotations, + ToolCallSoundBehavior, + ToolCallSoundType, + ToolCallUnitTestModel, + ToolErrorHandlingMode, + ToolExecution, + ToolExecutionMode, + ToolExecutionResponseModel, + ToolExecutionResponseModelToolCallDetails, + ToolExecutionResponseModelToolCallDetails_ApiIntegrationWebhook, + ToolExecutionResponseModelToolCallDetails_Client, + ToolExecutionResponseModelToolCallDetails_Mcp, + ToolExecutionResponseModelToolCallDetails_Webhook, + ToolExecutionTaskSupport, + ToolInterruptionMode, + ToolMockConfig, + ToolRequestModel, + ToolRequestModelToolConfig, + ToolRequestModelToolConfig_Client, + ToolRequestModelToolConfig_Mcp, + ToolRequestModelToolConfig_System, + ToolRequestModelToolConfig_Webhook, + ToolResponseMockConfigInput, + ToolResponseMockConfigOutput, + ToolResponseModel, + ToolResponseModelToolConfig, + ToolResponseModelToolConfig_Client, + ToolResponseModelToolConfig_Mcp, + ToolResponseModelToolConfig_System, + ToolResponseModelToolConfig_Webhook, + ToolSortBy, + ToolType, + ToolTypeFilter, + ToolUsageStatsResponseModel, + ToolsResponseModel, + TopicDiscoverySettings, + TopicEvaluationCriteriaAggregate, + TopicMetricsAggregate, + TopicSentimentAggregate, + TopicSortBy, + TranscriptEditError, + TranscriptMessage, + TranscriptMessageRole, + TranscriptPlatformEvent, + TranscriptionOrderItemRequest, + TranscriptionWord, + TranscriptionWordType, + TransferBranchInfoConfigured, + TransferBranchInfoDefaultingToMain, + TransferBranchInfoTrafficSplit, + TransferToAgentToolConfigInput, + TransferToAgentToolConfigOutput, + TransferToAgentToolResultErrorModel, + TransferToAgentToolResultSuccessModelInput, + TransferToAgentToolResultSuccessModelInputBranchInfo, + TransferToAgentToolResultSuccessModelInputBranchInfo_Configured, + TransferToAgentToolResultSuccessModelInputBranchInfo_DefaultingToMain, + TransferToAgentToolResultSuccessModelInputBranchInfo_TrafficSplit, + TransferToAgentToolResultSuccessModelOutput, + TransferToAgentToolResultSuccessModelOutputBranchInfo, + TransferToAgentToolResultSuccessModelOutputBranchInfo_Configured, + TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain, + TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit, + TransferToNumberResultAmazonConnectSuccessModel, + TransferToNumberResultErrorModel, + TransferToNumberResultExotelSuccessModel, + TransferToNumberResultSipSuccessModel, + TransferToNumberResultTwilioSuccessModel, + TransferToNumberToolConfigInput, + TransferToNumberToolConfigOutput, + TransferTypeEnum, + TranslateAudioOutputError, + TranslateAudioPayload, + TranslateAuthError, + TranslateEndOfStreamPayload, + TranslateErrorPayload, + TranslateFinalTranscriptPayload, + TranslateInputAudioChunkPayload, + TranslateInputError, + TranslateInputFormatEnum, + TranslateOutputFormatEnum, + TranslatePartialTranscriptPayload, + TranslatePaymentIssueError, + TranslateQueueOverflowError, + TranslateQuotaExceededError, + TranslateRateLimitedError, + TranslateSessionStartedPayload, + TranslateStatusPayload, + TranslateTranscriberError, + TranslateTranslationError, + TranslateTranslationPayload, + TranslateUnacceptedTermsError, + TranslatedString, + TriggerUserVerificationParams, + TriggeredGuardrailCommonModel, + TtsConversationalConfigInput, + TtsConversationalConfigOutput, + TtsConversationalConfigOverride, + TtsConversationalConfigOverrideConfig, + TtsConversationalConfigWorkflowOverrideInput, + TtsConversationalConfigWorkflowOverrideOutput, + TtsConversationalModel, + TtsModelFamily, + TtsOptimizeStreamingLatency, + TtsOutputFormat, + TtsVoiceSettings, + TurnCommentRequestModel, + TurnCommentResponseModel, + TurnConfig, + TurnConfigOverride, + TurnConfigOverrideConfig, + TurnConfigWorkflowOverride, + TurnDetectionType, + TurnEagerness, + TurnMode, + TurnModel, + TwilioAnsweredBy, + TwilioEdgeLocation, + TwilioMachineDetectionAction, + TwilioMachineDetectionConfig, + TwilioMachineDetectionMode, + TwilioMachineDetectionRule, + TwilioOutboundCallResponse, + TwilioRegionId, + TxtExportOptions, + UnitTestRunResponseModel, + UnitTestRunResponseModelTestInfo, + UnitTestRunResponseModelTestInfo_Llm, + UnitTestRunResponseModelTestInfo_Simulation, + UnitTestRunResponseModelTestInfo_Tool, + UnitTestSummaryResponseModel, + UnitTestToolCallEvaluationModelInput, + UnitTestToolCallEvaluationModelOutput, + UnitTestToolCallParameter, + UnitTestToolCallParameterEval, + UnitTestToolCallParameterEval_Anything, + UnitTestToolCallParameterEval_Exact, + UnitTestToolCallParameterEval_Llm, + UnitTestToolCallParameterEval_Regex, + UnitTestWorkflowNodeTransitionEvaluationNodeId, + UpdateAgentConfigParams, + UpdateAgentProcedureParams, + UpdateAgentRuleParams, + UpdateAssetParams, + UpdateAudioNativeProjectRequest, + UpdateBasicAuthRequest, + UpdateBearerAuthRequest, + UpdateBookingPageAppearanceParams, + UpdateBookingPageSettingsParams, + UpdateBusinessInfoParams, + UpdateCalendarEventParams, + UpdateChapterRequest, + UpdateClientParams, + UpdateGroupSessionSeatsParams, + UpdateHolidayParams, + UpdateLocationParams, + UpdateOAuth2ClientCredsRequest, + UpdateOAuth2JwtRequest, + UpdateOAuth2JwtRequestAlgorithm, + UpdateOAuth2JwtRequestTokenResponseField, + UpdateOrderParams, + UpdateOrderRequest, + UpdateOrderResponse, + UpdateProductParams, + UpdateProjectRequest, + UpdatePronunciationDictionariesRequest, + UpdateResponseUnitTestRequest, + UpdateServiceParams, + UpdateSimulationTestRequest, + UpdateStaffParams, + UpdateToolCallUnitTestRequest, + UpdateTransferRuleParams, + UpdateWorkspaceMemberResponseModel, + UpsertOrderItemRequest, + UpsertOrderItemResponse, + UrlAvatar, + UrlModel, + UrlSecretAuthResponse, + UsageAggregationInterval, + UsageCharactersResponseModel, + User, + UserAccessManagementActivityId, + UserFeedback, + UserFeedbackScore, + UserModel, + UserTranscriptPayload, + UserTypeId, + UserVoiceCollectionResponseModel, + UserVoiceCollectionResponseModelPermissionOnResource, + UsersSortBy, + UtteranceResponseModel, + UuiTransferConfig, + UuiTransferConfigProtocolDiscriminatorMode, + VadConfig, + VadConfigWorkflowOverride, + ValidateUserVerificationCodeParams, + ValidationError, + ValidationErrorLocItem, + Veo31FastRequest, + Veo31FastRequestAspectRatio, + Veo31FastRequestResolution, + Veo31Request, + Veo31RequestAspectRatio, + Veo31RequestResolution, + VeoImageReference, + VeoImageReferenceRole, + Verbosity, + VerificationAttemptResponse, + VerifiedVoiceLanguageResponseModel, + VerifyPvcVoiceCaptchaResponseModel, + VideoAnalysis, + VideoAnalysisResult, + VideoAnalysisStatus, + VideoGenerationRequest, + VideoGenerationRequest_BytedanceSeedanceV2, + VideoGenerationRequest_BytedanceSeedanceV25, + VideoGenerationRequest_BytedanceSeedanceV2Fast, + VideoGenerationRequest_BytedanceSeedanceV2Mini, + VideoGenerationRequest_CreatifyAurora, + VideoGenerationRequest_Veo31FastGenerate001, + VideoGenerationRequest_Veo31Generate001, + VideoKeyMoment, + VideoReference, + VideoReference_Asset, + VideoReference_Generation, + VideoReference_InlineBase64, + VideoSchema, + VideoSegment, + VideoSubject, + VisitedAgentRef, + Voice, + VoiceAccentResponseModel, + VoiceCategory, + VoiceDesignPreviewResponse, + VoiceGenerationParameterOptionResponse, + VoiceGenerationParameterResponse, + VoiceLabellingStatus, + VoiceMailDetectionResultSuccessModel, + VoicePreviewResponseModel, + VoiceRecordingQuality, + VoiceReference, + VoiceSafetyControl, + VoiceSample, + VoiceSamplePreviewResponseModel, + VoiceSampleVisualWaveformResponseModel, + VoiceSchema, + VoiceSegment, + VoiceSettings, + VoiceSharingModerationCheckResponseModel, + VoiceSharingResponse, + VoiceSharingResponseCategory, + VoiceSharingState, + VoiceStatisticsResponseModel, + VoiceVerificationResponse, + VoicemailDetectionToolConfig, + VoicesNotPermittedWarning, + WebhookAuthMethodType, + WebhookEventType, + WebhookHmacSettings, + WebhookTarget, + WebhookTargetAll, + WebhookTargetIds, + WebhookTarget_All, + WebhookTarget_Ids, + WebhookToolApiSchemaConfigInput, + WebhookToolApiSchemaConfigInputAuthConnection, + WebhookToolApiSchemaConfigInputContentType, + WebhookToolApiSchemaConfigInputMethod, + WebhookToolApiSchemaConfigInputRequestHeadersValue, + WebhookToolApiSchemaConfigOutput, + WebhookToolApiSchemaConfigOutputAuthConnection, + WebhookToolApiSchemaConfigOutputContentType, + WebhookToolApiSchemaConfigOutputMethod, + WebhookToolApiSchemaConfigOutputRequestHeadersValue, + WebhookToolConfigInput, + WebhookToolConfigOutput, + WebhookTranscriptFormat, + WebhookUsageType, + WebsocketTtsClientMessageMulti, + WebsocketTtsServerMessageMulti, + WhatsAppAccountType, + WhatsAppAuthResponse, + WhatsAppCallPermissionRequest, + WhatsAppCallPermissionRequestState, + WhatsAppConversationInfo, + WhatsAppConversationInfoDirection, + WhatsAppOutboundCallResponse, + WhatsAppOutboundMessageResponse, + WhatsAppRecipient, + WhatsAppTemplateBodyComponentParams, + WhatsAppTemplateButtonComponentParams, + WhatsAppTemplateDocumentParam, + WhatsAppTemplateDocumentParamDetails, + WhatsAppTemplateHeaderComponentParams, + WhatsAppTemplateHeaderComponentParamsParametersItem, + WhatsAppTemplateHeaderComponentParamsParametersItem_Document, + WhatsAppTemplateHeaderComponentParamsParametersItem_Image, + WhatsAppTemplateHeaderComponentParamsParametersItem_Location, + WhatsAppTemplateHeaderComponentParamsParametersItem_Text, + WhatsAppTemplateImageParam, + WhatsAppTemplateImageParamDetails, + WhatsAppTemplateLocationParam, + WhatsAppTemplateLocationParamDetails, + WhatsAppTemplateTextParam, + WidgetConfig, + WidgetConfigAvatar, + WidgetConfigAvatar_Image, + WidgetConfigAvatar_Orb, + WidgetConfigAvatar_Url, + WidgetConfigResponse, + WidgetConfigResponseAvatar, + WidgetConfigResponseAvatar_Image, + WidgetConfigResponseAvatar_Orb, + WidgetConfigResponseAvatar_Url, + WidgetConfigResponseSyntaxHighlightTheme, + WidgetConfigSyntaxHighlightTheme, + WidgetEndFeedbackConfig, + WidgetEndFeedbackType, + WidgetExpandable, + WidgetFeedbackMode, + WidgetLanguagePreset, + WidgetLanguagePresetResponse, + WidgetPlacement, + WidgetStyles, + WidgetTermsTranslation, + WidgetTextContents, + WidgetTextContentsTranslation, + WordTimestamp, + WorkflowEdgeModelInput, + WorkflowEdgeModelInputBackwardCondition, + WorkflowEdgeModelInputBackwardCondition_Expression, + WorkflowEdgeModelInputBackwardCondition_Llm, + WorkflowEdgeModelInputBackwardCondition_Result, + WorkflowEdgeModelInputBackwardCondition_Unconditional, + WorkflowEdgeModelInputForwardCondition, + WorkflowEdgeModelInputForwardCondition_Expression, + WorkflowEdgeModelInputForwardCondition_Llm, + WorkflowEdgeModelInputForwardCondition_Result, + WorkflowEdgeModelInputForwardCondition_Unconditional, + WorkflowEdgeModelOutput, + WorkflowEdgeModelOutputBackwardCondition, + WorkflowEdgeModelOutputBackwardCondition_Expression, + WorkflowEdgeModelOutputBackwardCondition_Llm, + WorkflowEdgeModelOutputBackwardCondition_Result, + WorkflowEdgeModelOutputBackwardCondition_Unconditional, + WorkflowEdgeModelOutputForwardCondition, + WorkflowEdgeModelOutputForwardCondition_Expression, + WorkflowEdgeModelOutputForwardCondition_Llm, + WorkflowEdgeModelOutputForwardCondition_Result, + WorkflowEdgeModelOutputForwardCondition_Unconditional, + WorkflowEndNodeModelInput, + WorkflowEndNodeModelOutput, + WorkflowEndNodeOutcome, + WorkflowExpressionConditionModelInput, + WorkflowExpressionConditionModelOutput, + WorkflowFeaturesUsageCommonModel, + WorkflowLlmConditionModelInput, + WorkflowLlmConditionModelOutput, + WorkflowOverrideAgentNodeModelInput, + WorkflowOverrideAgentNodeModelOutput, + WorkflowPhoneNumberNodeModelInput, + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem, + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Dynamic, + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Static, + WorkflowPhoneNumberNodeModelInputPostDialDigits, + WorkflowPhoneNumberNodeModelInputPostDialDigits_Dynamic, + WorkflowPhoneNumberNodeModelInputPostDialDigits_Static, + WorkflowPhoneNumberNodeModelInputTransferDestination, + WorkflowPhoneNumberNodeModelInputTransferDestination_Phone, + WorkflowPhoneNumberNodeModelInputTransferDestination_PhoneDynamicVariable, + WorkflowPhoneNumberNodeModelInputTransferDestination_SipUri, + WorkflowPhoneNumberNodeModelInputTransferDestination_SipUriDynamicVariable, + WorkflowPhoneNumberNodeModelOutput, + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem, + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Dynamic, + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Static, + WorkflowPhoneNumberNodeModelOutputPostDialDigits, + WorkflowPhoneNumberNodeModelOutputPostDialDigits_Dynamic, + WorkflowPhoneNumberNodeModelOutputPostDialDigits_Static, + WorkflowPhoneNumberNodeModelOutputTransferDestination, + WorkflowPhoneNumberNodeModelOutputTransferDestination_Phone, + WorkflowPhoneNumberNodeModelOutputTransferDestination_PhoneDynamicVariable, + WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUri, + WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUriDynamicVariable, + WorkflowResultConditionModelInput, + WorkflowResultConditionModelOutput, + WorkflowSayNodeModelInput, + WorkflowSayNodeModelInputMessage, + WorkflowSayNodeModelInputMessage_Literal, + WorkflowSayNodeModelInputMessage_Prompt, + WorkflowSayNodeModelOutput, + WorkflowSayNodeModelOutputMessage, + WorkflowSayNodeModelOutputMessage_Literal, + WorkflowSayNodeModelOutputMessage_Prompt, + WorkflowStandaloneAgentNodeModelInput, + WorkflowStandaloneAgentNodeModelOutput, + WorkflowStartNodeModelInput, + WorkflowStartNodeModelOutput, + WorkflowStateUpdateInput, + WorkflowStateUpdateOutput, + WorkflowToolEdgeStepModel, + WorkflowToolLocator, + WorkflowToolLocatorSchemaOverridesValue, + WorkflowToolLocatorSchemaOverridesValue_Constant, + WorkflowToolLocatorSchemaOverridesValue_DynamicVariable, + WorkflowToolLocatorSchemaOverridesValue_Llm, + WorkflowToolLocatorSchemaOverridesValue_Omit, + WorkflowToolMaxIterationsExceededStepModel, + WorkflowToolNestedToolsStepModelInput, + WorkflowToolNestedToolsStepModelInputResultsItem, + WorkflowToolNestedToolsStepModelOutput, + WorkflowToolNestedToolsStepModelOutputResultsItem, + WorkflowToolNodeModelInput, + WorkflowToolNodeModelOutput, + WorkflowToolResponseModelInput, + WorkflowToolResponseModelInputStepsItem, + WorkflowToolResponseModelInputStepsItem_Edge, + WorkflowToolResponseModelInputStepsItem_MaxIterationsExceeded, + WorkflowToolResponseModelInputStepsItem_NestedTools, + WorkflowToolResponseModelOutput, + WorkflowToolResponseModelOutputStepsItem, + WorkflowToolResponseModelOutputStepsItem_Edge, + WorkflowToolResponseModelOutputStepsItem_MaxIterationsExceeded, + WorkflowToolResponseModelOutputStepsItem_NestedTools, + WorkflowUnconditionalModelInput, + WorkflowUnconditionalModelOutput, + WorkflowUpdateStateNodeModelInput, + WorkflowUpdateStateNodeModelOutput, + WorkspaceAnalyticsQueryResponseModel, + WorkspaceAnalyticsQueryResponseModelColumnTypesItem, + WorkspaceAnalyticsQueryResponseModelRowsItemItem, + WorkspaceApiKeyListResponseModel, + WorkspaceApiKeyResponseModel, + WorkspaceAuditLogEntryResponse, + WorkspaceAuditLogEntryResponseActivityId, + WorkspaceAuditLogsPageResponse, + WorkspaceBatchCallsResponse, + WorkspaceCreateApiKeyResponseModel, + WorkspaceCreateServiceAccountResponseModel, + WorkspaceCreateWebhookResponseModel, + WorkspaceGroupByNameResponseModel, + WorkspaceGroupPermission, + WorkspaceGroupResponseModel, + WorkspaceGroupResponseModelGroupConcurrencyLimit, + WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit, + WorkspaceGroupResponseModelGroupMusicConcurrencyLimit, + WorkspaceGroupResponseModelGroupPvcLimit, + WorkspaceGroupResponseModelGroupUsageLimit, + WorkspaceMemberResponseModel, + WorkspaceResourceType, + WorkspaceServiceAccountListResponseModel, + WorkspaceServiceAccountResponseModel, + WorkspaceWebhookEventType, + WorkspaceWebhookListResponseModel, + WorkspaceWebhookResponseModel, + WorkspaceWebhookUsageResponseModel, + ) + from .errors import ( + BadRequestError, + ConflictError, + ForbiddenError, + NotFoundError, + TooEarlyError, + UnauthorizedError, + UnprocessableEntityError, + ) + from . import ( + assets, + audio_effects, + audio_isolation, + audio_native, + conversational_ai, + dubbing, + environment_variables, + environments, + flows, + forced_alignment, + history, + models, + music, + productions, + pronunciation_dictionaries, + samples, + service_accounts, + speech_engine, + speech_engine_upstream, + speech_to_speech, + speech_to_text, + studio, + text_to_dialogue, + text_to_sound_effects, + text_to_speech, + text_to_voice, + tokens, + usage, + user, + v_1_dubbing_realtime, + v_1_speech_to_text_realtime, + v_1_text_to_dialogue_multi_stream_input, + v_1_text_to_dialogue_stream_input, + v_1_text_to_speech_voice_id_multi_stream_input, + v_1_text_to_speech_voice_id_stream_input, + v_1_translation_realtime, + voices, + webhooks, + workspace, + workspaces, + ) + from .audio_isolation import AudioIsolationRequestFileFormat, AudioIsolationStreamRequestFileFormat + from .audio_native import AudioNativeCreateRequestApplyTextNormalization + from .client import AsyncElevenLabs, ElevenLabs + from .dubbing import ( + DubRequestMode, + DubbingListRequestCreationSourcesItem, + DubbingListRequestDubbingModelsItem, + DubbingListRequestDubbingStatus, + DubbingListRequestDubbingStatusesItem, + DubbingListRequestFilterByCreator, + DubbingListRequestOrderBy, + DubbingListRequestOrderDirection, + ) + from .environment import ElevenLabsEnvironment + from .environment_variables import ( + EnvironmentVariablesCreateRequestBody, + EnvironmentVariablesCreateRequestBody_AuthConnection, + EnvironmentVariablesCreateRequestBody_Secret, + EnvironmentVariablesCreateRequestBody_String, + EnvironmentVariablesListRequestType, + UpdateEnvironmentVariableRequestValuesValue, + ) + from .history import HistoryListRequestSortDirection, HistoryListRequestSource + from .music import ( + BodyComposeMusicV1MusicPostCompositionPlan, + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, + BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, + MusicComposeDetailedRequestOutputFormat, + MusicComposeDetailedStreamRequestOutputFormat, + MusicComposeRequestOutputFormat, + MusicSeparateStemsRequestStemVariationId, + MusicStreamRequestOutputFormat, + MusicUploadRequestExtractCompositionPlan, + ) + from .play import play, save, stream + from .pronunciation_dictionaries import ( + AddPronunciationDictionaryRequestWorkspaceAccess, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess, + PronunciationDictionariesListRequestSort, + ) + from .realtime import ( + AudioFormat, + CommitStrategy, + RealtimeAudioOptions, + RealtimeConnection, + RealtimeEvents, + RealtimeUrlOptions, + ) + from .speech_engine_upstream import ReceiveUpstreamMessage, SendUpstreamMessage + from .speech_to_speech import ( + SpeechToSpeechConvertRequestOutputFormat, + SpeechToSpeechRequestFileFormat, + SpeechToSpeechStreamRequestFileFormat, + SpeechToSpeechStreamRequestOutputFormat, + ) + from .speech_to_text import ( + SpeechToTextConvertRequestEntityDetection, + SpeechToTextConvertRequestEntityRedaction, + SpeechToTextConvertRequestFileFormat, + SpeechToTextConvertRequestMultichannelOutputStyle, + SpeechToTextConvertRequestTimestampsGranularity, + SpeechToTextConvertRequestWebhookMetadata, + SpeechToTextConvertResponse, + ) + from .studio import ( + BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization, + BodyCreatePodcastV1StudioPodcastsPostDurationScale, + BodyCreatePodcastV1StudioPodcastsPostMode, + BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin, + BodyCreatePodcastV1StudioPodcastsPostMode_Conversation, + BodyCreatePodcastV1StudioPodcastsPostSource, + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem, + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text, + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url, + ) + from .text_to_dialogue import ( + BodyTextToDialogueFullWithTimestampsApplyTextNormalization, + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization, + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization, + BodyTextToDialogueStreamWithTimestampsApplyTextNormalization, + TextToDialogueConvertRequestOutputFormat, + TextToDialogueConvertWithTimestampsRequestOutputFormat, + ) + from .text_to_sound_effects import TextToSoundEffectsConvertRequestOutputFormat + from .text_to_speech import ( + BodyTextToSpeechFullApplyTextNormalization, + BodyTextToSpeechFullWithTimestampsApplyTextNormalization, + BodyTextToSpeechStreamApplyTextNormalization, + BodyTextToSpeechStreamWithTimestampsApplyTextNormalization, + TextToSpeechConvertRequestOutputFormat, + TextToSpeechConvertWithTimestampsRequestOutputFormat, + TextToSpeechStreamRequestOutputFormat, + TextToSpeechStreamWithTimestampsRequestOutputFormat, + ) + from .text_to_voice import VoiceDesignRequestModelModelId + from .v_1_dubbing_realtime import ( + ReceiveDubbingStreamMessage, + SendDubbingStreamMessage, + TextToDialogueInputFormat, + TextToDialogueOutputFormat, + ) + from .v_1_speech_to_text_realtime import ReceiveTranscription, TextToDialogueCommitStrategy + from .v_1_text_to_dialogue_multi_stream_input import ReceiveTextToDialogueWebsocketMessageMulti + from .v_1_text_to_dialogue_stream_input import ReceiveTextToDialogueWebsocketMessage + from .v_1_text_to_speech_voice_id_multi_stream_input import ReceiveMessageMulti, SendMessageMulti + from .v_1_text_to_speech_voice_id_stream_input import ReceiveMessage, SendMessage + from .v_1_translation_realtime import ( + ReceiveTranslateStreamMessage, + SendTranslateStreamMessage, + TextToDialogueApplyTextNormalization, + TextToDialogueEagerness, + TextToDialogueTtsModelId, + ) + from .version import __version__ + from .voices import EditVoiceRequestLabels, VoicesGetSharedRequestCategory, VoicesGetSharedRequestSort +_dynamic_imports: typing.Dict[str, str] = { + "AccountChangeActivityId": ".types", + "ActorModel": ".types", + "AddChapterResponseModel": ".types", + "AddKnowledgeBaseResponseModel": ".types", + "AddProjectRequest": ".types", + "AddProjectResponseModel": ".types", + "AddPronunciationDictionaryRequestWorkspaceAccess": ".pronunciation_dictionaries", + "AddPronunciationDictionaryResponseModel": ".types", + "AddPronunciationDictionaryResponseModelPermissionOnResource": ".types", + "AddSharingVoiceRequest": ".types", + "AddVoiceIvcResponseModel": ".types", + "AddVoiceResponseModel": ".types", + "AddVoiceToUserVoiceCollectionResponseModel": ".types", + "AddWorkspaceGroupMemberResponseModel": ".types", + "AddWorkspaceInviteResponseModel": ".types", + "AdditionalFormatResponseModel": ".types", + "AdditionalFormats": ".types", + "AdhocAgentConfigOverrideForTestRequestModel": ".types", + "Age": ".types", + "AgentAnalysisItemsInput": ".types", + "AgentAnalysisItemsInputDataCollectionItem": ".types", + "AgentAnalysisItemsInputDataCollectionItem_System": ".types", + "AgentAnalysisItemsInputDataCollectionItem_User": ".types", + "AgentAnalysisItemsInputEvaluationCriteriaItem": ".types", + "AgentAnalysisItemsInputEvaluationCriteriaItem_System": ".types", + "AgentAnalysisItemsInputEvaluationCriteriaItem_User": ".types", + "AgentAnalysisItemsOutput": ".types", + "AgentAnalysisItemsOutputDataCollectionItem": ".types", + "AgentAnalysisItemsOutputDataCollectionItem_System": ".types", + "AgentAnalysisItemsOutputDataCollectionItem_User": ".types", + "AgentAnalysisItemsOutputEvaluationCriteriaItem": ".types", + "AgentAnalysisItemsOutputEvaluationCriteriaItem_System": ".types", + "AgentAnalysisItemsOutputEvaluationCriteriaItem_User": ".types", + "AgentBranchBasicInfo": ".types", + "AgentBranchResponse": ".types", + "AgentBranchSummary": ".types", + "AgentCallLimits": ".types", + "AgentConfig": ".types", + "AgentConfigApiModelWorkflowOverrideInput": ".types", + "AgentConfigApiModelWorkflowOverrideOutput": ".types", + "AgentConfigOverrideConfig": ".types", + "AgentConfigOverrideInput": ".types", + "AgentConfigOverrideOutput": ".types", + "AgentConversationTicketIssueType": ".types", + "AgentConversationTicketPriority": ".types", + "AgentConversationTicketResponseModel": ".types", + "AgentConversationTicketSortBy": ".types", + "AgentConversationTicketSource": ".types", + "AgentConversationTicketStatus": ".types", + "AgentDefinitionSource": ".types", + "AgentDeploymentHistoryItem": ".types", + "AgentDeploymentPercentageStrategy": ".types", + "AgentDeploymentRequest": ".types", + "AgentDeploymentRequestItem": ".types", + "AgentDeploymentResponse": ".types", + "AgentDeploymentSource": ".types", + "AgentFailureResponseExample": ".types", + "AgentHoldAudioConfig": ".types", + "AgentKnowledgeBaseRagChunkResponseModel": ".types", + "AgentKnowledgeBaseRagQueryRequestModel": ".types", + "AgentKnowledgeBaseRagQueryResponseModel": ".types", + "AgentMergeProposalResponse": ".types", + "AgentMergeProposalResponseOutcome": ".types", + "AgentMergeProposalResponseOutcome_Closed": ".types", + "AgentMergeProposalResponseOutcome_Merged": ".types", + "AgentMergeProposalResponseOutcome_Open": ".types", + "AgentMetadata": ".types", + "AgentMetadataDbModel": ".types", + "AgentMetadataResponseModel": ".types", + "AgentPlatformSettingsRequestModel": ".types", + "AgentPlatformSettingsResponseModel": ".types", + "AgentQueueingConfig": ".types", + "AgentResponsePayload": ".types", + "AgentSimulatedChatTestResponseModel": ".types", + "AgentSmbMetadata": ".types", + "AgentSortBy": ".types", + "AgentSuccessfulResponseExample": ".types", + "AgentSummaryBatchSuccessfulResponseModel": ".types", + "AgentSummaryResponseModel": ".types", + "AgentTestEntityType": ".types", + "AgentTestFolderPathSegmentResponseModel": ".types", + "AgentTestingSettings": ".types", + "AgentTopicResponseModel": ".types", + "AgentTransferInput": ".types", + "AgentTransferOp": ".types", + "AgentTransferOpPop": ".types", + "AgentTransferOpPush": ".types", + "AgentTransferOpReplace": ".types", + "AgentTransferOp_Pop": ".types", + "AgentTransferOp_Push": ".types", + "AgentTransferOp_Replace": ".types", + "AgentTransferOutput": ".types", + "AgentTrustContext": ".types", + "AgentVersionMetadata": ".types", + "AgentVersionParents": ".types", + "AgentWorkflowRequestModel": ".types", + "AgentWorkflowRequestModelNodesValue": ".types", + "AgentWorkflowRequestModelNodesValue_End": ".types", + "AgentWorkflowRequestModelNodesValue_OverrideAgent": ".types", + "AgentWorkflowRequestModelNodesValue_PhoneNumber": ".types", + "AgentWorkflowRequestModelNodesValue_Say": ".types", + "AgentWorkflowRequestModelNodesValue_StandaloneAgent": ".types", + "AgentWorkflowRequestModelNodesValue_Start": ".types", + "AgentWorkflowRequestModelNodesValue_Tool": ".types", + "AgentWorkflowRequestModelNodesValue_UpdateState": ".types", + "AgentWorkflowResponseModel": ".types", + "AgentWorkflowResponseModelNodesValue": ".types", + "AgentWorkflowResponseModelNodesValue_End": ".types", + "AgentWorkflowResponseModelNodesValue_OverrideAgent": ".types", + "AgentWorkflowResponseModelNodesValue_PhoneNumber": ".types", + "AgentWorkflowResponseModelNodesValue_Say": ".types", + "AgentWorkflowResponseModelNodesValue_StandaloneAgent": ".types", + "AgentWorkflowResponseModelNodesValue_Start": ".types", + "AgentWorkflowResponseModelNodesValue_Tool": ".types", + "AgentWorkflowResponseModelNodesValue_UpdateState": ".types", + "AgentWorkspaceOverridesInput": ".types", + "AgentWorkspaceOverridesOutput": ".types", + "AlertingIntegrationNotifier": ".types", + "AlertingIntegrationNotifierIntegrationType": ".types", + "AlertingIntegrationNotifierResponse": ".types", + "AlertingIntegrationNotifierResponseIntegrationType": ".types", + "AlertingMonitorConfig": ".types", + "AlertingPagerDutyNotifier": ".types", + "AlertingPagerDutyNotifierResponse": ".types", + "AlertingSettings": ".types", + "AlertingSettingsNotifiersItem": ".types", + "AlertingSettingsNotifiersItem_Integration": ".types", + "AlertingSettingsNotifiersItem_Webhook": ".types", + "AlertingSettingsResponse": ".types", + "AlertingSettingsResponseNotifiersItem": ".types", + "AlertingSettingsResponseNotifiersItem_Integration": ".types", + "AlertingSettingsResponseNotifiersItem_Webhook": ".types", + "AlertingSlackNotifier": ".types", + "AlertingSlackNotifierResponse": ".types", + "AlertingWebhookHeader": ".types", + "AlertingWebhookMethod": ".types", + "AlertingWebhookNotifier": ".types", + "AlertingWebhookNotifierResponse": ".types", + "AlertingWebhookSecretHeaderValue": ".types", + "Alignment": ".types", + "AllowedOutputFormats": ".types", + "AllowedValues": ".types", + "AllowlistItem": ".types", + "AnalysisCharging": ".types", + "AnalysisProperty": ".types", + "AnalysisPropertyConstantValue": ".types", + "AnalysisPropertyType": ".types", + "AnalysisRunSnapshot": ".types", + "AnalysisRunningTotal": ".types", + "AnalysisScope": ".types", + "AnalysisType": ".types", + "ApiIntegrationOAuth2AuthCodeResponse": ".types", + "ApiIntegrationOAuth2AuthCodeResponseScopeSeparator": ".types", + "ApiIntegrationOAuth2CustomAppResponse": ".types", + "ApiIntegrationOAuth2CustomAppResponseScopeSeparator": ".types", + "ApiIntegrationWebhookOverrides": ".types", + "ApiIntegrationWebhookOverridesRequestHeadersValue": ".types", + "ApiIntegrationWebhookOverridesSchemaOverridesValue": ".types", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Constant": ".types", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_DynamicVariable": ".types", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Llm": ".types", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Omit": ".types", + "ApiIntegrationWebhookToolConfigInput": ".types", + "ApiIntegrationWebhookToolConfigOutput": ".types", + "ArchitectDispatchResponseModel": ".types", + "ArrayJsonSchemaPropertyInput": ".types", + "ArrayJsonSchemaPropertyInputItems": ".types", + "ArrayJsonSchemaPropertyInputPropertyKind": ".types", + "ArrayJsonSchemaPropertyOutput": ".types", + "ArrayJsonSchemaPropertyOutputItems": ".types", + "ArraySchema": ".types", + "AsrConversationalConfig": ".types", + "AsrConversationalConfigOverride": ".types", + "AsrConversationalConfigOverrideConfig": ".types", + "AsrConversationalConfigWorkflowOverride": ".types", + "AsrInputFormat": ".types", + "AsrProvider": ".types", + "AsrQuality": ".types", + "AssetListResponse": ".types", + "AssetResponse": ".types", + "AssetTranscription": ".types", + "AssetTranscriptionData": ".types", + "AssetTranscriptionStatus": ".types", + "AssignableUserResponseModel": ".types", + "AstAdditionOperatorNodeInput": ".types", + "AstAdditionOperatorNodeOutput": ".types", + "AstAndOperatorNodeInput": ".types", + "AstAndOperatorNodeOutput": ".types", + "AstBooleanNodeInput": ".types", + "AstBooleanNodeOutput": ".types", + "AstConditionalOperatorNodeInput": ".types", + "AstConditionalOperatorNodeOutput": ".types", + "AstDivisionOperatorNodeInput": ".types", + "AstDivisionOperatorNodeOutput": ".types", + "AstDynamicVariableNodeInput": ".types", + "AstDynamicVariableNodeOutput": ".types", + "AstEqualsOperatorNodeInput": ".types", + "AstEqualsOperatorNodeOutput": ".types", + "AstGreaterThanOperatorNodeInput": ".types", + "AstGreaterThanOperatorNodeOutput": ".types", + "AstGreaterThanOrEqualsOperatorNodeInput": ".types", + "AstGreaterThanOrEqualsOperatorNodeOutput": ".types", + "AstLessThanOperatorNodeInput": ".types", + "AstLessThanOperatorNodeOutput": ".types", + "AstLessThanOrEqualsOperatorNodeInput": ".types", + "AstLessThanOrEqualsOperatorNodeOutput": ".types", + "AstMultiplicationOperatorNodeInput": ".types", + "AstMultiplicationOperatorNodeOutput": ".types", + "AstNodeInput": ".types", + "AstNodeInputLlm": ".types", + "AstNodeInput_AddOperator": ".types", + "AstNodeInput_AndOperator": ".types", + "AstNodeInput_BooleanLiteral": ".types", + "AstNodeInput_ConditionalOperator": ".types", + "AstNodeInput_DivOperator": ".types", + "AstNodeInput_DynamicVariable": ".types", + "AstNodeInput_EqOperator": ".types", + "AstNodeInput_GtOperator": ".types", + "AstNodeInput_GteOperator": ".types", + "AstNodeInput_Llm": ".types", + "AstNodeInput_LtOperator": ".types", + "AstNodeInput_LteOperator": ".types", + "AstNodeInput_MulOperator": ".types", + "AstNodeInput_NeqOperator": ".types", + "AstNodeInput_NullLiteral": ".types", + "AstNodeInput_NumberLiteral": ".types", + "AstNodeInput_OrOperator": ".types", + "AstNodeInput_StringLiteral": ".types", + "AstNodeInput_SubOperator": ".types", + "AstNodeOutput": ".types", + "AstNodeOutput_AddOperator": ".types", + "AstNodeOutput_AndOperator": ".types", + "AstNodeOutput_BooleanLiteral": ".types", + "AstNodeOutput_ConditionalOperator": ".types", + "AstNodeOutput_DivOperator": ".types", + "AstNodeOutput_DynamicVariable": ".types", + "AstNodeOutput_EqOperator": ".types", + "AstNodeOutput_GtOperator": ".types", + "AstNodeOutput_GteOperator": ".types", + "AstNodeOutput_Llm": ".types", + "AstNodeOutput_LtOperator": ".types", + "AstNodeOutput_LteOperator": ".types", + "AstNodeOutput_MulOperator": ".types", + "AstNodeOutput_NeqOperator": ".types", + "AstNodeOutput_NullLiteral": ".types", + "AstNodeOutput_NumberLiteral": ".types", + "AstNodeOutput_OrOperator": ".types", + "AstNodeOutput_StringLiteral": ".types", + "AstNodeOutput_SubOperator": ".types", + "AstNotEqualsOperatorNodeInput": ".types", + "AstNotEqualsOperatorNodeOutput": ".types", + "AstNullNodeInput": ".types", + "AstNullNodeOutput": ".types", + "AstNumberNodeInput": ".types", + "AstNumberNodeInputValue": ".types", + "AstNumberNodeOutput": ".types", + "AstNumberNodeOutputValue": ".types", + "AstOrOperatorNodeInput": ".types", + "AstOrOperatorNodeOutput": ".types", + "AstStringNodeInput": ".types", + "AstStringNodeOutput": ".types", + "AstSubtractionOperatorNodeInput": ".types", + "AstSubtractionOperatorNodeOutput": ".types", + "AstllmNodeInput": ".types", + "AstllmNodeInputPrompt": ".types", + "AstllmNodeInputValueSchema": ".types", + "AstllmNodeOutput": ".types", + "AsyncConversationMetadata": ".types", + "AsyncConversationMetadataDeliveryStatus": ".types", + "AsyncElevenLabs": ".client", + "AttachedSystemDataCollectionRef": ".types", + "AttachedSystemEvaluationRef": ".types", + "AttachedTestModel": ".types", + "AttachedUserDataCollectionRef": ".types", + "AttachedUserEvaluationRef": ".types", + "AudioAnalysis": ".types", + "AudioAnalysisResult": ".types", + "AudioAnalysisStatus": ".types", + "AudioEffectsBackgroundNoiseResponseModel": ".types", + "AudioEffectsCatalogResponseModel": ".types", + "AudioEffectsEnvironmentResponseModel": ".types", + "AudioEffectsFilterPresetResponseModel": ".types", + "AudioFormat": ".realtime", + "AudioFormatEnum": ".types", + "AudioInputPacing": ".types", + "AudioIsolationHistoryItemResponseModel": ".types", + "AudioIsolationRequestFileFormat": ".audio_isolation", + "AudioIsolationStreamRequestFileFormat": ".audio_isolation", + "AudioKeyMoment": ".types", + "AudioNativeCreateProjectResponseModel": ".types", + "AudioNativeCreateRequestApplyTextNormalization": ".audio_native", + "AudioNativeEditContentResponseModel": ".types", + "AudioNativeProjectSettingsResponseModel": ".types", + "AudioNativeProjectSettingsResponseModelStatus": ".types", + "AudioOutput": ".types", + "AudioOutputMulti": ".types", + "AudioRefChunk": ".types", + "AudioReference": ".types", + "AudioReference_Asset": ".types", + "AudioReference_Generation": ".types", + "AudioReference_InlineBase64": ".types", + "AudioSchema": ".types", + "AudioSegment": ".types", + "AudioWithTimestampsAndVoiceSegmentsResponseModel": ".types", + "AudioWithTimestampsResponse": ".types", + "AuthConnectionDependencies": ".types", + "AuthConnectionDependenciesMcpServersItem": ".types", + "AuthConnectionDependenciesMcpServersItem_Available": ".types", + "AuthConnectionDependenciesMcpServersItem_Unknown": ".types", + "AuthConnectionDependenciesToolsItem": ".types", + "AuthConnectionDependenciesToolsItem_Available": ".types", + "AuthConnectionDependenciesToolsItem_Unknown": ".types", + "AuthConnectionLocator": ".types", + "AuthConnectionStatus": ".types", + "AuthSettings": ".types", + "AuthenticationActivityId": ".types", + "AuthorizationMethod": ".types", + "AutoGenerationMetadata": ".types", + "AutoSyncInfo": ".types", + "AvatarContextResponseModel": ".types", + "BackgroundSoundConfig": ".types", + "BackgroundSoundConfigWorkflowOverride": ".types", + "BackgroundSoundPresetId": ".types", + "BackgroundSoundSourceType": ".types", + "BackupLlmDefault": ".types", + "BackupLlmDisabled": ".types", + "BackupLlmOverride": ".types", + "BadRequestError": ".errors", + "BadRequestErrorBody": ".types", + "BanReasonType": ".types", + "BaseTurnConfig": ".types", + "BasicAuthResponse": ".types", + "BatchCallDetailedResponse": ".types", + "BatchCallRecipientStatus": ".types", + "BatchCallResponse": ".types", + "BatchCallStatus": ".types", + "BatchCallWhatsAppParams": ".types", + "BatchCallingCampaignInformation": ".types", + "BatchFailureResponseModel": ".types", + "BearerAuthResponse": ".types", + "BehaviorOverride": ".types", + "BillingPeriod": ".types", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem": ".pronunciation_dictionaries", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias": ".pronunciation_dictionaries", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme": ".pronunciation_dictionaries", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess": ".pronunciation_dictionaries", + "BodyComposeMusicV1MusicPostCompositionPlan": ".music", + "BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan": ".music", + "BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization": ".studio", + "BodyCreatePodcastV1StudioPodcastsPostDurationScale": ".studio", + "BodyCreatePodcastV1StudioPodcastsPostMode": ".studio", + "BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin": ".studio", + "BodyCreatePodcastV1StudioPodcastsPostMode_Conversation": ".studio", + "BodyCreatePodcastV1StudioPodcastsPostSource": ".studio", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem": ".studio", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text": ".studio", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url": ".studio", + "BodyStreamComposedMusicV1MusicStreamPostCompositionPlan": ".music", + "BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan": ".music", + "BodyTextToDialogueFullWithTimestampsApplyTextNormalization": ".text_to_dialogue", + "BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization": ".text_to_dialogue", + "BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization": ".text_to_dialogue", + "BodyTextToDialogueStreamWithTimestampsApplyTextNormalization": ".text_to_dialogue", + "BodyTextToSpeechFullApplyTextNormalization": ".text_to_speech", + "BodyTextToSpeechFullWithTimestampsApplyTextNormalization": ".text_to_speech", + "BodyTextToSpeechStreamApplyTextNormalization": ".text_to_speech", + "BodyTextToSpeechStreamWithTimestampsApplyTextNormalization": ".text_to_speech", + "BooleanSchema": ".types", + "BranchProtectionStatus": ".types", + "BreakdownTypes": ".types", + "BucketingStatus": ".types", + "BuiltInToolsInput": ".types", + "BuiltInToolsOutput": ".types", + "BuiltInToolsWorkflowOverrideInput": ".types", + "BuiltInToolsWorkflowOverrideOutput": ".types", + "BytedanceSeedance25Request": ".types", + "BytedanceSeedance25RequestAspectRatio": ".types", + "BytedanceSeedance25RequestResolution": ".types", + "BytedanceSeedance2FastRequest": ".types", + "BytedanceSeedance2FastRequestAspectRatio": ".types", + "BytedanceSeedance2FastRequestResolution": ".types", + "BytedanceSeedance2MiniRequest": ".types", + "BytedanceSeedance2MiniRequestAspectRatio": ".types", + "BytedanceSeedance2MiniRequestResolution": ".types", + "BytedanceSeedance2Request": ".types", + "BytedanceSeedance2RequestAspectRatio": ".types", + "BytedanceSeedance2RequestResolution": ".types", + "BytedanceSeedream5LiteRequest": ".types", + "BytedanceSeedream5LiteRequestAspectRatio": ".types", + "BytedanceSeedream5LiteRequestResolution": ".types", + "BytedanceSeedream5ProRequest": ".types", + "BytedanceSeedream5ProRequestAspectRatio": ".types", + "BytedanceSeedream5ProRequestResolution": ".types", + "CallResult": ".types", + "CampaignConversationType": ".types", + "CancelCalendarEventParams": ".types", + "CancelGroupSessionForAllParams": ".types", + "CancelGroupSessionRegistrationParams": ".types", + "CancelOrderParams": ".types", + "CanvasPlacement": ".types", + "CaptionStyleCharacterAnimationModel": ".types", + "CaptionStyleCharacterAnimationModelEnterType": ".types", + "CaptionStyleCharacterAnimationModelExitType": ".types", + "CaptionStyleHorizontalPlacementModel": ".types", + "CaptionStyleHorizontalPlacementModelAlign": ".types", + "CaptionStyleModel": ".types", + "CaptionStyleModelTextAlign": ".types", + "CaptionStyleModelTextBlendMode": ".types", + "CaptionStyleModelTextStyle": ".types", + "CaptionStyleModelTextTransform": ".types", + "CaptionStyleModelTextWeight": ".types", + "CaptionStyleSectionAnimationModel": ".types", + "CaptionStyleSectionAnimationModelEnterType": ".types", + "CaptionStyleSectionAnimationModelExitType": ".types", + "CaptionStyleTemplateModel": ".types", + "CaptionStyleVerticalPlacementModel": ".types", + "CaptionStyleVerticalPlacementModelAlign": ".types", + "CaptionStyleWordAnimationModel": ".types", + "CaptionStyleWordAnimationModelEnterType": ".types", + "CaptionStyleWordAnimationModelExitType": ".types", + "ChapterContentBlockExtendableNodeResponseModel": ".types", + "ChapterContentBlockInputModel": ".types", + "ChapterContentBlockInputModelSubType": ".types", + "ChapterContentBlockResponseModel": ".types", + "ChapterContentBlockResponseModelNodesItem": ".types", + "ChapterContentBlockResponseModelNodesItem_Other": ".types", + "ChapterContentBlockResponseModelNodesItem_TtsNode": ".types", + "ChapterContentBlockTtsNodeResponseModel": ".types", + "ChapterContentInputModel": ".types", + "ChapterContentParagraphTtsNodeInputModel": ".types", + "ChapterContentResponseModel": ".types", + "ChapterResponse": ".types", + "ChapterSnapshotExtendedResponseModel": ".types", + "ChapterSnapshotResponse": ".types", + "ChapterSnapshotsResponse": ".types", + "ChapterState": ".types", + "ChapterStatisticsResponse": ".types", + "ChapterWithContentResponseModel": ".types", + "ChapterWithContentResponseModelState": ".types", + "CharacterAge": ".types", + "CharacterAlignmentModel": ".types", + "CharacterAlignmentResponseModel": ".types", + "CharacterGender": ".types", + "CharacterMetadataResponseModel": ".types", + "CharacterRefreshPeriod": ".types", + "CharacterResponseModel": ".types", + "CharacterRole": ".types", + "CharacterUsageResponse": ".types", + "ChatSourceMedium": ".types", + "CheckServiceAvailabilityParams": ".types", + "ClientEvent": ".types", + "ClientSecretResponse": ".types", + "ClientToolConfigInput": ".types", + "ClientToolConfigOutput": ".types", + "ClipAnimation": ".types", + "ClipAnimationEnterEffect": ".types", + "ClipAnimationExitEffect": ".types", + "CloseConnection": ".types", + "CloseContext": ".types", + "ClosePayload": ".types", + "CloseSocket": ".types", + "ClosedOutcome": ".types", + "ColumnFilter": ".types", + "ColumnFilterOperation": ".types", + "ColumnFilterValuesItem": ".types", + "ColumnUnit": ".types", + "CommitStrategy": ".realtime", + "CommittedTranscriptEntitiesPayload": ".types", + "CommittedTranscriptPayload": ".types", + "CommittedTranscriptWithTimestampsPayload": ".types", + "CompactionSettingsWorkflowOverride": ".types", + "CompileProceduresResponseModel": ".types", + "CompileProceduresValidationErrorResponseModel": ".types", + "CompositionPlan": ".types", + "CompositionPlanChunksItem": ".types", + "ComputedUsagePlatformLimit": ".types", + "ConditionStrength": ".types", + "ConfigEntityType": ".types", + "ConflictError": ".errors", + "ConflictSection": ".types", + "ConstantSchemaOverride": ".types", + "ConstantSchemaOverrideConstantValue": ".types", + "ContentConfig": ".types", + "ContentFormat": ".types", + "ContentGuardrailInput": ".types", + "ContentGuardrailInputTriggerAction": ".types", + "ContentGuardrailInputTriggerAction_EndCall": ".types", + "ContentGuardrailInputTriggerAction_Retry": ".types", + "ContentGuardrailOutput": ".types", + "ContentGuardrailOutputTriggerAction": ".types", + "ContentGuardrailOutputTriggerAction_EndCall": ".types", + "ContentGuardrailOutputTriggerAction_Retry": ".types", + "ContentSchema": ".types", + "ContentSchema_Array": ".types", + "ContentSchema_Audio": ".types", + "ContentSchema_Boolean": ".types", + "ContentSchema_Image": ".types", + "ContentSchema_Integer": ".types", + "ContentSchema_Number": ".types", + "ContentSchema_Object": ".types", + "ContentSchema_String": ".types", + "ContentSchema_Video": ".types", + "ContentSchema_Voice": ".types", + "ContentThresholdGuardrail": ".types", + "ContentThresholdGuardrailThreshold": ".types", + "ContextualUpdateInfo": ".types", + "Contributor": ".types", + "ConvAiDynamicVariable": ".types", + "ConvAiEnvVarLocator": ".types", + "ConvAiFileUploadResponseModel": ".types", + "ConvAiSecretLocator": ".types", + "ConvAiStoredSecretDependencies": ".types", + "ConvAiStoredSecretDependenciesAgentsItem": ".types", + "ConvAiStoredSecretDependenciesAgentsItem_Available": ".types", + "ConvAiStoredSecretDependenciesAgentsItem_Unknown": ".types", + "ConvAiStoredSecretDependenciesMcpServersItem": ".types", + "ConvAiStoredSecretDependenciesMcpServersItem_Available": ".types", + "ConvAiStoredSecretDependenciesMcpServersItem_Unknown": ".types", + "ConvAiStoredSecretDependenciesToolsItem": ".types", + "ConvAiStoredSecretDependenciesToolsItem_Available": ".types", + "ConvAiStoredSecretDependenciesToolsItem_Unknown": ".types", + "ConvAiUserSecretDbModel": ".types", + "ConvAiWebhooks": ".types", + "ConvAiWorkspaceStoredSecretConfig": ".types", + "ConversationAsrUsageModel": ".types", + "ConversationChargingCommonModel": ".types", + "ConversationConfigClientOverrideConfigInput": ".types", + "ConversationConfigClientOverrideConfigOutput": ".types", + "ConversationConfigClientOverrideInput": ".types", + "ConversationConfigClientOverrideOutput": ".types", + "ConversationConfigInput": ".types", + "ConversationConfigOutput": ".types", + "ConversationConfigOverride": ".types", + "ConversationConfigOverrideConfig": ".types", + "ConversationConfigWorkflowOverrideInput": ".types", + "ConversationConfigWorkflowOverrideOutput": ".types", + "ConversationDeletionSettings": ".types", + "ConversationErrorType": ".types", + "ConversationFeedbackType": ".types", + "ConversationHistoryAnalysisCommonModel": ".types", + "ConversationHistoryBatchCallModel": ".types", + "ConversationHistoryElevenAssistantCommonModel": ".types", + "ConversationHistoryErrorCommonModel": ".types", + "ConversationHistoryEvaluationCriteriaResultCommonModel": ".types", + "ConversationHistoryExotelPhoneCallModel": ".types", + "ConversationHistoryFeedbackCommonModel": ".types", + "ConversationHistoryMetadataCommonModel": ".types", + "ConversationHistoryMetadataCommonModelPhoneCall": ".types", + "ConversationHistoryMetadataCommonModelPhoneCall_Exotel": ".types", + "ConversationHistoryMetadataCommonModelPhoneCall_SipTrunking": ".types", + "ConversationHistoryMetadataCommonModelPhoneCall_Twilio": ".types", + "ConversationHistoryMultivoiceMessageModel": ".types", + "ConversationHistoryMultivoiceMessagePartModel": ".types", + "ConversationHistoryRagUsageCommonModel": ".types", + "ConversationHistoryRedactionConfig": ".types", + "ConversationHistorySipTrunkingPhoneCallModel": ".types", + "ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput": ".types", + "ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput": ".types", + "ConversationHistoryTranscriptCommonModelInput": ".types", + "ConversationHistoryTranscriptCommonModelInputRole": ".types", + "ConversationHistoryTranscriptCommonModelInputToolResultsItem": ".types", + "ConversationHistoryTranscriptCommonModelOutput": ".types", + "ConversationHistoryTranscriptCommonModelOutputRole": ".types", + "ConversationHistoryTranscriptCommonModelOutputToolResultsItem": ".types", + "ConversationHistoryTranscriptFileInputResponseModel": ".types", + "ConversationHistoryTranscriptOtherToolsResultCommonModel": ".types", + "ConversationHistoryTranscriptOtherToolsResultCommonModelType": ".types", + "ConversationHistoryTranscriptResponseModel": ".types", + "ConversationHistoryTranscriptResponseModelRole": ".types", + "ConversationHistoryTranscriptResponseModelToolResultsItem": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInput": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_Dummy": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndCallSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseRagSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_LanguageDetectionSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_SkipTurnSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TestingToolResult": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberAmazonConnectSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberExotelSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberSipSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberTwilioSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_VoicemailDetectionSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutput": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_Dummy": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndCallSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseRagSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_LanguageDetectionSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_SkipTurnSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TestingToolResult": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberAmazonConnectSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberError": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberExotelSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberSipSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberTwilioSuccess": ".types", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_VoicemailDetectionSuccess": ".types", + "ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsInput": ".types", + "ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsOutput": ".types", + "ConversationHistoryTranscriptToolCallClientDetails": ".types", + "ConversationHistoryTranscriptToolCallCommonModelInput": ".types", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails": ".types", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_ApiIntegrationWebhook": ".types", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Client": ".types", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Mcp": ".types", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Webhook": ".types", + "ConversationHistoryTranscriptToolCallCommonModelOutput": ".types", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails": ".types", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_ApiIntegrationWebhook": ".types", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Client": ".types", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Mcp": ".types", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Webhook": ".types", + "ConversationHistoryTranscriptToolCallMcpDetails": ".types", + "ConversationHistoryTranscriptToolCallWebhookDetails": ".types", + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput": ".types", + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput": ".types", + "ConversationHistoryTwilioPhoneCallModel": ".types", + "ConversationInitiationClientDataConfigInput": ".types", + "ConversationInitiationClientDataConfigOutput": ".types", + "ConversationInitiationClientDataInternal": ".types", + "ConversationInitiationClientDataRequestInput": ".types", + "ConversationInitiationClientDataRequestOutput": ".types", + "ConversationInitiationClientDataWebhook": ".types", + "ConversationInitiationClientDataWebhookRequestHeadersValue": ".types", + "ConversationInitiationSource": ".types", + "ConversationInitiationSourceInfo": ".types", + "ConversationProduct": ".types", + "ConversationReasoningModel": ".types", + "ConversationSentimentAnalysis": ".types", + "ConversationSentimentAnalysisOverallLabel": ".types", + "ConversationSignedUrlResponseModel": ".types", + "ConversationSimulationSpecification": ".types", + "ConversationSource": ".types", + "ConversationSummaryMessageModel": ".types", + "ConversationSummaryMessageModelRole": ".types", + "ConversationSummaryResponseModel": ".types", + "ConversationSummaryResponseModelStatus": ".types", + "ConversationTagResponseModel": ".types", + "ConversationTokenPurpose": ".types", + "ConversationTokenResponseModel": ".types", + "ConversationTtsUsageModel": ".types", + "ConversationTurnMetrics": ".types", + "ConversationUserResponseModel": ".types", + "ConversationVoiceRewardModel": ".types", + "ConversationVoiceUsageModel": ".types", + "ConversationalConfig": ".types", + "ConversationalConfigApiModelWorkflowOverrideInput": ".types", + "ConversationalConfigApiModelWorkflowOverrideOutput": ".types", + "ConvertChapterResponseModel": ".types", + "ConvertProjectResponseModel": ".types", + "CrawlStatus": ".types", + "CrawlType": ".types", + "CreateAgentBranchResponseModel": ".types", + "CreateAgentMergeProposalResponseModel": ".types", + "CreateAgentProcedureParams": ".types", + "CreateAgentResponseModel": ".types", + "CreateAgentRuleParams": ".types", + "CreateAgentTestFolderResponseModel": ".types", + "CreateAgentTestResponseModel": ".types", + "CreateAssetParams": ".types", + "CreateAudioNativeProjectRequest": ".types", + "CreateAuthConnectionEnvironmentVariableRequest": ".types", + "CreateBasicAuthRequest": ".types", + "CreateBearerAuthRequest": ".types", + "CreateClientAppointmentParams": ".types", + "CreateClientInteractionParams": ".types", + "CreateClientParams": ".types", + "CreateClientSecretRequest": ".types", + "CreateCrawlJobResponseModel": ".types", + "CreateCustomHeaderAuthRequest": ".types", + "CreateExotelPhoneNumberRequest": ".types", + "CreateHolidayParams": ".types", + "CreateLocationParams": ".types", + "CreateMtlsAuthRequest": ".types", + "CreateOAuth2ClientCredsRequest": ".types", + "CreateOAuth2JwtRequest": ".types", + "CreateOAuth2JwtRequestAlgorithm": ".types", + "CreateOAuth2JwtRequestTokenResponseField": ".types", + "CreateOrderParams": ".types", + "CreateOrderRequest": ".types", + "CreateOrderResponse": ".types", + "CreatePhoneNumberResponseModel": ".types", + "CreatePreviouslyGeneratedVoiceRequest": ".types", + "CreatePrivateKeyJwtRequest": ".types", + "CreatePrivateKeyJwtRequestAlgorithm": ".types", + "CreateProcedureRequestModel": ".types", + "CreateProcedureResponseModel": ".types", + "CreateProductParams": ".types", + "CreateProductQuoteRequestParams": ".types", + "CreatePronunciationDictionaryResponseModel": ".types", + "CreateResponseUnitTestRequest": ".types", + "CreateSecretEnvironmentVariableRequest": ".types", + "CreateServiceParams": ".types", + "CreateServiceQuoteRequestParams": ".types", + "CreateSimulationTestRequest": ".types", + "CreateSipTrunkPhoneNumberRequest": ".types", + "CreateStaffParams": ".types", + "CreateStringEnvironmentVariableRequest": ".types", + "CreateToolCallUnitTestRequest": ".types", + "CreateTranscriptRequest": ".types", + "CreateTransferRuleParams": ".types", + "CreateTwilioPhoneNumberRequest": ".types", + "CreatifyAuroraRequest": ".types", + "CreatifyAuroraRequestResolution": ".types", + "CriteriaScoringMode": ".types", + "CueOptionsRequest": ".types", + "Currency": ".types", + "CustomGuardrailConfig": ".types", + "CustomGuardrailConfigModel": ".types", + "CustomGuardrailConfigTriggerAction": ".types", + "CustomGuardrailConfigTriggerAction_EndCall": ".types", + "CustomGuardrailConfigTriggerAction_Retry": ".types", + "CustomGuardrailInput": ".types", + "CustomGuardrailOutput": ".types", + "CustomGuardrailsConfigInput": ".types", + "CustomGuardrailsConfigOutput": ".types", + "CustomHeaderAuthResponse": ".types", + "CustomLlm": ".types", + "CustomLlmApiKey": ".types", + "CustomLlmAuthConnection": ".types", + "CustomLlmRequestHeadersValue": ".types", + "CustomLlmapiType": ".types", + "CustomSipHeader": ".types", + "CustomSipHeaderWithDynamicVariable": ".types", + "DashboardCallSuccessChartModel": ".types", + "DashboardCriteriaChartModel": ".types", + "DashboardDataCollectionChartModel": ".types", + "DataCollectionResultCommonModel": ".types", + "DefaultSharingGroupConfig": ".types", + "DefaultSharingGroupConfigPermissionLevel": ".types", + "DefaultSharingGroupResponseModel": ".types", + "DefaultSharingGroupResponseModelPermissionLevel": ".types", + "DeleteAgentHoldAudioResponseModel": ".types", + "DeleteAgentProcedureParams": ".types", + "DeleteAgentRuleParams": ".types", + "DeleteAssetParams": ".types", + "DeleteCalendarEventParams": ".types", + "DeleteChapterRequest": ".types", + "DeleteChapterResponseModel": ".types", + "DeleteClientInteractionParams": ".types", + "DeleteClientParams": ".types", + "DeleteDubbingResponseModel": ".types", + "DeleteGroupSessionParams": ".types", + "DeleteHistoryItemResponse": ".types", + "DeleteHolidayParams": ".types", + "DeleteLocationParams": ".types", + "DeleteProductParams": ".types", + "DeleteProjectRequest": ".types", + "DeleteProjectResponseModel": ".types", + "DeleteSampleResponse": ".types", + "DeleteServiceParams": ".types", + "DeleteStaffParams": ".types", + "DeleteTransferRuleParams": ".types", + "DeleteUserVoiceCollectionResponseModel": ".types", + "DeleteVoiceResponseModel": ".types", + "DeleteVoiceSampleResponseModel": ".types", + "DeleteWorkspaceGroupMemberResponseModel": ".types", + "DeleteWorkspaceInviteResponseModel": ".types", + "DeleteWorkspaceWebhookResponseModel": ".types", + "DeliverableInfo": ".types", + "DependentAvailableAgentIdentifier": ".types", + "DependentAvailableAgentIdentifierAccessLevel": ".types", + "DependentAvailableMcpServerIdentifier": ".types", + "DependentAvailableMcpServerIdentifierAccessLevel": ".types", + "DependentAvailableToolIdentifier": ".types", + "DependentAvailableToolIdentifierAccessLevel": ".types", + "DependentBranchInfo": ".types", + "DependentIntegrationConnectionIdentifier": ".types", + "DependentPhoneNumberIdentifier": ".types", + "DependentUnknownAgentIdentifier": ".types", + "DependentUnknownMcpServerIdentifier": ".types", + "DependentUnknownToolIdentifier": ".types", + "DetailedMusicResponse": ".types", + "DetailedMusicResponseCompositionPlan": ".types", + "DetectedEntity": ".types", + "DeviceModel": ".types", + "DialogueInput": ".types", + "DialogueInputResponseModel": ".types", + "DialogueTextAlignment": ".types", + "DirectPublishingReadResponseModel": ".types", + "DirectPublishingReadResponseModelDisplayMode": ".types", + "DirectPublishingReadResponseModelGenreItem": ".types", + "DirectPublishingReadResponseModelPayoutType": ".types", + "DirectPublishingReadResponseModelTargetAudience": ".types", + "DiscountResponseModel": ".types", + "DoDubbingResponse": ".types", + "DocumentUsageModeEnum": ".types", + "DocxExportOptions": ".types", + "DtmfInputConfig": ".types", + "DubOrderItemRequest": ".types", + "DubRequestMode": ".dubbing", + "DubbedSegment": ".types", + "DubbingAudio": ".types", + "DubbingAudioOutputError": ".types", + "DubbingAuthError": ".types", + "DubbingBulkSourceSegmentUpdateResponse": ".types", + "DubbingBulkTargetSegmentUpdateResponse": ".types", + "DubbingCommittedTranscript": ".types", + "DubbingEndOfStream": ".types", + "DubbingError": ".types", + "DubbingInputAudioChunk": ".types", + "DubbingInputError": ".types", + "DubbingInvalidRequestError": ".types", + "DubbingLanguageListResponse": ".types", + "DubbingLanguageOutputs": ".types", + "DubbingLanguageResponse": ".types", + "DubbingLanguageResponseStatus": ".types", + "DubbingListRequestCreationSourcesItem": ".dubbing", + "DubbingListRequestDubbingModelsItem": ".dubbing", + "DubbingListRequestDubbingStatus": ".dubbing", + "DubbingListRequestDubbingStatusesItem": ".dubbing", + "DubbingListRequestFilterByCreator": ".dubbing", + "DubbingListRequestOrderBy": ".dubbing", + "DubbingListRequestOrderDirection": ".dubbing", + "DubbingMediaMetadata": ".types", + "DubbingMediaReference": ".types", + "DubbingMetadataPageResponseModel": ".types", + "DubbingMetadataResponse": ".types", + "DubbingPartialTranscript": ".types", + "DubbingProjectListResponse": ".types", + "DubbingProjectResponse": ".types", + "DubbingProjectResponseStatus": ".types", + "DubbingQueueOverflowError": ".types", + "DubbingRateLimitedError": ".types", + "DubbingRegenerateResponse": ".types", + "DubbingReleaseChannel": ".types", + "DubbingRenderResponseModel": ".types", + "DubbingResource": ".types", + "DubbingSegmentUpdateRequest": ".types", + "DubbingSessionStarted": ".types", + "DubbingSourceMediaInfo": ".types", + "DubbingSourceSegmentUpdateResponse": ".types", + "DubbingSourceTranscriptResponse": ".types", + "DubbingStatus": ".types", + "DubbingStatusStatus": ".types", + "DubbingTargetSegmentUpdateRequest": ".types", + "DubbingTargetSegmentUpdateResponse": ".types", + "DubbingTargetTranscriptResponse": ".types", + "DubbingTargetTranscriptSegment": ".types", + "DubbingTranscriberError": ".types", + "DubbingTranscript": ".types", + "DubbingTranscriptCharacter": ".types", + "DubbingTranscriptResponseModel": ".types", + "DubbingTranscriptRevisionResponse": ".types", + "DubbingTranscriptSegment": ".types", + "DubbingTranscriptUtterance": ".types", + "DubbingTranscriptWord": ".types", + "DubbingTranscriptsResponseModel": ".types", + "DubbingTranscriptsResponseModelTranscriptFormat": ".types", + "DubbingTranslation": ".types", + "DubbingTranslationError": ".types", + "DummyToolResultModel": ".types", + "DuplicateSpeechEngineRequest": ".types", + "DynamicVariableAssignment": ".types", + "DynamicVariableInternalValueType": ".types", + "DynamicVariableNestedValueTypeInput": ".types", + "DynamicVariableNestedValueTypeOutput": ".types", + "DynamicVariableSchemaOverride": ".types", + "DynamicVariableUpdateCommonModel": ".types", + "DynamicVariablesConfig": ".types", + "DynamicVariablesConfigWorkflowOverride": ".types", + "Eagerness": ".types", + "EditChapterResponseModel": ".types", + "EditProjectResponseModel": ".types", + "EditVoiceRequestLabels": ".voices", + "EditVoiceResponseModel": ".types", + "EditVoiceSettingsRequest": ".types", + "EditVoiceSettingsResponseModel": ".types", + "EditedTranscript": ".types", + "EffectsSpecInput": ".types", + "EffectsSpecOutput": ".types", + "ElevenFlashV25Request": ".types", + "ElevenFlashV25RequestOutputFormat": ".types", + "ElevenFlashV25VoiceSettings": ".types", + "ElevenLabs": ".client", + "ElevenLabsEnvironment": ".environment", + "ElevenMultilingualV2Request": ".types", + "ElevenMultilingualV2RequestOutputFormat": ".types", + "ElevenV3Request": ".types", + "ElevenV3RequestOutputFormat": ".types", + "ElevenV3VoiceSettings": ".types", + "EmbedVariant": ".types", + "EmbeddingModelEnum": ".types", + "EndCallToolConfig": ".types", + "EndCallToolResultModel": ".types", + "EndCallTriggerAction": ".types", + "EndProcedureToolConfig": ".types", + "EndProcedureToolConfigProceduresValue": ".types", + "EndProcedureToolErrorStatus": ".types", + "EndProcedureToolResultErrorModel": ".types", + "EndProcedureToolResultSuccessModel": ".types", + "EntityManagementActivityId": ".types", + "EntryBehavior": ".types", + "EnvironmentAuthConnectionLocator": ".types", + "EnvironmentResponse": ".types", + "EnvironmentVariableAuthConnectionValue": ".types", + "EnvironmentVariableAuthConnectionValueRequest": ".types", + "EnvironmentVariableResponse": ".types", + "EnvironmentVariableResponseType": ".types", + "EnvironmentVariableResponseValues": ".types", + "EnvironmentVariableSecretValue": ".types", + "EnvironmentVariableSecretValueRequest": ".types", + "EnvironmentVariablesCreateRequestBody": ".environment_variables", + "EnvironmentVariablesCreateRequestBody_AuthConnection": ".environment_variables", + "EnvironmentVariablesCreateRequestBody_Secret": ".environment_variables", + "EnvironmentVariablesCreateRequestBody_String": ".environment_variables", + "EnvironmentVariablesListRequestType": ".environment_variables", + "EnvironmentVariablesListResponse": ".types", + "EnvironmentsListResponse": ".types", + "ErrorPayload": ".types", + "EvaluationCriteriaSummaryResult": ".types", + "EvaluationResultFilter": ".types", + "EvaluationSettingsInput": ".types", + "EvaluationSettingsOutput": ".types", + "EvaluationSuccessResult": ".types", + "ExactParameterEvaluationStrategy": ".types", + "ExotelApiSubdomain": ".types", + "ExotelOutboundCallResponse": ".types", + "ExperimentAssignment": ".types", + "ExperimentAssignmentSource": ".types", + "ExpiresAfter": ".types", + "ExportOptions": ".types", + "ExportOptions_Docx": ".types", + "ExportOptions_Html": ".types", + "ExportOptions_Pdf": ".types", + "ExportOptions_SegmentedJson": ".types", + "ExportOptions_Srt": ".types", + "ExportOptions_Txt": ".types", + "ExternalFileSyncInfo": ".types", + "ExternalFolderSyncInfo": ".types", + "ExternalSyncJobTrigger": ".types", + "ExternalSyncJobType": ".types", + "ExternalSyncProvider": ".types", + "FeatureStatusCommonModel": ".types", + "FeaturesUsageCommonModel": ".types", + "FeedbackItem": ".types", + "FieldConflict": ".types", + "FileInputConfig": ".types", + "FileInputConfigWorkflowOverride": ".types", + "FileRefreshStatus": ".types", + "FinalOutput": ".types", + "FinalOutputMulti": ".types", + "FineTuningResponse": ".types", + "FineTuningResponseStateValue": ".types", + "FinetuneCreatedBy": ".types", + "FinetuneVisibility": ".types", + "FlushContext": ".types", + "FocusGuardrail": ".types", + "ForbiddenError": ".errors", + "ForcedAlignmentCharacterResponseModel": ".types", + "ForcedAlignmentResponseModel": ".types", + "ForcedAlignmentWordResponseModel": ".types", + "FrustratedConversationRef": ".types", + "FrustratedConversationRefOverallLabel": ".types", + "Gemini25FlashImageRequest": ".types", + "Gemini25FlashImageRequestAspectRatio": ".types", + "Gemini31FlashImageRequest": ".types", + "Gemini31FlashImageRequestAspectRatio": ".types", + "Gemini31FlashImageRequestResolution": ".types", + "Gemini31FlashLiteImageRequest": ".types", + "Gemini31FlashLiteImageRequestAspectRatio": ".types", + "Gemini3ProImageRequest": ".types", + "Gemini3ProImageRequestAspectRatio": ".types", + "Gemini3ProImageRequestResolution": ".types", + "Gender": ".types", + "GenerateVoiceRequest": ".types", + "GenerationChunkInput": ".types", + "GenerationChunkInputContextAdherence": ".types", + "GenerationChunkOutput": ".types", + "GenerationChunkOutputContextAdherence": ".types", + "GenerationConfig": ".types", + "GenerationReference": ".types", + "GenerationSourceContext": ".types", + "GenesysBotOutcome": ".types", + "GenesysRegion": ".types", + "GetAgentConfigParams": ".types", + "GetAgentConversationTicketsPageResponseModel": ".types", + "GetAgentEmbedResponseModel": ".types", + "GetAgentKnowledgebaseSizeResponseModel": ".types", + "GetAgentLinkResponseModel": ".types", + "GetAgentResponseModel": ".types", + "GetAgentResponseModelPhoneNumbersItem": ".types", + "GetAgentResponseModelPhoneNumbersItem_Exotel": ".types", + "GetAgentResponseModelPhoneNumbersItem_SipTrunk": ".types", + "GetAgentResponseModelPhoneNumbersItem_Twilio": ".types", + "GetAgentTestFolderResponseModel": ".types", + "GetAgentTopicsResponseModel": ".types", + "GetAgentsPageResponseModel": ".types", + "GetAnalyticsSummaryParams": ".types", + "GetAppointmentByConfirmationNumberParams": ".types", + "GetAudioIsolationHistoryResponseModel": ".types", + "GetAudioNativeProjectSettingsResponseModel": ".types", + "GetBookingPageSettingsParams": ".types", + "GetBookingSlugStatusParams": ".types", + "GetChapterRequest": ".types", + "GetChapterSnapshotsRequest": ".types", + "GetChaptersRequest": ".types", + "GetChaptersResponse": ".types", + "GetClientAppointmentsParams": ".types", + "GetClientByPhoneParams": ".types", + "GetClientOrdersParams": ".types", + "GetConvAiDashboardSettingsResponseModel": ".types", + "GetConvAiDashboardSettingsResponseModelChartsItem": ".types", + "GetConvAiDashboardSettingsResponseModelChartsItem_CallSuccess": ".types", + "GetConvAiDashboardSettingsResponseModelChartsItem_Criteria": ".types", + "GetConvAiDashboardSettingsResponseModelChartsItem_DataCollection": ".types", + "GetConvAiSettingsResponseModel": ".types", + "GetConversationResponseModel": ".types", + "GetConversationResponseModelStatus": ".types", + "GetConversationSummaryResponseModel": ".types", + "GetConversationSummaryResponseModelStatus": ".types", + "GetConversationTagsPageResponseModel": ".types", + "GetConversationUsersPageResponseModel": ".types", + "GetConversationsPageResponseModel": ".types", + "GetCrawlJobResponseModel": ".types", + "GetKnowledgeBaseDependentAgentsResponseModel": ".types", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem": ".types", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Available": ".types", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Unknown": ".types", + "GetKnowledgeBaseFileResponseModel": ".types", + "GetKnowledgeBaseFolderResponseModel": ".types", + "GetKnowledgeBaseListResponseModel": ".types", + "GetKnowledgeBaseListResponseModelDocumentsItem": ".types", + "GetKnowledgeBaseListResponseModelDocumentsItem_File": ".types", + "GetKnowledgeBaseListResponseModelDocumentsItem_Folder": ".types", + "GetKnowledgeBaseListResponseModelDocumentsItem_Text": ".types", + "GetKnowledgeBaseListResponseModelDocumentsItem_Url": ".types", + "GetKnowledgeBaseSummaryFileResponseModel": ".types", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem": ".types", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Available": ".types", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Unknown": ".types", + "GetKnowledgeBaseSummaryFolderResponseModel": ".types", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem": ".types", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Available": ".types", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Unknown": ".types", + "GetKnowledgeBaseSummaryTextResponseModel": ".types", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem": ".types", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Available": ".types", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Unknown": ".types", + "GetKnowledgeBaseSummaryUrlResponseModel": ".types", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem": ".types", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Available": ".types", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Unknown": ".types", + "GetKnowledgeBaseTextResponseModel": ".types", + "GetKnowledgeBaseUrlResponseModel": ".types", + "GetLibraryVoicesResponse": ".types", + "GetLiveCountResponse": ".types", + "GetOrCreateRagIndexRequestModel": ".types", + "GetOrderByConfirmationNumberParams": ".types", + "GetPhoneNumberExotelResponseModel": ".types", + "GetPhoneNumberInboundSipTrunkConfigResponseModel": ".types", + "GetPhoneNumberOutboundSipTrunkConfigResponseModel": ".types", + "GetPhoneNumberResponse": ".types", + "GetPhoneNumberSipTrunkResponseModel": ".types", + "GetPhoneNumberTwilioResponseModel": ".types", + "GetPhoneNumbersPageResponseModel": ".types", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem": ".types", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_Exotel": ".types", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_SipTrunk": ".types", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_Twilio": ".types", + "GetProjectRequest": ".types", + "GetProjectsRequest": ".types", + "GetProjectsResponse": ".types", + "GetPronunciationDictionariesMetadataResponseModel": ".types", + "GetPronunciationDictionariesResponse": ".types", + "GetPronunciationDictionaryMetadataResponse": ".types", + "GetPronunciationDictionaryMetadataResponsePermissionOnResource": ".types", + "GetPronunciationDictionaryResponse": ".types", + "GetPronunciationDictionaryWithRulesResponseModel": ".types", + "GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource": ".types", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem": ".types", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem_Alias": ".types", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem_Phoneme": ".types", + "GetResponseUnitTestResponseModel": ".types", + "GetScheduleParams": ".types", + "GetSecretDependenciesResponseModel": ".types", + "GetSecretDependenciesResponseModelDependencies": ".types", + "GetSecretDependenciesResponseModelDependenciesOneItem": ".types", + "GetSecretDependenciesResponseModelDependenciesOneItem_Available": ".types", + "GetSecretDependenciesResponseModelDependenciesOneItem_Unknown": ".types", + "GetSecretDependenciesResponseModelDependenciesZeroItem": ".types", + "GetSecretDependenciesResponseModelDependenciesZeroItem_Available": ".types", + "GetSecretDependenciesResponseModelDependenciesZeroItem_Unknown": ".types", + "GetSimulationTestResponseModel": ".types", + "GetSipLogMessagesResponse": ".types", + "GetSpeechHistoryResponse": ".types", + "GetTestInvocationsPageResponseModel": ".types", + "GetTestSuiteInvocationResponseModel": ".types", + "GetTestsPageResponseModel": ".types", + "GetTestsSummariesByIdsResponseModel": ".types", + "GetToolCallUnitTestResponseModel": ".types", + "GetToolDependentAgentsResponseModel": ".types", + "GetToolDependentAgentsResponseModelAgentsItem": ".types", + "GetToolDependentAgentsResponseModelAgentsItem_Available": ".types", + "GetToolDependentAgentsResponseModelAgentsItem_Unknown": ".types", + "GetToolExecutionsPageResponseModel": ".types", + "GetUserVoiceCollectionsResponseModel": ".types", + "GetVoiceAccentsResponseModel": ".types", + "GetVoicesResponse": ".types", + "GetVoicesV2Response": ".types", + "GetWhatsAppAccountResponse": ".types", + "GetWorkspacePlanParams": ".types", + "GetWorkspaceSecretsResponseModel": ".types", + "GptImage15Request": ".types", + "GptImage15RequestAspectRatio": ".types", + "GptImage15RequestBackground": ".types", + "GptImage15RequestQuality": ".types", + "GptImage1Request": ".types", + "GptImage1RequestAspectRatio": ".types", + "GptImage1RequestBackground": ".types", + "GptImage1RequestQuality": ".types", + "GptImage25FlareRequest": ".types", + "GptImage25FlareRequestAspectRatio": ".types", + "GptImage25FlareRequestQuality": ".types", + "GptImage25FlareRequestResolution": ".types", + "GptImage25SunburstRequest": ".types", + "GptImage25SunburstRequestAspectRatio": ".types", + "GptImage25SunburstRequestQuality": ".types", + "GptImage25SunburstRequestResolution": ".types", + "GptImage2Request": ".types", + "GptImage2RequestAspectRatio": ".types", + "GptImage2RequestQuality": ".types", + "GptImage2RequestResolution": ".types", + "GroupManagementActivityId": ".types", + "GuardrailExecutionMode": ".types", + "GuardrailType": ".types", + "GuardrailsResult": ".types", + "GuardrailsV1Input": ".types", + "GuardrailsV1Output": ".types", + "HidingReason": ".types", + "HistoryAlignmentResponseModel": ".types", + "HistoryAlignmentsResponseModel": ".types", + "HistoryItemResponse": ".types", + "HistoryListRequestSortDirection": ".history", + "HistoryListRequestSource": ".history", + "HtmlExportOptions": ".types", + "HttpRequestModel": ".types", + "HttpValidationError": ".types", + "Icon": ".types", + "IconTheme": ".types", + "ImageAnalysis": ".types", + "ImageAnalysisResult": ".types", + "ImageAnalysisStatus": ".types", + "ImageAvatar": ".types", + "ImageGenerationRequest": ".types", + "ImageGenerationRequest_BytedanceSeedream5Lite": ".types", + "ImageGenerationRequest_BytedanceSeedream5Pro": ".types", + "ImageGenerationRequest_Gemini25FlashImage": ".types", + "ImageGenerationRequest_Gemini31FlashImage": ".types", + "ImageGenerationRequest_Gemini31FlashLiteImage": ".types", + "ImageGenerationRequest_Gemini3ProImage": ".types", + "ImageGenerationRequest_GptImage1": ".types", + "ImageGenerationRequest_GptImage15": ".types", + "ImageGenerationRequest_GptImage2": ".types", + "ImageGenerationRequest_GptImage25Flare": ".types", + "ImageGenerationRequest_GptImage25Sunburst": ".types", + "ImageReference": ".types", + "ImageReference_Asset": ".types", + "ImageReference_Generation": ".types", + "ImageReference_InlineBase64": ".types", + "ImageSchema": ".types", + "ImageSubject": ".types", + "InboundSipTrunkConfigRequestModel": ".types", + "InitPayload": ".types", + "InitialiseContext": ".types", + "InitializeConnection": ".types", + "InitializeConnectionMulti": ".types", + "InlineAudioReference": ".types", + "InlineAudioReferenceMimeType": ".types", + "InlineBase64Reference": ".types", + "InlineBase64ReferenceMimeType": ".types", + "InlineImageReference": ".types", + "InlineImageReferenceMimeType": ".types", + "InlineVideoReference": ".types", + "InlineVideoReferenceMimeType": ".types", + "InputAudioChunkPayload": ".types", + "IntegerSchema": ".types", + "IntegrationType": ".types", + "InteractionBudget": ".types", + "InternalAlertingWebhookNotifier": ".types", + "InternalSamplingConfigResponseModel": ".types", + "InvoiceResponse": ".types", + "InvoiceResponsePaymentIntentStatus": ".types", + "InvoiceResponsePaymentIntentStatussesItem": ".types", + "ItemId": ".types", + "KbExternalSyncJob": ".types", + "KeepContextAlive": ".types", + "KnowledgeBaseBulkDeleteSuccessfulResponseModel": ".types", + "KnowledgeBaseContentSearchResponseModel": ".types", + "KnowledgeBaseContentSearchResult": ".types", + "KnowledgeBaseContentSearchResultDocument": ".types", + "KnowledgeBaseContentSearchResultDocument_File": ".types", + "KnowledgeBaseContentSearchResultDocument_Folder": ".types", + "KnowledgeBaseContentSearchResultDocument_Text": ".types", + "KnowledgeBaseContentSearchResultDocument_Url": ".types", + "KnowledgeBaseDeletedResponseModel": ".types", + "KnowledgeBaseDependentType": ".types", + "KnowledgeBaseDocumentChunkResponseModel": ".types", + "KnowledgeBaseDocumentChunksResponseModel": ".types", + "KnowledgeBaseDocumentMetadataResponseModel": ".types", + "KnowledgeBaseDocumentType": ".types", + "KnowledgeBaseFolderPathSegmentResponseModel": ".types", + "KnowledgeBaseFolderPathSegmentSummaryResponseModel": ".types", + "KnowledgeBaseLocator": ".types", + "KnowledgeBaseRagChunkModel": ".types", + "KnowledgeBaseRagToolConfig": ".types", + "KnowledgeBaseRagToolResultModel": ".types", + "KnowledgeBaseRagToolStatus": ".types", + "KnowledgeBaseSortBy": ".types", + "KnowledgeBaseSourceFileUrlResponseModel": ".types", + "KnowledgeBaseSummaryBatchSuccessfulResponseModel": ".types", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData": ".types", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_File": ".types", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Folder": ".types", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Text": ".types", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Url": ".types", + "KnowledgeBaseToolConfig": ".types", + "KnowledgeBaseToolInfo": ".types", + "KnowledgeBaseToolResultModel": ".types", + "KnowledgeBaseToolStatus": ".types", + "LanguageAddedResponse": ".types", + "LanguageDetectionToolConfig": ".types", + "LanguageDetectionToolResultModel": ".types", + "LanguageInfo": ".types", + "LanguagePairInfo": ".types", + "LanguagePresetInput": ".types", + "LanguagePresetOutput": ".types", + "LanguagePresetTranslation": ".types", + "LanguageResponse": ".types", + "LanguagesResponse": ".types", + "LanguagesResponse_Pair": ".types", + "LanguagesResponse_Single": ".types", + "LeaveMessageParams": ".types", + "LibraryVoiceResponse": ".types", + "LibraryVoiceResponseCategory": ".types", + "ListAgentProceduresParams": ".types", + "ListAgentReferencesParams": ".types", + "ListAgentRulesParams": ".types", + "ListAssetsParams": ".types", + "ListAuthConnectionsResponse": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2AuthCode": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2CustomApp": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_BasicAuth": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_BearerAuth": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_CustomHeaderAuth": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_Mtls": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_Oauth2ClientCredentials": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_Oauth2Jwt": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_PrivateKeyJwt": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_RefreshTokenAuth": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_SlackBotAuth": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_UrlSecret": ".types", + "ListAuthConnectionsResponseAuthConnectionsItem_WhatsappAuth": ".types", + "ListCalendarEventsParams": ".types", + "ListClientInteractionsParams": ".types", + "ListClientsParams": ".types", + "ListCrawlJobsResponseModel": ".types", + "ListCustomerFacingAgentsParams": ".types", + "ListGroupSessionsParams": ".types", + "ListHolidaysParams": ".types", + "ListLocationsParams": ".types", + "ListMcpToolsResponseModel": ".types", + "ListOrdersResponse": ".types", + "ListProceduresResponseModel": ".types", + "ListProductsParams": ".types", + "ListResponseAgentBranchSummary": ".types", + "ListResponseAgentDeploymentHistoryItem": ".types", + "ListResponseMeta": ".types", + "ListServicesParams": ".types", + "ListSpeechEnginesResponse": ".types", + "ListStaffParams": ".types", + "ListTransferRulesParams": ".types", + "ListWhatsAppAccountsResponse": ".types", + "LiteralJsonSchemaProperty": ".types", + "LiteralJsonSchemaPropertyConstantValue": ".types", + "LiteralJsonSchemaPropertyType": ".types", + "LivekitStackType": ".types", + "Llm": ".types", + "LlmCategoryUsage": ".types", + "LlmDeprecationConfigModel": ".types", + "LlmDeprecationInfoModel": ".types", + "LlmInfoModel": ".types", + "LlmInputOutputTokensUsage": ".types", + "LlmListResponseModel": ".types", + "LlmLiteralJsonSchemaProperty": ".types", + "LlmLiteralJsonSchemaPropertyType": ".types", + "LlmParameterEvaluationStrategy": ".types", + "LlmReasoningEffort": ".types", + "LlmSchemaOverride": ".types", + "LlmTokensCategoryUsage": ".types", + "LlmUsageCalculatorLlmResponseModel": ".types", + "LlmUsageCalculatorResponseModel": ".types", + "LlmUsageInput": ".types", + "LlmUsageOutput": ".types", + "LoadMemoryEntryToolErrorStatus": ".types", + "LoadableMemoryEntry": ".types", + "LockReason": ".types", + "ManualSource": ".types", + "ManualVerificationFileResponse": ".types", + "ManualVerificationResponse": ".types", + "MatchAnythingParameterEvaluationStrategy": ".types", + "McpApprovalPolicy": ".types", + "McpApprovedToolDefinition": ".types", + "McpServerConfigInput": ".types", + "McpServerConfigInputAuthConnection": ".types", + "McpServerConfigInputRequestHeadersValue": ".types", + "McpServerConfigInputRequestMetaValue": ".types", + "McpServerConfigInputSecretToken": ".types", + "McpServerConfigInputUrl": ".types", + "McpServerConfigOutput": ".types", + "McpServerConfigOutputAuthConnection": ".types", + "McpServerConfigOutputRequestHeadersValue": ".types", + "McpServerConfigOutputRequestMetaValue": ".types", + "McpServerConfigOutputSecretToken": ".types", + "McpServerConfigOutputUrl": ".types", + "McpServerMetadataResponseModel": ".types", + "McpServerResponseModel": ".types", + "McpServerResponseModelDependentAgentsItem": ".types", + "McpServerResponseModelDependentAgentsItem_Available": ".types", + "McpServerResponseModelDependentAgentsItem_Unknown": ".types", + "McpServerTransport": ".types", + "McpServersResponseModel": ".types", + "McpToolApprovalHash": ".types", + "McpToolApprovalPolicy": ".types", + "McpToolApprovalState": ".types", + "McpToolApprovalStatus": ".types", + "McpToolConfigOverrideInput": ".types", + "McpToolConfigOverrideInputInputOverridesValue": ".types", + "McpToolConfigOverrideInputInputOverridesValue_Constant": ".types", + "McpToolConfigOverrideInputInputOverridesValue_DynamicVariable": ".types", + "McpToolConfigOverrideInputInputOverridesValue_Llm": ".types", + "McpToolConfigOverrideInputInputOverridesValue_Omit": ".types", + "McpToolConfigOverrideInputToolCallSound": ".types", + "McpToolConfigOverrideOutput": ".types", + "McpToolConfigOverrideOutputInputOverridesValue": ".types", + "McpToolConfigOverrideOutputInputOverridesValue_Constant": ".types", + "McpToolConfigOverrideOutputInputOverridesValue_DynamicVariable": ".types", + "McpToolConfigOverrideOutputInputOverridesValue_Llm": ".types", + "McpToolConfigOverrideOutputInputOverridesValue_Omit": ".types", + "McpToolConfigOverrideOutputToolCallSound": ".types", + "MediaCodec": ".types", + "MediaGenerationCompletedResponse": ".types", + "MediaGenerationCreateResponse": ".types", + "MediaGenerationFailedResponse": ".types", + "MediaGenerationFailedResponseFailureReason": ".types", + "MediaGenerationInProgressResponse": ".types", + "MediaGenerationListResponse": ".types", + "MediaGenerationResponse": ".types", + "MediaGenerationResponse_Completed": ".types", + "MediaGenerationResponse_Failed": ".types", + "MediaGenerationResponse_Generating": ".types", + "MediaGenerationResponse_Pending": ".types", + "MediaId": ".types", + "MemoryEntrySearchResult": ".types", + "MemoryEntrySearchResultSource": ".types", + "MergePreviewResponseModel": ".types", + "MergePreviewResponseModelPhoneNumbersItem": ".types", + "MergePreviewResponseModelPhoneNumbersItem_Exotel": ".types", + "MergePreviewResponseModelPhoneNumbersItem_SipTrunk": ".types", + "MergePreviewResponseModelPhoneNumbersItem_Twilio": ".types", + "MergeProposalCloseReason": ".types", + "MergeProposalComment": ".types", + "MergeProposalReview": ".types", + "MergeProposalReviewReviewerRole": ".types", + "MergeProposalReviewState": ".types", + "MergeProposalStatus": ".types", + "MergedOutcome": ".types", + "MessageSearchSortBy": ".types", + "MessagesSearchResponse": ".types", + "MessagesSearchResult": ".types", + "MetricRecord": ".types", + "MetricType": ".types", + "MockNoMatchBehavior": ".types", + "MockingStrategy": ".types", + "Model": ".types", + "ModelRatesResponseModel": ".types", + "ModerationConfig": ".types", + "ModerationGuardrailInput": ".types", + "ModerationGuardrailOutput": ".types", + "ModerationStatusResponseModel": ".types", + "ModerationStatusResponseModelSafetyStatus": ".types", + "ModerationStatusResponseModelWarningStatus": ".types", + "MtlsAuthResponse": ".types", + "MultichannelSpeechToTextResponseModel": ".types", + "MultipartMusicResponse": ".types", + "MusicAllowedOutputFormats": ".types", + "MusicComposeDetailedRequestOutputFormat": ".music", + "MusicComposeDetailedStreamRequestOutputFormat": ".music", + "MusicComposeRequestOutputFormat": ".music", + "MusicExploreSongSourceContext": ".types", + "MusicFinetuneFailureReason": ".types", + "MusicFinetunePageResponseModel": ".types", + "MusicFinetuneResponseModel": ".types", + "MusicFinetuneStatus": ".types", + "MusicGenerationMode": ".types", + "MusicModelId": ".types", + "MusicOnlyOutputFormats": ".types", + "MusicOutputFormat": ".types", + "MusicPrompt": ".types", + "MusicSeparateStemsRequestStemVariationId": ".music", + "MusicStreamRequestOutputFormat": ".music", + "MusicUploadRequestExtractCompositionPlan": ".music", + "MusicUploadResponse": ".types", + "MusicUploadResponseCompositionPlan": ".types", + "NonStreamingOutputFormats": ".types", + "NormalizedAlignment": ".types", + "NotFoundError": ".errors", + "NumberSchema": ".types", + "NumericDistributionAggregate": ".types", + "OAuth2ClientCredsResponse": ".types", + "OAuth2JwtResponse": ".types", + "OAuth2JwtResponseAlgorithm": ".types", + "OAuth2JwtResponseTokenResponseField": ".types", + "OTelAttribute": ".types", + "OTelAttributeValueValue": ".types", + "OTelResource": ".types", + "OTelResourceSpans": ".types", + "OTelScope": ".types", + "OTelScopeSpans": ".types", + "OTelSpan": ".types", + "OTelStatus": ".types", + "OTelTracePayload": ".types", + "ObjectJsonSchemaPropertyInput": ".types", + "ObjectJsonSchemaPropertyInputPropertiesValue": ".types", + "ObjectJsonSchemaPropertyInputPropertyKind": ".types", + "ObjectJsonSchemaPropertyOutput": ".types", + "ObjectJsonSchemaPropertyOutputPropertiesValue": ".types", + "ObjectSchema": ".types", + "OmitSchemaOverride": ".types", + "OpenAiAudioConfigInput": ".types", + "OpenAiAudioConfigOutput": ".types", + "OpenAiAudioFormat": ".types", + "OpenAiAudioInputConfigInput": ".types", + "OpenAiAudioInputConfigOutput": ".types", + "OpenAiAudioInputFormat": ".types", + "OpenAiAudioInputTranscription": ".types", + "OpenAiAudioOutputConfigInput": ".types", + "OpenAiAudioOutputConfigOutput": ".types", + "OpenAiAudioOutputFormat": ".types", + "OpenAiFunctionTool": ".types", + "OpenAiSessionConfigInput": ".types", + "OpenAiSessionConfigInputMaxResponseOutputTokens": ".types", + "OpenAiSessionConfigInputToolChoice": ".types", + "OpenAiSessionConfigInputToolsItem": ".types", + "OpenAiSessionConfigInputToolsItem_Function": ".types", + "OpenAiSessionConfigInputToolsItem_Mcp": ".types", + "OpenAiSessionConfigInputTracing": ".types", + "OpenAiSessionConfigInputTruncation": ".types", + "OpenAiSessionConfigInputTurnDetection": ".types", + "OpenAiSessionConfigOutput": ".types", + "OpenAiSessionConfigOutputMaxResponseOutputTokens": ".types", + "OpenAiSessionConfigOutputToolChoice": ".types", + "OpenAiSessionConfigOutputToolsItem": ".types", + "OpenAiSessionConfigOutputToolsItem_Function": ".types", + "OpenAiSessionConfigOutputToolsItem_Mcp": ".types", + "OpenAiSessionConfigOutputTracing": ".types", + "OpenAiToolChoiceFunction": ".types", + "OpenAiToolChoiceFunctionInner": ".types", + "OpenAiTracingConfiguration": ".types", + "OpenAiTurnDetection": ".types", + "OpenAimcpTool": ".types", + "OpenAimcpToolRequireApproval": ".types", + "OpenOutcome": ".types", + "OpenerConfig": ".types", + "OptInSmsReminderParams": ".types", + "OptOutSmsReminderParams": ".types", + "OrbAvatar": ".types", + "OrchestratorToolMockBehaviorConfig": ".types", + "OrderDeliverablesResponse": ".types", + "OrderId": ".types", + "OrderItemInfo": ".types", + "OrderItemKind": ".types", + "OrderItemRequestInput": ".types", + "OrderItemRequestInput_Dub": ".types", + "OrderItemRequestInput_Subtitles": ".types", + "OrderItemRequestInput_Transcription": ".types", + "OrderItemRequestOutput": ".types", + "OrderItemRequestOutput_Dub": ".types", + "OrderItemRequestOutput_Subtitles": ".types", + "OrderItemRequestOutput_Transcription": ".types", + "OrderMediaResponse": ".types", + "OrderResponse": ".types", + "OrderState": ".types", + "OrderSummary": ".types", + "OutboundCallRecipient": ".types", + "OutboundCallRecipientResponseModel": ".types", + "OutboundSipTrunkConfigRequestModel": ".types", + "OutputFormat": ".types", + "PaginatedResultAgentMergeProposalResponse": ".types", + "PairedLanguagesResponse": ".types", + "PartialTranscriptPayload": ".types", + "PatchWorkspaceWebhookResponseModel": ".types", + "PdfExportOptions": ".types", + "PendingBlocksMetadataModel": ".types", + "PendingCancellationResponseModel": ".types", + "PendingClipTask": ".types", + "PendingClipTaskType": ".types", + "PendingExternalAudiosMetadataModel": ".types", + "PendingSubscriptionSwitchResponseModel": ".types", + "PendingSubscriptionSwitchResponseModelNextTier": ".types", + "PermissionType": ".types", + "PhoneNumberAgentInfo": ".types", + "PhoneNumberDynamicVariableTransferDestination": ".types", + "PhoneNumberSortBy": ".types", + "PhoneNumberTransfer": ".types", + "PhoneNumberTransferCustomSipHeadersItem": ".types", + "PhoneNumberTransferCustomSipHeadersItem_Dynamic": ".types", + "PhoneNumberTransferCustomSipHeadersItem_Static": ".types", + "PhoneNumberTransferDestination": ".types", + "PhoneNumberTransferPostDialDigits": ".types", + "PhoneNumberTransferPostDialDigits_Dynamic": ".types", + "PhoneNumberTransferPostDialDigits_Static": ".types", + "PhoneNumberTransferTransferDestination": ".types", + "PhoneNumberTransferTransferDestination_Phone": ".types", + "PhoneNumberTransferTransferDestination_PhoneDynamicVariable": ".types", + "PhoneNumberTransferTransferDestination_SipUri": ".types", + "PhoneNumberTransferTransferDestination_SipUriDynamicVariable": ".types", + "PingPayload": ".types", + "PlatformCategory": ".types", + "PlatformCategoryUsage": ".types", + "PlatformLimits": ".types", + "PlatformUsage": ".types", + "PlayDtmfResultErrorModel": ".types", + "PlayDtmfResultSuccessModel": ".types", + "PlayDtmfToolConfig": ".types", + "PodcastBulletinMode": ".types", + "PodcastBulletinModeData": ".types", + "PodcastConversationMode": ".types", + "PodcastConversationModeData": ".types", + "PodcastProjectResponseModel": ".types", + "PodcastTextSource": ".types", + "PodcastUrlSource": ".types", + "PongPayload": ".types", + "PositionInput": ".types", + "PositionOutput": ".types", + "PostAgentAvatarResponseModel": ".types", + "PostAgentHoldAudioResponseModel": ".types", + "PostDialDigitsDynamicVariable": ".types", + "PostDialDigitsStatic": ".types", + "PostWorkspaceSecretResponseModel": ".types", + "PreToolSpeechMode": ".types", + "PreviewAudioDbModel": ".types", + "Price": ".types", + "PrivacyConfigInput": ".types", + "PrivacyConfigOutput": ".types", + "PrivateKeyJwtResponse": ".types", + "PrivateKeyJwtResponseAlgorithm": ".types", + "ProcedureAtVersionResponseModel": ".types", + "ProcedureDraftRef": ".types", + "ProcedureDraftResponseModel": ".types", + "ProcedureListItemResponseModel": ".types", + "ProcedureRefResponseModel": ".types", + "ProcedureType": ".types", + "ProcedureValidationError": ".types", + "ProcedureVersionRef": ".types", + "ProjectCreationMetaResponseModel": ".types", + "ProjectCreationMetaResponseModelStatus": ".types", + "ProjectCreationMetaType": ".types", + "ProjectExtendedResponse": ".types", + "ProjectExtendedResponseAccessLevel": ".types", + "ProjectExtendedResponseApplyTextNormalization": ".types", + "ProjectExtendedResponseAspectRatio": ".types", + "ProjectExtendedResponseAssetsItem": ".types", + "ProjectExtendedResponseAssetsItem_Audio": ".types", + "ProjectExtendedResponseAssetsItem_Image": ".types", + "ProjectExtendedResponseAssetsItem_Video": ".types", + "ProjectExtendedResponseFiction": ".types", + "ProjectExtendedResponseSourceType": ".types", + "ProjectExtendedResponseTargetAudience": ".types", + "ProjectExternalAudioResponseModel": ".types", + "ProjectExternalAudioResponseModelSourceContext": ".types", + "ProjectExternalAudioResponseModelSourceContext_MusicExploreSong": ".types", + "ProjectExternalAudioResponseModelSourceContext_Sfx": ".types", + "ProjectExternalAudioResponseModelSourceContext_Song": ".types", + "ProjectImageResponseModel": ".types", + "ProjectMutedTracksResponseModel": ".types", + "ProjectResponse": ".types", + "ProjectResponseAccessLevel": ".types", + "ProjectResponseAspectRatio": ".types", + "ProjectResponseFiction": ".types", + "ProjectResponseSourceType": ".types", + "ProjectResponseTargetAudience": ".types", + "ProjectSnapshotExtendedResponseModel": ".types", + "ProjectSnapshotResponse": ".types", + "ProjectSnapshotsResponse": ".types", + "ProjectState": ".types", + "ProjectVideoResponseModel": ".types", + "ProjectVideoThumbnailSheetResponseModel": ".types", + "ProjectVoiceResponseModel": ".types", + "PromptAgent": ".types", + "PromptAgentApiModelInput": ".types", + "PromptAgentApiModelInputBackupLlmConfig": ".types", + "PromptAgentApiModelInputBackupLlmConfig_Default": ".types", + "PromptAgentApiModelInputBackupLlmConfig_Disabled": ".types", + "PromptAgentApiModelInputBackupLlmConfig_Override": ".types", + "PromptAgentApiModelInputToolsItem": ".types", + "PromptAgentApiModelInputToolsItem_ApiIntegrationWebhook": ".types", + "PromptAgentApiModelInputToolsItem_Client": ".types", + "PromptAgentApiModelInputToolsItem_Mcp": ".types", + "PromptAgentApiModelInputToolsItem_Smb": ".types", + "PromptAgentApiModelInputToolsItem_System": ".types", + "PromptAgentApiModelInputToolsItem_Webhook": ".types", + "PromptAgentApiModelOutput": ".types", + "PromptAgentApiModelOutputBackupLlmConfig": ".types", + "PromptAgentApiModelOutputBackupLlmConfig_Default": ".types", + "PromptAgentApiModelOutputBackupLlmConfig_Disabled": ".types", + "PromptAgentApiModelOutputBackupLlmConfig_Override": ".types", + "PromptAgentApiModelOutputToolsItem": ".types", + "PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook": ".types", + "PromptAgentApiModelOutputToolsItem_Client": ".types", + "PromptAgentApiModelOutputToolsItem_Mcp": ".types", + "PromptAgentApiModelOutputToolsItem_Smb": ".types", + "PromptAgentApiModelOutputToolsItem_System": ".types", + "PromptAgentApiModelOutputToolsItem_Webhook": ".types", + "PromptAgentApiModelOverrideConfig": ".types", + "PromptAgentApiModelOverrideInput": ".types", + "PromptAgentApiModelOverrideOutput": ".types", + "PromptAgentApiModelWorkflowOverrideInput": ".types", + "PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig": ".types", + "PromptAgentApiModelWorkflowOverrideInputToolsItem": ".types", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_ApiIntegrationWebhook": ".types", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Client": ".types", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Mcp": ".types", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Smb": ".types", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_System": ".types", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook": ".types", + "PromptAgentApiModelWorkflowOverrideOutput": ".types", + "PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig": ".types", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem": ".types", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_ApiIntegrationWebhook": ".types", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client": ".types", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Mcp": ".types", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Smb": ".types", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_System": ".types", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook": ".types", + "PromptAgentDbModel": ".types", + "PromptEvaluationCriteria": ".types", + "PromptInjectionGuardrail": ".types", + "PronunciationDictionariesListRequestSort": ".pronunciation_dictionaries", + "PronunciationDictionaryAliasRuleRequestModel": ".types", + "PronunciationDictionaryAliasRuleResponseModel": ".types", + "PronunciationDictionaryLocator": ".types", + "PronunciationDictionaryLocatorResponseModel": ".types", + "PronunciationDictionaryPhonemeRuleRequestModel": ".types", + "PronunciationDictionaryPhonemeRuleResponseModel": ".types", + "PronunciationDictionaryRulesResponseModel": ".types", + "PronunciationDictionaryVersionLocator": ".types", + "PronunciationDictionaryVersionResponseModel": ".types", + "PronunciationDictionaryVersionResponseModelPermissionOnResource": ".types", + "PydanticPronunciationDictionaryVersionLocator": ".types", + "QualityPresetType": ".types", + "QueryParamsJsonSchemaInput": ".types", + "QueryParamsJsonSchemaOutput": ".types", + "QuoteInfo": ".types", + "RagChunkMetadata": ".types", + "RagConfigInput": ".types", + "RagConfigOutput": ".types", + "RagConfigWorkflowOverrideInput": ".types", + "RagConfigWorkflowOverrideOutput": ".types", + "RagDocumentIndexResponseModel": ".types", + "RagDocumentIndexUsage": ".types", + "RagDocumentIndexesResponseModel": ".types", + "RagIndexBatchSuccessfulResponseModel": ".types", + "RagIndexOverviewEmbeddingModelResponseModel": ".types", + "RagIndexOverviewResponseModel": ".types", + "RagIndexStatus": ".types", + "RagRetrievalInfo": ".types", + "ReadLegalTerms": ".types", + "ReadMetadataChapterDbModel": ".types", + "ReaderResourceResponseModel": ".types", + "ReaderResourceResponseModelResourceType": ".types", + "RealtimeAudioOptions": ".realtime", + "RealtimeConnection": ".realtime", + "RealtimeEvents": ".realtime", + "RealtimeModel": ".types", + "RealtimeUrlOptions": ".realtime", + "RealtimeVoiceSettings": ".types", + "ReceiveDubbingStreamMessage": ".v_1_dubbing_realtime", + "ReceiveMessage": ".v_1_text_to_speech_voice_id_stream_input", + "ReceiveMessageMulti": ".v_1_text_to_speech_voice_id_multi_stream_input", + "ReceiveTextToDialogueWebsocketMessage": ".v_1_text_to_dialogue_stream_input", + "ReceiveTextToDialogueWebsocketMessageMulti": ".v_1_text_to_dialogue_multi_stream_input", + "ReceiveTranscription": ".v_1_speech_to_text_realtime", + "ReceiveTranslateStreamMessage": ".v_1_translation_realtime", + "ReceiveUpstreamMessage": ".speech_engine_upstream", + "RecordingResponse": ".types", + "ReferenceVideo": ".types", + "ReferencedToolCommonModel": ".types", + "ReferencedToolCommonModelType": ".types", + "RefreshTokenAuthResponse": ".types", + "RegexParameterEvaluationStrategy": ".types", + "RegionConfigRequest": ".types", + "RegionalProcessingSurchargeInfo": ".types", + "RegisterForGroupSessionParams": ".types", + "RegisterMediaResponse": ".types", + "RemoveMemberFromGroupRequest": ".types", + "RemoveOrderItemResponse": ".types", + "RemoveVoiceFromUserVoiceCollectionResponseModel": ".types", + "Render": ".types", + "RenderStatus": ".types", + "RenderType": ".types", + "ReplicateVoiceToIsolatedEnvironmentResponseModel": ".types", + "ReportKnowledgeGapParams": ".types", + "RequestPvcManualVerificationResponseModel": ".types", + "RequiredConstraint": ".types", + "RequiredConstraints": ".types", + "ResourceAccessInfo": ".types", + "ResourceAccessInfoAccessSource": ".types", + "ResourceAccessInfoAnonymousAccessLevelOverride": ".types", + "ResourceAccessInfoRole": ".types", + "ResourceMetadataResponseModel": ".types", + "ResourceMetadataResponseModelAnonymousAccessLevelOverride": ".types", + "ResponseConversationErrorType": ".types", + "ResponseFilter": ".types", + "ResponseFilterMode": ".types", + "ResponseUnitTestModel": ".types", + "RestoreCalendarEventParams": ".types", + "RetryTriggerAction": ".types", + "ReviewResponseModel": ".types", + "ReviewResponseModelRejectReasonsItem": ".types", + "ReviewResponseModelReviewStatus": ".types", + "ReviewStatus": ".types", + "SafetyCommonModelInput": ".types", + "SafetyCommonModelOutput": ".types", + "SafetyEvaluation": ".types", + "SafetyResponseModel": ".types", + "SafetyRule": ".types", + "SampleConfigDbModel": ".types", + "SampleConfigDbModelParentType": ".types", + "SaveVoicePreviewRequest": ".types", + "SayNodeLiteralMessageInput": ".types", + "SayNodeLiteralMessageOutput": ".types", + "SayNodePromptMessageInput": ".types", + "SayNodePromptMessageOutput": ".types", + "ScheduleGroupSessionParams": ".types", + "ScimGroupResponseModel": ".types", + "ScopedAnalysisResult": ".types", + "ScribeAuthErrorPayload": ".types", + "ScribeChunkSizeExceededErrorPayload": ".types", + "ScribeErrorPayload": ".types", + "ScribeInputErrorPayload": ".types", + "ScribeInsufficientAudioActivityErrorPayload": ".types", + "ScribeInvalidRequestError": ".types", + "ScribeQueueOverflowErrorPayload": ".types", + "ScribeQuotaExceededErrorPayload": ".types", + "ScribeRateLimitedErrorPayload": ".types", + "ScribeResourceExhaustedErrorPayload": ".types", + "ScribeSessionTimeLimitExceededErrorPayload": ".types", + "ScribeThrottledErrorPayload": ".types", + "ScribeTranscriberErrorPayload": ".types", + "ScribeUnacceptedTermsErrorPayload": ".types", + "ScribeWarning": ".types", + "SearchClientsParams": ".types", + "SearchHighlightSegment": ".types", + "SearchStrategy": ".types", + "SeatType": ".types", + "SecretDependencyResourceType": ".types", + "SecretDependencyType": ".types", + "SectionSource": ".types", + "SegmentCreateResponse": ".types", + "SegmentDeleteResponse": ".types", + "SegmentDubResponse": ".types", + "SegmentMigrationResponse": ".types", + "SegmentSubtitleFrame": ".types", + "SegmentTranscriptionResponse": ".types", + "SegmentTranslationResponse": ".types", + "SegmentUpdateResponse": ".types", + "SegmentedJsonExportOptions": ".types", + "SendCustomEmailParams": ".types", + "SendDubbingStreamMessage": ".v_1_dubbing_realtime", + "SendMessage": ".v_1_text_to_speech_voice_id_stream_input", + "SendMessageMulti": ".v_1_text_to_speech_voice_id_multi_stream_input", + "SendText": ".types", + "SendTextMulti": ".types", + "SendTranslateStreamMessage": ".v_1_translation_realtime", + "SendUpstreamMessage": ".speech_engine_upstream", + "SentimentAggregate": ".types", + "SentimentAnalysisSettings": ".types", + "SessionStartedPayload": ".types", + "SessionStartedPayloadConfig": ".types", + "SessionStartedPayloadConfigCommitStrategy": ".types", + "SetBookingSlugParams": ".types", + "SeverityId": ".types", + "SfxModelId": ".types", + "SfxSourceContext": ".types", + "ShareOptionResponseModel": ".types", + "ShareOptionResponseModelType": ".types", + "SimilarVoice": ".types", + "SimilarVoicesForSpeakerResponse": ".types", + "SimulationLibrarySettings": ".types", + "SimulationTestModel": ".types", + "SimulationToolMockBehaviorConfig": ".types", + "SingleLanguagesResponse": ".types", + "SingleTestRunRequestModel": ".types", + "SingleUseTokenResponseModel": ".types", + "SingleUseTokenType": ".types", + "SipLogMessage": ".types", + "SipLogMessageDirection": ".types", + "SipMediaEncryptionEnum": ".types", + "SipTrunkCredentialsRequestModel": ".types", + "SipTrunkOutboundCallResponse": ".types", + "SipTrunkTransportEnum": ".types", + "SipUriDynamicVariableTransferDestination": ".types", + "SipUriTransferDestination": ".types", + "SkipTurnToolConfig": ".types", + "SkipTurnToolResponseModel": ".types", + "SlackBotAuthResponse": ".types", + "SmbAgentType": ".types", + "SmbClientAccessConfig": ".types", + "SmsConversationInfo": ".types", + "SmsConversationInfoDirection": ".types", + "SoftTimeoutConfig": ".types", + "SoftTimeoutConfigOverride": ".types", + "SoftTimeoutConfigOverrideConfig": ".types", + "SoftTimeoutConfigWorkflowOverride": ".types", + "SongMetadata": ".types", + "SongSection": ".types", + "SongSourceContext": ".types", + "SortDirection": ".types", + "SpeakerAudioResponseModel": ".types", + "SpeakerCreatedResponse": ".types", + "SpeakerResponseModel": ".types", + "SpeakerSegment": ".types", + "SpeakerSeparationResponseModel": ".types", + "SpeakerSeparationResponseModelStatus": ".types", + "SpeakerTrack": ".types", + "SpeakerUpdatedResponse": ".types", + "SpeechEngineConfig": ".types", + "SpeechEngineConfigRequestHeadersValue": ".types", + "SpeechEngineConversationInitiationClientDataConfig": ".types", + "SpeechEngineResponse": ".types", + "SpeechEngineSummaryResponse": ".types", + "SpeechHistoryItemResponse": ".types", + "SpeechHistoryItemResponseSource": ".types", + "SpeechHistoryItemResponseVoiceCategory": ".types", + "SpeechToSpeechConvertRequestOutputFormat": ".speech_to_speech", + "SpeechToSpeechRequestFileFormat": ".speech_to_speech", + "SpeechToSpeechStreamRequestFileFormat": ".speech_to_speech", + "SpeechToSpeechStreamRequestOutputFormat": ".speech_to_speech", + "SpeechToTextCharacterResponseModel": ".types", + "SpeechToTextChunkResponseModel": ".types", + "SpeechToTextChunkResponseModelEditedTranscript": ".types", + "SpeechToTextChunkResponseModelEditedTranscript_Error": ".types", + "SpeechToTextChunkResponseModelEditedTranscript_Transcript": ".types", + "SpeechToTextConvertRequestEntityDetection": ".speech_to_text", + "SpeechToTextConvertRequestEntityRedaction": ".speech_to_text", + "SpeechToTextConvertRequestFileFormat": ".speech_to_text", + "SpeechToTextConvertRequestMultichannelOutputStyle": ".speech_to_text", + "SpeechToTextConvertRequestTimestampsGranularity": ".speech_to_text", + "SpeechToTextConvertRequestWebhookMetadata": ".speech_to_text", + "SpeechToTextConvertResponse": ".speech_to_text", + "SpeechToTextWebhookResponseModel": ".types", + "SpeechToTextWordResponseModel": ".types", + "SpeechToTextWordResponseModelType": ".types", + "SpellingPatience": ".types", + "SrtExportOptions": ".types", + "StartProcedureToolConfig": ".types", + "StartProcedureToolConfigProceduresValue": ".types", + "StartProcedureToolErrorStatus": ".types", + "StartProcedureToolResultErrorModel": ".types", + "StartProcedureToolResultSuccessModel": ".types", + "StartPvcVoiceTrainingResponseModel": ".types", + "StartSpeakerSeparationResponseModel": ".types", + "StaticAssetReference": ".types", + "StatusId": ".types", + "StoredUsagePlatformLimit": ".types", + "StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel": ".types", + "StreamingAudioChunkWithTimestampsResponse": ".types", + "StringSchema": ".types", + "StudioAgentSettingsModel": ".types", + "StudioAgentToolSettingsModel": ".types", + "StudioClipLocator": ".types", + "StudioClipLocatorClipType": ".types", + "StudioTextStyleOutlineModel": ".types", + "StudioTextStyleShadowModel": ".types", + "SubmitBusinessInfoParams": ".types", + "SubmitOrderResponse": ".types", + "Subscription": ".types", + "SubscriptionExtrasResponseModel": ".types", + "SubscriptionMaxCreditLimitExtension": ".types", + "SubscriptionPendingChange": ".types", + "SubscriptionResponse": ".types", + "SubscriptionResponseMaxCreditLimitExtension": ".types", + "SubscriptionStatusType": ".types", + "SubscriptionUsageResponseModel": ".types", + "SubtitleOrderItemRequest": ".types", + "SuggestedAudioTag": ".types", + "SupportedVoice": ".types", + "SystemDataCollectionId": ".types", + "SystemEvaluationCriteria": ".types", + "SystemEvaluationId": ".types", + "SystemToolConfigInput": ".types", + "SystemToolConfigInputParams": ".types", + "SystemToolConfigInputParams_EndCall": ".types", + "SystemToolConfigInputParams_EndProcedure": ".types", + "SystemToolConfigInputParams_KnowledgeBase": ".types", + "SystemToolConfigInputParams_KnowledgeBaseRag": ".types", + "SystemToolConfigInputParams_LanguageDetection": ".types", + "SystemToolConfigInputParams_PlayKeypadTouchTone": ".types", + "SystemToolConfigInputParams_SkipTurn": ".types", + "SystemToolConfigInputParams_StartProcedure": ".types", + "SystemToolConfigInputParams_TransferToAgent": ".types", + "SystemToolConfigInputParams_TransferToNumber": ".types", + "SystemToolConfigInputParams_VoicemailDetection": ".types", + "SystemToolConfigOutput": ".types", + "SystemToolConfigOutputParams": ".types", + "SystemToolConfigOutputParams_EndCall": ".types", + "SystemToolConfigOutputParams_EndProcedure": ".types", + "SystemToolConfigOutputParams_KnowledgeBase": ".types", + "SystemToolConfigOutputParams_KnowledgeBaseRag": ".types", + "SystemToolConfigOutputParams_LanguageDetection": ".types", + "SystemToolConfigOutputParams_PlayKeypadTouchTone": ".types", + "SystemToolConfigOutputParams_SkipTurn": ".types", + "SystemToolConfigOutputParams_StartProcedure": ".types", + "SystemToolConfigOutputParams_TransferToAgent": ".types", + "SystemToolConfigOutputParams_TransferToNumber": ".types", + "SystemToolConfigOutputParams_VoicemailDetection": ".types", + "TelephonyCallConfigInput": ".types", + "TelephonyCallConfigOutput": ".types", + "TelephonyDirection": ".types", + "TelephonyProvider": ".types", + "TemplateArrayOutput": ".types", + "TemplateArrayOutputFailureReason": ".types", + "TemplateAudioOutput": ".types", + "TemplateAudioOutputFailureReason": ".types", + "TemplateBooleanOutput": ".types", + "TemplateBooleanOutputFailureReason": ".types", + "TemplateImageOutput": ".types", + "TemplateImageOutputFailureReason": ".types", + "TemplateInputReference": ".types", + "TemplateInputReference_Asset": ".types", + "TemplateInputReference_Generation": ".types", + "TemplateInputReference_InlineBase64": ".types", + "TemplateInputReference_Voice": ".types", + "TemplateIntegerOutput": ".types", + "TemplateIntegerOutputFailureReason": ".types", + "TemplateListResponse": ".types", + "TemplateNumberOutput": ".types", + "TemplateNumberOutputFailureReason": ".types", + "TemplateObjectOutput": ".types", + "TemplateObjectOutputFailureReason": ".types", + "TemplateOutput": ".types", + "TemplateOutput_Array": ".types", + "TemplateOutput_Audio": ".types", + "TemplateOutput_Boolean": ".types", + "TemplateOutput_Image": ".types", + "TemplateOutput_Integer": ".types", + "TemplateOutput_Number": ".types", + "TemplateOutput_Object": ".types", + "TemplateOutput_String": ".types", + "TemplateOutput_Video": ".types", + "TemplatePort": ".types", + "TemplateRunInput": ".types", + "TemplateRunListResponse": ".types", + "TemplateRunResponse": ".types", + "TemplateRunStatus": ".types", + "TemplateStringOutput": ".types", + "TemplateStringOutputFailureReason": ".types", + "TemplateSummary": ".types", + "TemplateVersion": ".types", + "TemplateVideoOutput": ".types", + "TemplateVideoOutputFailureReason": ".types", + "TestConditionRationaleCommonModel": ".types", + "TestConditionResultCommonModel": ".types", + "TestFromConversationMetadataInput": ".types", + "TestFromConversationMetadataOutput": ".types", + "TestInvocationSummaryResponseModel": ".types", + "TestRunMetadata": ".types", + "TestRunMetadataTestType": ".types", + "TestRunResultBucket": ".types", + "TestRunResultSummary": ".types", + "TestRunStatus": ".types", + "TestSharingMode": ".types", + "TestToolResultModel": ".types", + "TestType": ".types", + "TestsFeatureUsageCommonModel": ".types", + "TextNormalisationType": ".types", + "TextToDialogueApplyTextNormalization": ".v_1_translation_realtime", + "TextToDialogueCommitStrategy": ".v_1_speech_to_text_realtime", + "TextToDialogueConvertRequestOutputFormat": ".text_to_dialogue", + "TextToDialogueConvertWithTimestampsRequestOutputFormat": ".text_to_dialogue", + "TextToDialogueEagerness": ".v_1_translation_realtime", + "TextToDialogueInputFormat": ".v_1_dubbing_realtime", + "TextToDialogueOutputFormat": ".v_1_dubbing_realtime", + "TextToDialogueTtsModelId": ".v_1_translation_realtime", + "TextToDialogueWebsocketApplyTextNormalizationEnum": ".types", + "TextToDialogueWebsocketAudioChunk": ".types", + "TextToDialogueWebsocketAudioChunkMulti": ".types", + "TextToDialogueWebsocketClientMessage": ".types", + "TextToDialogueWebsocketClientMessageMulti": ".types", + "TextToDialogueWebsocketError": ".types", + "TextToDialogueWebsocketFinal": ".types", + "TextToDialogueWebsocketFinalAudioForTurn": ".types", + "TextToDialogueWebsocketFinalAudioForTurnMulti": ".types", + "TextToDialogueWebsocketFinalMulti": ".types", + "TextToDialogueWebsocketOutputFormatEnum": ".types", + "TextToDialogueWebsocketVoiceInput": ".types", + "TextToDialogueWebsocketVoiceSettings": ".types", + "TextToSoundEffectsConvertRequestOutputFormat": ".text_to_sound_effects", + "TextToSpeechApplyTextNormalizationEnum": ".types", + "TextToSpeechConvertRequestOutputFormat": ".text_to_speech", + "TextToSpeechConvertWithTimestampsRequestOutputFormat": ".text_to_speech", + "TextToSpeechGenerationRequest": ".types", + "TextToSpeechGenerationRequest_ElevenFlashV25": ".types", + "TextToSpeechGenerationRequest_ElevenMultilingualV2": ".types", + "TextToSpeechGenerationRequest_ElevenV3": ".types", + "TextToSpeechOutputFormatEnum": ".types", + "TextToSpeechRequest": ".types", + "TextToSpeechStreamRequest": ".types", + "TextToSpeechStreamRequestOutputFormat": ".text_to_speech", + "TextToSpeechStreamWithTimestampsRequest": ".types", + "TextToSpeechStreamWithTimestampsRequestOutputFormat": ".text_to_speech", + "TextToSpeechWithTimestampsRequest": ".types", + "ThresholdGuardrail": ".types", + "TicketCommentResponseModel": ".types", + "TicketMergeProposalLinkResponseModel": ".types", + "TicketPriorityChangeResponseModel": ".types", + "TicketSearchMatchField": ".types", + "TicketSearchMatchResponseModel": ".types", + "TicketStatusChangeResponseModel": ".types", + "TimeRange": ".types", + "ToDialogueSettingsResponseModel": ".types", + "TokenResponseModel": ".types", + "TooEarlyError": ".errors", + "Tool": ".types", + "ToolAnnotations": ".types", + "ToolCallSoundBehavior": ".types", + "ToolCallSoundType": ".types", + "ToolCallUnitTestModel": ".types", + "ToolErrorHandlingMode": ".types", + "ToolExecution": ".types", + "ToolExecutionMode": ".types", + "ToolExecutionResponseModel": ".types", + "ToolExecutionResponseModelToolCallDetails": ".types", + "ToolExecutionResponseModelToolCallDetails_ApiIntegrationWebhook": ".types", + "ToolExecutionResponseModelToolCallDetails_Client": ".types", + "ToolExecutionResponseModelToolCallDetails_Mcp": ".types", + "ToolExecutionResponseModelToolCallDetails_Webhook": ".types", + "ToolExecutionTaskSupport": ".types", + "ToolInterruptionMode": ".types", + "ToolMockConfig": ".types", + "ToolRequestModel": ".types", + "ToolRequestModelToolConfig": ".types", + "ToolRequestModelToolConfig_Client": ".types", + "ToolRequestModelToolConfig_Mcp": ".types", + "ToolRequestModelToolConfig_System": ".types", + "ToolRequestModelToolConfig_Webhook": ".types", + "ToolResponseMockConfigInput": ".types", + "ToolResponseMockConfigOutput": ".types", + "ToolResponseModel": ".types", + "ToolResponseModelToolConfig": ".types", + "ToolResponseModelToolConfig_Client": ".types", + "ToolResponseModelToolConfig_Mcp": ".types", + "ToolResponseModelToolConfig_System": ".types", + "ToolResponseModelToolConfig_Webhook": ".types", + "ToolSortBy": ".types", + "ToolType": ".types", + "ToolTypeFilter": ".types", + "ToolUsageStatsResponseModel": ".types", + "ToolsResponseModel": ".types", + "TopicDiscoverySettings": ".types", + "TopicEvaluationCriteriaAggregate": ".types", + "TopicMetricsAggregate": ".types", + "TopicSentimentAggregate": ".types", + "TopicSortBy": ".types", + "TranscriptEditError": ".types", + "TranscriptMessage": ".types", + "TranscriptMessageRole": ".types", + "TranscriptPlatformEvent": ".types", + "TranscriptionOrderItemRequest": ".types", + "TranscriptionWord": ".types", + "TranscriptionWordType": ".types", + "TransferBranchInfoConfigured": ".types", + "TransferBranchInfoDefaultingToMain": ".types", + "TransferBranchInfoTrafficSplit": ".types", + "TransferToAgentToolConfigInput": ".types", + "TransferToAgentToolConfigOutput": ".types", + "TransferToAgentToolResultErrorModel": ".types", + "TransferToAgentToolResultSuccessModelInput": ".types", + "TransferToAgentToolResultSuccessModelInputBranchInfo": ".types", + "TransferToAgentToolResultSuccessModelInputBranchInfo_Configured": ".types", + "TransferToAgentToolResultSuccessModelInputBranchInfo_DefaultingToMain": ".types", + "TransferToAgentToolResultSuccessModelInputBranchInfo_TrafficSplit": ".types", + "TransferToAgentToolResultSuccessModelOutput": ".types", + "TransferToAgentToolResultSuccessModelOutputBranchInfo": ".types", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_Configured": ".types", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain": ".types", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit": ".types", + "TransferToNumberResultAmazonConnectSuccessModel": ".types", + "TransferToNumberResultErrorModel": ".types", + "TransferToNumberResultExotelSuccessModel": ".types", + "TransferToNumberResultSipSuccessModel": ".types", + "TransferToNumberResultTwilioSuccessModel": ".types", + "TransferToNumberToolConfigInput": ".types", + "TransferToNumberToolConfigOutput": ".types", + "TransferTypeEnum": ".types", + "TranslateAudioOutputError": ".types", + "TranslateAudioPayload": ".types", + "TranslateAuthError": ".types", + "TranslateEndOfStreamPayload": ".types", + "TranslateErrorPayload": ".types", + "TranslateFinalTranscriptPayload": ".types", + "TranslateInputAudioChunkPayload": ".types", + "TranslateInputError": ".types", + "TranslateInputFormatEnum": ".types", + "TranslateOutputFormatEnum": ".types", + "TranslatePartialTranscriptPayload": ".types", + "TranslatePaymentIssueError": ".types", + "TranslateQueueOverflowError": ".types", + "TranslateQuotaExceededError": ".types", + "TranslateRateLimitedError": ".types", + "TranslateSessionStartedPayload": ".types", + "TranslateStatusPayload": ".types", + "TranslateTranscriberError": ".types", + "TranslateTranslationError": ".types", + "TranslateTranslationPayload": ".types", + "TranslateUnacceptedTermsError": ".types", + "TranslatedString": ".types", + "TriggerUserVerificationParams": ".types", + "TriggeredGuardrailCommonModel": ".types", + "TtsConversationalConfigInput": ".types", + "TtsConversationalConfigOutput": ".types", + "TtsConversationalConfigOverride": ".types", + "TtsConversationalConfigOverrideConfig": ".types", + "TtsConversationalConfigWorkflowOverrideInput": ".types", + "TtsConversationalConfigWorkflowOverrideOutput": ".types", + "TtsConversationalModel": ".types", + "TtsModelFamily": ".types", + "TtsOptimizeStreamingLatency": ".types", + "TtsOutputFormat": ".types", + "TtsVoiceSettings": ".types", + "TurnCommentRequestModel": ".types", + "TurnCommentResponseModel": ".types", + "TurnConfig": ".types", + "TurnConfigOverride": ".types", + "TurnConfigOverrideConfig": ".types", + "TurnConfigWorkflowOverride": ".types", + "TurnDetectionType": ".types", + "TurnEagerness": ".types", + "TurnMode": ".types", + "TurnModel": ".types", + "TwilioAnsweredBy": ".types", + "TwilioEdgeLocation": ".types", + "TwilioMachineDetectionAction": ".types", + "TwilioMachineDetectionConfig": ".types", + "TwilioMachineDetectionMode": ".types", + "TwilioMachineDetectionRule": ".types", + "TwilioOutboundCallResponse": ".types", + "TwilioRegionId": ".types", + "TxtExportOptions": ".types", + "UnauthorizedError": ".errors", + "UnitTestRunResponseModel": ".types", + "UnitTestRunResponseModelTestInfo": ".types", + "UnitTestRunResponseModelTestInfo_Llm": ".types", + "UnitTestRunResponseModelTestInfo_Simulation": ".types", + "UnitTestRunResponseModelTestInfo_Tool": ".types", + "UnitTestSummaryResponseModel": ".types", + "UnitTestToolCallEvaluationModelInput": ".types", + "UnitTestToolCallEvaluationModelOutput": ".types", + "UnitTestToolCallParameter": ".types", + "UnitTestToolCallParameterEval": ".types", + "UnitTestToolCallParameterEval_Anything": ".types", + "UnitTestToolCallParameterEval_Exact": ".types", + "UnitTestToolCallParameterEval_Llm": ".types", + "UnitTestToolCallParameterEval_Regex": ".types", + "UnitTestWorkflowNodeTransitionEvaluationNodeId": ".types", + "UnprocessableEntityError": ".errors", + "UpdateAgentConfigParams": ".types", + "UpdateAgentProcedureParams": ".types", + "UpdateAgentRuleParams": ".types", + "UpdateAssetParams": ".types", + "UpdateAudioNativeProjectRequest": ".types", + "UpdateBasicAuthRequest": ".types", + "UpdateBearerAuthRequest": ".types", + "UpdateBookingPageAppearanceParams": ".types", + "UpdateBookingPageSettingsParams": ".types", + "UpdateBusinessInfoParams": ".types", + "UpdateCalendarEventParams": ".types", + "UpdateChapterRequest": ".types", + "UpdateClientParams": ".types", + "UpdateEnvironmentVariableRequestValuesValue": ".environment_variables", + "UpdateGroupSessionSeatsParams": ".types", + "UpdateHolidayParams": ".types", + "UpdateLocationParams": ".types", + "UpdateOAuth2ClientCredsRequest": ".types", + "UpdateOAuth2JwtRequest": ".types", + "UpdateOAuth2JwtRequestAlgorithm": ".types", + "UpdateOAuth2JwtRequestTokenResponseField": ".types", + "UpdateOrderParams": ".types", + "UpdateOrderRequest": ".types", + "UpdateOrderResponse": ".types", + "UpdateProductParams": ".types", + "UpdateProjectRequest": ".types", + "UpdatePronunciationDictionariesRequest": ".types", + "UpdateResponseUnitTestRequest": ".types", + "UpdateServiceParams": ".types", + "UpdateSimulationTestRequest": ".types", + "UpdateStaffParams": ".types", + "UpdateToolCallUnitTestRequest": ".types", + "UpdateTransferRuleParams": ".types", + "UpdateWorkspaceMemberResponseModel": ".types", + "UpsertOrderItemRequest": ".types", + "UpsertOrderItemResponse": ".types", + "UrlAvatar": ".types", + "UrlModel": ".types", + "UrlSecretAuthResponse": ".types", + "UsageAggregationInterval": ".types", + "UsageCharactersResponseModel": ".types", + "User": ".types", + "UserAccessManagementActivityId": ".types", + "UserFeedback": ".types", + "UserFeedbackScore": ".types", + "UserModel": ".types", + "UserTranscriptPayload": ".types", + "UserTypeId": ".types", + "UserVoiceCollectionResponseModel": ".types", + "UserVoiceCollectionResponseModelPermissionOnResource": ".types", + "UsersSortBy": ".types", + "UtteranceResponseModel": ".types", + "UuiTransferConfig": ".types", + "UuiTransferConfigProtocolDiscriminatorMode": ".types", + "VadConfig": ".types", + "VadConfigWorkflowOverride": ".types", + "ValidateUserVerificationCodeParams": ".types", + "ValidationError": ".types", + "ValidationErrorLocItem": ".types", + "Veo31FastRequest": ".types", + "Veo31FastRequestAspectRatio": ".types", + "Veo31FastRequestResolution": ".types", + "Veo31Request": ".types", + "Veo31RequestAspectRatio": ".types", + "Veo31RequestResolution": ".types", + "VeoImageReference": ".types", + "VeoImageReferenceRole": ".types", + "Verbosity": ".types", + "VerificationAttemptResponse": ".types", + "VerifiedVoiceLanguageResponseModel": ".types", + "VerifyPvcVoiceCaptchaResponseModel": ".types", + "VideoAnalysis": ".types", + "VideoAnalysisResult": ".types", + "VideoAnalysisStatus": ".types", + "VideoGenerationRequest": ".types", + "VideoGenerationRequest_BytedanceSeedanceV2": ".types", + "VideoGenerationRequest_BytedanceSeedanceV25": ".types", + "VideoGenerationRequest_BytedanceSeedanceV2Fast": ".types", + "VideoGenerationRequest_BytedanceSeedanceV2Mini": ".types", + "VideoGenerationRequest_CreatifyAurora": ".types", + "VideoGenerationRequest_Veo31FastGenerate001": ".types", + "VideoGenerationRequest_Veo31Generate001": ".types", + "VideoKeyMoment": ".types", + "VideoReference": ".types", + "VideoReference_Asset": ".types", + "VideoReference_Generation": ".types", + "VideoReference_InlineBase64": ".types", + "VideoSchema": ".types", + "VideoSegment": ".types", + "VideoSubject": ".types", + "VisitedAgentRef": ".types", + "Voice": ".types", + "VoiceAccentResponseModel": ".types", + "VoiceCategory": ".types", + "VoiceDesignPreviewResponse": ".types", + "VoiceDesignRequestModelModelId": ".text_to_voice", + "VoiceGenerationParameterOptionResponse": ".types", + "VoiceGenerationParameterResponse": ".types", + "VoiceLabellingStatus": ".types", + "VoiceMailDetectionResultSuccessModel": ".types", + "VoicePreviewResponseModel": ".types", + "VoiceRecordingQuality": ".types", + "VoiceReference": ".types", + "VoiceSafetyControl": ".types", + "VoiceSample": ".types", + "VoiceSamplePreviewResponseModel": ".types", + "VoiceSampleVisualWaveformResponseModel": ".types", + "VoiceSchema": ".types", + "VoiceSegment": ".types", + "VoiceSettings": ".types", + "VoiceSharingModerationCheckResponseModel": ".types", + "VoiceSharingResponse": ".types", + "VoiceSharingResponseCategory": ".types", + "VoiceSharingState": ".types", + "VoiceStatisticsResponseModel": ".types", + "VoiceVerificationResponse": ".types", + "VoicemailDetectionToolConfig": ".types", + "VoicesGetSharedRequestCategory": ".voices", + "VoicesGetSharedRequestSort": ".voices", + "VoicesNotPermittedWarning": ".types", + "WebhookAuthMethodType": ".types", + "WebhookEventType": ".types", + "WebhookHmacSettings": ".types", + "WebhookTarget": ".types", + "WebhookTargetAll": ".types", + "WebhookTargetIds": ".types", + "WebhookTarget_All": ".types", + "WebhookTarget_Ids": ".types", + "WebhookToolApiSchemaConfigInput": ".types", + "WebhookToolApiSchemaConfigInputAuthConnection": ".types", + "WebhookToolApiSchemaConfigInputContentType": ".types", + "WebhookToolApiSchemaConfigInputMethod": ".types", + "WebhookToolApiSchemaConfigInputRequestHeadersValue": ".types", + "WebhookToolApiSchemaConfigOutput": ".types", + "WebhookToolApiSchemaConfigOutputAuthConnection": ".types", + "WebhookToolApiSchemaConfigOutputContentType": ".types", + "WebhookToolApiSchemaConfigOutputMethod": ".types", + "WebhookToolApiSchemaConfigOutputRequestHeadersValue": ".types", + "WebhookToolConfigInput": ".types", + "WebhookToolConfigOutput": ".types", + "WebhookTranscriptFormat": ".types", + "WebhookUsageType": ".types", + "WebsocketTtsClientMessageMulti": ".types", + "WebsocketTtsServerMessageMulti": ".types", + "WhatsAppAccountType": ".types", + "WhatsAppAuthResponse": ".types", + "WhatsAppCallPermissionRequest": ".types", + "WhatsAppCallPermissionRequestState": ".types", + "WhatsAppConversationInfo": ".types", + "WhatsAppConversationInfoDirection": ".types", + "WhatsAppOutboundCallResponse": ".types", + "WhatsAppOutboundMessageResponse": ".types", + "WhatsAppRecipient": ".types", + "WhatsAppTemplateBodyComponentParams": ".types", + "WhatsAppTemplateButtonComponentParams": ".types", + "WhatsAppTemplateDocumentParam": ".types", + "WhatsAppTemplateDocumentParamDetails": ".types", + "WhatsAppTemplateHeaderComponentParams": ".types", + "WhatsAppTemplateHeaderComponentParamsParametersItem": ".types", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Document": ".types", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Image": ".types", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Location": ".types", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Text": ".types", + "WhatsAppTemplateImageParam": ".types", + "WhatsAppTemplateImageParamDetails": ".types", + "WhatsAppTemplateLocationParam": ".types", + "WhatsAppTemplateLocationParamDetails": ".types", + "WhatsAppTemplateTextParam": ".types", + "WidgetConfig": ".types", + "WidgetConfigAvatar": ".types", + "WidgetConfigAvatar_Image": ".types", + "WidgetConfigAvatar_Orb": ".types", + "WidgetConfigAvatar_Url": ".types", + "WidgetConfigResponse": ".types", + "WidgetConfigResponseAvatar": ".types", + "WidgetConfigResponseAvatar_Image": ".types", + "WidgetConfigResponseAvatar_Orb": ".types", + "WidgetConfigResponseAvatar_Url": ".types", + "WidgetConfigResponseSyntaxHighlightTheme": ".types", + "WidgetConfigSyntaxHighlightTheme": ".types", + "WidgetEndFeedbackConfig": ".types", + "WidgetEndFeedbackType": ".types", + "WidgetExpandable": ".types", + "WidgetFeedbackMode": ".types", + "WidgetLanguagePreset": ".types", + "WidgetLanguagePresetResponse": ".types", + "WidgetPlacement": ".types", + "WidgetStyles": ".types", + "WidgetTermsTranslation": ".types", + "WidgetTextContents": ".types", + "WidgetTextContentsTranslation": ".types", + "WordTimestamp": ".types", + "WorkflowEdgeModelInput": ".types", + "WorkflowEdgeModelInputBackwardCondition": ".types", + "WorkflowEdgeModelInputBackwardCondition_Expression": ".types", + "WorkflowEdgeModelInputBackwardCondition_Llm": ".types", + "WorkflowEdgeModelInputBackwardCondition_Result": ".types", + "WorkflowEdgeModelInputBackwardCondition_Unconditional": ".types", + "WorkflowEdgeModelInputForwardCondition": ".types", + "WorkflowEdgeModelInputForwardCondition_Expression": ".types", + "WorkflowEdgeModelInputForwardCondition_Llm": ".types", + "WorkflowEdgeModelInputForwardCondition_Result": ".types", + "WorkflowEdgeModelInputForwardCondition_Unconditional": ".types", + "WorkflowEdgeModelOutput": ".types", + "WorkflowEdgeModelOutputBackwardCondition": ".types", + "WorkflowEdgeModelOutputBackwardCondition_Expression": ".types", + "WorkflowEdgeModelOutputBackwardCondition_Llm": ".types", + "WorkflowEdgeModelOutputBackwardCondition_Result": ".types", + "WorkflowEdgeModelOutputBackwardCondition_Unconditional": ".types", + "WorkflowEdgeModelOutputForwardCondition": ".types", + "WorkflowEdgeModelOutputForwardCondition_Expression": ".types", + "WorkflowEdgeModelOutputForwardCondition_Llm": ".types", + "WorkflowEdgeModelOutputForwardCondition_Result": ".types", + "WorkflowEdgeModelOutputForwardCondition_Unconditional": ".types", + "WorkflowEndNodeModelInput": ".types", + "WorkflowEndNodeModelOutput": ".types", + "WorkflowEndNodeOutcome": ".types", + "WorkflowExpressionConditionModelInput": ".types", + "WorkflowExpressionConditionModelOutput": ".types", + "WorkflowFeaturesUsageCommonModel": ".types", + "WorkflowLlmConditionModelInput": ".types", + "WorkflowLlmConditionModelOutput": ".types", + "WorkflowOverrideAgentNodeModelInput": ".types", + "WorkflowOverrideAgentNodeModelOutput": ".types", + "WorkflowPhoneNumberNodeModelInput": ".types", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem": ".types", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Dynamic": ".types", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Static": ".types", + "WorkflowPhoneNumberNodeModelInputPostDialDigits": ".types", + "WorkflowPhoneNumberNodeModelInputPostDialDigits_Dynamic": ".types", + "WorkflowPhoneNumberNodeModelInputPostDialDigits_Static": ".types", + "WorkflowPhoneNumberNodeModelInputTransferDestination": ".types", + "WorkflowPhoneNumberNodeModelInputTransferDestination_Phone": ".types", + "WorkflowPhoneNumberNodeModelInputTransferDestination_PhoneDynamicVariable": ".types", + "WorkflowPhoneNumberNodeModelInputTransferDestination_SipUri": ".types", + "WorkflowPhoneNumberNodeModelInputTransferDestination_SipUriDynamicVariable": ".types", + "WorkflowPhoneNumberNodeModelOutput": ".types", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem": ".types", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Dynamic": ".types", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Static": ".types", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits": ".types", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits_Dynamic": ".types", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits_Static": ".types", + "WorkflowPhoneNumberNodeModelOutputTransferDestination": ".types", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_Phone": ".types", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_PhoneDynamicVariable": ".types", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUri": ".types", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUriDynamicVariable": ".types", + "WorkflowResultConditionModelInput": ".types", + "WorkflowResultConditionModelOutput": ".types", + "WorkflowSayNodeModelInput": ".types", + "WorkflowSayNodeModelInputMessage": ".types", + "WorkflowSayNodeModelInputMessage_Literal": ".types", + "WorkflowSayNodeModelInputMessage_Prompt": ".types", + "WorkflowSayNodeModelOutput": ".types", + "WorkflowSayNodeModelOutputMessage": ".types", + "WorkflowSayNodeModelOutputMessage_Literal": ".types", + "WorkflowSayNodeModelOutputMessage_Prompt": ".types", + "WorkflowStandaloneAgentNodeModelInput": ".types", + "WorkflowStandaloneAgentNodeModelOutput": ".types", + "WorkflowStartNodeModelInput": ".types", + "WorkflowStartNodeModelOutput": ".types", + "WorkflowStateUpdateInput": ".types", + "WorkflowStateUpdateOutput": ".types", + "WorkflowToolEdgeStepModel": ".types", + "WorkflowToolLocator": ".types", + "WorkflowToolLocatorSchemaOverridesValue": ".types", + "WorkflowToolLocatorSchemaOverridesValue_Constant": ".types", + "WorkflowToolLocatorSchemaOverridesValue_DynamicVariable": ".types", + "WorkflowToolLocatorSchemaOverridesValue_Llm": ".types", + "WorkflowToolLocatorSchemaOverridesValue_Omit": ".types", + "WorkflowToolMaxIterationsExceededStepModel": ".types", + "WorkflowToolNestedToolsStepModelInput": ".types", + "WorkflowToolNestedToolsStepModelInputResultsItem": ".types", + "WorkflowToolNestedToolsStepModelOutput": ".types", + "WorkflowToolNestedToolsStepModelOutputResultsItem": ".types", + "WorkflowToolNodeModelInput": ".types", + "WorkflowToolNodeModelOutput": ".types", + "WorkflowToolResponseModelInput": ".types", + "WorkflowToolResponseModelInputStepsItem": ".types", + "WorkflowToolResponseModelInputStepsItem_Edge": ".types", + "WorkflowToolResponseModelInputStepsItem_MaxIterationsExceeded": ".types", + "WorkflowToolResponseModelInputStepsItem_NestedTools": ".types", + "WorkflowToolResponseModelOutput": ".types", + "WorkflowToolResponseModelOutputStepsItem": ".types", + "WorkflowToolResponseModelOutputStepsItem_Edge": ".types", + "WorkflowToolResponseModelOutputStepsItem_MaxIterationsExceeded": ".types", + "WorkflowToolResponseModelOutputStepsItem_NestedTools": ".types", + "WorkflowUnconditionalModelInput": ".types", + "WorkflowUnconditionalModelOutput": ".types", + "WorkflowUpdateStateNodeModelInput": ".types", + "WorkflowUpdateStateNodeModelOutput": ".types", + "WorkspaceAnalyticsQueryResponseModel": ".types", + "WorkspaceAnalyticsQueryResponseModelColumnTypesItem": ".types", + "WorkspaceAnalyticsQueryResponseModelRowsItemItem": ".types", + "WorkspaceApiKeyListResponseModel": ".types", + "WorkspaceApiKeyResponseModel": ".types", + "WorkspaceAuditLogEntryResponse": ".types", + "WorkspaceAuditLogEntryResponseActivityId": ".types", + "WorkspaceAuditLogsPageResponse": ".types", + "WorkspaceBatchCallsResponse": ".types", + "WorkspaceCreateApiKeyResponseModel": ".types", + "WorkspaceCreateServiceAccountResponseModel": ".types", + "WorkspaceCreateWebhookResponseModel": ".types", + "WorkspaceGroupByNameResponseModel": ".types", + "WorkspaceGroupPermission": ".types", + "WorkspaceGroupResponseModel": ".types", + "WorkspaceGroupResponseModelGroupConcurrencyLimit": ".types", + "WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit": ".types", + "WorkspaceGroupResponseModelGroupMusicConcurrencyLimit": ".types", + "WorkspaceGroupResponseModelGroupPvcLimit": ".types", + "WorkspaceGroupResponseModelGroupUsageLimit": ".types", + "WorkspaceMemberResponseModel": ".types", + "WorkspaceResourceType": ".types", + "WorkspaceServiceAccountListResponseModel": ".types", + "WorkspaceServiceAccountResponseModel": ".types", + "WorkspaceWebhookEventType": ".types", + "WorkspaceWebhookListResponseModel": ".types", + "WorkspaceWebhookResponseModel": ".types", + "WorkspaceWebhookUsageResponseModel": ".types", + "__version__": ".version", + "assets": ".assets", + "audio_effects": ".audio_effects", + "audio_isolation": ".audio_isolation", + "audio_native": ".audio_native", + "conversational_ai": ".conversational_ai", + "dubbing": ".dubbing", + "environment_variables": ".environment_variables", + "environments": ".environments", + "flows": ".flows", + "forced_alignment": ".forced_alignment", + "history": ".history", + "models": ".models", + "music": ".music", + "play": ".play", + "productions": ".productions", + "pronunciation_dictionaries": ".pronunciation_dictionaries", + "samples": ".samples", + "save": ".play", + "service_accounts": ".service_accounts", + "speech_engine": ".speech_engine", + "speech_engine_upstream": ".speech_engine_upstream", + "speech_to_speech": ".speech_to_speech", + "speech_to_text": ".speech_to_text", + "stream": ".play", + "studio": ".studio", + "text_to_dialogue": ".text_to_dialogue", + "text_to_sound_effects": ".text_to_sound_effects", + "text_to_speech": ".text_to_speech", + "text_to_voice": ".text_to_voice", + "tokens": ".tokens", + "usage": ".usage", + "user": ".user", + "v_1_dubbing_realtime": ".v_1_dubbing_realtime", + "v_1_speech_to_text_realtime": ".v_1_speech_to_text_realtime", + "v_1_text_to_dialogue_multi_stream_input": ".v_1_text_to_dialogue_multi_stream_input", + "v_1_text_to_dialogue_stream_input": ".v_1_text_to_dialogue_stream_input", + "v_1_text_to_speech_voice_id_multi_stream_input": ".v_1_text_to_speech_voice_id_multi_stream_input", + "v_1_text_to_speech_voice_id_stream_input": ".v_1_text_to_speech_voice_id_stream_input", + "v_1_translation_realtime": ".v_1_translation_realtime", + "voices": ".voices", + "webhooks": ".webhooks", + "workspace": ".workspace", + "workspaces": ".workspaces", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AccountChangeActivityId", + "ActorModel", + "AddChapterResponseModel", + "AddKnowledgeBaseResponseModel", + "AddProjectRequest", + "AddProjectResponseModel", + "AddPronunciationDictionaryRequestWorkspaceAccess", + "AddPronunciationDictionaryResponseModel", + "AddPronunciationDictionaryResponseModelPermissionOnResource", + "AddSharingVoiceRequest", + "AddVoiceIvcResponseModel", + "AddVoiceResponseModel", + "AddVoiceToUserVoiceCollectionResponseModel", + "AddWorkspaceGroupMemberResponseModel", + "AddWorkspaceInviteResponseModel", + "AdditionalFormatResponseModel", + "AdditionalFormats", + "AdhocAgentConfigOverrideForTestRequestModel", + "Age", + "AgentAnalysisItemsInput", + "AgentAnalysisItemsInputDataCollectionItem", + "AgentAnalysisItemsInputDataCollectionItem_System", + "AgentAnalysisItemsInputDataCollectionItem_User", + "AgentAnalysisItemsInputEvaluationCriteriaItem", + "AgentAnalysisItemsInputEvaluationCriteriaItem_System", + "AgentAnalysisItemsInputEvaluationCriteriaItem_User", + "AgentAnalysisItemsOutput", + "AgentAnalysisItemsOutputDataCollectionItem", + "AgentAnalysisItemsOutputDataCollectionItem_System", + "AgentAnalysisItemsOutputDataCollectionItem_User", + "AgentAnalysisItemsOutputEvaluationCriteriaItem", + "AgentAnalysisItemsOutputEvaluationCriteriaItem_System", + "AgentAnalysisItemsOutputEvaluationCriteriaItem_User", + "AgentBranchBasicInfo", + "AgentBranchResponse", + "AgentBranchSummary", + "AgentCallLimits", + "AgentConfig", + "AgentConfigApiModelWorkflowOverrideInput", + "AgentConfigApiModelWorkflowOverrideOutput", + "AgentConfigOverrideConfig", + "AgentConfigOverrideInput", + "AgentConfigOverrideOutput", + "AgentConversationTicketIssueType", + "AgentConversationTicketPriority", + "AgentConversationTicketResponseModel", + "AgentConversationTicketSortBy", + "AgentConversationTicketSource", + "AgentConversationTicketStatus", + "AgentDefinitionSource", + "AgentDeploymentHistoryItem", + "AgentDeploymentPercentageStrategy", + "AgentDeploymentRequest", + "AgentDeploymentRequestItem", + "AgentDeploymentResponse", + "AgentDeploymentSource", + "AgentFailureResponseExample", + "AgentHoldAudioConfig", + "AgentKnowledgeBaseRagChunkResponseModel", + "AgentKnowledgeBaseRagQueryRequestModel", + "AgentKnowledgeBaseRagQueryResponseModel", + "AgentMergeProposalResponse", + "AgentMergeProposalResponseOutcome", + "AgentMergeProposalResponseOutcome_Closed", + "AgentMergeProposalResponseOutcome_Merged", + "AgentMergeProposalResponseOutcome_Open", + "AgentMetadata", + "AgentMetadataDbModel", + "AgentMetadataResponseModel", + "AgentPlatformSettingsRequestModel", + "AgentPlatformSettingsResponseModel", + "AgentQueueingConfig", + "AgentResponsePayload", + "AgentSimulatedChatTestResponseModel", + "AgentSmbMetadata", + "AgentSortBy", + "AgentSuccessfulResponseExample", + "AgentSummaryBatchSuccessfulResponseModel", + "AgentSummaryResponseModel", + "AgentTestEntityType", + "AgentTestFolderPathSegmentResponseModel", + "AgentTestingSettings", + "AgentTopicResponseModel", + "AgentTransferInput", + "AgentTransferOp", + "AgentTransferOpPop", + "AgentTransferOpPush", + "AgentTransferOpReplace", + "AgentTransferOp_Pop", + "AgentTransferOp_Push", + "AgentTransferOp_Replace", + "AgentTransferOutput", + "AgentTrustContext", + "AgentVersionMetadata", + "AgentVersionParents", + "AgentWorkflowRequestModel", + "AgentWorkflowRequestModelNodesValue", + "AgentWorkflowRequestModelNodesValue_End", + "AgentWorkflowRequestModelNodesValue_OverrideAgent", + "AgentWorkflowRequestModelNodesValue_PhoneNumber", + "AgentWorkflowRequestModelNodesValue_Say", + "AgentWorkflowRequestModelNodesValue_StandaloneAgent", + "AgentWorkflowRequestModelNodesValue_Start", + "AgentWorkflowRequestModelNodesValue_Tool", + "AgentWorkflowRequestModelNodesValue_UpdateState", + "AgentWorkflowResponseModel", + "AgentWorkflowResponseModelNodesValue", + "AgentWorkflowResponseModelNodesValue_End", + "AgentWorkflowResponseModelNodesValue_OverrideAgent", + "AgentWorkflowResponseModelNodesValue_PhoneNumber", + "AgentWorkflowResponseModelNodesValue_Say", + "AgentWorkflowResponseModelNodesValue_StandaloneAgent", + "AgentWorkflowResponseModelNodesValue_Start", + "AgentWorkflowResponseModelNodesValue_Tool", + "AgentWorkflowResponseModelNodesValue_UpdateState", + "AgentWorkspaceOverridesInput", + "AgentWorkspaceOverridesOutput", + "AlertingIntegrationNotifier", + "AlertingIntegrationNotifierIntegrationType", + "AlertingIntegrationNotifierResponse", + "AlertingIntegrationNotifierResponseIntegrationType", + "AlertingMonitorConfig", + "AlertingPagerDutyNotifier", + "AlertingPagerDutyNotifierResponse", + "AlertingSettings", + "AlertingSettingsNotifiersItem", + "AlertingSettingsNotifiersItem_Integration", + "AlertingSettingsNotifiersItem_Webhook", + "AlertingSettingsResponse", + "AlertingSettingsResponseNotifiersItem", + "AlertingSettingsResponseNotifiersItem_Integration", + "AlertingSettingsResponseNotifiersItem_Webhook", + "AlertingSlackNotifier", + "AlertingSlackNotifierResponse", + "AlertingWebhookHeader", + "AlertingWebhookMethod", + "AlertingWebhookNotifier", + "AlertingWebhookNotifierResponse", + "AlertingWebhookSecretHeaderValue", + "Alignment", + "AllowedOutputFormats", + "AllowedValues", + "AllowlistItem", + "AnalysisCharging", + "AnalysisProperty", + "AnalysisPropertyConstantValue", + "AnalysisPropertyType", + "AnalysisRunSnapshot", + "AnalysisRunningTotal", + "AnalysisScope", + "AnalysisType", + "ApiIntegrationOAuth2AuthCodeResponse", + "ApiIntegrationOAuth2AuthCodeResponseScopeSeparator", + "ApiIntegrationOAuth2CustomAppResponse", + "ApiIntegrationOAuth2CustomAppResponseScopeSeparator", + "ApiIntegrationWebhookOverrides", + "ApiIntegrationWebhookOverridesRequestHeadersValue", + "ApiIntegrationWebhookOverridesSchemaOverridesValue", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Constant", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_DynamicVariable", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Llm", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Omit", + "ApiIntegrationWebhookToolConfigInput", + "ApiIntegrationWebhookToolConfigOutput", + "ArchitectDispatchResponseModel", + "ArrayJsonSchemaPropertyInput", + "ArrayJsonSchemaPropertyInputItems", + "ArrayJsonSchemaPropertyInputPropertyKind", + "ArrayJsonSchemaPropertyOutput", + "ArrayJsonSchemaPropertyOutputItems", + "ArraySchema", + "AsrConversationalConfig", + "AsrConversationalConfigOverride", + "AsrConversationalConfigOverrideConfig", + "AsrConversationalConfigWorkflowOverride", + "AsrInputFormat", + "AsrProvider", + "AsrQuality", + "AssetListResponse", + "AssetResponse", + "AssetTranscription", + "AssetTranscriptionData", + "AssetTranscriptionStatus", + "AssignableUserResponseModel", + "AstAdditionOperatorNodeInput", + "AstAdditionOperatorNodeOutput", + "AstAndOperatorNodeInput", + "AstAndOperatorNodeOutput", + "AstBooleanNodeInput", + "AstBooleanNodeOutput", + "AstConditionalOperatorNodeInput", + "AstConditionalOperatorNodeOutput", + "AstDivisionOperatorNodeInput", + "AstDivisionOperatorNodeOutput", + "AstDynamicVariableNodeInput", + "AstDynamicVariableNodeOutput", + "AstEqualsOperatorNodeInput", + "AstEqualsOperatorNodeOutput", + "AstGreaterThanOperatorNodeInput", + "AstGreaterThanOperatorNodeOutput", + "AstGreaterThanOrEqualsOperatorNodeInput", + "AstGreaterThanOrEqualsOperatorNodeOutput", + "AstLessThanOperatorNodeInput", + "AstLessThanOperatorNodeOutput", + "AstLessThanOrEqualsOperatorNodeInput", + "AstLessThanOrEqualsOperatorNodeOutput", + "AstMultiplicationOperatorNodeInput", + "AstMultiplicationOperatorNodeOutput", + "AstNodeInput", + "AstNodeInputLlm", + "AstNodeInput_AddOperator", + "AstNodeInput_AndOperator", + "AstNodeInput_BooleanLiteral", + "AstNodeInput_ConditionalOperator", + "AstNodeInput_DivOperator", + "AstNodeInput_DynamicVariable", + "AstNodeInput_EqOperator", + "AstNodeInput_GtOperator", + "AstNodeInput_GteOperator", + "AstNodeInput_Llm", + "AstNodeInput_LtOperator", + "AstNodeInput_LteOperator", + "AstNodeInput_MulOperator", + "AstNodeInput_NeqOperator", + "AstNodeInput_NullLiteral", + "AstNodeInput_NumberLiteral", + "AstNodeInput_OrOperator", + "AstNodeInput_StringLiteral", + "AstNodeInput_SubOperator", + "AstNodeOutput", + "AstNodeOutput_AddOperator", + "AstNodeOutput_AndOperator", + "AstNodeOutput_BooleanLiteral", + "AstNodeOutput_ConditionalOperator", + "AstNodeOutput_DivOperator", + "AstNodeOutput_DynamicVariable", + "AstNodeOutput_EqOperator", + "AstNodeOutput_GtOperator", + "AstNodeOutput_GteOperator", + "AstNodeOutput_Llm", + "AstNodeOutput_LtOperator", + "AstNodeOutput_LteOperator", + "AstNodeOutput_MulOperator", + "AstNodeOutput_NeqOperator", + "AstNodeOutput_NullLiteral", + "AstNodeOutput_NumberLiteral", + "AstNodeOutput_OrOperator", + "AstNodeOutput_StringLiteral", + "AstNodeOutput_SubOperator", + "AstNotEqualsOperatorNodeInput", + "AstNotEqualsOperatorNodeOutput", + "AstNullNodeInput", + "AstNullNodeOutput", + "AstNumberNodeInput", + "AstNumberNodeInputValue", + "AstNumberNodeOutput", + "AstNumberNodeOutputValue", + "AstOrOperatorNodeInput", + "AstOrOperatorNodeOutput", + "AstStringNodeInput", + "AstStringNodeOutput", + "AstSubtractionOperatorNodeInput", + "AstSubtractionOperatorNodeOutput", + "AstllmNodeInput", + "AstllmNodeInputPrompt", + "AstllmNodeInputValueSchema", + "AstllmNodeOutput", + "AsyncConversationMetadata", + "AsyncConversationMetadataDeliveryStatus", + "AsyncElevenLabs", + "AttachedSystemDataCollectionRef", + "AttachedSystemEvaluationRef", + "AttachedTestModel", + "AttachedUserDataCollectionRef", + "AttachedUserEvaluationRef", + "AudioAnalysis", + "AudioAnalysisResult", + "AudioAnalysisStatus", + "AudioEffectsBackgroundNoiseResponseModel", + "AudioEffectsCatalogResponseModel", + "AudioEffectsEnvironmentResponseModel", + "AudioEffectsFilterPresetResponseModel", + "AudioFormat", + "AudioFormatEnum", + "AudioInputPacing", + "AudioIsolationHistoryItemResponseModel", + "AudioIsolationRequestFileFormat", + "AudioIsolationStreamRequestFileFormat", + "AudioKeyMoment", + "AudioNativeCreateProjectResponseModel", + "AudioNativeCreateRequestApplyTextNormalization", + "AudioNativeEditContentResponseModel", + "AudioNativeProjectSettingsResponseModel", + "AudioNativeProjectSettingsResponseModelStatus", + "AudioOutput", + "AudioOutputMulti", + "AudioRefChunk", + "AudioReference", + "AudioReference_Asset", + "AudioReference_Generation", + "AudioReference_InlineBase64", + "AudioSchema", + "AudioSegment", + "AudioWithTimestampsAndVoiceSegmentsResponseModel", + "AudioWithTimestampsResponse", + "AuthConnectionDependencies", + "AuthConnectionDependenciesMcpServersItem", + "AuthConnectionDependenciesMcpServersItem_Available", + "AuthConnectionDependenciesMcpServersItem_Unknown", + "AuthConnectionDependenciesToolsItem", + "AuthConnectionDependenciesToolsItem_Available", + "AuthConnectionDependenciesToolsItem_Unknown", + "AuthConnectionLocator", + "AuthConnectionStatus", + "AuthSettings", + "AuthenticationActivityId", + "AuthorizationMethod", + "AutoGenerationMetadata", + "AutoSyncInfo", + "AvatarContextResponseModel", + "BackgroundSoundConfig", + "BackgroundSoundConfigWorkflowOverride", + "BackgroundSoundPresetId", + "BackgroundSoundSourceType", + "BackupLlmDefault", + "BackupLlmDisabled", + "BackupLlmOverride", + "BadRequestError", + "BadRequestErrorBody", + "BanReasonType", + "BaseTurnConfig", + "BasicAuthResponse", + "BatchCallDetailedResponse", + "BatchCallRecipientStatus", + "BatchCallResponse", + "BatchCallStatus", + "BatchCallWhatsAppParams", + "BatchCallingCampaignInformation", + "BatchFailureResponseModel", + "BearerAuthResponse", + "BehaviorOverride", + "BillingPeriod", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess", + "BodyComposeMusicV1MusicPostCompositionPlan", + "BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan", + "BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization", + "BodyCreatePodcastV1StudioPodcastsPostDurationScale", + "BodyCreatePodcastV1StudioPodcastsPostMode", + "BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin", + "BodyCreatePodcastV1StudioPodcastsPostMode_Conversation", + "BodyCreatePodcastV1StudioPodcastsPostSource", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url", + "BodyStreamComposedMusicV1MusicStreamPostCompositionPlan", + "BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan", + "BodyTextToDialogueFullWithTimestampsApplyTextNormalization", + "BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization", + "BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization", + "BodyTextToDialogueStreamWithTimestampsApplyTextNormalization", + "BodyTextToSpeechFullApplyTextNormalization", + "BodyTextToSpeechFullWithTimestampsApplyTextNormalization", + "BodyTextToSpeechStreamApplyTextNormalization", + "BodyTextToSpeechStreamWithTimestampsApplyTextNormalization", + "BooleanSchema", + "BranchProtectionStatus", + "BreakdownTypes", + "BucketingStatus", + "BuiltInToolsInput", + "BuiltInToolsOutput", + "BuiltInToolsWorkflowOverrideInput", + "BuiltInToolsWorkflowOverrideOutput", + "BytedanceSeedance25Request", + "BytedanceSeedance25RequestAspectRatio", + "BytedanceSeedance25RequestResolution", + "BytedanceSeedance2FastRequest", + "BytedanceSeedance2FastRequestAspectRatio", + "BytedanceSeedance2FastRequestResolution", + "BytedanceSeedance2MiniRequest", + "BytedanceSeedance2MiniRequestAspectRatio", + "BytedanceSeedance2MiniRequestResolution", + "BytedanceSeedance2Request", + "BytedanceSeedance2RequestAspectRatio", + "BytedanceSeedance2RequestResolution", + "BytedanceSeedream5LiteRequest", + "BytedanceSeedream5LiteRequestAspectRatio", + "BytedanceSeedream5LiteRequestResolution", + "BytedanceSeedream5ProRequest", + "BytedanceSeedream5ProRequestAspectRatio", + "BytedanceSeedream5ProRequestResolution", + "CallResult", + "CampaignConversationType", + "CancelCalendarEventParams", + "CancelGroupSessionForAllParams", + "CancelGroupSessionRegistrationParams", + "CancelOrderParams", + "CanvasPlacement", + "CaptionStyleCharacterAnimationModel", + "CaptionStyleCharacterAnimationModelEnterType", + "CaptionStyleCharacterAnimationModelExitType", + "CaptionStyleHorizontalPlacementModel", + "CaptionStyleHorizontalPlacementModelAlign", + "CaptionStyleModel", + "CaptionStyleModelTextAlign", + "CaptionStyleModelTextBlendMode", + "CaptionStyleModelTextStyle", + "CaptionStyleModelTextTransform", + "CaptionStyleModelTextWeight", + "CaptionStyleSectionAnimationModel", + "CaptionStyleSectionAnimationModelEnterType", + "CaptionStyleSectionAnimationModelExitType", + "CaptionStyleTemplateModel", + "CaptionStyleVerticalPlacementModel", + "CaptionStyleVerticalPlacementModelAlign", + "CaptionStyleWordAnimationModel", + "CaptionStyleWordAnimationModelEnterType", + "CaptionStyleWordAnimationModelExitType", + "ChapterContentBlockExtendableNodeResponseModel", + "ChapterContentBlockInputModel", + "ChapterContentBlockInputModelSubType", + "ChapterContentBlockResponseModel", + "ChapterContentBlockResponseModelNodesItem", + "ChapterContentBlockResponseModelNodesItem_Other", + "ChapterContentBlockResponseModelNodesItem_TtsNode", + "ChapterContentBlockTtsNodeResponseModel", + "ChapterContentInputModel", + "ChapterContentParagraphTtsNodeInputModel", + "ChapterContentResponseModel", + "ChapterResponse", + "ChapterSnapshotExtendedResponseModel", + "ChapterSnapshotResponse", + "ChapterSnapshotsResponse", + "ChapterState", + "ChapterStatisticsResponse", + "ChapterWithContentResponseModel", + "ChapterWithContentResponseModelState", + "CharacterAge", + "CharacterAlignmentModel", + "CharacterAlignmentResponseModel", + "CharacterGender", + "CharacterMetadataResponseModel", + "CharacterRefreshPeriod", + "CharacterResponseModel", + "CharacterRole", + "CharacterUsageResponse", + "ChatSourceMedium", + "CheckServiceAvailabilityParams", + "ClientEvent", + "ClientSecretResponse", + "ClientToolConfigInput", + "ClientToolConfigOutput", + "ClipAnimation", + "ClipAnimationEnterEffect", + "ClipAnimationExitEffect", + "CloseConnection", + "CloseContext", + "ClosePayload", + "CloseSocket", + "ClosedOutcome", + "ColumnFilter", + "ColumnFilterOperation", + "ColumnFilterValuesItem", + "ColumnUnit", + "CommitStrategy", + "CommittedTranscriptEntitiesPayload", + "CommittedTranscriptPayload", + "CommittedTranscriptWithTimestampsPayload", + "CompactionSettingsWorkflowOverride", + "CompileProceduresResponseModel", + "CompileProceduresValidationErrorResponseModel", + "CompositionPlan", + "CompositionPlanChunksItem", + "ComputedUsagePlatformLimit", + "ConditionStrength", + "ConfigEntityType", + "ConflictError", + "ConflictSection", + "ConstantSchemaOverride", + "ConstantSchemaOverrideConstantValue", + "ContentConfig", + "ContentFormat", + "ContentGuardrailInput", + "ContentGuardrailInputTriggerAction", + "ContentGuardrailInputTriggerAction_EndCall", + "ContentGuardrailInputTriggerAction_Retry", + "ContentGuardrailOutput", + "ContentGuardrailOutputTriggerAction", + "ContentGuardrailOutputTriggerAction_EndCall", + "ContentGuardrailOutputTriggerAction_Retry", + "ContentSchema", + "ContentSchema_Array", + "ContentSchema_Audio", + "ContentSchema_Boolean", + "ContentSchema_Image", + "ContentSchema_Integer", + "ContentSchema_Number", + "ContentSchema_Object", + "ContentSchema_String", + "ContentSchema_Video", + "ContentSchema_Voice", + "ContentThresholdGuardrail", + "ContentThresholdGuardrailThreshold", + "ContextualUpdateInfo", + "Contributor", + "ConvAiDynamicVariable", + "ConvAiEnvVarLocator", + "ConvAiFileUploadResponseModel", + "ConvAiSecretLocator", + "ConvAiStoredSecretDependencies", + "ConvAiStoredSecretDependenciesAgentsItem", + "ConvAiStoredSecretDependenciesAgentsItem_Available", + "ConvAiStoredSecretDependenciesAgentsItem_Unknown", + "ConvAiStoredSecretDependenciesMcpServersItem", + "ConvAiStoredSecretDependenciesMcpServersItem_Available", + "ConvAiStoredSecretDependenciesMcpServersItem_Unknown", + "ConvAiStoredSecretDependenciesToolsItem", + "ConvAiStoredSecretDependenciesToolsItem_Available", + "ConvAiStoredSecretDependenciesToolsItem_Unknown", + "ConvAiUserSecretDbModel", + "ConvAiWebhooks", + "ConvAiWorkspaceStoredSecretConfig", + "ConversationAsrUsageModel", + "ConversationChargingCommonModel", + "ConversationConfigClientOverrideConfigInput", + "ConversationConfigClientOverrideConfigOutput", + "ConversationConfigClientOverrideInput", + "ConversationConfigClientOverrideOutput", + "ConversationConfigInput", + "ConversationConfigOutput", + "ConversationConfigOverride", + "ConversationConfigOverrideConfig", + "ConversationConfigWorkflowOverrideInput", + "ConversationConfigWorkflowOverrideOutput", + "ConversationDeletionSettings", + "ConversationErrorType", + "ConversationFeedbackType", + "ConversationHistoryAnalysisCommonModel", + "ConversationHistoryBatchCallModel", + "ConversationHistoryElevenAssistantCommonModel", + "ConversationHistoryErrorCommonModel", + "ConversationHistoryEvaluationCriteriaResultCommonModel", + "ConversationHistoryExotelPhoneCallModel", + "ConversationHistoryFeedbackCommonModel", + "ConversationHistoryMetadataCommonModel", + "ConversationHistoryMetadataCommonModelPhoneCall", + "ConversationHistoryMetadataCommonModelPhoneCall_Exotel", + "ConversationHistoryMetadataCommonModelPhoneCall_SipTrunking", + "ConversationHistoryMetadataCommonModelPhoneCall_Twilio", + "ConversationHistoryMultivoiceMessageModel", + "ConversationHistoryMultivoiceMessagePartModel", + "ConversationHistoryRagUsageCommonModel", + "ConversationHistoryRedactionConfig", + "ConversationHistorySipTrunkingPhoneCallModel", + "ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput", + "ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput", + "ConversationHistoryTranscriptCommonModelInput", + "ConversationHistoryTranscriptCommonModelInputRole", + "ConversationHistoryTranscriptCommonModelInputToolResultsItem", + "ConversationHistoryTranscriptCommonModelOutput", + "ConversationHistoryTranscriptCommonModelOutputRole", + "ConversationHistoryTranscriptCommonModelOutputToolResultsItem", + "ConversationHistoryTranscriptFileInputResponseModel", + "ConversationHistoryTranscriptOtherToolsResultCommonModel", + "ConversationHistoryTranscriptOtherToolsResultCommonModelType", + "ConversationHistoryTranscriptResponseModel", + "ConversationHistoryTranscriptResponseModelRole", + "ConversationHistoryTranscriptResponseModelToolResultsItem", + "ConversationHistoryTranscriptSystemToolResultCommonModelInput", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_Dummy", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndCallSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseRagSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_LanguageDetectionSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_SkipTurnSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TestingToolResult", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberAmazonConnectSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberExotelSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberSipSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberTwilioSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_VoicemailDetectionSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutput", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_Dummy", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndCallSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseRagSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_LanguageDetectionSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_SkipTurnSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TestingToolResult", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberAmazonConnectSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberExotelSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberSipSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberTwilioSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_VoicemailDetectionSuccess", + "ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsInput", + "ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsOutput", + "ConversationHistoryTranscriptToolCallClientDetails", + "ConversationHistoryTranscriptToolCallCommonModelInput", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_ApiIntegrationWebhook", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Client", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Mcp", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Webhook", + "ConversationHistoryTranscriptToolCallCommonModelOutput", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_ApiIntegrationWebhook", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Client", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Mcp", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Webhook", + "ConversationHistoryTranscriptToolCallMcpDetails", + "ConversationHistoryTranscriptToolCallWebhookDetails", + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput", + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput", + "ConversationHistoryTwilioPhoneCallModel", + "ConversationInitiationClientDataConfigInput", + "ConversationInitiationClientDataConfigOutput", + "ConversationInitiationClientDataInternal", + "ConversationInitiationClientDataRequestInput", + "ConversationInitiationClientDataRequestOutput", + "ConversationInitiationClientDataWebhook", + "ConversationInitiationClientDataWebhookRequestHeadersValue", + "ConversationInitiationSource", + "ConversationInitiationSourceInfo", + "ConversationProduct", + "ConversationReasoningModel", + "ConversationSentimentAnalysis", + "ConversationSentimentAnalysisOverallLabel", + "ConversationSignedUrlResponseModel", + "ConversationSimulationSpecification", + "ConversationSource", + "ConversationSummaryMessageModel", + "ConversationSummaryMessageModelRole", + "ConversationSummaryResponseModel", + "ConversationSummaryResponseModelStatus", + "ConversationTagResponseModel", + "ConversationTokenPurpose", + "ConversationTokenResponseModel", + "ConversationTtsUsageModel", + "ConversationTurnMetrics", + "ConversationUserResponseModel", + "ConversationVoiceRewardModel", + "ConversationVoiceUsageModel", + "ConversationalConfig", + "ConversationalConfigApiModelWorkflowOverrideInput", + "ConversationalConfigApiModelWorkflowOverrideOutput", + "ConvertChapterResponseModel", + "ConvertProjectResponseModel", + "CrawlStatus", + "CrawlType", + "CreateAgentBranchResponseModel", + "CreateAgentMergeProposalResponseModel", + "CreateAgentProcedureParams", + "CreateAgentResponseModel", + "CreateAgentRuleParams", + "CreateAgentTestFolderResponseModel", + "CreateAgentTestResponseModel", + "CreateAssetParams", + "CreateAudioNativeProjectRequest", + "CreateAuthConnectionEnvironmentVariableRequest", + "CreateBasicAuthRequest", + "CreateBearerAuthRequest", + "CreateClientAppointmentParams", + "CreateClientInteractionParams", + "CreateClientParams", + "CreateClientSecretRequest", + "CreateCrawlJobResponseModel", + "CreateCustomHeaderAuthRequest", + "CreateExotelPhoneNumberRequest", + "CreateHolidayParams", + "CreateLocationParams", + "CreateMtlsAuthRequest", + "CreateOAuth2ClientCredsRequest", + "CreateOAuth2JwtRequest", + "CreateOAuth2JwtRequestAlgorithm", + "CreateOAuth2JwtRequestTokenResponseField", + "CreateOrderParams", + "CreateOrderRequest", + "CreateOrderResponse", + "CreatePhoneNumberResponseModel", + "CreatePreviouslyGeneratedVoiceRequest", + "CreatePrivateKeyJwtRequest", + "CreatePrivateKeyJwtRequestAlgorithm", + "CreateProcedureRequestModel", + "CreateProcedureResponseModel", + "CreateProductParams", + "CreateProductQuoteRequestParams", + "CreatePronunciationDictionaryResponseModel", + "CreateResponseUnitTestRequest", + "CreateSecretEnvironmentVariableRequest", + "CreateServiceParams", + "CreateServiceQuoteRequestParams", + "CreateSimulationTestRequest", + "CreateSipTrunkPhoneNumberRequest", + "CreateStaffParams", + "CreateStringEnvironmentVariableRequest", + "CreateToolCallUnitTestRequest", + "CreateTranscriptRequest", + "CreateTransferRuleParams", + "CreateTwilioPhoneNumberRequest", + "CreatifyAuroraRequest", + "CreatifyAuroraRequestResolution", + "CriteriaScoringMode", + "CueOptionsRequest", + "Currency", + "CustomGuardrailConfig", + "CustomGuardrailConfigModel", + "CustomGuardrailConfigTriggerAction", + "CustomGuardrailConfigTriggerAction_EndCall", + "CustomGuardrailConfigTriggerAction_Retry", + "CustomGuardrailInput", + "CustomGuardrailOutput", + "CustomGuardrailsConfigInput", + "CustomGuardrailsConfigOutput", + "CustomHeaderAuthResponse", + "CustomLlm", + "CustomLlmApiKey", + "CustomLlmAuthConnection", + "CustomLlmRequestHeadersValue", + "CustomLlmapiType", + "CustomSipHeader", + "CustomSipHeaderWithDynamicVariable", + "DashboardCallSuccessChartModel", + "DashboardCriteriaChartModel", + "DashboardDataCollectionChartModel", + "DataCollectionResultCommonModel", + "DefaultSharingGroupConfig", + "DefaultSharingGroupConfigPermissionLevel", + "DefaultSharingGroupResponseModel", + "DefaultSharingGroupResponseModelPermissionLevel", + "DeleteAgentHoldAudioResponseModel", + "DeleteAgentProcedureParams", + "DeleteAgentRuleParams", + "DeleteAssetParams", + "DeleteCalendarEventParams", + "DeleteChapterRequest", + "DeleteChapterResponseModel", + "DeleteClientInteractionParams", + "DeleteClientParams", + "DeleteDubbingResponseModel", + "DeleteGroupSessionParams", + "DeleteHistoryItemResponse", + "DeleteHolidayParams", + "DeleteLocationParams", + "DeleteProductParams", + "DeleteProjectRequest", + "DeleteProjectResponseModel", + "DeleteSampleResponse", + "DeleteServiceParams", + "DeleteStaffParams", + "DeleteTransferRuleParams", + "DeleteUserVoiceCollectionResponseModel", + "DeleteVoiceResponseModel", + "DeleteVoiceSampleResponseModel", + "DeleteWorkspaceGroupMemberResponseModel", + "DeleteWorkspaceInviteResponseModel", + "DeleteWorkspaceWebhookResponseModel", + "DeliverableInfo", + "DependentAvailableAgentIdentifier", + "DependentAvailableAgentIdentifierAccessLevel", + "DependentAvailableMcpServerIdentifier", + "DependentAvailableMcpServerIdentifierAccessLevel", + "DependentAvailableToolIdentifier", + "DependentAvailableToolIdentifierAccessLevel", + "DependentBranchInfo", + "DependentIntegrationConnectionIdentifier", + "DependentPhoneNumberIdentifier", + "DependentUnknownAgentIdentifier", + "DependentUnknownMcpServerIdentifier", + "DependentUnknownToolIdentifier", + "DetailedMusicResponse", + "DetailedMusicResponseCompositionPlan", + "DetectedEntity", + "DeviceModel", + "DialogueInput", + "DialogueInputResponseModel", + "DialogueTextAlignment", + "DirectPublishingReadResponseModel", + "DirectPublishingReadResponseModelDisplayMode", + "DirectPublishingReadResponseModelGenreItem", + "DirectPublishingReadResponseModelPayoutType", + "DirectPublishingReadResponseModelTargetAudience", + "DiscountResponseModel", + "DoDubbingResponse", + "DocumentUsageModeEnum", + "DocxExportOptions", + "DtmfInputConfig", + "DubOrderItemRequest", + "DubRequestMode", + "DubbedSegment", + "DubbingAudio", + "DubbingAudioOutputError", + "DubbingAuthError", + "DubbingBulkSourceSegmentUpdateResponse", + "DubbingBulkTargetSegmentUpdateResponse", + "DubbingCommittedTranscript", + "DubbingEndOfStream", + "DubbingError", + "DubbingInputAudioChunk", + "DubbingInputError", + "DubbingInvalidRequestError", + "DubbingLanguageListResponse", + "DubbingLanguageOutputs", + "DubbingLanguageResponse", + "DubbingLanguageResponseStatus", + "DubbingListRequestCreationSourcesItem", + "DubbingListRequestDubbingModelsItem", + "DubbingListRequestDubbingStatus", + "DubbingListRequestDubbingStatusesItem", + "DubbingListRequestFilterByCreator", + "DubbingListRequestOrderBy", + "DubbingListRequestOrderDirection", + "DubbingMediaMetadata", + "DubbingMediaReference", + "DubbingMetadataPageResponseModel", + "DubbingMetadataResponse", + "DubbingPartialTranscript", + "DubbingProjectListResponse", + "DubbingProjectResponse", + "DubbingProjectResponseStatus", + "DubbingQueueOverflowError", + "DubbingRateLimitedError", + "DubbingRegenerateResponse", + "DubbingReleaseChannel", + "DubbingRenderResponseModel", + "DubbingResource", + "DubbingSegmentUpdateRequest", + "DubbingSessionStarted", + "DubbingSourceMediaInfo", + "DubbingSourceSegmentUpdateResponse", + "DubbingSourceTranscriptResponse", + "DubbingStatus", + "DubbingStatusStatus", + "DubbingTargetSegmentUpdateRequest", + "DubbingTargetSegmentUpdateResponse", + "DubbingTargetTranscriptResponse", + "DubbingTargetTranscriptSegment", + "DubbingTranscriberError", + "DubbingTranscript", + "DubbingTranscriptCharacter", + "DubbingTranscriptResponseModel", + "DubbingTranscriptRevisionResponse", + "DubbingTranscriptSegment", + "DubbingTranscriptUtterance", + "DubbingTranscriptWord", + "DubbingTranscriptsResponseModel", + "DubbingTranscriptsResponseModelTranscriptFormat", + "DubbingTranslation", + "DubbingTranslationError", + "DummyToolResultModel", + "DuplicateSpeechEngineRequest", + "DynamicVariableAssignment", + "DynamicVariableInternalValueType", + "DynamicVariableNestedValueTypeInput", + "DynamicVariableNestedValueTypeOutput", + "DynamicVariableSchemaOverride", + "DynamicVariableUpdateCommonModel", + "DynamicVariablesConfig", + "DynamicVariablesConfigWorkflowOverride", + "Eagerness", + "EditChapterResponseModel", + "EditProjectResponseModel", + "EditVoiceRequestLabels", + "EditVoiceResponseModel", + "EditVoiceSettingsRequest", + "EditVoiceSettingsResponseModel", + "EditedTranscript", + "EffectsSpecInput", + "EffectsSpecOutput", + "ElevenFlashV25Request", + "ElevenFlashV25RequestOutputFormat", + "ElevenFlashV25VoiceSettings", + "ElevenLabs", + "ElevenLabsEnvironment", + "ElevenMultilingualV2Request", + "ElevenMultilingualV2RequestOutputFormat", + "ElevenV3Request", + "ElevenV3RequestOutputFormat", + "ElevenV3VoiceSettings", + "EmbedVariant", + "EmbeddingModelEnum", + "EndCallToolConfig", + "EndCallToolResultModel", + "EndCallTriggerAction", + "EndProcedureToolConfig", + "EndProcedureToolConfigProceduresValue", + "EndProcedureToolErrorStatus", + "EndProcedureToolResultErrorModel", + "EndProcedureToolResultSuccessModel", + "EntityManagementActivityId", + "EntryBehavior", + "EnvironmentAuthConnectionLocator", + "EnvironmentResponse", + "EnvironmentVariableAuthConnectionValue", + "EnvironmentVariableAuthConnectionValueRequest", + "EnvironmentVariableResponse", + "EnvironmentVariableResponseType", + "EnvironmentVariableResponseValues", + "EnvironmentVariableSecretValue", + "EnvironmentVariableSecretValueRequest", + "EnvironmentVariablesCreateRequestBody", + "EnvironmentVariablesCreateRequestBody_AuthConnection", + "EnvironmentVariablesCreateRequestBody_Secret", + "EnvironmentVariablesCreateRequestBody_String", + "EnvironmentVariablesListRequestType", + "EnvironmentVariablesListResponse", + "EnvironmentsListResponse", + "ErrorPayload", + "EvaluationCriteriaSummaryResult", + "EvaluationResultFilter", + "EvaluationSettingsInput", + "EvaluationSettingsOutput", + "EvaluationSuccessResult", + "ExactParameterEvaluationStrategy", + "ExotelApiSubdomain", + "ExotelOutboundCallResponse", + "ExperimentAssignment", + "ExperimentAssignmentSource", + "ExpiresAfter", + "ExportOptions", + "ExportOptions_Docx", + "ExportOptions_Html", + "ExportOptions_Pdf", + "ExportOptions_SegmentedJson", + "ExportOptions_Srt", + "ExportOptions_Txt", + "ExternalFileSyncInfo", + "ExternalFolderSyncInfo", + "ExternalSyncJobTrigger", + "ExternalSyncJobType", + "ExternalSyncProvider", + "FeatureStatusCommonModel", + "FeaturesUsageCommonModel", + "FeedbackItem", + "FieldConflict", + "FileInputConfig", + "FileInputConfigWorkflowOverride", + "FileRefreshStatus", + "FinalOutput", + "FinalOutputMulti", + "FineTuningResponse", + "FineTuningResponseStateValue", + "FinetuneCreatedBy", + "FinetuneVisibility", + "FlushContext", + "FocusGuardrail", + "ForbiddenError", + "ForcedAlignmentCharacterResponseModel", + "ForcedAlignmentResponseModel", + "ForcedAlignmentWordResponseModel", + "FrustratedConversationRef", + "FrustratedConversationRefOverallLabel", + "Gemini25FlashImageRequest", + "Gemini25FlashImageRequestAspectRatio", + "Gemini31FlashImageRequest", + "Gemini31FlashImageRequestAspectRatio", + "Gemini31FlashImageRequestResolution", + "Gemini31FlashLiteImageRequest", + "Gemini31FlashLiteImageRequestAspectRatio", + "Gemini3ProImageRequest", + "Gemini3ProImageRequestAspectRatio", + "Gemini3ProImageRequestResolution", + "Gender", + "GenerateVoiceRequest", + "GenerationChunkInput", + "GenerationChunkInputContextAdherence", + "GenerationChunkOutput", + "GenerationChunkOutputContextAdherence", + "GenerationConfig", + "GenerationReference", + "GenerationSourceContext", + "GenesysBotOutcome", + "GenesysRegion", + "GetAgentConfigParams", + "GetAgentConversationTicketsPageResponseModel", + "GetAgentEmbedResponseModel", + "GetAgentKnowledgebaseSizeResponseModel", + "GetAgentLinkResponseModel", + "GetAgentResponseModel", + "GetAgentResponseModelPhoneNumbersItem", + "GetAgentResponseModelPhoneNumbersItem_Exotel", + "GetAgentResponseModelPhoneNumbersItem_SipTrunk", + "GetAgentResponseModelPhoneNumbersItem_Twilio", + "GetAgentTestFolderResponseModel", + "GetAgentTopicsResponseModel", + "GetAgentsPageResponseModel", + "GetAnalyticsSummaryParams", + "GetAppointmentByConfirmationNumberParams", + "GetAudioIsolationHistoryResponseModel", + "GetAudioNativeProjectSettingsResponseModel", + "GetBookingPageSettingsParams", + "GetBookingSlugStatusParams", + "GetChapterRequest", + "GetChapterSnapshotsRequest", + "GetChaptersRequest", + "GetChaptersResponse", + "GetClientAppointmentsParams", + "GetClientByPhoneParams", + "GetClientOrdersParams", + "GetConvAiDashboardSettingsResponseModel", + "GetConvAiDashboardSettingsResponseModelChartsItem", + "GetConvAiDashboardSettingsResponseModelChartsItem_CallSuccess", + "GetConvAiDashboardSettingsResponseModelChartsItem_Criteria", + "GetConvAiDashboardSettingsResponseModelChartsItem_DataCollection", + "GetConvAiSettingsResponseModel", + "GetConversationResponseModel", + "GetConversationResponseModelStatus", + "GetConversationSummaryResponseModel", + "GetConversationSummaryResponseModelStatus", + "GetConversationTagsPageResponseModel", + "GetConversationUsersPageResponseModel", + "GetConversationsPageResponseModel", + "GetCrawlJobResponseModel", + "GetKnowledgeBaseDependentAgentsResponseModel", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Available", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Unknown", + "GetKnowledgeBaseFileResponseModel", + "GetKnowledgeBaseFolderResponseModel", + "GetKnowledgeBaseListResponseModel", + "GetKnowledgeBaseListResponseModelDocumentsItem", + "GetKnowledgeBaseListResponseModelDocumentsItem_File", + "GetKnowledgeBaseListResponseModelDocumentsItem_Folder", + "GetKnowledgeBaseListResponseModelDocumentsItem_Text", + "GetKnowledgeBaseListResponseModelDocumentsItem_Url", + "GetKnowledgeBaseSummaryFileResponseModel", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Available", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Unknown", + "GetKnowledgeBaseSummaryFolderResponseModel", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Available", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Unknown", + "GetKnowledgeBaseSummaryTextResponseModel", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Available", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Unknown", + "GetKnowledgeBaseSummaryUrlResponseModel", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Available", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Unknown", + "GetKnowledgeBaseTextResponseModel", + "GetKnowledgeBaseUrlResponseModel", + "GetLibraryVoicesResponse", + "GetLiveCountResponse", + "GetOrCreateRagIndexRequestModel", + "GetOrderByConfirmationNumberParams", + "GetPhoneNumberExotelResponseModel", + "GetPhoneNumberInboundSipTrunkConfigResponseModel", + "GetPhoneNumberOutboundSipTrunkConfigResponseModel", + "GetPhoneNumberResponse", + "GetPhoneNumberSipTrunkResponseModel", + "GetPhoneNumberTwilioResponseModel", + "GetPhoneNumbersPageResponseModel", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_Exotel", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_SipTrunk", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_Twilio", + "GetProjectRequest", + "GetProjectsRequest", + "GetProjectsResponse", + "GetPronunciationDictionariesMetadataResponseModel", + "GetPronunciationDictionariesResponse", + "GetPronunciationDictionaryMetadataResponse", + "GetPronunciationDictionaryMetadataResponsePermissionOnResource", + "GetPronunciationDictionaryResponse", + "GetPronunciationDictionaryWithRulesResponseModel", + "GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem_Alias", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem_Phoneme", + "GetResponseUnitTestResponseModel", + "GetScheduleParams", + "GetSecretDependenciesResponseModel", + "GetSecretDependenciesResponseModelDependencies", + "GetSecretDependenciesResponseModelDependenciesOneItem", + "GetSecretDependenciesResponseModelDependenciesOneItem_Available", + "GetSecretDependenciesResponseModelDependenciesOneItem_Unknown", + "GetSecretDependenciesResponseModelDependenciesZeroItem", + "GetSecretDependenciesResponseModelDependenciesZeroItem_Available", + "GetSecretDependenciesResponseModelDependenciesZeroItem_Unknown", + "GetSimulationTestResponseModel", + "GetSipLogMessagesResponse", + "GetSpeechHistoryResponse", + "GetTestInvocationsPageResponseModel", + "GetTestSuiteInvocationResponseModel", + "GetTestsPageResponseModel", + "GetTestsSummariesByIdsResponseModel", + "GetToolCallUnitTestResponseModel", + "GetToolDependentAgentsResponseModel", + "GetToolDependentAgentsResponseModelAgentsItem", + "GetToolDependentAgentsResponseModelAgentsItem_Available", + "GetToolDependentAgentsResponseModelAgentsItem_Unknown", + "GetToolExecutionsPageResponseModel", + "GetUserVoiceCollectionsResponseModel", + "GetVoiceAccentsResponseModel", + "GetVoicesResponse", + "GetVoicesV2Response", + "GetWhatsAppAccountResponse", + "GetWorkspacePlanParams", + "GetWorkspaceSecretsResponseModel", + "GptImage15Request", + "GptImage15RequestAspectRatio", + "GptImage15RequestBackground", + "GptImage15RequestQuality", + "GptImage1Request", + "GptImage1RequestAspectRatio", + "GptImage1RequestBackground", + "GptImage1RequestQuality", + "GptImage25FlareRequest", + "GptImage25FlareRequestAspectRatio", + "GptImage25FlareRequestQuality", + "GptImage25FlareRequestResolution", + "GptImage25SunburstRequest", + "GptImage25SunburstRequestAspectRatio", + "GptImage25SunburstRequestQuality", + "GptImage25SunburstRequestResolution", + "GptImage2Request", + "GptImage2RequestAspectRatio", + "GptImage2RequestQuality", + "GptImage2RequestResolution", + "GroupManagementActivityId", + "GuardrailExecutionMode", + "GuardrailType", + "GuardrailsResult", + "GuardrailsV1Input", + "GuardrailsV1Output", + "HidingReason", + "HistoryAlignmentResponseModel", + "HistoryAlignmentsResponseModel", + "HistoryItemResponse", + "HistoryListRequestSortDirection", + "HistoryListRequestSource", + "HtmlExportOptions", + "HttpRequestModel", + "HttpValidationError", + "Icon", + "IconTheme", + "ImageAnalysis", + "ImageAnalysisResult", + "ImageAnalysisStatus", + "ImageAvatar", + "ImageGenerationRequest", + "ImageGenerationRequest_BytedanceSeedream5Lite", + "ImageGenerationRequest_BytedanceSeedream5Pro", + "ImageGenerationRequest_Gemini25FlashImage", + "ImageGenerationRequest_Gemini31FlashImage", + "ImageGenerationRequest_Gemini31FlashLiteImage", + "ImageGenerationRequest_Gemini3ProImage", + "ImageGenerationRequest_GptImage1", + "ImageGenerationRequest_GptImage15", + "ImageGenerationRequest_GptImage2", + "ImageGenerationRequest_GptImage25Flare", + "ImageGenerationRequest_GptImage25Sunburst", + "ImageReference", + "ImageReference_Asset", + "ImageReference_Generation", + "ImageReference_InlineBase64", + "ImageSchema", + "ImageSubject", + "InboundSipTrunkConfigRequestModel", + "InitPayload", + "InitialiseContext", + "InitializeConnection", + "InitializeConnectionMulti", + "InlineAudioReference", + "InlineAudioReferenceMimeType", + "InlineBase64Reference", + "InlineBase64ReferenceMimeType", + "InlineImageReference", + "InlineImageReferenceMimeType", + "InlineVideoReference", + "InlineVideoReferenceMimeType", + "InputAudioChunkPayload", + "IntegerSchema", + "IntegrationType", + "InteractionBudget", + "InternalAlertingWebhookNotifier", + "InternalSamplingConfigResponseModel", + "InvoiceResponse", + "InvoiceResponsePaymentIntentStatus", + "InvoiceResponsePaymentIntentStatussesItem", + "ItemId", + "KbExternalSyncJob", + "KeepContextAlive", + "KnowledgeBaseBulkDeleteSuccessfulResponseModel", + "KnowledgeBaseContentSearchResponseModel", + "KnowledgeBaseContentSearchResult", + "KnowledgeBaseContentSearchResultDocument", + "KnowledgeBaseContentSearchResultDocument_File", + "KnowledgeBaseContentSearchResultDocument_Folder", + "KnowledgeBaseContentSearchResultDocument_Text", + "KnowledgeBaseContentSearchResultDocument_Url", + "KnowledgeBaseDeletedResponseModel", + "KnowledgeBaseDependentType", + "KnowledgeBaseDocumentChunkResponseModel", + "KnowledgeBaseDocumentChunksResponseModel", + "KnowledgeBaseDocumentMetadataResponseModel", + "KnowledgeBaseDocumentType", + "KnowledgeBaseFolderPathSegmentResponseModel", + "KnowledgeBaseFolderPathSegmentSummaryResponseModel", + "KnowledgeBaseLocator", + "KnowledgeBaseRagChunkModel", + "KnowledgeBaseRagToolConfig", + "KnowledgeBaseRagToolResultModel", + "KnowledgeBaseRagToolStatus", + "KnowledgeBaseSortBy", + "KnowledgeBaseSourceFileUrlResponseModel", + "KnowledgeBaseSummaryBatchSuccessfulResponseModel", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_File", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Folder", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Text", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Url", + "KnowledgeBaseToolConfig", + "KnowledgeBaseToolInfo", + "KnowledgeBaseToolResultModel", + "KnowledgeBaseToolStatus", + "LanguageAddedResponse", + "LanguageDetectionToolConfig", + "LanguageDetectionToolResultModel", + "LanguageInfo", + "LanguagePairInfo", + "LanguagePresetInput", + "LanguagePresetOutput", + "LanguagePresetTranslation", + "LanguageResponse", + "LanguagesResponse", + "LanguagesResponse_Pair", + "LanguagesResponse_Single", + "LeaveMessageParams", + "LibraryVoiceResponse", + "LibraryVoiceResponseCategory", + "ListAgentProceduresParams", + "ListAgentReferencesParams", + "ListAgentRulesParams", + "ListAssetsParams", + "ListAuthConnectionsResponse", + "ListAuthConnectionsResponseAuthConnectionsItem", + "ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2AuthCode", + "ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2CustomApp", + "ListAuthConnectionsResponseAuthConnectionsItem_BasicAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_BearerAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_CustomHeaderAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_Mtls", + "ListAuthConnectionsResponseAuthConnectionsItem_Oauth2ClientCredentials", + "ListAuthConnectionsResponseAuthConnectionsItem_Oauth2Jwt", + "ListAuthConnectionsResponseAuthConnectionsItem_PrivateKeyJwt", + "ListAuthConnectionsResponseAuthConnectionsItem_RefreshTokenAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_SlackBotAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_UrlSecret", + "ListAuthConnectionsResponseAuthConnectionsItem_WhatsappAuth", + "ListCalendarEventsParams", + "ListClientInteractionsParams", + "ListClientsParams", + "ListCrawlJobsResponseModel", + "ListCustomerFacingAgentsParams", + "ListGroupSessionsParams", + "ListHolidaysParams", + "ListLocationsParams", + "ListMcpToolsResponseModel", + "ListOrdersResponse", + "ListProceduresResponseModel", + "ListProductsParams", + "ListResponseAgentBranchSummary", + "ListResponseAgentDeploymentHistoryItem", + "ListResponseMeta", + "ListServicesParams", + "ListSpeechEnginesResponse", + "ListStaffParams", + "ListTransferRulesParams", + "ListWhatsAppAccountsResponse", + "LiteralJsonSchemaProperty", + "LiteralJsonSchemaPropertyConstantValue", + "LiteralJsonSchemaPropertyType", + "LivekitStackType", + "Llm", + "LlmCategoryUsage", + "LlmDeprecationConfigModel", + "LlmDeprecationInfoModel", + "LlmInfoModel", + "LlmInputOutputTokensUsage", + "LlmListResponseModel", + "LlmLiteralJsonSchemaProperty", + "LlmLiteralJsonSchemaPropertyType", + "LlmParameterEvaluationStrategy", + "LlmReasoningEffort", + "LlmSchemaOverride", + "LlmTokensCategoryUsage", + "LlmUsageCalculatorLlmResponseModel", + "LlmUsageCalculatorResponseModel", + "LlmUsageInput", + "LlmUsageOutput", + "LoadMemoryEntryToolErrorStatus", + "LoadableMemoryEntry", + "LockReason", + "ManualSource", + "ManualVerificationFileResponse", + "ManualVerificationResponse", + "MatchAnythingParameterEvaluationStrategy", + "McpApprovalPolicy", + "McpApprovedToolDefinition", + "McpServerConfigInput", + "McpServerConfigInputAuthConnection", + "McpServerConfigInputRequestHeadersValue", + "McpServerConfigInputRequestMetaValue", + "McpServerConfigInputSecretToken", + "McpServerConfigInputUrl", + "McpServerConfigOutput", + "McpServerConfigOutputAuthConnection", + "McpServerConfigOutputRequestHeadersValue", + "McpServerConfigOutputRequestMetaValue", + "McpServerConfigOutputSecretToken", + "McpServerConfigOutputUrl", + "McpServerMetadataResponseModel", + "McpServerResponseModel", + "McpServerResponseModelDependentAgentsItem", + "McpServerResponseModelDependentAgentsItem_Available", + "McpServerResponseModelDependentAgentsItem_Unknown", + "McpServerTransport", + "McpServersResponseModel", + "McpToolApprovalHash", + "McpToolApprovalPolicy", + "McpToolApprovalState", + "McpToolApprovalStatus", + "McpToolConfigOverrideInput", + "McpToolConfigOverrideInputInputOverridesValue", + "McpToolConfigOverrideInputInputOverridesValue_Constant", + "McpToolConfigOverrideInputInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideInputInputOverridesValue_Llm", + "McpToolConfigOverrideInputInputOverridesValue_Omit", + "McpToolConfigOverrideInputToolCallSound", + "McpToolConfigOverrideOutput", + "McpToolConfigOverrideOutputInputOverridesValue", + "McpToolConfigOverrideOutputInputOverridesValue_Constant", + "McpToolConfigOverrideOutputInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideOutputInputOverridesValue_Llm", + "McpToolConfigOverrideOutputInputOverridesValue_Omit", + "McpToolConfigOverrideOutputToolCallSound", + "MediaCodec", + "MediaGenerationCompletedResponse", + "MediaGenerationCreateResponse", + "MediaGenerationFailedResponse", + "MediaGenerationFailedResponseFailureReason", + "MediaGenerationInProgressResponse", + "MediaGenerationListResponse", + "MediaGenerationResponse", + "MediaGenerationResponse_Completed", + "MediaGenerationResponse_Failed", + "MediaGenerationResponse_Generating", + "MediaGenerationResponse_Pending", + "MediaId", + "MemoryEntrySearchResult", + "MemoryEntrySearchResultSource", + "MergePreviewResponseModel", + "MergePreviewResponseModelPhoneNumbersItem", + "MergePreviewResponseModelPhoneNumbersItem_Exotel", + "MergePreviewResponseModelPhoneNumbersItem_SipTrunk", + "MergePreviewResponseModelPhoneNumbersItem_Twilio", + "MergeProposalCloseReason", + "MergeProposalComment", + "MergeProposalReview", + "MergeProposalReviewReviewerRole", + "MergeProposalReviewState", + "MergeProposalStatus", + "MergedOutcome", + "MessageSearchSortBy", + "MessagesSearchResponse", + "MessagesSearchResult", + "MetricRecord", + "MetricType", + "MockNoMatchBehavior", + "MockingStrategy", + "Model", + "ModelRatesResponseModel", + "ModerationConfig", + "ModerationGuardrailInput", + "ModerationGuardrailOutput", + "ModerationStatusResponseModel", + "ModerationStatusResponseModelSafetyStatus", + "ModerationStatusResponseModelWarningStatus", + "MtlsAuthResponse", + "MultichannelSpeechToTextResponseModel", + "MultipartMusicResponse", + "MusicAllowedOutputFormats", + "MusicComposeDetailedRequestOutputFormat", + "MusicComposeDetailedStreamRequestOutputFormat", + "MusicComposeRequestOutputFormat", + "MusicExploreSongSourceContext", + "MusicFinetuneFailureReason", + "MusicFinetunePageResponseModel", + "MusicFinetuneResponseModel", + "MusicFinetuneStatus", + "MusicGenerationMode", + "MusicModelId", + "MusicOnlyOutputFormats", + "MusicOutputFormat", + "MusicPrompt", + "MusicSeparateStemsRequestStemVariationId", + "MusicStreamRequestOutputFormat", + "MusicUploadRequestExtractCompositionPlan", + "MusicUploadResponse", + "MusicUploadResponseCompositionPlan", + "NonStreamingOutputFormats", + "NormalizedAlignment", + "NotFoundError", + "NumberSchema", + "NumericDistributionAggregate", + "OAuth2ClientCredsResponse", + "OAuth2JwtResponse", + "OAuth2JwtResponseAlgorithm", + "OAuth2JwtResponseTokenResponseField", + "OTelAttribute", + "OTelAttributeValueValue", + "OTelResource", + "OTelResourceSpans", + "OTelScope", + "OTelScopeSpans", + "OTelSpan", + "OTelStatus", + "OTelTracePayload", + "ObjectJsonSchemaPropertyInput", + "ObjectJsonSchemaPropertyInputPropertiesValue", + "ObjectJsonSchemaPropertyInputPropertyKind", + "ObjectJsonSchemaPropertyOutput", + "ObjectJsonSchemaPropertyOutputPropertiesValue", + "ObjectSchema", + "OmitSchemaOverride", + "OpenAiAudioConfigInput", + "OpenAiAudioConfigOutput", + "OpenAiAudioFormat", + "OpenAiAudioInputConfigInput", + "OpenAiAudioInputConfigOutput", + "OpenAiAudioInputFormat", + "OpenAiAudioInputTranscription", + "OpenAiAudioOutputConfigInput", + "OpenAiAudioOutputConfigOutput", + "OpenAiAudioOutputFormat", + "OpenAiFunctionTool", + "OpenAiSessionConfigInput", + "OpenAiSessionConfigInputMaxResponseOutputTokens", + "OpenAiSessionConfigInputToolChoice", + "OpenAiSessionConfigInputToolsItem", + "OpenAiSessionConfigInputToolsItem_Function", + "OpenAiSessionConfigInputToolsItem_Mcp", + "OpenAiSessionConfigInputTracing", + "OpenAiSessionConfigInputTruncation", + "OpenAiSessionConfigInputTurnDetection", + "OpenAiSessionConfigOutput", + "OpenAiSessionConfigOutputMaxResponseOutputTokens", + "OpenAiSessionConfigOutputToolChoice", + "OpenAiSessionConfigOutputToolsItem", + "OpenAiSessionConfigOutputToolsItem_Function", + "OpenAiSessionConfigOutputToolsItem_Mcp", + "OpenAiSessionConfigOutputTracing", + "OpenAiToolChoiceFunction", + "OpenAiToolChoiceFunctionInner", + "OpenAiTracingConfiguration", + "OpenAiTurnDetection", + "OpenAimcpTool", + "OpenAimcpToolRequireApproval", + "OpenOutcome", + "OpenerConfig", + "OptInSmsReminderParams", + "OptOutSmsReminderParams", + "OrbAvatar", + "OrchestratorToolMockBehaviorConfig", + "OrderDeliverablesResponse", + "OrderId", + "OrderItemInfo", + "OrderItemKind", + "OrderItemRequestInput", + "OrderItemRequestInput_Dub", + "OrderItemRequestInput_Subtitles", + "OrderItemRequestInput_Transcription", + "OrderItemRequestOutput", + "OrderItemRequestOutput_Dub", + "OrderItemRequestOutput_Subtitles", + "OrderItemRequestOutput_Transcription", + "OrderMediaResponse", + "OrderResponse", + "OrderState", + "OrderSummary", + "OutboundCallRecipient", + "OutboundCallRecipientResponseModel", + "OutboundSipTrunkConfigRequestModel", + "OutputFormat", + "PaginatedResultAgentMergeProposalResponse", + "PairedLanguagesResponse", + "PartialTranscriptPayload", + "PatchWorkspaceWebhookResponseModel", + "PdfExportOptions", + "PendingBlocksMetadataModel", + "PendingCancellationResponseModel", + "PendingClipTask", + "PendingClipTaskType", + "PendingExternalAudiosMetadataModel", + "PendingSubscriptionSwitchResponseModel", + "PendingSubscriptionSwitchResponseModelNextTier", + "PermissionType", + "PhoneNumberAgentInfo", + "PhoneNumberDynamicVariableTransferDestination", + "PhoneNumberSortBy", + "PhoneNumberTransfer", + "PhoneNumberTransferCustomSipHeadersItem", + "PhoneNumberTransferCustomSipHeadersItem_Dynamic", + "PhoneNumberTransferCustomSipHeadersItem_Static", + "PhoneNumberTransferDestination", + "PhoneNumberTransferPostDialDigits", + "PhoneNumberTransferPostDialDigits_Dynamic", + "PhoneNumberTransferPostDialDigits_Static", + "PhoneNumberTransferTransferDestination", + "PhoneNumberTransferTransferDestination_Phone", + "PhoneNumberTransferTransferDestination_PhoneDynamicVariable", + "PhoneNumberTransferTransferDestination_SipUri", + "PhoneNumberTransferTransferDestination_SipUriDynamicVariable", + "PingPayload", + "PlatformCategory", + "PlatformCategoryUsage", + "PlatformLimits", + "PlatformUsage", + "PlayDtmfResultErrorModel", + "PlayDtmfResultSuccessModel", + "PlayDtmfToolConfig", + "PodcastBulletinMode", + "PodcastBulletinModeData", + "PodcastConversationMode", + "PodcastConversationModeData", + "PodcastProjectResponseModel", + "PodcastTextSource", + "PodcastUrlSource", + "PongPayload", + "PositionInput", + "PositionOutput", + "PostAgentAvatarResponseModel", + "PostAgentHoldAudioResponseModel", + "PostDialDigitsDynamicVariable", + "PostDialDigitsStatic", + "PostWorkspaceSecretResponseModel", + "PreToolSpeechMode", + "PreviewAudioDbModel", + "Price", + "PrivacyConfigInput", + "PrivacyConfigOutput", + "PrivateKeyJwtResponse", + "PrivateKeyJwtResponseAlgorithm", + "ProcedureAtVersionResponseModel", + "ProcedureDraftRef", + "ProcedureDraftResponseModel", + "ProcedureListItemResponseModel", + "ProcedureRefResponseModel", + "ProcedureType", + "ProcedureValidationError", + "ProcedureVersionRef", + "ProjectCreationMetaResponseModel", + "ProjectCreationMetaResponseModelStatus", + "ProjectCreationMetaType", + "ProjectExtendedResponse", + "ProjectExtendedResponseAccessLevel", + "ProjectExtendedResponseApplyTextNormalization", + "ProjectExtendedResponseAspectRatio", + "ProjectExtendedResponseAssetsItem", + "ProjectExtendedResponseAssetsItem_Audio", + "ProjectExtendedResponseAssetsItem_Image", + "ProjectExtendedResponseAssetsItem_Video", + "ProjectExtendedResponseFiction", + "ProjectExtendedResponseSourceType", + "ProjectExtendedResponseTargetAudience", + "ProjectExternalAudioResponseModel", + "ProjectExternalAudioResponseModelSourceContext", + "ProjectExternalAudioResponseModelSourceContext_MusicExploreSong", + "ProjectExternalAudioResponseModelSourceContext_Sfx", + "ProjectExternalAudioResponseModelSourceContext_Song", + "ProjectImageResponseModel", + "ProjectMutedTracksResponseModel", + "ProjectResponse", + "ProjectResponseAccessLevel", + "ProjectResponseAspectRatio", + "ProjectResponseFiction", + "ProjectResponseSourceType", + "ProjectResponseTargetAudience", + "ProjectSnapshotExtendedResponseModel", + "ProjectSnapshotResponse", + "ProjectSnapshotsResponse", + "ProjectState", + "ProjectVideoResponseModel", + "ProjectVideoThumbnailSheetResponseModel", + "ProjectVoiceResponseModel", + "PromptAgent", + "PromptAgentApiModelInput", + "PromptAgentApiModelInputBackupLlmConfig", + "PromptAgentApiModelInputBackupLlmConfig_Default", + "PromptAgentApiModelInputBackupLlmConfig_Disabled", + "PromptAgentApiModelInputBackupLlmConfig_Override", + "PromptAgentApiModelInputToolsItem", + "PromptAgentApiModelInputToolsItem_ApiIntegrationWebhook", + "PromptAgentApiModelInputToolsItem_Client", + "PromptAgentApiModelInputToolsItem_Mcp", + "PromptAgentApiModelInputToolsItem_Smb", + "PromptAgentApiModelInputToolsItem_System", + "PromptAgentApiModelInputToolsItem_Webhook", + "PromptAgentApiModelOutput", + "PromptAgentApiModelOutputBackupLlmConfig", + "PromptAgentApiModelOutputBackupLlmConfig_Default", + "PromptAgentApiModelOutputBackupLlmConfig_Disabled", + "PromptAgentApiModelOutputBackupLlmConfig_Override", + "PromptAgentApiModelOutputToolsItem", + "PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook", + "PromptAgentApiModelOutputToolsItem_Client", + "PromptAgentApiModelOutputToolsItem_Mcp", + "PromptAgentApiModelOutputToolsItem_Smb", + "PromptAgentApiModelOutputToolsItem_System", + "PromptAgentApiModelOutputToolsItem_Webhook", + "PromptAgentApiModelOverrideConfig", + "PromptAgentApiModelOverrideInput", + "PromptAgentApiModelOverrideOutput", + "PromptAgentApiModelWorkflowOverrideInput", + "PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig", + "PromptAgentApiModelWorkflowOverrideInputToolsItem", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_ApiIntegrationWebhook", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Client", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Mcp", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Smb", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_System", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook", + "PromptAgentApiModelWorkflowOverrideOutput", + "PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_ApiIntegrationWebhook", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Mcp", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Smb", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_System", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook", + "PromptAgentDbModel", + "PromptEvaluationCriteria", + "PromptInjectionGuardrail", + "PronunciationDictionariesListRequestSort", + "PronunciationDictionaryAliasRuleRequestModel", + "PronunciationDictionaryAliasRuleResponseModel", + "PronunciationDictionaryLocator", + "PronunciationDictionaryLocatorResponseModel", + "PronunciationDictionaryPhonemeRuleRequestModel", + "PronunciationDictionaryPhonemeRuleResponseModel", + "PronunciationDictionaryRulesResponseModel", + "PronunciationDictionaryVersionLocator", + "PronunciationDictionaryVersionResponseModel", + "PronunciationDictionaryVersionResponseModelPermissionOnResource", + "PydanticPronunciationDictionaryVersionLocator", + "QualityPresetType", + "QueryParamsJsonSchemaInput", + "QueryParamsJsonSchemaOutput", + "QuoteInfo", + "RagChunkMetadata", + "RagConfigInput", + "RagConfigOutput", + "RagConfigWorkflowOverrideInput", + "RagConfigWorkflowOverrideOutput", + "RagDocumentIndexResponseModel", + "RagDocumentIndexUsage", + "RagDocumentIndexesResponseModel", + "RagIndexBatchSuccessfulResponseModel", + "RagIndexOverviewEmbeddingModelResponseModel", + "RagIndexOverviewResponseModel", + "RagIndexStatus", + "RagRetrievalInfo", + "ReadLegalTerms", + "ReadMetadataChapterDbModel", + "ReaderResourceResponseModel", + "ReaderResourceResponseModelResourceType", + "RealtimeAudioOptions", + "RealtimeConnection", + "RealtimeEvents", + "RealtimeModel", + "RealtimeUrlOptions", + "RealtimeVoiceSettings", + "ReceiveDubbingStreamMessage", + "ReceiveMessage", + "ReceiveMessageMulti", + "ReceiveTextToDialogueWebsocketMessage", + "ReceiveTextToDialogueWebsocketMessageMulti", + "ReceiveTranscription", + "ReceiveTranslateStreamMessage", + "ReceiveUpstreamMessage", + "RecordingResponse", + "ReferenceVideo", + "ReferencedToolCommonModel", + "ReferencedToolCommonModelType", + "RefreshTokenAuthResponse", + "RegexParameterEvaluationStrategy", + "RegionConfigRequest", + "RegionalProcessingSurchargeInfo", + "RegisterForGroupSessionParams", + "RegisterMediaResponse", + "RemoveMemberFromGroupRequest", + "RemoveOrderItemResponse", + "RemoveVoiceFromUserVoiceCollectionResponseModel", + "Render", + "RenderStatus", + "RenderType", + "ReplicateVoiceToIsolatedEnvironmentResponseModel", + "ReportKnowledgeGapParams", + "RequestPvcManualVerificationResponseModel", + "RequiredConstraint", + "RequiredConstraints", + "ResourceAccessInfo", + "ResourceAccessInfoAccessSource", + "ResourceAccessInfoAnonymousAccessLevelOverride", + "ResourceAccessInfoRole", + "ResourceMetadataResponseModel", + "ResourceMetadataResponseModelAnonymousAccessLevelOverride", + "ResponseConversationErrorType", + "ResponseFilter", + "ResponseFilterMode", + "ResponseUnitTestModel", + "RestoreCalendarEventParams", + "RetryTriggerAction", + "ReviewResponseModel", + "ReviewResponseModelRejectReasonsItem", + "ReviewResponseModelReviewStatus", + "ReviewStatus", + "SafetyCommonModelInput", + "SafetyCommonModelOutput", + "SafetyEvaluation", + "SafetyResponseModel", + "SafetyRule", + "SampleConfigDbModel", + "SampleConfigDbModelParentType", + "SaveVoicePreviewRequest", + "SayNodeLiteralMessageInput", + "SayNodeLiteralMessageOutput", + "SayNodePromptMessageInput", + "SayNodePromptMessageOutput", + "ScheduleGroupSessionParams", + "ScimGroupResponseModel", + "ScopedAnalysisResult", + "ScribeAuthErrorPayload", + "ScribeChunkSizeExceededErrorPayload", + "ScribeErrorPayload", + "ScribeInputErrorPayload", + "ScribeInsufficientAudioActivityErrorPayload", + "ScribeInvalidRequestError", + "ScribeQueueOverflowErrorPayload", + "ScribeQuotaExceededErrorPayload", + "ScribeRateLimitedErrorPayload", + "ScribeResourceExhaustedErrorPayload", + "ScribeSessionTimeLimitExceededErrorPayload", + "ScribeThrottledErrorPayload", + "ScribeTranscriberErrorPayload", + "ScribeUnacceptedTermsErrorPayload", + "ScribeWarning", + "SearchClientsParams", + "SearchHighlightSegment", + "SearchStrategy", + "SeatType", + "SecretDependencyResourceType", + "SecretDependencyType", + "SectionSource", + "SegmentCreateResponse", + "SegmentDeleteResponse", + "SegmentDubResponse", + "SegmentMigrationResponse", + "SegmentSubtitleFrame", + "SegmentTranscriptionResponse", + "SegmentTranslationResponse", + "SegmentUpdateResponse", + "SegmentedJsonExportOptions", + "SendCustomEmailParams", + "SendDubbingStreamMessage", + "SendMessage", + "SendMessageMulti", + "SendText", + "SendTextMulti", + "SendTranslateStreamMessage", + "SendUpstreamMessage", + "SentimentAggregate", + "SentimentAnalysisSettings", + "SessionStartedPayload", + "SessionStartedPayloadConfig", + "SessionStartedPayloadConfigCommitStrategy", + "SetBookingSlugParams", + "SeverityId", + "SfxModelId", + "SfxSourceContext", + "ShareOptionResponseModel", + "ShareOptionResponseModelType", + "SimilarVoice", + "SimilarVoicesForSpeakerResponse", + "SimulationLibrarySettings", + "SimulationTestModel", + "SimulationToolMockBehaviorConfig", + "SingleLanguagesResponse", + "SingleTestRunRequestModel", + "SingleUseTokenResponseModel", + "SingleUseTokenType", + "SipLogMessage", + "SipLogMessageDirection", + "SipMediaEncryptionEnum", + "SipTrunkCredentialsRequestModel", + "SipTrunkOutboundCallResponse", + "SipTrunkTransportEnum", + "SipUriDynamicVariableTransferDestination", + "SipUriTransferDestination", + "SkipTurnToolConfig", + "SkipTurnToolResponseModel", + "SlackBotAuthResponse", + "SmbAgentType", + "SmbClientAccessConfig", + "SmsConversationInfo", + "SmsConversationInfoDirection", + "SoftTimeoutConfig", + "SoftTimeoutConfigOverride", + "SoftTimeoutConfigOverrideConfig", + "SoftTimeoutConfigWorkflowOverride", + "SongMetadata", + "SongSection", + "SongSourceContext", + "SortDirection", + "SpeakerAudioResponseModel", + "SpeakerCreatedResponse", + "SpeakerResponseModel", + "SpeakerSegment", + "SpeakerSeparationResponseModel", + "SpeakerSeparationResponseModelStatus", + "SpeakerTrack", + "SpeakerUpdatedResponse", + "SpeechEngineConfig", + "SpeechEngineConfigRequestHeadersValue", + "SpeechEngineConversationInitiationClientDataConfig", + "SpeechEngineResponse", + "SpeechEngineSummaryResponse", + "SpeechHistoryItemResponse", + "SpeechHistoryItemResponseSource", + "SpeechHistoryItemResponseVoiceCategory", + "SpeechToSpeechConvertRequestOutputFormat", + "SpeechToSpeechRequestFileFormat", + "SpeechToSpeechStreamRequestFileFormat", + "SpeechToSpeechStreamRequestOutputFormat", + "SpeechToTextCharacterResponseModel", + "SpeechToTextChunkResponseModel", + "SpeechToTextChunkResponseModelEditedTranscript", + "SpeechToTextChunkResponseModelEditedTranscript_Error", + "SpeechToTextChunkResponseModelEditedTranscript_Transcript", + "SpeechToTextConvertRequestEntityDetection", + "SpeechToTextConvertRequestEntityRedaction", + "SpeechToTextConvertRequestFileFormat", + "SpeechToTextConvertRequestMultichannelOutputStyle", + "SpeechToTextConvertRequestTimestampsGranularity", + "SpeechToTextConvertRequestWebhookMetadata", + "SpeechToTextConvertResponse", + "SpeechToTextWebhookResponseModel", + "SpeechToTextWordResponseModel", + "SpeechToTextWordResponseModelType", + "SpellingPatience", + "SrtExportOptions", + "StartProcedureToolConfig", + "StartProcedureToolConfigProceduresValue", + "StartProcedureToolErrorStatus", + "StartProcedureToolResultErrorModel", + "StartProcedureToolResultSuccessModel", + "StartPvcVoiceTrainingResponseModel", + "StartSpeakerSeparationResponseModel", + "StaticAssetReference", + "StatusId", + "StoredUsagePlatformLimit", + "StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel", + "StreamingAudioChunkWithTimestampsResponse", + "StringSchema", + "StudioAgentSettingsModel", + "StudioAgentToolSettingsModel", + "StudioClipLocator", + "StudioClipLocatorClipType", + "StudioTextStyleOutlineModel", + "StudioTextStyleShadowModel", + "SubmitBusinessInfoParams", + "SubmitOrderResponse", + "Subscription", + "SubscriptionExtrasResponseModel", + "SubscriptionMaxCreditLimitExtension", + "SubscriptionPendingChange", + "SubscriptionResponse", + "SubscriptionResponseMaxCreditLimitExtension", + "SubscriptionStatusType", + "SubscriptionUsageResponseModel", + "SubtitleOrderItemRequest", + "SuggestedAudioTag", + "SupportedVoice", + "SystemDataCollectionId", + "SystemEvaluationCriteria", + "SystemEvaluationId", + "SystemToolConfigInput", + "SystemToolConfigInputParams", + "SystemToolConfigInputParams_EndCall", + "SystemToolConfigInputParams_EndProcedure", + "SystemToolConfigInputParams_KnowledgeBase", + "SystemToolConfigInputParams_KnowledgeBaseRag", + "SystemToolConfigInputParams_LanguageDetection", + "SystemToolConfigInputParams_PlayKeypadTouchTone", + "SystemToolConfigInputParams_SkipTurn", + "SystemToolConfigInputParams_StartProcedure", + "SystemToolConfigInputParams_TransferToAgent", + "SystemToolConfigInputParams_TransferToNumber", + "SystemToolConfigInputParams_VoicemailDetection", + "SystemToolConfigOutput", + "SystemToolConfigOutputParams", + "SystemToolConfigOutputParams_EndCall", + "SystemToolConfigOutputParams_EndProcedure", + "SystemToolConfigOutputParams_KnowledgeBase", + "SystemToolConfigOutputParams_KnowledgeBaseRag", + "SystemToolConfigOutputParams_LanguageDetection", + "SystemToolConfigOutputParams_PlayKeypadTouchTone", + "SystemToolConfigOutputParams_SkipTurn", + "SystemToolConfigOutputParams_StartProcedure", + "SystemToolConfigOutputParams_TransferToAgent", + "SystemToolConfigOutputParams_TransferToNumber", + "SystemToolConfigOutputParams_VoicemailDetection", + "TelephonyCallConfigInput", + "TelephonyCallConfigOutput", + "TelephonyDirection", + "TelephonyProvider", + "TemplateArrayOutput", + "TemplateArrayOutputFailureReason", + "TemplateAudioOutput", + "TemplateAudioOutputFailureReason", + "TemplateBooleanOutput", + "TemplateBooleanOutputFailureReason", + "TemplateImageOutput", + "TemplateImageOutputFailureReason", + "TemplateInputReference", + "TemplateInputReference_Asset", + "TemplateInputReference_Generation", + "TemplateInputReference_InlineBase64", + "TemplateInputReference_Voice", + "TemplateIntegerOutput", + "TemplateIntegerOutputFailureReason", + "TemplateListResponse", + "TemplateNumberOutput", + "TemplateNumberOutputFailureReason", + "TemplateObjectOutput", + "TemplateObjectOutputFailureReason", + "TemplateOutput", + "TemplateOutput_Array", + "TemplateOutput_Audio", + "TemplateOutput_Boolean", + "TemplateOutput_Image", + "TemplateOutput_Integer", + "TemplateOutput_Number", + "TemplateOutput_Object", + "TemplateOutput_String", + "TemplateOutput_Video", + "TemplatePort", + "TemplateRunInput", + "TemplateRunListResponse", + "TemplateRunResponse", + "TemplateRunStatus", + "TemplateStringOutput", + "TemplateStringOutputFailureReason", + "TemplateSummary", + "TemplateVersion", + "TemplateVideoOutput", + "TemplateVideoOutputFailureReason", + "TestConditionRationaleCommonModel", + "TestConditionResultCommonModel", + "TestFromConversationMetadataInput", + "TestFromConversationMetadataOutput", + "TestInvocationSummaryResponseModel", + "TestRunMetadata", + "TestRunMetadataTestType", + "TestRunResultBucket", + "TestRunResultSummary", + "TestRunStatus", + "TestSharingMode", + "TestToolResultModel", + "TestType", + "TestsFeatureUsageCommonModel", + "TextNormalisationType", + "TextToDialogueApplyTextNormalization", + "TextToDialogueCommitStrategy", + "TextToDialogueConvertRequestOutputFormat", + "TextToDialogueConvertWithTimestampsRequestOutputFormat", + "TextToDialogueEagerness", + "TextToDialogueInputFormat", + "TextToDialogueOutputFormat", + "TextToDialogueTtsModelId", + "TextToDialogueWebsocketApplyTextNormalizationEnum", + "TextToDialogueWebsocketAudioChunk", + "TextToDialogueWebsocketAudioChunkMulti", + "TextToDialogueWebsocketClientMessage", + "TextToDialogueWebsocketClientMessageMulti", + "TextToDialogueWebsocketError", + "TextToDialogueWebsocketFinal", + "TextToDialogueWebsocketFinalAudioForTurn", + "TextToDialogueWebsocketFinalAudioForTurnMulti", + "TextToDialogueWebsocketFinalMulti", + "TextToDialogueWebsocketOutputFormatEnum", + "TextToDialogueWebsocketVoiceInput", + "TextToDialogueWebsocketVoiceSettings", + "TextToSoundEffectsConvertRequestOutputFormat", + "TextToSpeechApplyTextNormalizationEnum", + "TextToSpeechConvertRequestOutputFormat", + "TextToSpeechConvertWithTimestampsRequestOutputFormat", + "TextToSpeechGenerationRequest", + "TextToSpeechGenerationRequest_ElevenFlashV25", + "TextToSpeechGenerationRequest_ElevenMultilingualV2", + "TextToSpeechGenerationRequest_ElevenV3", + "TextToSpeechOutputFormatEnum", + "TextToSpeechRequest", + "TextToSpeechStreamRequest", + "TextToSpeechStreamRequestOutputFormat", + "TextToSpeechStreamWithTimestampsRequest", + "TextToSpeechStreamWithTimestampsRequestOutputFormat", + "TextToSpeechWithTimestampsRequest", + "ThresholdGuardrail", + "TicketCommentResponseModel", + "TicketMergeProposalLinkResponseModel", + "TicketPriorityChangeResponseModel", + "TicketSearchMatchField", + "TicketSearchMatchResponseModel", + "TicketStatusChangeResponseModel", + "TimeRange", + "ToDialogueSettingsResponseModel", + "TokenResponseModel", + "TooEarlyError", + "Tool", + "ToolAnnotations", + "ToolCallSoundBehavior", + "ToolCallSoundType", + "ToolCallUnitTestModel", + "ToolErrorHandlingMode", + "ToolExecution", + "ToolExecutionMode", + "ToolExecutionResponseModel", + "ToolExecutionResponseModelToolCallDetails", + "ToolExecutionResponseModelToolCallDetails_ApiIntegrationWebhook", + "ToolExecutionResponseModelToolCallDetails_Client", + "ToolExecutionResponseModelToolCallDetails_Mcp", + "ToolExecutionResponseModelToolCallDetails_Webhook", + "ToolExecutionTaskSupport", + "ToolInterruptionMode", + "ToolMockConfig", + "ToolRequestModel", + "ToolRequestModelToolConfig", + "ToolRequestModelToolConfig_Client", + "ToolRequestModelToolConfig_Mcp", + "ToolRequestModelToolConfig_System", + "ToolRequestModelToolConfig_Webhook", + "ToolResponseMockConfigInput", + "ToolResponseMockConfigOutput", + "ToolResponseModel", + "ToolResponseModelToolConfig", + "ToolResponseModelToolConfig_Client", + "ToolResponseModelToolConfig_Mcp", + "ToolResponseModelToolConfig_System", + "ToolResponseModelToolConfig_Webhook", + "ToolSortBy", + "ToolType", + "ToolTypeFilter", + "ToolUsageStatsResponseModel", + "ToolsResponseModel", + "TopicDiscoverySettings", + "TopicEvaluationCriteriaAggregate", + "TopicMetricsAggregate", + "TopicSentimentAggregate", + "TopicSortBy", + "TranscriptEditError", + "TranscriptMessage", + "TranscriptMessageRole", + "TranscriptPlatformEvent", + "TranscriptionOrderItemRequest", + "TranscriptionWord", + "TranscriptionWordType", + "TransferBranchInfoConfigured", + "TransferBranchInfoDefaultingToMain", + "TransferBranchInfoTrafficSplit", + "TransferToAgentToolConfigInput", + "TransferToAgentToolConfigOutput", + "TransferToAgentToolResultErrorModel", + "TransferToAgentToolResultSuccessModelInput", + "TransferToAgentToolResultSuccessModelInputBranchInfo", + "TransferToAgentToolResultSuccessModelInputBranchInfo_Configured", + "TransferToAgentToolResultSuccessModelInputBranchInfo_DefaultingToMain", + "TransferToAgentToolResultSuccessModelInputBranchInfo_TrafficSplit", + "TransferToAgentToolResultSuccessModelOutput", + "TransferToAgentToolResultSuccessModelOutputBranchInfo", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_Configured", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit", + "TransferToNumberResultAmazonConnectSuccessModel", + "TransferToNumberResultErrorModel", + "TransferToNumberResultExotelSuccessModel", + "TransferToNumberResultSipSuccessModel", + "TransferToNumberResultTwilioSuccessModel", + "TransferToNumberToolConfigInput", + "TransferToNumberToolConfigOutput", + "TransferTypeEnum", + "TranslateAudioOutputError", + "TranslateAudioPayload", + "TranslateAuthError", + "TranslateEndOfStreamPayload", + "TranslateErrorPayload", + "TranslateFinalTranscriptPayload", + "TranslateInputAudioChunkPayload", + "TranslateInputError", + "TranslateInputFormatEnum", + "TranslateOutputFormatEnum", + "TranslatePartialTranscriptPayload", + "TranslatePaymentIssueError", + "TranslateQueueOverflowError", + "TranslateQuotaExceededError", + "TranslateRateLimitedError", + "TranslateSessionStartedPayload", + "TranslateStatusPayload", + "TranslateTranscriberError", + "TranslateTranslationError", + "TranslateTranslationPayload", + "TranslateUnacceptedTermsError", + "TranslatedString", + "TriggerUserVerificationParams", + "TriggeredGuardrailCommonModel", + "TtsConversationalConfigInput", + "TtsConversationalConfigOutput", + "TtsConversationalConfigOverride", + "TtsConversationalConfigOverrideConfig", + "TtsConversationalConfigWorkflowOverrideInput", + "TtsConversationalConfigWorkflowOverrideOutput", + "TtsConversationalModel", + "TtsModelFamily", + "TtsOptimizeStreamingLatency", + "TtsOutputFormat", + "TtsVoiceSettings", + "TurnCommentRequestModel", + "TurnCommentResponseModel", + "TurnConfig", + "TurnConfigOverride", + "TurnConfigOverrideConfig", + "TurnConfigWorkflowOverride", + "TurnDetectionType", + "TurnEagerness", + "TurnMode", + "TurnModel", + "TwilioAnsweredBy", + "TwilioEdgeLocation", + "TwilioMachineDetectionAction", + "TwilioMachineDetectionConfig", + "TwilioMachineDetectionMode", + "TwilioMachineDetectionRule", + "TwilioOutboundCallResponse", + "TwilioRegionId", + "TxtExportOptions", + "UnauthorizedError", + "UnitTestRunResponseModel", + "UnitTestRunResponseModelTestInfo", + "UnitTestRunResponseModelTestInfo_Llm", + "UnitTestRunResponseModelTestInfo_Simulation", + "UnitTestRunResponseModelTestInfo_Tool", + "UnitTestSummaryResponseModel", + "UnitTestToolCallEvaluationModelInput", + "UnitTestToolCallEvaluationModelOutput", + "UnitTestToolCallParameter", + "UnitTestToolCallParameterEval", + "UnitTestToolCallParameterEval_Anything", + "UnitTestToolCallParameterEval_Exact", + "UnitTestToolCallParameterEval_Llm", + "UnitTestToolCallParameterEval_Regex", + "UnitTestWorkflowNodeTransitionEvaluationNodeId", + "UnprocessableEntityError", + "UpdateAgentConfigParams", + "UpdateAgentProcedureParams", + "UpdateAgentRuleParams", + "UpdateAssetParams", + "UpdateAudioNativeProjectRequest", + "UpdateBasicAuthRequest", + "UpdateBearerAuthRequest", + "UpdateBookingPageAppearanceParams", + "UpdateBookingPageSettingsParams", + "UpdateBusinessInfoParams", + "UpdateCalendarEventParams", + "UpdateChapterRequest", + "UpdateClientParams", + "UpdateEnvironmentVariableRequestValuesValue", + "UpdateGroupSessionSeatsParams", + "UpdateHolidayParams", + "UpdateLocationParams", + "UpdateOAuth2ClientCredsRequest", + "UpdateOAuth2JwtRequest", + "UpdateOAuth2JwtRequestAlgorithm", + "UpdateOAuth2JwtRequestTokenResponseField", + "UpdateOrderParams", + "UpdateOrderRequest", + "UpdateOrderResponse", + "UpdateProductParams", + "UpdateProjectRequest", + "UpdatePronunciationDictionariesRequest", + "UpdateResponseUnitTestRequest", + "UpdateServiceParams", + "UpdateSimulationTestRequest", + "UpdateStaffParams", + "UpdateToolCallUnitTestRequest", + "UpdateTransferRuleParams", + "UpdateWorkspaceMemberResponseModel", + "UpsertOrderItemRequest", + "UpsertOrderItemResponse", + "UrlAvatar", + "UrlModel", + "UrlSecretAuthResponse", + "UsageAggregationInterval", + "UsageCharactersResponseModel", + "User", + "UserAccessManagementActivityId", + "UserFeedback", + "UserFeedbackScore", + "UserModel", + "UserTranscriptPayload", + "UserTypeId", + "UserVoiceCollectionResponseModel", + "UserVoiceCollectionResponseModelPermissionOnResource", + "UsersSortBy", + "UtteranceResponseModel", + "UuiTransferConfig", + "UuiTransferConfigProtocolDiscriminatorMode", + "VadConfig", + "VadConfigWorkflowOverride", + "ValidateUserVerificationCodeParams", + "ValidationError", + "ValidationErrorLocItem", + "Veo31FastRequest", + "Veo31FastRequestAspectRatio", + "Veo31FastRequestResolution", + "Veo31Request", + "Veo31RequestAspectRatio", + "Veo31RequestResolution", + "VeoImageReference", + "VeoImageReferenceRole", + "Verbosity", + "VerificationAttemptResponse", + "VerifiedVoiceLanguageResponseModel", + "VerifyPvcVoiceCaptchaResponseModel", + "VideoAnalysis", + "VideoAnalysisResult", + "VideoAnalysisStatus", + "VideoGenerationRequest", + "VideoGenerationRequest_BytedanceSeedanceV2", + "VideoGenerationRequest_BytedanceSeedanceV25", + "VideoGenerationRequest_BytedanceSeedanceV2Fast", + "VideoGenerationRequest_BytedanceSeedanceV2Mini", + "VideoGenerationRequest_CreatifyAurora", + "VideoGenerationRequest_Veo31FastGenerate001", + "VideoGenerationRequest_Veo31Generate001", + "VideoKeyMoment", + "VideoReference", + "VideoReference_Asset", + "VideoReference_Generation", + "VideoReference_InlineBase64", + "VideoSchema", + "VideoSegment", + "VideoSubject", + "VisitedAgentRef", + "Voice", + "VoiceAccentResponseModel", + "VoiceCategory", + "VoiceDesignPreviewResponse", + "VoiceDesignRequestModelModelId", + "VoiceGenerationParameterOptionResponse", + "VoiceGenerationParameterResponse", + "VoiceLabellingStatus", + "VoiceMailDetectionResultSuccessModel", + "VoicePreviewResponseModel", + "VoiceRecordingQuality", + "VoiceReference", + "VoiceSafetyControl", + "VoiceSample", + "VoiceSamplePreviewResponseModel", + "VoiceSampleVisualWaveformResponseModel", + "VoiceSchema", + "VoiceSegment", + "VoiceSettings", + "VoiceSharingModerationCheckResponseModel", + "VoiceSharingResponse", + "VoiceSharingResponseCategory", + "VoiceSharingState", + "VoiceStatisticsResponseModel", + "VoiceVerificationResponse", + "VoicemailDetectionToolConfig", + "VoicesGetSharedRequestCategory", + "VoicesGetSharedRequestSort", + "VoicesNotPermittedWarning", + "WebhookAuthMethodType", + "WebhookEventType", + "WebhookHmacSettings", + "WebhookTarget", + "WebhookTargetAll", + "WebhookTargetIds", + "WebhookTarget_All", + "WebhookTarget_Ids", + "WebhookToolApiSchemaConfigInput", + "WebhookToolApiSchemaConfigInputAuthConnection", + "WebhookToolApiSchemaConfigInputContentType", + "WebhookToolApiSchemaConfigInputMethod", + "WebhookToolApiSchemaConfigInputRequestHeadersValue", + "WebhookToolApiSchemaConfigOutput", + "WebhookToolApiSchemaConfigOutputAuthConnection", + "WebhookToolApiSchemaConfigOutputContentType", + "WebhookToolApiSchemaConfigOutputMethod", + "WebhookToolApiSchemaConfigOutputRequestHeadersValue", + "WebhookToolConfigInput", + "WebhookToolConfigOutput", + "WebhookTranscriptFormat", + "WebhookUsageType", + "WebsocketTtsClientMessageMulti", + "WebsocketTtsServerMessageMulti", + "WhatsAppAccountType", + "WhatsAppAuthResponse", + "WhatsAppCallPermissionRequest", + "WhatsAppCallPermissionRequestState", + "WhatsAppConversationInfo", + "WhatsAppConversationInfoDirection", + "WhatsAppOutboundCallResponse", + "WhatsAppOutboundMessageResponse", + "WhatsAppRecipient", + "WhatsAppTemplateBodyComponentParams", + "WhatsAppTemplateButtonComponentParams", + "WhatsAppTemplateDocumentParam", + "WhatsAppTemplateDocumentParamDetails", + "WhatsAppTemplateHeaderComponentParams", + "WhatsAppTemplateHeaderComponentParamsParametersItem", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Document", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Image", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Location", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Text", + "WhatsAppTemplateImageParam", + "WhatsAppTemplateImageParamDetails", + "WhatsAppTemplateLocationParam", + "WhatsAppTemplateLocationParamDetails", + "WhatsAppTemplateTextParam", + "WidgetConfig", + "WidgetConfigAvatar", + "WidgetConfigAvatar_Image", + "WidgetConfigAvatar_Orb", + "WidgetConfigAvatar_Url", + "WidgetConfigResponse", + "WidgetConfigResponseAvatar", + "WidgetConfigResponseAvatar_Image", + "WidgetConfigResponseAvatar_Orb", + "WidgetConfigResponseAvatar_Url", + "WidgetConfigResponseSyntaxHighlightTheme", + "WidgetConfigSyntaxHighlightTheme", + "WidgetEndFeedbackConfig", + "WidgetEndFeedbackType", + "WidgetExpandable", + "WidgetFeedbackMode", + "WidgetLanguagePreset", + "WidgetLanguagePresetResponse", + "WidgetPlacement", + "WidgetStyles", + "WidgetTermsTranslation", + "WidgetTextContents", + "WidgetTextContentsTranslation", + "WordTimestamp", + "WorkflowEdgeModelInput", + "WorkflowEdgeModelInputBackwardCondition", + "WorkflowEdgeModelInputBackwardCondition_Expression", + "WorkflowEdgeModelInputBackwardCondition_Llm", + "WorkflowEdgeModelInputBackwardCondition_Result", + "WorkflowEdgeModelInputBackwardCondition_Unconditional", + "WorkflowEdgeModelInputForwardCondition", + "WorkflowEdgeModelInputForwardCondition_Expression", + "WorkflowEdgeModelInputForwardCondition_Llm", + "WorkflowEdgeModelInputForwardCondition_Result", + "WorkflowEdgeModelInputForwardCondition_Unconditional", + "WorkflowEdgeModelOutput", + "WorkflowEdgeModelOutputBackwardCondition", + "WorkflowEdgeModelOutputBackwardCondition_Expression", + "WorkflowEdgeModelOutputBackwardCondition_Llm", + "WorkflowEdgeModelOutputBackwardCondition_Result", + "WorkflowEdgeModelOutputBackwardCondition_Unconditional", + "WorkflowEdgeModelOutputForwardCondition", + "WorkflowEdgeModelOutputForwardCondition_Expression", + "WorkflowEdgeModelOutputForwardCondition_Llm", + "WorkflowEdgeModelOutputForwardCondition_Result", + "WorkflowEdgeModelOutputForwardCondition_Unconditional", + "WorkflowEndNodeModelInput", + "WorkflowEndNodeModelOutput", + "WorkflowEndNodeOutcome", + "WorkflowExpressionConditionModelInput", + "WorkflowExpressionConditionModelOutput", + "WorkflowFeaturesUsageCommonModel", + "WorkflowLlmConditionModelInput", + "WorkflowLlmConditionModelOutput", + "WorkflowOverrideAgentNodeModelInput", + "WorkflowOverrideAgentNodeModelOutput", + "WorkflowPhoneNumberNodeModelInput", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Dynamic", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Static", + "WorkflowPhoneNumberNodeModelInputPostDialDigits", + "WorkflowPhoneNumberNodeModelInputPostDialDigits_Dynamic", + "WorkflowPhoneNumberNodeModelInputPostDialDigits_Static", + "WorkflowPhoneNumberNodeModelInputTransferDestination", + "WorkflowPhoneNumberNodeModelInputTransferDestination_Phone", + "WorkflowPhoneNumberNodeModelInputTransferDestination_PhoneDynamicVariable", + "WorkflowPhoneNumberNodeModelInputTransferDestination_SipUri", + "WorkflowPhoneNumberNodeModelInputTransferDestination_SipUriDynamicVariable", + "WorkflowPhoneNumberNodeModelOutput", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Dynamic", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Static", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits_Dynamic", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits_Static", + "WorkflowPhoneNumberNodeModelOutputTransferDestination", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_Phone", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_PhoneDynamicVariable", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUri", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUriDynamicVariable", + "WorkflowResultConditionModelInput", + "WorkflowResultConditionModelOutput", + "WorkflowSayNodeModelInput", + "WorkflowSayNodeModelInputMessage", + "WorkflowSayNodeModelInputMessage_Literal", + "WorkflowSayNodeModelInputMessage_Prompt", + "WorkflowSayNodeModelOutput", + "WorkflowSayNodeModelOutputMessage", + "WorkflowSayNodeModelOutputMessage_Literal", + "WorkflowSayNodeModelOutputMessage_Prompt", + "WorkflowStandaloneAgentNodeModelInput", + "WorkflowStandaloneAgentNodeModelOutput", + "WorkflowStartNodeModelInput", + "WorkflowStartNodeModelOutput", + "WorkflowStateUpdateInput", + "WorkflowStateUpdateOutput", + "WorkflowToolEdgeStepModel", + "WorkflowToolLocator", + "WorkflowToolLocatorSchemaOverridesValue", + "WorkflowToolLocatorSchemaOverridesValue_Constant", + "WorkflowToolLocatorSchemaOverridesValue_DynamicVariable", + "WorkflowToolLocatorSchemaOverridesValue_Llm", + "WorkflowToolLocatorSchemaOverridesValue_Omit", + "WorkflowToolMaxIterationsExceededStepModel", + "WorkflowToolNestedToolsStepModelInput", + "WorkflowToolNestedToolsStepModelInputResultsItem", + "WorkflowToolNestedToolsStepModelOutput", + "WorkflowToolNestedToolsStepModelOutputResultsItem", + "WorkflowToolNodeModelInput", + "WorkflowToolNodeModelOutput", + "WorkflowToolResponseModelInput", + "WorkflowToolResponseModelInputStepsItem", + "WorkflowToolResponseModelInputStepsItem_Edge", + "WorkflowToolResponseModelInputStepsItem_MaxIterationsExceeded", + "WorkflowToolResponseModelInputStepsItem_NestedTools", + "WorkflowToolResponseModelOutput", + "WorkflowToolResponseModelOutputStepsItem", + "WorkflowToolResponseModelOutputStepsItem_Edge", + "WorkflowToolResponseModelOutputStepsItem_MaxIterationsExceeded", + "WorkflowToolResponseModelOutputStepsItem_NestedTools", + "WorkflowUnconditionalModelInput", + "WorkflowUnconditionalModelOutput", + "WorkflowUpdateStateNodeModelInput", + "WorkflowUpdateStateNodeModelOutput", + "WorkspaceAnalyticsQueryResponseModel", + "WorkspaceAnalyticsQueryResponseModelColumnTypesItem", + "WorkspaceAnalyticsQueryResponseModelRowsItemItem", + "WorkspaceApiKeyListResponseModel", + "WorkspaceApiKeyResponseModel", + "WorkspaceAuditLogEntryResponse", + "WorkspaceAuditLogEntryResponseActivityId", + "WorkspaceAuditLogsPageResponse", + "WorkspaceBatchCallsResponse", + "WorkspaceCreateApiKeyResponseModel", + "WorkspaceCreateServiceAccountResponseModel", + "WorkspaceCreateWebhookResponseModel", + "WorkspaceGroupByNameResponseModel", + "WorkspaceGroupPermission", + "WorkspaceGroupResponseModel", + "WorkspaceGroupResponseModelGroupConcurrencyLimit", + "WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit", + "WorkspaceGroupResponseModelGroupMusicConcurrencyLimit", + "WorkspaceGroupResponseModelGroupPvcLimit", + "WorkspaceGroupResponseModelGroupUsageLimit", + "WorkspaceMemberResponseModel", + "WorkspaceResourceType", + "WorkspaceServiceAccountListResponseModel", + "WorkspaceServiceAccountResponseModel", + "WorkspaceWebhookEventType", + "WorkspaceWebhookListResponseModel", + "WorkspaceWebhookResponseModel", + "WorkspaceWebhookUsageResponseModel", + "__version__", + "assets", + "audio_effects", + "audio_isolation", + "audio_native", + "conversational_ai", + "dubbing", + "environment_variables", + "environments", + "flows", + "forced_alignment", + "history", + "models", + "music", + "play", + "productions", + "pronunciation_dictionaries", + "samples", + "save", + "service_accounts", + "speech_engine", + "speech_engine_upstream", + "speech_to_speech", + "speech_to_text", + "stream", + "studio", + "text_to_dialogue", + "text_to_sound_effects", + "text_to_speech", + "text_to_voice", + "tokens", + "usage", + "user", + "v_1_dubbing_realtime", + "v_1_speech_to_text_realtime", + "v_1_text_to_dialogue_multi_stream_input", + "v_1_text_to_dialogue_stream_input", + "v_1_text_to_speech_voice_id_multi_stream_input", + "v_1_text_to_speech_voice_id_stream_input", + "v_1_translation_realtime", + "voices", + "webhooks", + "workspace", + "workspaces", +] diff --git a/data/src/elevenlabs/assets/__init__.py b/data/src/elevenlabs/assets/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/assets/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/assets/client.py b/data/src/elevenlabs/assets/client.py new file mode 100644 index 0000000000000000000000000000000000000000..239700a8aa41dd05cb05091a1f25239fe25a3c47 --- /dev/null +++ b/data/src/elevenlabs/assets/client.py @@ -0,0 +1,367 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.asset_list_response import AssetListResponse +from ..types.asset_response import AssetResponse +from .raw_client import AsyncRawAssetsClient, RawAssetsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AssetsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAssetsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAssetsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAssetsClient + """ + return self._raw_client + + def list( + self, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AssetListResponse: + """ + List assets in the workspace, most recently created first. + + Parameters + ---------- + page_size : typing.Optional[int] + Number of assets to return. + + cursor : typing.Optional[str] + Token from a previous response's `next_cursor`. Omit to fetch the first page. + + search : typing.Optional[str] + Optional free-text search filter over asset names. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AssetListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.assets.list( + page_size=1, + cursor="cursor", + search="search", + ) + """ + _response = self._raw_client.list( + page_size=page_size, cursor=cursor, search=search, request_options=request_options + ) + return _response.data + + def create( + self, *, asset: core.File, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AssetResponse: + """ + Upload a new asset. + + Parameters + ---------- + asset : core.File + See core.File for more documentation + + name : str + Display name for the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AssetResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.assets.create( + name="name", + ) + """ + _response = self._raw_client.create(asset=asset, name=name, request_options=request_options) + return _response.data + + def get(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AssetResponse: + """ + Retrieve a single asset by ID. + + Parameters + ---------- + asset_id : str + ID of the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AssetResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.assets.get( + asset_id="5xM2KqOnZyce22SPZ9d4", + ) + """ + _response = self._raw_client.get(asset_id, request_options=request_options) + return _response.data + + def delete(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete an asset by ID. + + Parameters + ---------- + asset_id : str + ID of the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.assets.delete( + asset_id="5xM2KqOnZyce22SPZ9d4", + ) + """ + _response = self._raw_client.delete(asset_id, request_options=request_options) + return _response.data + + +class AsyncAssetsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAssetsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAssetsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAssetsClient + """ + return self._raw_client + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AssetListResponse: + """ + List assets in the workspace, most recently created first. + + Parameters + ---------- + page_size : typing.Optional[int] + Number of assets to return. + + cursor : typing.Optional[str] + Token from a previous response's `next_cursor`. Omit to fetch the first page. + + search : typing.Optional[str] + Optional free-text search filter over asset names. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AssetListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.assets.list( + page_size=1, + cursor="cursor", + search="search", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + page_size=page_size, cursor=cursor, search=search, request_options=request_options + ) + return _response.data + + async def create( + self, *, asset: core.File, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AssetResponse: + """ + Upload a new asset. + + Parameters + ---------- + asset : core.File + See core.File for more documentation + + name : str + Display name for the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AssetResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.assets.create( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(asset=asset, name=name, request_options=request_options) + return _response.data + + async def get(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AssetResponse: + """ + Retrieve a single asset by ID. + + Parameters + ---------- + asset_id : str + ID of the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AssetResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.assets.get( + asset_id="5xM2KqOnZyce22SPZ9d4", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(asset_id, request_options=request_options) + return _response.data + + async def delete(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete an asset by ID. + + Parameters + ---------- + asset_id : str + ID of the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.assets.delete( + asset_id="5xM2KqOnZyce22SPZ9d4", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(asset_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/assets/raw_client.py b/data/src/elevenlabs/assets/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..2db2e0846cd1c002622cfd9a5a76115f89cd6e5b --- /dev/null +++ b/data/src/elevenlabs/assets/raw_client.py @@ -0,0 +1,498 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.asset_list_response import AssetListResponse +from ..types.asset_response import AssetResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAssetsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AssetListResponse]: + """ + List assets in the workspace, most recently created first. + + Parameters + ---------- + page_size : typing.Optional[int] + Number of assets to return. + + cursor : typing.Optional[str] + Token from a previous response's `next_cursor`. Omit to fetch the first page. + + search : typing.Optional[str] + Optional free-text search filter over asset names. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AssetListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/assets", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AssetListResponse, + construct_type( + type_=AssetListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, asset: core.File, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AssetResponse]: + """ + Upload a new asset. + + Parameters + ---------- + asset : core.File + See core.File for more documentation + + name : str + Display name for the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AssetResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/assets", + method="POST", + data={ + "name": name, + }, + files={ + "asset": asset, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AssetResponse, + construct_type( + type_=AssetResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AssetResponse]: + """ + Retrieve a single asset by ID. + + Parameters + ---------- + asset_id : str + ID of the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AssetResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/assets/{jsonable_encoder(asset_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AssetResponse, + construct_type( + type_=AssetResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete(self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Delete an asset by ID. + + Parameters + ---------- + asset_id : str + ID of the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/assets/{jsonable_encoder(asset_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAssetsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AssetListResponse]: + """ + List assets in the workspace, most recently created first. + + Parameters + ---------- + page_size : typing.Optional[int] + Number of assets to return. + + cursor : typing.Optional[str] + Token from a previous response's `next_cursor`. Omit to fetch the first page. + + search : typing.Optional[str] + Optional free-text search filter over asset names. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AssetListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/assets", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AssetListResponse, + construct_type( + type_=AssetListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, asset: core.File, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AssetResponse]: + """ + Upload a new asset. + + Parameters + ---------- + asset : core.File + See core.File for more documentation + + name : str + Display name for the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AssetResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/assets", + method="POST", + data={ + "name": name, + }, + files={ + "asset": asset, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AssetResponse, + construct_type( + type_=AssetResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AssetResponse]: + """ + Retrieve a single asset by ID. + + Parameters + ---------- + asset_id : str + ID of the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AssetResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/assets/{jsonable_encoder(asset_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AssetResponse, + construct_type( + type_=AssetResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, asset_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete an asset by ID. + + Parameters + ---------- + asset_id : str + ID of the asset. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/assets/{jsonable_encoder(asset_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/audio_effects/__init__.py b/data/src/elevenlabs/audio_effects/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/audio_effects/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/audio_effects/client.py b/data/src/elevenlabs/audio_effects/client.py new file mode 100644 index 0000000000000000000000000000000000000000..69154579fefb5c3c3ac07eb9e180be5940f4fa72 --- /dev/null +++ b/data/src/elevenlabs/audio_effects/client.py @@ -0,0 +1,104 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.audio_effects_catalog_response_model import AudioEffectsCatalogResponseModel +from .raw_client import AsyncRawAudioEffectsClient, RawAudioEffectsClient + + +class AudioEffectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAudioEffectsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAudioEffectsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAudioEffectsClient + """ + return self._raw_client + + def get_catalog( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AudioEffectsCatalogResponseModel: + """ + Lists the filter presets, reverb environments, and background noises that `audio_effects` can reference in Text to Speech, Text to Dialogue, and agent configurations. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioEffectsCatalogResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_effects.get_catalog() + """ + _response = self._raw_client.get_catalog(request_options=request_options) + return _response.data + + +class AsyncAudioEffectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAudioEffectsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAudioEffectsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAudioEffectsClient + """ + return self._raw_client + + async def get_catalog( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AudioEffectsCatalogResponseModel: + """ + Lists the filter presets, reverb environments, and background noises that `audio_effects` can reference in Text to Speech, Text to Dialogue, and agent configurations. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioEffectsCatalogResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.audio_effects.get_catalog() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_catalog(request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/audio_effects/raw_client.py b/data/src/elevenlabs/audio_effects/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b1188f36794cbb302dbaedc51e0e48711e563e18 --- /dev/null +++ b/data/src/elevenlabs/audio_effects/raw_client.py @@ -0,0 +1,126 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.audio_effects_catalog_response_model import AudioEffectsCatalogResponseModel +from pydantic import ValidationError + + +class RawAudioEffectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_catalog( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AudioEffectsCatalogResponseModel]: + """ + Lists the filter presets, reverb environments, and background noises that `audio_effects` can reference in Text to Speech, Text to Dialogue, and agent configurations. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioEffectsCatalogResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/audio-effects/catalog", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioEffectsCatalogResponseModel, + construct_type( + type_=AudioEffectsCatalogResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAudioEffectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_catalog( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AudioEffectsCatalogResponseModel]: + """ + Lists the filter presets, reverb environments, and background noises that `audio_effects` can reference in Text to Speech, Text to Dialogue, and agent configurations. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioEffectsCatalogResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/audio-effects/catalog", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioEffectsCatalogResponseModel, + construct_type( + type_=AudioEffectsCatalogResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/audio_isolation/__init__.py b/data/src/elevenlabs/audio_isolation/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c8bdefbb467dfb1282b2d25ba255d3947f9f5bd0 --- /dev/null +++ b/data/src/elevenlabs/audio_isolation/__init__.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import AudioIsolationRequestFileFormat, AudioIsolationStreamRequestFileFormat +_dynamic_imports: typing.Dict[str, str] = { + "AudioIsolationRequestFileFormat": ".types", + "AudioIsolationStreamRequestFileFormat": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["AudioIsolationRequestFileFormat", "AudioIsolationStreamRequestFileFormat"] diff --git a/data/src/elevenlabs/audio_isolation/client.py b/data/src/elevenlabs/audio_isolation/client.py new file mode 100644 index 0000000000000000000000000000000000000000..eaef7407e7d5c4e6c86e8a80ee32a26e9aad01c2 --- /dev/null +++ b/data/src/elevenlabs/audio_isolation/client.py @@ -0,0 +1,348 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.get_audio_isolation_history_response_model import GetAudioIsolationHistoryResponseModel +from .raw_client import AsyncRawAudioIsolationClient, RawAudioIsolationClient +from .types.audio_isolation_request_file_format import AudioIsolationRequestFileFormat +from .types.audio_isolation_stream_request_file_format import AudioIsolationStreamRequestFileFormat + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AudioIsolationClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAudioIsolationClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAudioIsolationClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAudioIsolationClient + """ + return self._raw_client + + def convert( + self, + *, + audio: core.File, + file_format: typing.Optional[AudioIsolationRequestFileFormat] = OMIT, + preview_b_64: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Removes background noise from audio. + + Parameters + ---------- + audio : core.File + See core.File for more documentation + + file_format : typing.Optional[AudioIsolationRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + preview_b_64 : typing.Optional[str] + Optional preview image base64 for tracking this generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Successful Response + """ + with self._raw_client.convert( + audio=audio, file_format=file_format, preview_b_64=preview_b_64, request_options=request_options + ) as r: + yield from r.data + + def list( + self, + *, + page_size: typing.Optional[int] = None, + page: typing.Optional[int] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAudioIsolationHistoryResponseModel: + """ + Returns a list of all your audio isolation generations. + + Parameters + ---------- + page_size : typing.Optional[int] + How many history items to return at maximum. Defaults to 100. + + page : typing.Optional[int] + Page number for search pagination (1-based). Only used when search is provided. + + search : typing.Optional[str] + Optional search term used for filtering audio isolation history (title/text). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAudioIsolationHistoryResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_isolation.list( + page_size=1, + page=1, + search="search", + ) + """ + _response = self._raw_client.list( + page_size=page_size, page=page, search=search, request_options=request_options + ) + return _response.data + + def delete(self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Deletes a specific audio isolation history item and the associated media files. + + Parameters + ---------- + history_item_id : str + Identifier of the audio isolation history item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_isolation.delete( + history_item_id="history_item_id", + ) + """ + _response = self._raw_client.delete(history_item_id, request_options=request_options) + return _response.data + + def stream( + self, + *, + audio: core.File, + file_format: typing.Optional[AudioIsolationStreamRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Removes background noise from audio. + + Parameters + ---------- + audio : core.File + See core.File for more documentation + + file_format : typing.Optional[AudioIsolationStreamRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Successful Response + """ + with self._raw_client.stream(audio=audio, file_format=file_format, request_options=request_options) as r: + yield from r.data + + +class AsyncAudioIsolationClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAudioIsolationClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAudioIsolationClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAudioIsolationClient + """ + return self._raw_client + + async def convert( + self, + *, + audio: core.File, + file_format: typing.Optional[AudioIsolationRequestFileFormat] = OMIT, + preview_b_64: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Removes background noise from audio. + + Parameters + ---------- + audio : core.File + See core.File for more documentation + + file_format : typing.Optional[AudioIsolationRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + preview_b_64 : typing.Optional[str] + Optional preview image base64 for tracking this generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Successful Response + """ + async with self._raw_client.convert( + audio=audio, file_format=file_format, preview_b_64=preview_b_64, request_options=request_options + ) as r: + async for _chunk in r.data: + yield _chunk + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + page: typing.Optional[int] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAudioIsolationHistoryResponseModel: + """ + Returns a list of all your audio isolation generations. + + Parameters + ---------- + page_size : typing.Optional[int] + How many history items to return at maximum. Defaults to 100. + + page : typing.Optional[int] + Page number for search pagination (1-based). Only used when search is provided. + + search : typing.Optional[str] + Optional search term used for filtering audio isolation history (title/text). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAudioIsolationHistoryResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.audio_isolation.list( + page_size=1, + page=1, + search="search", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + page_size=page_size, page=page, search=search, request_options=request_options + ) + return _response.data + + async def delete(self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Deletes a specific audio isolation history item and the associated media files. + + Parameters + ---------- + history_item_id : str + Identifier of the audio isolation history item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.audio_isolation.delete( + history_item_id="history_item_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(history_item_id, request_options=request_options) + return _response.data + + async def stream( + self, + *, + audio: core.File, + file_format: typing.Optional[AudioIsolationStreamRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Removes background noise from audio. + + Parameters + ---------- + audio : core.File + See core.File for more documentation + + file_format : typing.Optional[AudioIsolationStreamRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Successful Response + """ + async with self._raw_client.stream(audio=audio, file_format=file_format, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/audio_isolation/raw_client.py b/data/src/elevenlabs/audio_isolation/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..69e18893b78833188722388711bcf6de46dc4c6b --- /dev/null +++ b/data/src/elevenlabs/audio_isolation/raw_client.py @@ -0,0 +1,580 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.get_audio_isolation_history_response_model import GetAudioIsolationHistoryResponseModel +from .types.audio_isolation_request_file_format import AudioIsolationRequestFileFormat +from .types.audio_isolation_stream_request_file_format import AudioIsolationStreamRequestFileFormat +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAudioIsolationClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def convert( + self, + *, + audio: core.File, + file_format: typing.Optional[AudioIsolationRequestFileFormat] = OMIT, + preview_b_64: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Removes background noise from audio. + + Parameters + ---------- + audio : core.File + See core.File for more documentation + + file_format : typing.Optional[AudioIsolationRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + preview_b_64 : typing.Optional[str] + Optional preview image base64 for tracking this generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Successful Response + """ + with self._client_wrapper.httpx_client.stream( + "v1/audio-isolation", + method="POST", + data={ + "file_format": file_format, + "preview_b64": preview_b_64, + }, + files={ + "audio": audio, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + def list( + self, + *, + page_size: typing.Optional[int] = None, + page: typing.Optional[int] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetAudioIsolationHistoryResponseModel]: + """ + Returns a list of all your audio isolation generations. + + Parameters + ---------- + page_size : typing.Optional[int] + How many history items to return at maximum. Defaults to 100. + + page : typing.Optional[int] + Page number for search pagination (1-based). Only used when search is provided. + + search : typing.Optional[str] + Optional search term used for filtering audio isolation history (title/text). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAudioIsolationHistoryResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/audio-isolation/history", + method="GET", + params={ + "page_size": page_size, + "page": page, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAudioIsolationHistoryResponseModel, + construct_type( + type_=GetAudioIsolationHistoryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Deletes a specific audio isolation history item and the associated media files. + + Parameters + ---------- + history_item_id : str + Identifier of the audio isolation history item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/audio-isolation/history/{jsonable_encoder(history_item_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def stream( + self, + *, + audio: core.File, + file_format: typing.Optional[AudioIsolationStreamRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Removes background noise from audio. + + Parameters + ---------- + audio : core.File + See core.File for more documentation + + file_format : typing.Optional[AudioIsolationStreamRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Successful Response + """ + with self._client_wrapper.httpx_client.stream( + "v1/audio-isolation/stream", + method="POST", + data={ + "file_format": file_format, + }, + files={ + "audio": audio, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawAudioIsolationClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def convert( + self, + *, + audio: core.File, + file_format: typing.Optional[AudioIsolationRequestFileFormat] = OMIT, + preview_b_64: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Removes background noise from audio. + + Parameters + ---------- + audio : core.File + See core.File for more documentation + + file_format : typing.Optional[AudioIsolationRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + preview_b_64 : typing.Optional[str] + Optional preview image base64 for tracking this generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Successful Response + """ + async with self._client_wrapper.httpx_client.stream( + "v1/audio-isolation", + method="POST", + data={ + "file_format": file_format, + "preview_b64": preview_b_64, + }, + files={ + "audio": audio, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + page: typing.Optional[int] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetAudioIsolationHistoryResponseModel]: + """ + Returns a list of all your audio isolation generations. + + Parameters + ---------- + page_size : typing.Optional[int] + How many history items to return at maximum. Defaults to 100. + + page : typing.Optional[int] + Page number for search pagination (1-based). Only used when search is provided. + + search : typing.Optional[str] + Optional search term used for filtering audio isolation history (title/text). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAudioIsolationHistoryResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/audio-isolation/history", + method="GET", + params={ + "page_size": page_size, + "page": page, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAudioIsolationHistoryResponseModel, + construct_type( + type_=GetAudioIsolationHistoryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Deletes a specific audio isolation history item and the associated media files. + + Parameters + ---------- + history_item_id : str + Identifier of the audio isolation history item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/audio-isolation/history/{jsonable_encoder(history_item_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def stream( + self, + *, + audio: core.File, + file_format: typing.Optional[AudioIsolationStreamRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Removes background noise from audio. + + Parameters + ---------- + audio : core.File + See core.File for more documentation + + file_format : typing.Optional[AudioIsolationStreamRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Successful Response + """ + async with self._client_wrapper.httpx_client.stream( + "v1/audio-isolation/stream", + method="POST", + data={ + "file_format": file_format, + }, + files={ + "audio": audio, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/audio_isolation/types/__init__.py b/data/src/elevenlabs/audio_isolation/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..be46218f2942f2ade5f57090bef11f64c7e8d2bb --- /dev/null +++ b/data/src/elevenlabs/audio_isolation/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .audio_isolation_request_file_format import AudioIsolationRequestFileFormat + from .audio_isolation_stream_request_file_format import AudioIsolationStreamRequestFileFormat +_dynamic_imports: typing.Dict[str, str] = { + "AudioIsolationRequestFileFormat": ".audio_isolation_request_file_format", + "AudioIsolationStreamRequestFileFormat": ".audio_isolation_stream_request_file_format", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["AudioIsolationRequestFileFormat", "AudioIsolationStreamRequestFileFormat"] diff --git a/data/src/elevenlabs/audio_isolation/types/audio_isolation_request_file_format.py b/data/src/elevenlabs/audio_isolation/types/audio_isolation_request_file_format.py new file mode 100644 index 0000000000000000000000000000000000000000..dfdea8981110cdc4de3ca8394b8ebea7c445b2b3 --- /dev/null +++ b/data/src/elevenlabs/audio_isolation/types/audio_isolation_request_file_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AudioIsolationRequestFileFormat = typing.Union[typing.Literal["pcm_s16le_16", "other"], typing.Any] diff --git a/data/src/elevenlabs/audio_isolation/types/audio_isolation_stream_request_file_format.py b/data/src/elevenlabs/audio_isolation/types/audio_isolation_stream_request_file_format.py new file mode 100644 index 0000000000000000000000000000000000000000..739aef423f1334fd592086245922d79c5cb2da56 --- /dev/null +++ b/data/src/elevenlabs/audio_isolation/types/audio_isolation_stream_request_file_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AudioIsolationStreamRequestFileFormat = typing.Union[typing.Literal["pcm_s16le_16", "other"], typing.Any] diff --git a/data/src/elevenlabs/audio_native/__init__.py b/data/src/elevenlabs/audio_native/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..daf6ffad5639374327a687fc8804af2db5366ff1 --- /dev/null +++ b/data/src/elevenlabs/audio_native/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import AudioNativeCreateRequestApplyTextNormalization +_dynamic_imports: typing.Dict[str, str] = {"AudioNativeCreateRequestApplyTextNormalization": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["AudioNativeCreateRequestApplyTextNormalization"] diff --git a/data/src/elevenlabs/audio_native/client.py b/data/src/elevenlabs/audio_native/client.py new file mode 100644 index 0000000000000000000000000000000000000000..92b3785ef388b5f90d8f308b03a79d11f8121381 --- /dev/null +++ b/data/src/elevenlabs/audio_native/client.py @@ -0,0 +1,555 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.audio_native_create_project_response_model import AudioNativeCreateProjectResponseModel +from ..types.audio_native_edit_content_response_model import AudioNativeEditContentResponseModel +from ..types.get_audio_native_project_settings_response_model import GetAudioNativeProjectSettingsResponseModel +from .raw_client import AsyncRawAudioNativeClient, RawAudioNativeClient +from .types.audio_native_create_request_apply_text_normalization import AudioNativeCreateRequestApplyTextNormalization + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AudioNativeClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAudioNativeClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAudioNativeClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAudioNativeClient + """ + return self._raw_client + + def create( + self, + *, + name: str, + image: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + small: typing.Optional[bool] = OMIT, + text_color: typing.Optional[str] = OMIT, + background_color: typing.Optional[str] = OMIT, + sessionization: typing.Optional[int] = OMIT, + voice_id: typing.Optional[str] = OMIT, + model_id: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[AudioNativeCreateRequestApplyTextNormalization] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioNativeCreateProjectResponseModel: + """ + Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet. + + Parameters + ---------- + name : str + Project name. + + image : typing.Optional[str] + (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + small : typing.Optional[bool] + (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used. + + text_color : typing.Optional[str] + Text color used in the player. If not provided, default text color set in the Player settings is used. + + background_color : typing.Optional[str] + Background color used in the player. If not provided, default background color set in the Player settings is used. + + sessionization : typing.Optional[int] + (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + + voice_id : typing.Optional[str] + Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + + model_id : typing.Optional[str] + TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + apply_text_normalization : typing.Optional[AudioNativeCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioNativeCreateProjectResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_native.create( + name="name", + ) + """ + _response = self._raw_client.create( + name=name, + image=image, + author=author, + title=title, + small=small, + text_color=text_color, + background_color=background_color, + sessionization=sessionization, + voice_id=voice_id, + model_id=model_id, + file=file, + auto_convert=auto_convert, + apply_text_normalization=apply_text_normalization, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + request_options=request_options, + ) + return _response.data + + def get_settings( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAudioNativeProjectSettingsResponseModel: + """ + Get player settings for the specific project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAudioNativeProjectSettingsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_native.get_settings( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get_settings(project_id, request_options=request_options) + return _response.data + + def update( + self, + project_id: str, + *, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_publish: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioNativeEditContentResponseModel: + """ + Updates content for the specific AudioNative Project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + auto_publish : typing.Optional[bool] + Whether to auto publish the new project snapshot after it's converted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioNativeEditContentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_native.update( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.update( + project_id, file=file, auto_convert=auto_convert, auto_publish=auto_publish, request_options=request_options + ) + return _response.data + + def update_content_from_url( + self, + *, + url: str, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioNativeEditContentResponseModel: + """ + Finds an AudioNative project matching the provided URL, extracts content from the URL, updates the project content, and queues it for conversion and auto-publishing. + + Parameters + ---------- + url : str + URL of the page to extract content from. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioNativeEditContentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.audio_native.update_content_from_url( + url="https://elevenlabs.io/blog/the_first_ai_that_can_laugh/", + ) + """ + _response = self._raw_client.update_content_from_url( + url=url, author=author, title=title, request_options=request_options + ) + return _response.data + + +class AsyncAudioNativeClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAudioNativeClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAudioNativeClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAudioNativeClient + """ + return self._raw_client + + async def create( + self, + *, + name: str, + image: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + small: typing.Optional[bool] = OMIT, + text_color: typing.Optional[str] = OMIT, + background_color: typing.Optional[str] = OMIT, + sessionization: typing.Optional[int] = OMIT, + voice_id: typing.Optional[str] = OMIT, + model_id: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[AudioNativeCreateRequestApplyTextNormalization] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioNativeCreateProjectResponseModel: + """ + Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet. + + Parameters + ---------- + name : str + Project name. + + image : typing.Optional[str] + (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + small : typing.Optional[bool] + (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used. + + text_color : typing.Optional[str] + Text color used in the player. If not provided, default text color set in the Player settings is used. + + background_color : typing.Optional[str] + Background color used in the player. If not provided, default background color set in the Player settings is used. + + sessionization : typing.Optional[int] + (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + + voice_id : typing.Optional[str] + Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + + model_id : typing.Optional[str] + TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + apply_text_normalization : typing.Optional[AudioNativeCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioNativeCreateProjectResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.audio_native.create( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + name=name, + image=image, + author=author, + title=title, + small=small, + text_color=text_color, + background_color=background_color, + sessionization=sessionization, + voice_id=voice_id, + model_id=model_id, + file=file, + auto_convert=auto_convert, + apply_text_normalization=apply_text_normalization, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + request_options=request_options, + ) + return _response.data + + async def get_settings( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAudioNativeProjectSettingsResponseModel: + """ + Get player settings for the specific project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAudioNativeProjectSettingsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.audio_native.get_settings( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_settings(project_id, request_options=request_options) + return _response.data + + async def update( + self, + project_id: str, + *, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_publish: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioNativeEditContentResponseModel: + """ + Updates content for the specific AudioNative Project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + auto_publish : typing.Optional[bool] + Whether to auto publish the new project snapshot after it's converted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioNativeEditContentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.audio_native.update( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + project_id, file=file, auto_convert=auto_convert, auto_publish=auto_publish, request_options=request_options + ) + return _response.data + + async def update_content_from_url( + self, + *, + url: str, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioNativeEditContentResponseModel: + """ + Finds an AudioNative project matching the provided URL, extracts content from the URL, updates the project content, and queues it for conversion and auto-publishing. + + Parameters + ---------- + url : str + URL of the page to extract content from. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioNativeEditContentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.audio_native.update_content_from_url( + url="https://elevenlabs.io/blog/the_first_ai_that_can_laugh/", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_content_from_url( + url=url, author=author, title=title, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/audio_native/raw_client.py b/data/src/elevenlabs/audio_native/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8b6c0fe3584a6df25fda09d01ddcaa89a9aa4ee0 --- /dev/null +++ b/data/src/elevenlabs/audio_native/raw_client.py @@ -0,0 +1,712 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.audio_native_create_project_response_model import AudioNativeCreateProjectResponseModel +from ..types.audio_native_edit_content_response_model import AudioNativeEditContentResponseModel +from ..types.get_audio_native_project_settings_response_model import GetAudioNativeProjectSettingsResponseModel +from .types.audio_native_create_request_apply_text_normalization import AudioNativeCreateRequestApplyTextNormalization +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAudioNativeClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + name: str, + image: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + small: typing.Optional[bool] = OMIT, + text_color: typing.Optional[str] = OMIT, + background_color: typing.Optional[str] = OMIT, + sessionization: typing.Optional[int] = OMIT, + voice_id: typing.Optional[str] = OMIT, + model_id: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[AudioNativeCreateRequestApplyTextNormalization] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AudioNativeCreateProjectResponseModel]: + """ + Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet. + + Parameters + ---------- + name : str + Project name. + + image : typing.Optional[str] + (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + small : typing.Optional[bool] + (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used. + + text_color : typing.Optional[str] + Text color used in the player. If not provided, default text color set in the Player settings is used. + + background_color : typing.Optional[str] + Background color used in the player. If not provided, default background color set in the Player settings is used. + + sessionization : typing.Optional[int] + (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + + voice_id : typing.Optional[str] + Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + + model_id : typing.Optional[str] + TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + apply_text_normalization : typing.Optional[AudioNativeCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioNativeCreateProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/audio-native", + method="POST", + data={ + "name": name, + "image": image, + "author": author, + "title": title, + "small": small, + "text_color": text_color, + "background_color": background_color, + "sessionization": sessionization, + "voice_id": voice_id, + "model_id": model_id, + "auto_convert": auto_convert, + "apply_text_normalization": apply_text_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeCreateProjectResponseModel, + construct_type( + type_=AudioNativeCreateProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_settings( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetAudioNativeProjectSettingsResponseModel]: + """ + Get player settings for the specific project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAudioNativeProjectSettingsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/audio-native/{jsonable_encoder(project_id)}/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAudioNativeProjectSettingsResponseModel, + construct_type( + type_=GetAudioNativeProjectSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + project_id: str, + *, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_publish: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AudioNativeEditContentResponseModel]: + """ + Updates content for the specific AudioNative Project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + auto_publish : typing.Optional[bool] + Whether to auto publish the new project snapshot after it's converted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioNativeEditContentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/audio-native/{jsonable_encoder(project_id)}/content", + method="POST", + data={ + "auto_convert": auto_convert, + "auto_publish": auto_publish, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeEditContentResponseModel, + construct_type( + type_=AudioNativeEditContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_content_from_url( + self, + *, + url: str, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AudioNativeEditContentResponseModel]: + """ + Finds an AudioNative project matching the provided URL, extracts content from the URL, updates the project content, and queues it for conversion and auto-publishing. + + Parameters + ---------- + url : str + URL of the page to extract content from. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioNativeEditContentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/audio-native/content", + method="POST", + json={ + "url": url, + "author": author, + "title": title, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeEditContentResponseModel, + construct_type( + type_=AudioNativeEditContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAudioNativeClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + name: str, + image: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + small: typing.Optional[bool] = OMIT, + text_color: typing.Optional[str] = OMIT, + background_color: typing.Optional[str] = OMIT, + sessionization: typing.Optional[int] = OMIT, + voice_id: typing.Optional[str] = OMIT, + model_id: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[AudioNativeCreateRequestApplyTextNormalization] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AudioNativeCreateProjectResponseModel]: + """ + Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet. + + Parameters + ---------- + name : str + Project name. + + image : typing.Optional[str] + (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + small : typing.Optional[bool] + (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used. + + text_color : typing.Optional[str] + Text color used in the player. If not provided, default text color set in the Player settings is used. + + background_color : typing.Optional[str] + Background color used in the player. If not provided, default background color set in the Player settings is used. + + sessionization : typing.Optional[int] + (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used. + + voice_id : typing.Optional[str] + Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used. + + model_id : typing.Optional[str] + TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + apply_text_normalization : typing.Optional[AudioNativeCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioNativeCreateProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/audio-native", + method="POST", + data={ + "name": name, + "image": image, + "author": author, + "title": title, + "small": small, + "text_color": text_color, + "background_color": background_color, + "sessionization": sessionization, + "voice_id": voice_id, + "model_id": model_id, + "auto_convert": auto_convert, + "apply_text_normalization": apply_text_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeCreateProjectResponseModel, + construct_type( + type_=AudioNativeCreateProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_settings( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetAudioNativeProjectSettingsResponseModel]: + """ + Get player settings for the specific project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAudioNativeProjectSettingsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/audio-native/{jsonable_encoder(project_id)}/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAudioNativeProjectSettingsResponseModel, + construct_type( + type_=GetAudioNativeProjectSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + project_id: str, + *, + file: typing.Optional[core.File] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_publish: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AudioNativeEditContentResponseModel]: + """ + Updates content for the specific AudioNative Project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + file : typing.Optional[core.File] + See core.File for more documentation + + auto_convert : typing.Optional[bool] + Whether to auto convert the project to audio or not. + + auto_publish : typing.Optional[bool] + Whether to auto publish the new project snapshot after it's converted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioNativeEditContentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/audio-native/{jsonable_encoder(project_id)}/content", + method="POST", + data={ + "auto_convert": auto_convert, + "auto_publish": auto_publish, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeEditContentResponseModel, + construct_type( + type_=AudioNativeEditContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_content_from_url( + self, + *, + url: str, + author: typing.Optional[str] = OMIT, + title: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AudioNativeEditContentResponseModel]: + """ + Finds an AudioNative project matching the provided URL, extracts content from the URL, updates the project content, and queues it for conversion and auto-publishing. + + Parameters + ---------- + url : str + URL of the page to extract content from. + + author : typing.Optional[str] + Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used. + + title : typing.Optional[str] + Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioNativeEditContentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/audio-native/content", + method="POST", + json={ + "url": url, + "author": author, + "title": title, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioNativeEditContentResponseModel, + construct_type( + type_=AudioNativeEditContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/audio_native/types/__init__.py b/data/src/elevenlabs/audio_native/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..dd51e77b8bbbfd7d0691ae8932233b2c6f454e0c --- /dev/null +++ b/data/src/elevenlabs/audio_native/types/__init__.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .audio_native_create_request_apply_text_normalization import AudioNativeCreateRequestApplyTextNormalization +_dynamic_imports: typing.Dict[str, str] = { + "AudioNativeCreateRequestApplyTextNormalization": ".audio_native_create_request_apply_text_normalization" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["AudioNativeCreateRequestApplyTextNormalization"] diff --git a/data/src/elevenlabs/audio_native/types/audio_native_create_request_apply_text_normalization.py b/data/src/elevenlabs/audio_native/types/audio_native_create_request_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..a132540c8d456b7a7cfeba73ca24070cd2164334 --- /dev/null +++ b/data/src/elevenlabs/audio_native/types/audio_native_create_request_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AudioNativeCreateRequestApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off", "apply_english"], typing.Any +] diff --git a/data/src/elevenlabs/base_client.py b/data/src/elevenlabs/base_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8d52c9462fd473ee76a76a19e6b0a0e8bf102077 --- /dev/null +++ b/data/src/elevenlabs/base_client.py @@ -0,0 +1,774 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import os +import typing + +import httpx +from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .core.logging import LogConfig, Logger +from .environment import ElevenLabsEnvironment + +if typing.TYPE_CHECKING: + from .assets.client import AssetsClient, AsyncAssetsClient + from .audio_effects.client import AsyncAudioEffectsClient, AudioEffectsClient + from .audio_isolation.client import AsyncAudioIsolationClient, AudioIsolationClient + from .audio_native.client import AsyncAudioNativeClient, AudioNativeClient + from .conversational_ai.client import AsyncConversationalAiClient, ConversationalAiClient + from .dubbing.client import AsyncDubbingClient, DubbingClient + from .environment_variables.client import AsyncEnvironmentVariablesClient, EnvironmentVariablesClient + from .environments.client import AsyncEnvironmentsClient, EnvironmentsClient + from .flows.client import AsyncFlowsClient, FlowsClient + from .forced_alignment.client import AsyncForcedAlignmentClient, ForcedAlignmentClient + from .history.client import AsyncHistoryClient, HistoryClient + from .models.client import AsyncModelsClient, ModelsClient + from .music.client import AsyncMusicClient, MusicClient + from .productions.client import AsyncProductionsClient, ProductionsClient + from .pronunciation_dictionaries.client import AsyncPronunciationDictionariesClient, PronunciationDictionariesClient + from .samples.client import AsyncSamplesClient, SamplesClient + from .service_accounts.client import AsyncServiceAccountsClient, ServiceAccountsClient + from .speech_engine.client import AsyncSpeechEngineClient, SpeechEngineClient + from .speech_to_speech.client import AsyncSpeechToSpeechClient, SpeechToSpeechClient + from .speech_to_text.client import AsyncSpeechToTextClient, SpeechToTextClient + from .studio.client import AsyncStudioClient, StudioClient + from .text_to_dialogue.client import AsyncTextToDialogueClient, TextToDialogueClient + from .text_to_sound_effects.client import AsyncTextToSoundEffectsClient, TextToSoundEffectsClient + from .text_to_speech.client import AsyncTextToSpeechClient, TextToSpeechClient + from .text_to_voice.client import AsyncTextToVoiceClient, TextToVoiceClient + from .tokens.client import AsyncTokensClient, TokensClient + from .usage.client import AsyncUsageClient, UsageClient + from .user.client import AsyncUserClient, UserClient + from .voices.client import AsyncVoicesClient, VoicesClient + from .webhooks.client import AsyncWebhooksClient, WebhooksClient + from .workspace.client import AsyncWorkspaceClient, WorkspaceClient + from .workspaces.client import AsyncWorkspacesClient, WorkspacesClient + + +class BaseElevenLabs: + """ + 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 : ElevenLabsEnvironment + The environment to use for requests from the client. from .environment import ElevenLabsEnvironment + + + + Defaults to ElevenLabsEnvironment.PRODUCTION + + + + api_key : typing.Optional[str] + headers : typing.Optional[typing.Dict[str, str]] + Additional headers to send with every request. + + timeout : typing.Optional[float] + The timeout to be used, in seconds, for requests. By default the timeout is 240 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. + + logging : typing.Optional[typing.Union[LogConfig, Logger]] + Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance. + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + """ + + def __init__( + self, + *, + base_url: typing.Optional[str] = None, + environment: ElevenLabsEnvironment = ElevenLabsEnvironment.PRODUCTION, + api_key: typing.Optional[str] = os.getenv("ELEVENLABS_API_KEY"), + headers: typing.Optional[typing.Dict[str, str]] = None, + timeout: typing.Optional[float] = None, + follow_redirects: typing.Optional[bool] = True, + httpx_client: typing.Optional[httpx.Client] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + ): + _defaulted_timeout = ( + timeout if timeout is not None else 240 if httpx_client is None else httpx_client.timeout.read + ) + self._client_wrapper = SyncClientWrapper( + base_url=_get_base_url(base_url=base_url, environment=environment), + api_key=api_key, + headers=headers, + 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, + logging=logging, + ) + self._history: typing.Optional[HistoryClient] = None + self._text_to_sound_effects: typing.Optional[TextToSoundEffectsClient] = None + self._audio_isolation: typing.Optional[AudioIsolationClient] = None + self._audio_effects: typing.Optional[AudioEffectsClient] = None + self._samples: typing.Optional[SamplesClient] = None + self._text_to_speech: typing.Optional[TextToSpeechClient] = None + self._text_to_dialogue: typing.Optional[TextToDialogueClient] = None + self._speech_to_speech: typing.Optional[SpeechToSpeechClient] = None + self._text_to_voice: typing.Optional[TextToVoiceClient] = None + self._user: typing.Optional[UserClient] = None + self._voices: typing.Optional[VoicesClient] = None + self._studio: typing.Optional[StudioClient] = None + self._dubbing: typing.Optional[DubbingClient] = None + self._models: typing.Optional[ModelsClient] = None + self._audio_native: typing.Optional[AudioNativeClient] = None + self._usage: typing.Optional[UsageClient] = None + self._pronunciation_dictionaries: typing.Optional[PronunciationDictionariesClient] = None + self._workspace: typing.Optional[WorkspaceClient] = None + self._service_accounts: typing.Optional[ServiceAccountsClient] = None + self._webhooks: typing.Optional[WebhooksClient] = None + self._music: typing.Optional[MusicClient] = None + self._speech_to_text: typing.Optional[SpeechToTextClient] = None + self._forced_alignment: typing.Optional[ForcedAlignmentClient] = None + self._conversational_ai: typing.Optional[ConversationalAiClient] = None + self._speech_engine: typing.Optional[SpeechEngineClient] = None + self._environment_variables: typing.Optional[EnvironmentVariablesClient] = None + self._environments: typing.Optional[EnvironmentsClient] = None + self._assets: typing.Optional[AssetsClient] = None + self._flows: typing.Optional[FlowsClient] = None + self._productions: typing.Optional[ProductionsClient] = None + self._tokens: typing.Optional[TokensClient] = None + self._workspaces: typing.Optional[WorkspacesClient] = None + + @property + def history(self): + if self._history is None: + from .history.client import HistoryClient # noqa: E402 + + self._history = HistoryClient(client_wrapper=self._client_wrapper) + return self._history + + @property + def text_to_sound_effects(self): + if self._text_to_sound_effects is None: + from .text_to_sound_effects.client import TextToSoundEffectsClient # noqa: E402 + + self._text_to_sound_effects = TextToSoundEffectsClient(client_wrapper=self._client_wrapper) + return self._text_to_sound_effects + + @property + def audio_isolation(self): + if self._audio_isolation is None: + from .audio_isolation.client import AudioIsolationClient # noqa: E402 + + self._audio_isolation = AudioIsolationClient(client_wrapper=self._client_wrapper) + return self._audio_isolation + + @property + def audio_effects(self): + if self._audio_effects is None: + from .audio_effects.client import AudioEffectsClient # noqa: E402 + + self._audio_effects = AudioEffectsClient(client_wrapper=self._client_wrapper) + return self._audio_effects + + @property + def samples(self): + if self._samples is None: + from .samples.client import SamplesClient # noqa: E402 + + self._samples = SamplesClient(client_wrapper=self._client_wrapper) + return self._samples + + @property + def text_to_speech(self): + if self._text_to_speech is None: + from .text_to_speech.client import TextToSpeechClient # noqa: E402 + + self._text_to_speech = TextToSpeechClient(client_wrapper=self._client_wrapper) + return self._text_to_speech + + @property + def text_to_dialogue(self): + if self._text_to_dialogue is None: + from .text_to_dialogue.client import TextToDialogueClient # noqa: E402 + + self._text_to_dialogue = TextToDialogueClient(client_wrapper=self._client_wrapper) + return self._text_to_dialogue + + @property + def speech_to_speech(self): + if self._speech_to_speech is None: + from .speech_to_speech.client import SpeechToSpeechClient # noqa: E402 + + self._speech_to_speech = SpeechToSpeechClient(client_wrapper=self._client_wrapper) + return self._speech_to_speech + + @property + def text_to_voice(self): + if self._text_to_voice is None: + from .text_to_voice.client import TextToVoiceClient # noqa: E402 + + self._text_to_voice = TextToVoiceClient(client_wrapper=self._client_wrapper) + return self._text_to_voice + + @property + def user(self): + if self._user is None: + from .user.client import UserClient # noqa: E402 + + self._user = UserClient(client_wrapper=self._client_wrapper) + return self._user + + @property + def voices(self): + if self._voices is None: + from .voices.client import VoicesClient # noqa: E402 + + self._voices = VoicesClient(client_wrapper=self._client_wrapper) + return self._voices + + @property + def studio(self): + if self._studio is None: + from .studio.client import StudioClient # noqa: E402 + + self._studio = StudioClient(client_wrapper=self._client_wrapper) + return self._studio + + @property + def dubbing(self): + if self._dubbing is None: + from .dubbing.client import DubbingClient # noqa: E402 + + self._dubbing = DubbingClient(client_wrapper=self._client_wrapper) + return self._dubbing + + @property + def models(self): + if self._models is None: + from .models.client import ModelsClient # noqa: E402 + + self._models = ModelsClient(client_wrapper=self._client_wrapper) + return self._models + + @property + def audio_native(self): + if self._audio_native is None: + from .audio_native.client import AudioNativeClient # noqa: E402 + + self._audio_native = AudioNativeClient(client_wrapper=self._client_wrapper) + return self._audio_native + + @property + def usage(self): + if self._usage is None: + from .usage.client import UsageClient # noqa: E402 + + self._usage = UsageClient(client_wrapper=self._client_wrapper) + return self._usage + + @property + def pronunciation_dictionaries(self): + if self._pronunciation_dictionaries is None: + from .pronunciation_dictionaries.client import PronunciationDictionariesClient # noqa: E402 + + self._pronunciation_dictionaries = PronunciationDictionariesClient(client_wrapper=self._client_wrapper) + return self._pronunciation_dictionaries + + @property + def workspace(self): + if self._workspace is None: + from .workspace.client import WorkspaceClient # noqa: E402 + + self._workspace = WorkspaceClient(client_wrapper=self._client_wrapper) + return self._workspace + + @property + def service_accounts(self): + if self._service_accounts is None: + from .service_accounts.client import ServiceAccountsClient # noqa: E402 + + self._service_accounts = ServiceAccountsClient(client_wrapper=self._client_wrapper) + return self._service_accounts + + @property + def webhooks(self): + if self._webhooks is None: + from .webhooks.client import WebhooksClient # noqa: E402 + + self._webhooks = WebhooksClient(client_wrapper=self._client_wrapper) + return self._webhooks + + @property + def music(self): + if self._music is None: + from .music.client import MusicClient # noqa: E402 + + self._music = MusicClient(client_wrapper=self._client_wrapper) + return self._music + + @property + def speech_to_text(self): + if self._speech_to_text is None: + from .speech_to_text.client import SpeechToTextClient # noqa: E402 + + self._speech_to_text = SpeechToTextClient(client_wrapper=self._client_wrapper) + return self._speech_to_text + + @property + def forced_alignment(self): + if self._forced_alignment is None: + from .forced_alignment.client import ForcedAlignmentClient # noqa: E402 + + self._forced_alignment = ForcedAlignmentClient(client_wrapper=self._client_wrapper) + return self._forced_alignment + + @property + def conversational_ai(self): + if self._conversational_ai is None: + from .conversational_ai.client import ConversationalAiClient # noqa: E402 + + self._conversational_ai = ConversationalAiClient(client_wrapper=self._client_wrapper) + return self._conversational_ai + + @property + def speech_engine(self): + if self._speech_engine is None: + from .speech_engine.client import SpeechEngineClient # noqa: E402 + + self._speech_engine = SpeechEngineClient(client_wrapper=self._client_wrapper) + return self._speech_engine + + @property + def environment_variables(self): + if self._environment_variables is None: + from .environment_variables.client import EnvironmentVariablesClient # noqa: E402 + + self._environment_variables = EnvironmentVariablesClient(client_wrapper=self._client_wrapper) + return self._environment_variables + + @property + def environments(self): + if self._environments is None: + from .environments.client import EnvironmentsClient # noqa: E402 + + self._environments = EnvironmentsClient(client_wrapper=self._client_wrapper) + return self._environments + + @property + def assets(self): + if self._assets is None: + from .assets.client import AssetsClient # noqa: E402 + + self._assets = AssetsClient(client_wrapper=self._client_wrapper) + return self._assets + + @property + def flows(self): + if self._flows is None: + from .flows.client import FlowsClient # noqa: E402 + + self._flows = FlowsClient(client_wrapper=self._client_wrapper) + return self._flows + + @property + def productions(self): + if self._productions is None: + from .productions.client import ProductionsClient # noqa: E402 + + self._productions = ProductionsClient(client_wrapper=self._client_wrapper) + return self._productions + + @property + def tokens(self): + if self._tokens is None: + from .tokens.client import TokensClient # noqa: E402 + + self._tokens = TokensClient(client_wrapper=self._client_wrapper) + return self._tokens + + @property + def workspaces(self): + if self._workspaces is None: + from .workspaces.client import WorkspacesClient # noqa: E402 + + self._workspaces = WorkspacesClient(client_wrapper=self._client_wrapper) + return self._workspaces + + +class AsyncBaseElevenLabs: + """ + 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 : ElevenLabsEnvironment + The environment to use for requests from the client. from .environment import ElevenLabsEnvironment + + + + Defaults to ElevenLabsEnvironment.PRODUCTION + + + + api_key : typing.Optional[str] + headers : typing.Optional[typing.Dict[str, str]] + Additional headers to send with every request. + + timeout : typing.Optional[float] + The timeout to be used, in seconds, for requests. By default the timeout is 240 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. + + logging : typing.Optional[typing.Union[LogConfig, Logger]] + Configure logging for the SDK. Accepts a LogConfig dict with 'level' (debug/info/warn/error), 'logger' (custom logger implementation), and 'silent' (boolean, defaults to True) fields. You can also pass a pre-configured Logger instance. + + Examples + -------- + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + """ + + def __init__( + self, + *, + base_url: typing.Optional[str] = None, + environment: ElevenLabsEnvironment = ElevenLabsEnvironment.PRODUCTION, + api_key: typing.Optional[str] = os.getenv("ELEVENLABS_API_KEY"), + headers: typing.Optional[typing.Dict[str, str]] = None, + timeout: typing.Optional[float] = None, + follow_redirects: typing.Optional[bool] = True, + httpx_client: typing.Optional[httpx.AsyncClient] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + ): + _defaulted_timeout = ( + timeout if timeout is not None else 240 if httpx_client is None else httpx_client.timeout.read + ) + self._client_wrapper = AsyncClientWrapper( + base_url=_get_base_url(base_url=base_url, environment=environment), + api_key=api_key, + headers=headers, + 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, + logging=logging, + ) + self._history: typing.Optional[AsyncHistoryClient] = None + self._text_to_sound_effects: typing.Optional[AsyncTextToSoundEffectsClient] = None + self._audio_isolation: typing.Optional[AsyncAudioIsolationClient] = None + self._audio_effects: typing.Optional[AsyncAudioEffectsClient] = None + self._samples: typing.Optional[AsyncSamplesClient] = None + self._text_to_speech: typing.Optional[AsyncTextToSpeechClient] = None + self._text_to_dialogue: typing.Optional[AsyncTextToDialogueClient] = None + self._speech_to_speech: typing.Optional[AsyncSpeechToSpeechClient] = None + self._text_to_voice: typing.Optional[AsyncTextToVoiceClient] = None + self._user: typing.Optional[AsyncUserClient] = None + self._voices: typing.Optional[AsyncVoicesClient] = None + self._studio: typing.Optional[AsyncStudioClient] = None + self._dubbing: typing.Optional[AsyncDubbingClient] = None + self._models: typing.Optional[AsyncModelsClient] = None + self._audio_native: typing.Optional[AsyncAudioNativeClient] = None + self._usage: typing.Optional[AsyncUsageClient] = None + self._pronunciation_dictionaries: typing.Optional[AsyncPronunciationDictionariesClient] = None + self._workspace: typing.Optional[AsyncWorkspaceClient] = None + self._service_accounts: typing.Optional[AsyncServiceAccountsClient] = None + self._webhooks: typing.Optional[AsyncWebhooksClient] = None + self._music: typing.Optional[AsyncMusicClient] = None + self._speech_to_text: typing.Optional[AsyncSpeechToTextClient] = None + self._forced_alignment: typing.Optional[AsyncForcedAlignmentClient] = None + self._conversational_ai: typing.Optional[AsyncConversationalAiClient] = None + self._speech_engine: typing.Optional[AsyncSpeechEngineClient] = None + self._environment_variables: typing.Optional[AsyncEnvironmentVariablesClient] = None + self._environments: typing.Optional[AsyncEnvironmentsClient] = None + self._assets: typing.Optional[AsyncAssetsClient] = None + self._flows: typing.Optional[AsyncFlowsClient] = None + self._productions: typing.Optional[AsyncProductionsClient] = None + self._tokens: typing.Optional[AsyncTokensClient] = None + self._workspaces: typing.Optional[AsyncWorkspacesClient] = None + + @property + def history(self): + if self._history is None: + from .history.client import AsyncHistoryClient # noqa: E402 + + self._history = AsyncHistoryClient(client_wrapper=self._client_wrapper) + return self._history + + @property + def text_to_sound_effects(self): + if self._text_to_sound_effects is None: + from .text_to_sound_effects.client import AsyncTextToSoundEffectsClient # noqa: E402 + + self._text_to_sound_effects = AsyncTextToSoundEffectsClient(client_wrapper=self._client_wrapper) + return self._text_to_sound_effects + + @property + def audio_isolation(self): + if self._audio_isolation is None: + from .audio_isolation.client import AsyncAudioIsolationClient # noqa: E402 + + self._audio_isolation = AsyncAudioIsolationClient(client_wrapper=self._client_wrapper) + return self._audio_isolation + + @property + def audio_effects(self): + if self._audio_effects is None: + from .audio_effects.client import AsyncAudioEffectsClient # noqa: E402 + + self._audio_effects = AsyncAudioEffectsClient(client_wrapper=self._client_wrapper) + return self._audio_effects + + @property + def samples(self): + if self._samples is None: + from .samples.client import AsyncSamplesClient # noqa: E402 + + self._samples = AsyncSamplesClient(client_wrapper=self._client_wrapper) + return self._samples + + @property + def text_to_speech(self): + if self._text_to_speech is None: + from .text_to_speech.client import AsyncTextToSpeechClient # noqa: E402 + + self._text_to_speech = AsyncTextToSpeechClient(client_wrapper=self._client_wrapper) + return self._text_to_speech + + @property + def text_to_dialogue(self): + if self._text_to_dialogue is None: + from .text_to_dialogue.client import AsyncTextToDialogueClient # noqa: E402 + + self._text_to_dialogue = AsyncTextToDialogueClient(client_wrapper=self._client_wrapper) + return self._text_to_dialogue + + @property + def speech_to_speech(self): + if self._speech_to_speech is None: + from .speech_to_speech.client import AsyncSpeechToSpeechClient # noqa: E402 + + self._speech_to_speech = AsyncSpeechToSpeechClient(client_wrapper=self._client_wrapper) + return self._speech_to_speech + + @property + def text_to_voice(self): + if self._text_to_voice is None: + from .text_to_voice.client import AsyncTextToVoiceClient # noqa: E402 + + self._text_to_voice = AsyncTextToVoiceClient(client_wrapper=self._client_wrapper) + return self._text_to_voice + + @property + def user(self): + if self._user is None: + from .user.client import AsyncUserClient # noqa: E402 + + self._user = AsyncUserClient(client_wrapper=self._client_wrapper) + return self._user + + @property + def voices(self): + if self._voices is None: + from .voices.client import AsyncVoicesClient # noqa: E402 + + self._voices = AsyncVoicesClient(client_wrapper=self._client_wrapper) + return self._voices + + @property + def studio(self): + if self._studio is None: + from .studio.client import AsyncStudioClient # noqa: E402 + + self._studio = AsyncStudioClient(client_wrapper=self._client_wrapper) + return self._studio + + @property + def dubbing(self): + if self._dubbing is None: + from .dubbing.client import AsyncDubbingClient # noqa: E402 + + self._dubbing = AsyncDubbingClient(client_wrapper=self._client_wrapper) + return self._dubbing + + @property + def models(self): + if self._models is None: + from .models.client import AsyncModelsClient # noqa: E402 + + self._models = AsyncModelsClient(client_wrapper=self._client_wrapper) + return self._models + + @property + def audio_native(self): + if self._audio_native is None: + from .audio_native.client import AsyncAudioNativeClient # noqa: E402 + + self._audio_native = AsyncAudioNativeClient(client_wrapper=self._client_wrapper) + return self._audio_native + + @property + def usage(self): + if self._usage is None: + from .usage.client import AsyncUsageClient # noqa: E402 + + self._usage = AsyncUsageClient(client_wrapper=self._client_wrapper) + return self._usage + + @property + def pronunciation_dictionaries(self): + if self._pronunciation_dictionaries is None: + from .pronunciation_dictionaries.client import AsyncPronunciationDictionariesClient # noqa: E402 + + self._pronunciation_dictionaries = AsyncPronunciationDictionariesClient(client_wrapper=self._client_wrapper) + return self._pronunciation_dictionaries + + @property + def workspace(self): + if self._workspace is None: + from .workspace.client import AsyncWorkspaceClient # noqa: E402 + + self._workspace = AsyncWorkspaceClient(client_wrapper=self._client_wrapper) + return self._workspace + + @property + def service_accounts(self): + if self._service_accounts is None: + from .service_accounts.client import AsyncServiceAccountsClient # noqa: E402 + + self._service_accounts = AsyncServiceAccountsClient(client_wrapper=self._client_wrapper) + return self._service_accounts + + @property + def webhooks(self): + if self._webhooks is None: + from .webhooks.client import AsyncWebhooksClient # noqa: E402 + + self._webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper) + return self._webhooks + + @property + def music(self): + if self._music is None: + from .music.client import AsyncMusicClient # noqa: E402 + + self._music = AsyncMusicClient(client_wrapper=self._client_wrapper) + return self._music + + @property + def speech_to_text(self): + if self._speech_to_text is None: + from .speech_to_text.client import AsyncSpeechToTextClient # noqa: E402 + + self._speech_to_text = AsyncSpeechToTextClient(client_wrapper=self._client_wrapper) + return self._speech_to_text + + @property + def forced_alignment(self): + if self._forced_alignment is None: + from .forced_alignment.client import AsyncForcedAlignmentClient # noqa: E402 + + self._forced_alignment = AsyncForcedAlignmentClient(client_wrapper=self._client_wrapper) + return self._forced_alignment + + @property + def conversational_ai(self): + if self._conversational_ai is None: + from .conversational_ai.client import AsyncConversationalAiClient # noqa: E402 + + self._conversational_ai = AsyncConversationalAiClient(client_wrapper=self._client_wrapper) + return self._conversational_ai + + @property + def speech_engine(self): + if self._speech_engine is None: + from .speech_engine.client import AsyncSpeechEngineClient # noqa: E402 + + self._speech_engine = AsyncSpeechEngineClient(client_wrapper=self._client_wrapper) + return self._speech_engine + + @property + def environment_variables(self): + if self._environment_variables is None: + from .environment_variables.client import AsyncEnvironmentVariablesClient # noqa: E402 + + self._environment_variables = AsyncEnvironmentVariablesClient(client_wrapper=self._client_wrapper) + return self._environment_variables + + @property + def environments(self): + if self._environments is None: + from .environments.client import AsyncEnvironmentsClient # noqa: E402 + + self._environments = AsyncEnvironmentsClient(client_wrapper=self._client_wrapper) + return self._environments + + @property + def assets(self): + if self._assets is None: + from .assets.client import AsyncAssetsClient # noqa: E402 + + self._assets = AsyncAssetsClient(client_wrapper=self._client_wrapper) + return self._assets + + @property + def flows(self): + if self._flows is None: + from .flows.client import AsyncFlowsClient # noqa: E402 + + self._flows = AsyncFlowsClient(client_wrapper=self._client_wrapper) + return self._flows + + @property + def productions(self): + if self._productions is None: + from .productions.client import AsyncProductionsClient # noqa: E402 + + self._productions = AsyncProductionsClient(client_wrapper=self._client_wrapper) + return self._productions + + @property + def tokens(self): + if self._tokens is None: + from .tokens.client import AsyncTokensClient # noqa: E402 + + self._tokens = AsyncTokensClient(client_wrapper=self._client_wrapper) + return self._tokens + + @property + def workspaces(self): + if self._workspaces is None: + from .workspaces.client import AsyncWorkspacesClient # noqa: E402 + + self._workspaces = AsyncWorkspacesClient(client_wrapper=self._client_wrapper) + return self._workspaces + + +def _get_base_url(*, base_url: typing.Optional[str] = None, environment: ElevenLabsEnvironment) -> str: + if base_url is not None: + return base_url + elif environment is not None: + return environment.value + else: + raise Exception("Please pass in either base_url or environment to construct the client") diff --git a/data/src/elevenlabs/client.py b/data/src/elevenlabs/client.py new file mode 100644 index 0000000000000000000000000000000000000000..e8ffa640645e361740e988abefd6b36754fd01de --- /dev/null +++ b/data/src/elevenlabs/client.py @@ -0,0 +1,175 @@ +import os +import typing + +import httpx + +from .base_client import AsyncBaseElevenLabs, BaseElevenLabs +from .environment import ElevenLabsEnvironment +from .flows_custom import AsyncFlowsClient, FlowsClient +from .music_custom import AsyncMusicClient, MusicClient +from .realtime_tts import RealtimeTextToSpeechClient +from .speech_engine_custom import AsyncSpeechEngineClient, SpeechEngineClient +from .speech_to_text_custom import AsyncSpeechToTextClient, SpeechToTextClient +from .webhooks_custom import AsyncWebhooksClient, WebhooksClient + + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +def get_base_url_host(base_url: str) -> str: + return httpx.URL(base_url).host + + +class ElevenLabs(BaseElevenLabs): + """ + Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions. + + Parameters: + - base_url: typing.Optional[str]. The base url to use for requests from the client. + + - environment: ElevenLabsEnvironment. The environment to use for requests from the client. from .environment import ElevenLabsEnvironment + + Defaults to ElevenLabsEnvironment.PRODUCTION + + - api_key: typing.Optional[str]. + + - headers: typing.Optional[typing.Dict[str, str]]. Additional headers to send with every request. + + - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 240 seconds. + + - follow_redirects: typing.Optional[bool]. Whether the default httpx client should follow redirects. Defaults to True. Ignored when a custom `httpx_client` is supplied. + + - 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. + --- + from elevenlabs.client import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + """ + def __init__( + self, + *, + base_url: typing.Optional[str] = None, + environment: ElevenLabsEnvironment = ElevenLabsEnvironment.PRODUCTION, + api_key: typing.Optional[str] = os.getenv("ELEVENLABS_API_KEY"), + headers: typing.Optional[typing.Dict[str, str]] = None, + timeout: typing.Optional[float] = 240, + follow_redirects: typing.Optional[bool] = True, + httpx_client: typing.Optional[httpx.Client] = None + ): + super().__init__( + base_url=base_url, + environment=environment, + api_key=api_key, + headers=headers, + timeout=timeout, + follow_redirects=follow_redirects, + httpx_client=httpx_client + ) + self._text_to_speech = RealtimeTextToSpeechClient(client_wrapper=self._client_wrapper) + self._webhooks = WebhooksClient(client_wrapper=self._client_wrapper) + self._music = MusicClient(client_wrapper=self._client_wrapper) + self._speech_to_text = SpeechToTextClient(client_wrapper=self._client_wrapper) + self._speech_engine = SpeechEngineClient(client_wrapper=self._client_wrapper) + self._flows = FlowsClient(client_wrapper=self._client_wrapper) + + @property + def text_to_speech(self) -> RealtimeTextToSpeechClient: + return typing.cast(RealtimeTextToSpeechClient, self._text_to_speech) + + @property + def webhooks(self) -> WebhooksClient: + return typing.cast(WebhooksClient, self._webhooks) + + @property + def music(self) -> MusicClient: + return typing.cast(MusicClient, self._music) + + @property + def speech_to_text(self) -> SpeechToTextClient: + return typing.cast(SpeechToTextClient, self._speech_to_text) + + @property + def speech_engine(self) -> SpeechEngineClient: + return typing.cast(SpeechEngineClient, self._speech_engine) + + @property + def flows(self) -> FlowsClient: + return typing.cast(FlowsClient, self._flows) + + +class AsyncElevenLabs(AsyncBaseElevenLabs): + """ + Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions. + + Parameters: + - base_url: typing.Optional[str]. The base url to use for requests from the client. + + - environment: ElevenLabsEnvironment. The environment to use for requests from the client. from .environment import ElevenLabsEnvironment + + Defaults to ElevenLabsEnvironment.PRODUCTION + + - api_key: typing.Optional[str]. + + - headers: typing.Optional[typing.Dict[str, str]]. Additional headers to send with every request. + + - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 240 seconds. + + - follow_redirects: typing.Optional[bool]. Whether the default httpx client should follow redirects. Defaults to True. Ignored when a custom `httpx_client` is supplied. + + - 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. + --- + from elevenlabs.client import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + """ + + def __init__( + self, + *, + base_url: typing.Optional[str] = None, + environment: ElevenLabsEnvironment = ElevenLabsEnvironment.PRODUCTION, + api_key: typing.Optional[str] = os.getenv("ELEVENLABS_API_KEY"), + headers: typing.Optional[typing.Dict[str, str]] = None, + timeout: typing.Optional[float] = 240, + follow_redirects: typing.Optional[bool] = True, + httpx_client: typing.Optional[httpx.AsyncClient] = None + ): + super().__init__( + base_url=base_url, + environment=environment, + api_key=api_key, + headers=headers, + timeout=timeout, + follow_redirects=follow_redirects, + httpx_client=httpx_client + ) + self._webhooks = AsyncWebhooksClient(client_wrapper=self._client_wrapper) + self._music = AsyncMusicClient(client_wrapper=self._client_wrapper) + self._speech_to_text = AsyncSpeechToTextClient(client_wrapper=self._client_wrapper) + self._speech_engine = AsyncSpeechEngineClient(client_wrapper=self._client_wrapper) + self._flows = AsyncFlowsClient(client_wrapper=self._client_wrapper) + + @property + def webhooks(self) -> AsyncWebhooksClient: + return typing.cast(AsyncWebhooksClient, self._webhooks) + + @property + def music(self) -> AsyncMusicClient: + return typing.cast(AsyncMusicClient, self._music) + + @property + def speech_to_text(self) -> AsyncSpeechToTextClient: + return typing.cast(AsyncSpeechToTextClient, self._speech_to_text) + + @property + def speech_engine(self) -> AsyncSpeechEngineClient: + return typing.cast(AsyncSpeechEngineClient, self._speech_engine) + + @property + def flows(self) -> AsyncFlowsClient: + return typing.cast(AsyncFlowsClient, self._flows) diff --git a/data/src/elevenlabs/conversational_ai/__init__.py b/data/src/elevenlabs/conversational_ai/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..da4e1d85c081e077c845c6c69298efdfe98e6d3a --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/__init__.py @@ -0,0 +1,253 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import ( + agents, + analytics, + batch_calls, + conversations, + dashboard, + exotel, + knowledge_base, + llm, + llm_usage, + mcp_servers, + phone_numbers, + realtime, + secrets, + settings, + sip_trunk, + tests, + tools, + triage_tickets, + twilio, + users, + whatsapp, + whatsapp_accounts, + ) + from .conversations import ( + ConversationsGetRequestFormat, + ConversationsListRequestExcludeStatusesItem, + ConversationsListRequestSummaryMode, + ) + from .knowledge_base import ( + KnowledgeBaseGetOrCreateRagIndexesResponseValue, + KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure, + KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success, + ) + from .mcp_servers import ( + McpServerConfigUpdateRequestModelAuthConnection, + McpServerConfigUpdateRequestModelRequestHeadersValue, + McpServerConfigUpdateRequestModelRequestMetaValue, + ) + from .phone_numbers import ( + PhoneNumbersCreateRequestBody, + PhoneNumbersCreateRequestBody_Exotel, + PhoneNumbersCreateRequestBody_SipTrunk, + PhoneNumbersCreateRequestBody_Twilio, + PhoneNumbersGetResponse, + PhoneNumbersGetResponse_Exotel, + PhoneNumbersGetResponse_SipTrunk, + PhoneNumbersGetResponse_Twilio, + PhoneNumbersListResponseItem, + PhoneNumbersListResponseItem_Exotel, + PhoneNumbersListResponseItem_SipTrunk, + PhoneNumbersListResponseItem_Twilio, + PhoneNumbersUpdateResponse, + PhoneNumbersUpdateResponse_Exotel, + PhoneNumbersUpdateResponse_SipTrunk, + PhoneNumbersUpdateResponse_Twilio, + ) + from .tests import ( + TestsCreateRequestBody, + TestsCreateRequestBody_Llm, + TestsCreateRequestBody_Simulation, + TestsCreateRequestBody_Tool, + TestsGetResponse, + TestsGetResponse_Llm, + TestsGetResponse_Simulation, + TestsGetResponse_Tool, + TestsListRequestSortMode, + TestsUpdateRequestBody, + TestsUpdateRequestBody_Llm, + TestsUpdateRequestBody_Simulation, + TestsUpdateRequestBody_Tool, + TestsUpdateResponse, + TestsUpdateResponse_Llm, + TestsUpdateResponse_Simulation, + TestsUpdateResponse_Tool, + ) + from .whatsapp import ( + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem": ".whatsapp", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body": ".whatsapp", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button": ".whatsapp", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header": ".whatsapp", + "ConversationsGetRequestFormat": ".conversations", + "ConversationsListRequestExcludeStatusesItem": ".conversations", + "ConversationsListRequestSummaryMode": ".conversations", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue": ".knowledge_base", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure": ".knowledge_base", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success": ".knowledge_base", + "McpServerConfigUpdateRequestModelAuthConnection": ".mcp_servers", + "McpServerConfigUpdateRequestModelRequestHeadersValue": ".mcp_servers", + "McpServerConfigUpdateRequestModelRequestMetaValue": ".mcp_servers", + "PhoneNumbersCreateRequestBody": ".phone_numbers", + "PhoneNumbersCreateRequestBody_Exotel": ".phone_numbers", + "PhoneNumbersCreateRequestBody_SipTrunk": ".phone_numbers", + "PhoneNumbersCreateRequestBody_Twilio": ".phone_numbers", + "PhoneNumbersGetResponse": ".phone_numbers", + "PhoneNumbersGetResponse_Exotel": ".phone_numbers", + "PhoneNumbersGetResponse_SipTrunk": ".phone_numbers", + "PhoneNumbersGetResponse_Twilio": ".phone_numbers", + "PhoneNumbersListResponseItem": ".phone_numbers", + "PhoneNumbersListResponseItem_Exotel": ".phone_numbers", + "PhoneNumbersListResponseItem_SipTrunk": ".phone_numbers", + "PhoneNumbersListResponseItem_Twilio": ".phone_numbers", + "PhoneNumbersUpdateResponse": ".phone_numbers", + "PhoneNumbersUpdateResponse_Exotel": ".phone_numbers", + "PhoneNumbersUpdateResponse_SipTrunk": ".phone_numbers", + "PhoneNumbersUpdateResponse_Twilio": ".phone_numbers", + "TestsCreateRequestBody": ".tests", + "TestsCreateRequestBody_Llm": ".tests", + "TestsCreateRequestBody_Simulation": ".tests", + "TestsCreateRequestBody_Tool": ".tests", + "TestsGetResponse": ".tests", + "TestsGetResponse_Llm": ".tests", + "TestsGetResponse_Simulation": ".tests", + "TestsGetResponse_Tool": ".tests", + "TestsListRequestSortMode": ".tests", + "TestsUpdateRequestBody": ".tests", + "TestsUpdateRequestBody_Llm": ".tests", + "TestsUpdateRequestBody_Simulation": ".tests", + "TestsUpdateRequestBody_Tool": ".tests", + "TestsUpdateResponse": ".tests", + "TestsUpdateResponse_Llm": ".tests", + "TestsUpdateResponse_Simulation": ".tests", + "TestsUpdateResponse_Tool": ".tests", + "agents": ".agents", + "analytics": ".analytics", + "batch_calls": ".batch_calls", + "conversations": ".conversations", + "dashboard": ".dashboard", + "exotel": ".exotel", + "knowledge_base": ".knowledge_base", + "llm": ".llm", + "llm_usage": ".llm_usage", + "mcp_servers": ".mcp_servers", + "phone_numbers": ".phone_numbers", + "realtime": ".realtime", + "secrets": ".secrets", + "settings": ".settings", + "sip_trunk": ".sip_trunk", + "tests": ".tests", + "tools": ".tools", + "triage_tickets": ".triage_tickets", + "twilio": ".twilio", + "users": ".users", + "whatsapp": ".whatsapp", + "whatsapp_accounts": ".whatsapp_accounts", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header", + "ConversationsGetRequestFormat", + "ConversationsListRequestExcludeStatusesItem", + "ConversationsListRequestSummaryMode", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success", + "McpServerConfigUpdateRequestModelAuthConnection", + "McpServerConfigUpdateRequestModelRequestHeadersValue", + "McpServerConfigUpdateRequestModelRequestMetaValue", + "PhoneNumbersCreateRequestBody", + "PhoneNumbersCreateRequestBody_Exotel", + "PhoneNumbersCreateRequestBody_SipTrunk", + "PhoneNumbersCreateRequestBody_Twilio", + "PhoneNumbersGetResponse", + "PhoneNumbersGetResponse_Exotel", + "PhoneNumbersGetResponse_SipTrunk", + "PhoneNumbersGetResponse_Twilio", + "PhoneNumbersListResponseItem", + "PhoneNumbersListResponseItem_Exotel", + "PhoneNumbersListResponseItem_SipTrunk", + "PhoneNumbersListResponseItem_Twilio", + "PhoneNumbersUpdateResponse", + "PhoneNumbersUpdateResponse_Exotel", + "PhoneNumbersUpdateResponse_SipTrunk", + "PhoneNumbersUpdateResponse_Twilio", + "TestsCreateRequestBody", + "TestsCreateRequestBody_Llm", + "TestsCreateRequestBody_Simulation", + "TestsCreateRequestBody_Tool", + "TestsGetResponse", + "TestsGetResponse_Llm", + "TestsGetResponse_Simulation", + "TestsGetResponse_Tool", + "TestsListRequestSortMode", + "TestsUpdateRequestBody", + "TestsUpdateRequestBody_Llm", + "TestsUpdateRequestBody_Simulation", + "TestsUpdateRequestBody_Tool", + "TestsUpdateResponse", + "TestsUpdateResponse_Llm", + "TestsUpdateResponse_Simulation", + "TestsUpdateResponse_Tool", + "agents", + "analytics", + "batch_calls", + "conversations", + "dashboard", + "exotel", + "knowledge_base", + "llm", + "llm_usage", + "mcp_servers", + "phone_numbers", + "realtime", + "secrets", + "settings", + "sip_trunk", + "tests", + "tools", + "triage_tickets", + "twilio", + "users", + "whatsapp", + "whatsapp_accounts", +] diff --git a/data/src/elevenlabs/conversational_ai/agents/__init__.py b/data/src/elevenlabs/conversational_ai/agents/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cbae2073cd52f1c94436f0e65c3b969ffc567373 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/__init__.py @@ -0,0 +1,84 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import ( + branches, + deployments, + drafts, + hold_audio, + knowledge_base, + link, + llm_usage, + merge_proposals, + procedures, + summaries, + versions, + widget, + ) + from .summaries import ( + SummariesGetResponseValue, + SummariesGetResponseValue_Failure, + SummariesGetResponseValue_Success, + ) +_dynamic_imports: typing.Dict[str, str] = { + "SummariesGetResponseValue": ".summaries", + "SummariesGetResponseValue_Failure": ".summaries", + "SummariesGetResponseValue_Success": ".summaries", + "branches": ".branches", + "deployments": ".deployments", + "drafts": ".drafts", + "hold_audio": ".hold_audio", + "knowledge_base": ".knowledge_base", + "link": ".link", + "llm_usage": ".llm_usage", + "merge_proposals": ".merge_proposals", + "procedures": ".procedures", + "summaries": ".summaries", + "versions": ".versions", + "widget": ".widget", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "SummariesGetResponseValue", + "SummariesGetResponseValue_Failure", + "SummariesGetResponseValue_Success", + "branches", + "deployments", + "drafts", + "hold_audio", + "knowledge_base", + "link", + "llm_usage", + "merge_proposals", + "procedures", + "summaries", + "versions", + "widget", +] diff --git a/data/src/elevenlabs/conversational_ai/agents/branches/__init__.py b/data/src/elevenlabs/conversational_ai/agents/branches/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/branches/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/branches/client.py b/data/src/elevenlabs/conversational_ai/agents/branches/client.py new file mode 100644 index 0000000000000000000000000000000000000000..859623bb054b4d7fda2343e278dc62fc4274114a --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/branches/client.py @@ -0,0 +1,1052 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.agent_branch_response import AgentBranchResponse +from ....types.agent_workflow_request_model import AgentWorkflowRequestModel +from ....types.branch_protection_status import BranchProtectionStatus +from ....types.create_agent_branch_response_model import CreateAgentBranchResponseModel +from ....types.list_response_agent_branch_summary import ListResponseAgentBranchSummary +from ....types.merge_preview_response_model import MergePreviewResponseModel +from .raw_client import AsyncRawBranchesClient, RawBranchesClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class BranchesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawBranchesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawBranchesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawBranchesClient + """ + return self._raw_client + + def list( + self, + agent_id: str, + *, + include_archived: typing.Optional[bool] = None, + limit: typing.Optional[int] = None, + include_commit_status: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListResponseAgentBranchSummary: + """ + Returns a list of branches an agent has + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + include_archived : typing.Optional[bool] + Whether archived branches should be included + + limit : typing.Optional[int] + How many results at most should be returned + + include_commit_status : typing.Optional[bool] + Whether to compute how far each branch has diverged from main (commits_ahead/commits_behind). This walks the version DAG of every branch, so it is slow on agents with long histories and is off by default, leaving those fields null. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListResponseAgentBranchSummary + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.branches.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + include_archived=True, + limit=1, + include_commit_status=True, + ) + """ + _response = self._raw_client.list( + agent_id, + include_archived=include_archived, + limit=limit, + include_commit_status=include_commit_status, + request_options=request_options, + ) + return _response.data + + def create( + self, + agent_id: str, + *, + parent_version_id: str, + name: str, + description: str, + conversation_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + platform_settings: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + include_draft: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentBranchResponseModel: + """ + Create a new branch from a given version of any branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + parent_version_id : str + ID of the version to branch from + + name : str + Name of the branch. It is unique within the agent. + + description : str + Description for the branch + + conversation_config : typing.Optional[typing.Dict[str, typing.Any]] + Changes to apply to conversation config + + platform_settings : typing.Optional[typing.Dict[str, typing.Any]] + Changes to apply to platform settings + + workflow : typing.Optional[AgentWorkflowRequestModel] + Updated workflow definition + + include_draft : typing.Optional[bool] + When true, the new branch uses the caller's draft procedure set instead of the branch tip. Requires parent_version_id to be the branch tip. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentBranchResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.branches.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + parent_version_id="parent_version_id", + name="name", + description="description", + ) + """ + _response = self._raw_client.create( + agent_id, + parent_version_id=parent_version_id, + name=name, + description=description, + conversation_config=conversation_config, + platform_settings=platform_settings, + workflow=workflow, + include_draft=include_draft, + request_options=request_options, + ) + return _response.data + + def get( + self, agent_id: str, branch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AgentBranchResponse: + """ + Get information about a single agent branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentBranchResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.branches.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + ) + """ + _response = self._raw_client.get(agent_id, branch_id, request_options=request_options) + return _response.data + + def update( + self, + agent_id: str, + branch_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + is_archived: typing.Optional[bool] = OMIT, + protection_status: typing.Optional[BranchProtectionStatus] = OMIT, + auto_rebase: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentBranchResponse: + """ + Update agent branch properties such as name, description, archiving status, protection level, and auto-rebase onto main + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the branch. + + name : typing.Optional[str] + New name for the branch. Must be unique within the agent. + + description : typing.Optional[str] + New description for the branch. Pass an empty string to clear it. + + is_archived : typing.Optional[bool] + Whether the branch should be archived + + protection_status : typing.Optional[BranchProtectionStatus] + The protection level for the branch + + auto_rebase : typing.Optional[bool] + When true, rebase this branch onto main automatically after each new main version. Cannot be enabled on the main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentBranchResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.branches.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + ) + """ + _response = self._raw_client.update( + agent_id, + branch_id, + name=name, + description=description, + is_archived=is_archived, + protection_status=protection_status, + auto_rebase=auto_rebase, + request_options=request_options, + ) + return _response.data + + def preview_merge( + self, + agent_id: str, + source_branch_id: str, + *, + target_branch_id: str, + force: typing.Optional[bool] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MergePreviewResponseModel: + """ + Returns the result of merging the source branch into the target branch without performing the merge. Useful for showing an accurate diff before confirming. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Unique identifier for the source branch to merge from. + + target_branch_id : str + The ID of the target branch to merge into. + + force : typing.Optional[bool] + When true, source branch changes always win conflicts regardless of timestamps + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MergePreviewResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.branches.preview_merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + target_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + force=True, + include_procedure_generated_workflow_elements=True, + ) + """ + _response = self._raw_client.preview_merge( + agent_id, + source_branch_id, + target_branch_id=target_branch_id, + force=force, + include_procedure_generated_workflow_elements=include_procedure_generated_workflow_elements, + request_options=request_options, + ) + return _response.data + + def merge( + self, + agent_id: str, + source_branch_id: str, + *, + target_branch_id: str, + archive_source_branch: typing.Optional[bool] = OMIT, + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Merge a branch into a target branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Unique identifier for the source branch to merge from. + + target_branch_id : str + The ID of the target branch to merge into. + + archive_source_branch : typing.Optional[bool] + Whether to archive the source branch after merging + + force : typing.Optional[bool] + Force source branch changes onto the target, overriding timestamp-based conflict resolution + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.branches.merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + target_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + ) + """ + _response = self._raw_client.merge( + agent_id, + source_branch_id, + target_branch_id=target_branch_id, + archive_source_branch=archive_source_branch, + force=force, + request_options=request_options, + ) + return _response.data + + def preview_rebase( + self, + agent_id: str, + branch_id: str, + *, + source_branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MergePreviewResponseModel: + """ + Returns the result of pulling changes from a source branch (defaults to main) into the given branch without performing it, preserving the given branch's own changes. Useful for showing an accurate diff before confirming. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the source branch to merge from. + + source_branch_id : typing.Optional[str] + The ID of the branch to pull changes from. Defaults to the agent's main branch. + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MergePreviewResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.branches.preview_rebase( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + source_branch_id="source_branch_id", + include_procedure_generated_workflow_elements=True, + ) + """ + _response = self._raw_client.preview_rebase( + agent_id, + branch_id, + source_branch_id=source_branch_id, + include_procedure_generated_workflow_elements=include_procedure_generated_workflow_elements, + request_options=request_options, + ) + return _response.data + + def rebase( + self, + agent_id: str, + branch_id: str, + *, + source_branch_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Pull changes from a source branch (defaults to main) into this branch as a new version, preserving this branch's own changes on conflicts. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the source branch to merge from. + + source_branch_id : typing.Optional[str] + The ID of the branch to pull changes from. Defaults to the agent's main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.branches.rebase( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + source_branch_id="source_branch_id", + ) + """ + _response = self._raw_client.rebase( + agent_id, branch_id, source_branch_id=source_branch_id, request_options=request_options + ) + return _response.data + + +class AsyncBranchesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawBranchesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawBranchesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawBranchesClient + """ + return self._raw_client + + async def list( + self, + agent_id: str, + *, + include_archived: typing.Optional[bool] = None, + limit: typing.Optional[int] = None, + include_commit_status: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListResponseAgentBranchSummary: + """ + Returns a list of branches an agent has + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + include_archived : typing.Optional[bool] + Whether archived branches should be included + + limit : typing.Optional[int] + How many results at most should be returned + + include_commit_status : typing.Optional[bool] + Whether to compute how far each branch has diverged from main (commits_ahead/commits_behind). This walks the version DAG of every branch, so it is slow on agents with long histories and is off by default, leaving those fields null. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListResponseAgentBranchSummary + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.branches.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + include_archived=True, + limit=1, + include_commit_status=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + agent_id, + include_archived=include_archived, + limit=limit, + include_commit_status=include_commit_status, + request_options=request_options, + ) + return _response.data + + async def create( + self, + agent_id: str, + *, + parent_version_id: str, + name: str, + description: str, + conversation_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + platform_settings: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + include_draft: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentBranchResponseModel: + """ + Create a new branch from a given version of any branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + parent_version_id : str + ID of the version to branch from + + name : str + Name of the branch. It is unique within the agent. + + description : str + Description for the branch + + conversation_config : typing.Optional[typing.Dict[str, typing.Any]] + Changes to apply to conversation config + + platform_settings : typing.Optional[typing.Dict[str, typing.Any]] + Changes to apply to platform settings + + workflow : typing.Optional[AgentWorkflowRequestModel] + Updated workflow definition + + include_draft : typing.Optional[bool] + When true, the new branch uses the caller's draft procedure set instead of the branch tip. Requires parent_version_id to be the branch tip. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentBranchResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.branches.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + parent_version_id="parent_version_id", + name="name", + description="description", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + agent_id, + parent_version_id=parent_version_id, + name=name, + description=description, + conversation_config=conversation_config, + platform_settings=platform_settings, + workflow=workflow, + include_draft=include_draft, + request_options=request_options, + ) + return _response.data + + async def get( + self, agent_id: str, branch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AgentBranchResponse: + """ + Get information about a single agent branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentBranchResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.branches.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(agent_id, branch_id, request_options=request_options) + return _response.data + + async def update( + self, + agent_id: str, + branch_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + is_archived: typing.Optional[bool] = OMIT, + protection_status: typing.Optional[BranchProtectionStatus] = OMIT, + auto_rebase: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentBranchResponse: + """ + Update agent branch properties such as name, description, archiving status, protection level, and auto-rebase onto main + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the branch. + + name : typing.Optional[str] + New name for the branch. Must be unique within the agent. + + description : typing.Optional[str] + New description for the branch. Pass an empty string to clear it. + + is_archived : typing.Optional[bool] + Whether the branch should be archived + + protection_status : typing.Optional[BranchProtectionStatus] + The protection level for the branch + + auto_rebase : typing.Optional[bool] + When true, rebase this branch onto main automatically after each new main version. Cannot be enabled on the main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentBranchResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.branches.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + agent_id, + branch_id, + name=name, + description=description, + is_archived=is_archived, + protection_status=protection_status, + auto_rebase=auto_rebase, + request_options=request_options, + ) + return _response.data + + async def preview_merge( + self, + agent_id: str, + source_branch_id: str, + *, + target_branch_id: str, + force: typing.Optional[bool] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MergePreviewResponseModel: + """ + Returns the result of merging the source branch into the target branch without performing the merge. Useful for showing an accurate diff before confirming. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Unique identifier for the source branch to merge from. + + target_branch_id : str + The ID of the target branch to merge into. + + force : typing.Optional[bool] + When true, source branch changes always win conflicts regardless of timestamps + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MergePreviewResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.branches.preview_merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + target_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + force=True, + include_procedure_generated_workflow_elements=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.preview_merge( + agent_id, + source_branch_id, + target_branch_id=target_branch_id, + force=force, + include_procedure_generated_workflow_elements=include_procedure_generated_workflow_elements, + request_options=request_options, + ) + return _response.data + + async def merge( + self, + agent_id: str, + source_branch_id: str, + *, + target_branch_id: str, + archive_source_branch: typing.Optional[bool] = OMIT, + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Merge a branch into a target branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Unique identifier for the source branch to merge from. + + target_branch_id : str + The ID of the target branch to merge into. + + archive_source_branch : typing.Optional[bool] + Whether to archive the source branch after merging + + force : typing.Optional[bool] + Force source branch changes onto the target, overriding timestamp-based conflict resolution + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.branches.merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + target_branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.merge( + agent_id, + source_branch_id, + target_branch_id=target_branch_id, + archive_source_branch=archive_source_branch, + force=force, + request_options=request_options, + ) + return _response.data + + async def preview_rebase( + self, + agent_id: str, + branch_id: str, + *, + source_branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MergePreviewResponseModel: + """ + Returns the result of pulling changes from a source branch (defaults to main) into the given branch without performing it, preserving the given branch's own changes. Useful for showing an accurate diff before confirming. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the source branch to merge from. + + source_branch_id : typing.Optional[str] + The ID of the branch to pull changes from. Defaults to the agent's main branch. + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MergePreviewResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.branches.preview_rebase( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + source_branch_id="source_branch_id", + include_procedure_generated_workflow_elements=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.preview_rebase( + agent_id, + branch_id, + source_branch_id=source_branch_id, + include_procedure_generated_workflow_elements=include_procedure_generated_workflow_elements, + request_options=request_options, + ) + return _response.data + + async def rebase( + self, + agent_id: str, + branch_id: str, + *, + source_branch_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Pull changes from a source branch (defaults to main) into this branch as a new version, preserving this branch's own changes on conflicts. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the source branch to merge from. + + source_branch_id : typing.Optional[str] + The ID of the branch to pull changes from. Defaults to the agent's main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.branches.rebase( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + source_branch_id="source_branch_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.rebase( + agent_id, branch_id, source_branch_id=source_branch_id, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/branches/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/branches/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..26e667bb64b5dbdf83a7b78ee7c8350c1898368c --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/branches/raw_client.py @@ -0,0 +1,1294 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.agent_branch_response import AgentBranchResponse +from ....types.agent_workflow_request_model import AgentWorkflowRequestModel +from ....types.branch_protection_status import BranchProtectionStatus +from ....types.create_agent_branch_response_model import CreateAgentBranchResponseModel +from ....types.list_response_agent_branch_summary import ListResponseAgentBranchSummary +from ....types.merge_preview_response_model import MergePreviewResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawBranchesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + agent_id: str, + *, + include_archived: typing.Optional[bool] = None, + limit: typing.Optional[int] = None, + include_commit_status: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListResponseAgentBranchSummary]: + """ + Returns a list of branches an agent has + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + include_archived : typing.Optional[bool] + Whether archived branches should be included + + limit : typing.Optional[int] + How many results at most should be returned + + include_commit_status : typing.Optional[bool] + Whether to compute how far each branch has diverged from main (commits_ahead/commits_behind). This walks the version DAG of every branch, so it is slow on agents with long histories and is off by default, leaving those fields null. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListResponseAgentBranchSummary] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches", + method="GET", + params={ + "include_archived": include_archived, + "limit": limit, + "include_commit_status": include_commit_status, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListResponseAgentBranchSummary, + construct_type( + type_=ListResponseAgentBranchSummary, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + agent_id: str, + *, + parent_version_id: str, + name: str, + description: str, + conversation_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + platform_settings: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + include_draft: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateAgentBranchResponseModel]: + """ + Create a new branch from a given version of any branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + parent_version_id : str + ID of the version to branch from + + name : str + Name of the branch. It is unique within the agent. + + description : str + Description for the branch + + conversation_config : typing.Optional[typing.Dict[str, typing.Any]] + Changes to apply to conversation config + + platform_settings : typing.Optional[typing.Dict[str, typing.Any]] + Changes to apply to platform settings + + workflow : typing.Optional[AgentWorkflowRequestModel] + Updated workflow definition + + include_draft : typing.Optional[bool] + When true, the new branch uses the caller's draft procedure set instead of the branch tip. Requires parent_version_id to be the branch tip. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateAgentBranchResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches", + method="POST", + json={ + "parent_version_id": parent_version_id, + "name": name, + "description": description, + "conversation_config": conversation_config, + "platform_settings": platform_settings, + "workflow": convert_and_respect_annotation_metadata( + object_=workflow, annotation=AgentWorkflowRequestModel, direction="write" + ), + "include_draft": include_draft, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentBranchResponseModel, + construct_type( + type_=CreateAgentBranchResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, agent_id: str, branch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AgentBranchResponse]: + """ + Get information about a single agent branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentBranchResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentBranchResponse, + construct_type( + type_=AgentBranchResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + agent_id: str, + branch_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + is_archived: typing.Optional[bool] = OMIT, + protection_status: typing.Optional[BranchProtectionStatus] = OMIT, + auto_rebase: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentBranchResponse]: + """ + Update agent branch properties such as name, description, archiving status, protection level, and auto-rebase onto main + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the branch. + + name : typing.Optional[str] + New name for the branch. Must be unique within the agent. + + description : typing.Optional[str] + New description for the branch. Pass an empty string to clear it. + + is_archived : typing.Optional[bool] + Whether the branch should be archived + + protection_status : typing.Optional[BranchProtectionStatus] + The protection level for the branch + + auto_rebase : typing.Optional[bool] + When true, rebase this branch onto main automatically after each new main version. Cannot be enabled on the main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentBranchResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}", + method="PATCH", + json={ + "name": name, + "description": description, + "is_archived": is_archived, + "protection_status": protection_status, + "auto_rebase": auto_rebase, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentBranchResponse, + construct_type( + type_=AgentBranchResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def preview_merge( + self, + agent_id: str, + source_branch_id: str, + *, + target_branch_id: str, + force: typing.Optional[bool] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MergePreviewResponseModel]: + """ + Returns the result of merging the source branch into the target branch without performing the merge. Useful for showing an accurate diff before confirming. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Unique identifier for the source branch to merge from. + + target_branch_id : str + The ID of the target branch to merge into. + + force : typing.Optional[bool] + When true, source branch changes always win conflicts regardless of timestamps + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MergePreviewResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(source_branch_id)}/merge-preview", + method="GET", + params={ + "target_branch_id": target_branch_id, + "force": force, + "include_procedure_generated_workflow_elements": include_procedure_generated_workflow_elements, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MergePreviewResponseModel, + construct_type( + type_=MergePreviewResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def merge( + self, + agent_id: str, + source_branch_id: str, + *, + target_branch_id: str, + archive_source_branch: typing.Optional[bool] = OMIT, + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Merge a branch into a target branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Unique identifier for the source branch to merge from. + + target_branch_id : str + The ID of the target branch to merge into. + + archive_source_branch : typing.Optional[bool] + Whether to archive the source branch after merging + + force : typing.Optional[bool] + Force source branch changes onto the target, overriding timestamp-based conflict resolution + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(source_branch_id)}/merge", + method="POST", + params={ + "target_branch_id": target_branch_id, + }, + json={ + "archive_source_branch": archive_source_branch, + "force": force, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def preview_rebase( + self, + agent_id: str, + branch_id: str, + *, + source_branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MergePreviewResponseModel]: + """ + Returns the result of pulling changes from a source branch (defaults to main) into the given branch without performing it, preserving the given branch's own changes. Useful for showing an accurate diff before confirming. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the source branch to merge from. + + source_branch_id : typing.Optional[str] + The ID of the branch to pull changes from. Defaults to the agent's main branch. + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MergePreviewResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/rebase-preview", + method="GET", + params={ + "source_branch_id": source_branch_id, + "include_procedure_generated_workflow_elements": include_procedure_generated_workflow_elements, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MergePreviewResponseModel, + construct_type( + type_=MergePreviewResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def rebase( + self, + agent_id: str, + branch_id: str, + *, + source_branch_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Pull changes from a source branch (defaults to main) into this branch as a new version, preserving this branch's own changes on conflicts. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the source branch to merge from. + + source_branch_id : typing.Optional[str] + The ID of the branch to pull changes from. Defaults to the agent's main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/rebase", + method="POST", + params={ + "source_branch_id": source_branch_id, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawBranchesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + agent_id: str, + *, + include_archived: typing.Optional[bool] = None, + limit: typing.Optional[int] = None, + include_commit_status: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListResponseAgentBranchSummary]: + """ + Returns a list of branches an agent has + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + include_archived : typing.Optional[bool] + Whether archived branches should be included + + limit : typing.Optional[int] + How many results at most should be returned + + include_commit_status : typing.Optional[bool] + Whether to compute how far each branch has diverged from main (commits_ahead/commits_behind). This walks the version DAG of every branch, so it is slow on agents with long histories and is off by default, leaving those fields null. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListResponseAgentBranchSummary] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches", + method="GET", + params={ + "include_archived": include_archived, + "limit": limit, + "include_commit_status": include_commit_status, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListResponseAgentBranchSummary, + construct_type( + type_=ListResponseAgentBranchSummary, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + agent_id: str, + *, + parent_version_id: str, + name: str, + description: str, + conversation_config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + platform_settings: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + include_draft: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateAgentBranchResponseModel]: + """ + Create a new branch from a given version of any branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + parent_version_id : str + ID of the version to branch from + + name : str + Name of the branch. It is unique within the agent. + + description : str + Description for the branch + + conversation_config : typing.Optional[typing.Dict[str, typing.Any]] + Changes to apply to conversation config + + platform_settings : typing.Optional[typing.Dict[str, typing.Any]] + Changes to apply to platform settings + + workflow : typing.Optional[AgentWorkflowRequestModel] + Updated workflow definition + + include_draft : typing.Optional[bool] + When true, the new branch uses the caller's draft procedure set instead of the branch tip. Requires parent_version_id to be the branch tip. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateAgentBranchResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches", + method="POST", + json={ + "parent_version_id": parent_version_id, + "name": name, + "description": description, + "conversation_config": conversation_config, + "platform_settings": platform_settings, + "workflow": convert_and_respect_annotation_metadata( + object_=workflow, annotation=AgentWorkflowRequestModel, direction="write" + ), + "include_draft": include_draft, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentBranchResponseModel, + construct_type( + type_=CreateAgentBranchResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, agent_id: str, branch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AgentBranchResponse]: + """ + Get information about a single agent branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentBranchResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentBranchResponse, + construct_type( + type_=AgentBranchResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + agent_id: str, + branch_id: str, + *, + name: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + is_archived: typing.Optional[bool] = OMIT, + protection_status: typing.Optional[BranchProtectionStatus] = OMIT, + auto_rebase: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentBranchResponse]: + """ + Update agent branch properties such as name, description, archiving status, protection level, and auto-rebase onto main + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the branch. + + name : typing.Optional[str] + New name for the branch. Must be unique within the agent. + + description : typing.Optional[str] + New description for the branch. Pass an empty string to clear it. + + is_archived : typing.Optional[bool] + Whether the branch should be archived + + protection_status : typing.Optional[BranchProtectionStatus] + The protection level for the branch + + auto_rebase : typing.Optional[bool] + When true, rebase this branch onto main automatically after each new main version. Cannot be enabled on the main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentBranchResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}", + method="PATCH", + json={ + "name": name, + "description": description, + "is_archived": is_archived, + "protection_status": protection_status, + "auto_rebase": auto_rebase, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentBranchResponse, + construct_type( + type_=AgentBranchResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def preview_merge( + self, + agent_id: str, + source_branch_id: str, + *, + target_branch_id: str, + force: typing.Optional[bool] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MergePreviewResponseModel]: + """ + Returns the result of merging the source branch into the target branch without performing the merge. Useful for showing an accurate diff before confirming. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Unique identifier for the source branch to merge from. + + target_branch_id : str + The ID of the target branch to merge into. + + force : typing.Optional[bool] + When true, source branch changes always win conflicts regardless of timestamps + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MergePreviewResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(source_branch_id)}/merge-preview", + method="GET", + params={ + "target_branch_id": target_branch_id, + "force": force, + "include_procedure_generated_workflow_elements": include_procedure_generated_workflow_elements, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MergePreviewResponseModel, + construct_type( + type_=MergePreviewResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def merge( + self, + agent_id: str, + source_branch_id: str, + *, + target_branch_id: str, + archive_source_branch: typing.Optional[bool] = OMIT, + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Merge a branch into a target branch + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Unique identifier for the source branch to merge from. + + target_branch_id : str + The ID of the target branch to merge into. + + archive_source_branch : typing.Optional[bool] + Whether to archive the source branch after merging + + force : typing.Optional[bool] + Force source branch changes onto the target, overriding timestamp-based conflict resolution + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(source_branch_id)}/merge", + method="POST", + params={ + "target_branch_id": target_branch_id, + }, + json={ + "archive_source_branch": archive_source_branch, + "force": force, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def preview_rebase( + self, + agent_id: str, + branch_id: str, + *, + source_branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MergePreviewResponseModel]: + """ + Returns the result of pulling changes from a source branch (defaults to main) into the given branch without performing it, preserving the given branch's own changes. Useful for showing an accurate diff before confirming. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the source branch to merge from. + + source_branch_id : typing.Optional[str] + The ID of the branch to pull changes from. Defaults to the agent's main branch. + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MergePreviewResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/rebase-preview", + method="GET", + params={ + "source_branch_id": source_branch_id, + "include_procedure_generated_workflow_elements": include_procedure_generated_workflow_elements, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MergePreviewResponseModel, + construct_type( + type_=MergePreviewResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def rebase( + self, + agent_id: str, + branch_id: str, + *, + source_branch_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Pull changes from a source branch (defaults to main) into this branch as a new version, preserving this branch's own changes on conflicts. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + Unique identifier for the source branch to merge from. + + source_branch_id : typing.Optional[str] + The ID of the branch to pull changes from. Defaults to the agent's main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/rebase", + method="POST", + params={ + "source_branch_id": source_branch_id, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/client.py b/data/src/elevenlabs/conversational_ai/agents/client.py new file mode 100644 index 0000000000000000000000000000000000000000..54b941f0df1c0972db4bd678478e0f202eaa6131 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/client.py @@ -0,0 +1,1510 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.adhoc_agent_config_override_for_test_request_model import AdhocAgentConfigOverrideForTestRequestModel +from ...types.agent_platform_settings_request_model import AgentPlatformSettingsRequestModel +from ...types.agent_simulated_chat_test_response_model import AgentSimulatedChatTestResponseModel +from ...types.agent_sort_by import AgentSortBy +from ...types.agent_workflow_request_model import AgentWorkflowRequestModel +from ...types.conversation_simulation_specification import ConversationSimulationSpecification +from ...types.conversational_config import ConversationalConfig +from ...types.create_agent_response_model import CreateAgentResponseModel +from ...types.get_agent_response_model import GetAgentResponseModel +from ...types.get_agents_page_response_model import GetAgentsPageResponseModel +from ...types.get_test_suite_invocation_response_model import GetTestSuiteInvocationResponseModel +from ...types.procedure_version_ref import ProcedureVersionRef +from ...types.prompt_evaluation_criteria import PromptEvaluationCriteria +from ...types.single_test_run_request_model import SingleTestRunRequestModel +from ...types.sort_direction import SortDirection +from .raw_client import AsyncRawAgentsClient, RawAgentsClient + +if typing.TYPE_CHECKING: + from .branches.client import AsyncBranchesClient, BranchesClient + from .deployments.client import AsyncDeploymentsClient, DeploymentsClient + from .drafts.client import AsyncDraftsClient, DraftsClient + from .hold_audio.client import AsyncHoldAudioClient, HoldAudioClient + from .knowledge_base.client import AsyncKnowledgeBaseClient, KnowledgeBaseClient + from .link.client import AsyncLinkClient, LinkClient + from .llm_usage.client import AsyncLlmUsageClient, LlmUsageClient + from .merge_proposals.client import AsyncMergeProposalsClient, MergeProposalsClient + from .procedures.client import AsyncProceduresClient, ProceduresClient + from .summaries.client import AsyncSummariesClient, SummariesClient + from .versions.client import AsyncVersionsClient, VersionsClient + from .widget.client import AsyncWidgetClient, WidgetClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AgentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAgentsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._summaries: typing.Optional[SummariesClient] = None + self._widget: typing.Optional[WidgetClient] = None + self._link: typing.Optional[LinkClient] = None + self._hold_audio: typing.Optional[HoldAudioClient] = None + self._knowledge_base: typing.Optional[KnowledgeBaseClient] = None + self._llm_usage: typing.Optional[LlmUsageClient] = None + self._branches: typing.Optional[BranchesClient] = None + self._versions: typing.Optional[VersionsClient] = None + self._deployments: typing.Optional[DeploymentsClient] = None + self._drafts: typing.Optional[DraftsClient] = None + self._merge_proposals: typing.Optional[MergeProposalsClient] = None + self._procedures: typing.Optional[ProceduresClient] = None + + @property + def with_raw_response(self) -> RawAgentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAgentsClient + """ + return self._raw_client + + def create( + self, + *, + conversation_config: ConversationalConfig, + enable_versioning: typing.Optional[bool] = None, + platform_settings: typing.Optional[AgentPlatformSettingsRequestModel] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentResponseModel: + """ + Create an agent from a config object + + Parameters + ---------- + conversation_config : ConversationalConfig + Conversation configuration for an agent + + enable_versioning : typing.Optional[bool] + Deprecated: all agents are versioned. This parameter is ignored. + + platform_settings : typing.Optional[AgentPlatformSettingsRequestModel] + Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + + workflow : typing.Optional[AgentWorkflowRequestModel] + Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + + name : typing.Optional[str] + A name to make the agent easier to find + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ConversationalConfig, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.create( + enable_versioning=True, + conversation_config=ConversationalConfig(), + ) + """ + _response = self._raw_client.create( + conversation_config=conversation_config, + enable_versioning=enable_versioning, + platform_settings=platform_settings, + workflow=workflow, + name=name, + tags=tags, + request_options=request_options, + ) + return _response.data + + def get( + self, + agent_id: str, + *, + version_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentResponseModel: + """ + Retrieve config for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + version_id : typing.Optional[str] + The ID of the agent version to use + + branch_id : typing.Optional[str] + The ID of the branch to use + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + version_id="version_id", + branch_id="branch_id", + include_procedure_generated_workflow_elements=True, + ) + """ + _response = self._raw_client.get( + agent_id, + version_id=version_id, + branch_id=branch_id, + include_procedure_generated_workflow_elements=include_procedure_generated_workflow_elements, + request_options=request_options, + ) + return _response.data + + def delete( + self, + agent_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Delete an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + force : typing.Optional[bool] + If set to true, the agent is deleted even if other agents use it as a subagent, and it is removed from those agents and their branches. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + force=True, + ) + """ + _response = self._raw_client.delete(agent_id, force=force, request_options=request_options) + return _response.data + + def update( + self, + agent_id: str, + *, + enable_versioning_if_not_enabled: typing.Optional[bool] = None, + branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + conversation_config: typing.Optional[ConversationalConfig] = OMIT, + platform_settings: typing.Optional[AgentPlatformSettingsRequestModel] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + version_description: typing.Optional[str] = OMIT, + procedures: typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentResponseModel: + """ + Patches an Agent settings + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + enable_versioning_if_not_enabled : typing.Optional[bool] + Deprecated: all agents are versioned. This parameter is ignored. + + branch_id : typing.Optional[str] + The ID of the branch to use + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + conversation_config : typing.Optional[ConversationalConfig] + Conversation configuration for an agent + + platform_settings : typing.Optional[AgentPlatformSettingsRequestModel] + Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + + workflow : typing.Optional[AgentWorkflowRequestModel] + Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + + name : typing.Optional[str] + A name to make the agent easier to find + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + version_description : typing.Optional[str] + Description for this version when publishing changes (only applicable for versioned agents) + + procedures : typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]] + Procedure versions to publish, keyed by procedure_id. When provided, this map replaces the procedures from the current draft or branch tip. When omitted or null, unpublished procedure edits are used if present; otherwise, the branch tip's procedures are retained. Pass an empty object to remove all procedures. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + enable_versioning_if_not_enabled=True, + branch_id="branch_id", + include_procedure_generated_workflow_elements=True, + ) + """ + _response = self._raw_client.update( + agent_id, + enable_versioning_if_not_enabled=enable_versioning_if_not_enabled, + branch_id=branch_id, + include_procedure_generated_workflow_elements=include_procedure_generated_workflow_elements, + conversation_config=conversation_config, + platform_settings=platform_settings, + workflow=workflow, + name=name, + tags=tags, + version_description=version_description, + procedures=procedures, + request_options=request_options, + ) + return _response.data + + def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + archived: typing.Optional[bool] = None, + show_only_owned_agents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[AgentSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentsPageResponseModel: + """ + Returns a list of your agents and their metadata. + + Parameters + ---------- + page_size : typing.Optional[int] + How many Agents to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search by agents name. + + archived : typing.Optional[bool] + Filter agents by archived status + + show_only_owned_agents : typing.Optional[bool] + If set to true, the endpoint will omit any agents that were shared with you by someone else and include only the ones you own. Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter agents by creator user ID. When set, only agents created by this user are returned. Takes precedence over show_only_owned_agents. Use '@me' to refer to the authenticated user. + + tags : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter agents by tag. Repeat the parameter to match any of several tags. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[AgentSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentsPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.list( + page_size=1, + search="search", + archived=True, + show_only_owned_agents=True, + created_by_user_id="created_by_user_id", + tags=["tags"], + sort_direction="asc", + sort_by="name", + cursor="cursor", + ) + """ + _response = self._raw_client.list( + page_size=page_size, + search=search, + archived=archived, + show_only_owned_agents=show_only_owned_agents, + created_by_user_id=created_by_user_id, + tags=tags, + sort_direction=sort_direction, + sort_by=sort_by, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def duplicate( + self, + agent_id: str, + *, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentResponseModel: + """ + Create a new agent by duplicating an existing one. The new agent gets a copy of every unarchived branch of the source agent, each with the same name and description and starting from the latest version on that branch. Version history, drafts, archived branches and traffic deployments are not copied, so the new agent routes all traffic to its main branch. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + name : typing.Optional[str] + A name to make the agent easier to find + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.duplicate( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + """ + _response = self._raw_client.duplicate(agent_id, name=name, request_options=request_options) + return _response.data + + def simulate_conversation( + self, + agent_id: str, + *, + simulation_specification: ConversationSimulationSpecification, + extra_evaluation_criteria: typing.Optional[typing.Sequence[PromptEvaluationCriteria]] = OMIT, + new_turns_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentSimulatedChatTestResponseModel: + """ + Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + simulation_specification : ConversationSimulationSpecification + A specification detailing how the conversation should be simulated + + extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]] + A list of evaluation criteria to test + + new_turns_limit : typing.Optional[int] + Maximum number of new turns to generate in the conversation simulation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentSimulatedChatTestResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ( + AgentConfig, + ConversationSimulationSpecification, + ElevenLabs, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.simulate_conversation( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + simulation_specification=ConversationSimulationSpecification( + simulated_user_config=AgentConfig( + first_message="Hello, how can I help you today?", + language="en", + disable_first_message_interruptions=False, + ), + ), + ) + """ + _response = self._raw_client.simulate_conversation( + agent_id, + simulation_specification=simulation_specification, + extra_evaluation_criteria=extra_evaluation_criteria, + new_turns_limit=new_turns_limit, + request_options=request_options, + ) + return _response.data + + def simulate_conversation_stream( + self, + agent_id: str, + *, + simulation_specification: ConversationSimulationSpecification, + extra_evaluation_criteria: typing.Optional[typing.Sequence[PromptEvaluationCriteria]] = OMIT, + new_turns_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user and stream back the response. Response is streamed back as partial lists of messages that should be concatenated and once the conversation has complete a single final message with the conversation analysis will be sent. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + simulation_specification : ConversationSimulationSpecification + A specification detailing how the conversation should be simulated + + extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]] + A list of evaluation criteria to test + + new_turns_limit : typing.Optional[int] + Maximum number of new turns to generate in the conversation simulation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ( + AgentConfig, + ConversationSimulationSpecification, + ElevenLabs, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.simulate_conversation_stream( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + simulation_specification=ConversationSimulationSpecification( + simulated_user_config=AgentConfig( + first_message="Hello, how can I help you today?", + language="en", + disable_first_message_interruptions=False, + ), + ), + ) + """ + _response = self._raw_client.simulate_conversation_stream( + agent_id, + simulation_specification=simulation_specification, + extra_evaluation_criteria=extra_evaluation_criteria, + new_turns_limit=new_turns_limit, + request_options=request_options, + ) + return _response.data + + def run_tests( + self, + agent_id: str, + *, + tests: typing.Sequence[SingleTestRunRequestModel], + agent_config_override: typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] = OMIT, + branch_id: typing.Optional[str] = OMIT, + repeat_count: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetTestSuiteInvocationResponseModel: + """ + Run selected tests on the agent with provided configuration. If the agent configuration is provided, it will be used to override default agent configuration. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + tests : typing.Sequence[SingleTestRunRequestModel] + List of tests to run on the agent + + agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] + Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + + branch_id : typing.Optional[str] + ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + + repeat_count : typing.Optional[int] + Number of times to run each test. When greater than 1, results are grouped and summarized. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestSuiteInvocationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, SingleTestRunRequestModel + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.run_tests( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + tests=[ + SingleTestRunRequestModel( + test_id="test_id", + ) + ], + ) + """ + _response = self._raw_client.run_tests( + agent_id, + tests=tests, + agent_config_override=agent_config_override, + branch_id=branch_id, + repeat_count=repeat_count, + request_options=request_options, + ) + return _response.data + + @property + def summaries(self): + if self._summaries is None: + from .summaries.client import SummariesClient # noqa: E402 + + self._summaries = SummariesClient(client_wrapper=self._client_wrapper) + return self._summaries + + @property + def widget(self): + if self._widget is None: + from .widget.client import WidgetClient # noqa: E402 + + self._widget = WidgetClient(client_wrapper=self._client_wrapper) + return self._widget + + @property + def link(self): + if self._link is None: + from .link.client import LinkClient # noqa: E402 + + self._link = LinkClient(client_wrapper=self._client_wrapper) + return self._link + + @property + def hold_audio(self): + if self._hold_audio is None: + from .hold_audio.client import HoldAudioClient # noqa: E402 + + self._hold_audio = HoldAudioClient(client_wrapper=self._client_wrapper) + return self._hold_audio + + @property + def knowledge_base(self): + if self._knowledge_base is None: + from .knowledge_base.client import KnowledgeBaseClient # noqa: E402 + + self._knowledge_base = KnowledgeBaseClient(client_wrapper=self._client_wrapper) + return self._knowledge_base + + @property + def llm_usage(self): + if self._llm_usage is None: + from .llm_usage.client import LlmUsageClient # noqa: E402 + + self._llm_usage = LlmUsageClient(client_wrapper=self._client_wrapper) + return self._llm_usage + + @property + def branches(self): + if self._branches is None: + from .branches.client import BranchesClient # noqa: E402 + + self._branches = BranchesClient(client_wrapper=self._client_wrapper) + return self._branches + + @property + def versions(self): + if self._versions is None: + from .versions.client import VersionsClient # noqa: E402 + + self._versions = VersionsClient(client_wrapper=self._client_wrapper) + return self._versions + + @property + def deployments(self): + if self._deployments is None: + from .deployments.client import DeploymentsClient # noqa: E402 + + self._deployments = DeploymentsClient(client_wrapper=self._client_wrapper) + return self._deployments + + @property + def drafts(self): + if self._drafts is None: + from .drafts.client import DraftsClient # noqa: E402 + + self._drafts = DraftsClient(client_wrapper=self._client_wrapper) + return self._drafts + + @property + def merge_proposals(self): + if self._merge_proposals is None: + from .merge_proposals.client import MergeProposalsClient # noqa: E402 + + self._merge_proposals = MergeProposalsClient(client_wrapper=self._client_wrapper) + return self._merge_proposals + + @property + def procedures(self): + if self._procedures is None: + from .procedures.client import ProceduresClient # noqa: E402 + + self._procedures = ProceduresClient(client_wrapper=self._client_wrapper) + return self._procedures + + +class AsyncAgentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAgentsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._summaries: typing.Optional[AsyncSummariesClient] = None + self._widget: typing.Optional[AsyncWidgetClient] = None + self._link: typing.Optional[AsyncLinkClient] = None + self._hold_audio: typing.Optional[AsyncHoldAudioClient] = None + self._knowledge_base: typing.Optional[AsyncKnowledgeBaseClient] = None + self._llm_usage: typing.Optional[AsyncLlmUsageClient] = None + self._branches: typing.Optional[AsyncBranchesClient] = None + self._versions: typing.Optional[AsyncVersionsClient] = None + self._deployments: typing.Optional[AsyncDeploymentsClient] = None + self._drafts: typing.Optional[AsyncDraftsClient] = None + self._merge_proposals: typing.Optional[AsyncMergeProposalsClient] = None + self._procedures: typing.Optional[AsyncProceduresClient] = None + + @property + def with_raw_response(self) -> AsyncRawAgentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAgentsClient + """ + return self._raw_client + + async def create( + self, + *, + conversation_config: ConversationalConfig, + enable_versioning: typing.Optional[bool] = None, + platform_settings: typing.Optional[AgentPlatformSettingsRequestModel] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentResponseModel: + """ + Create an agent from a config object + + Parameters + ---------- + conversation_config : ConversationalConfig + Conversation configuration for an agent + + enable_versioning : typing.Optional[bool] + Deprecated: all agents are versioned. This parameter is ignored. + + platform_settings : typing.Optional[AgentPlatformSettingsRequestModel] + Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + + workflow : typing.Optional[AgentWorkflowRequestModel] + Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + + name : typing.Optional[str] + A name to make the agent easier to find + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, ConversationalConfig + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.create( + enable_versioning=True, + conversation_config=ConversationalConfig(), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + conversation_config=conversation_config, + enable_versioning=enable_versioning, + platform_settings=platform_settings, + workflow=workflow, + name=name, + tags=tags, + request_options=request_options, + ) + return _response.data + + async def get( + self, + agent_id: str, + *, + version_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentResponseModel: + """ + Retrieve config for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + version_id : typing.Optional[str] + The ID of the agent version to use + + branch_id : typing.Optional[str] + The ID of the branch to use + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + version_id="version_id", + branch_id="branch_id", + include_procedure_generated_workflow_elements=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + agent_id, + version_id=version_id, + branch_id=branch_id, + include_procedure_generated_workflow_elements=include_procedure_generated_workflow_elements, + request_options=request_options, + ) + return _response.data + + async def delete( + self, + agent_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Delete an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + force : typing.Optional[bool] + If set to true, the agent is deleted even if other agents use it as a subagent, and it is removed from those agents and their branches. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + force=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(agent_id, force=force, request_options=request_options) + return _response.data + + async def update( + self, + agent_id: str, + *, + enable_versioning_if_not_enabled: typing.Optional[bool] = None, + branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + conversation_config: typing.Optional[ConversationalConfig] = OMIT, + platform_settings: typing.Optional[AgentPlatformSettingsRequestModel] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + version_description: typing.Optional[str] = OMIT, + procedures: typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentResponseModel: + """ + Patches an Agent settings + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + enable_versioning_if_not_enabled : typing.Optional[bool] + Deprecated: all agents are versioned. This parameter is ignored. + + branch_id : typing.Optional[str] + The ID of the branch to use + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + conversation_config : typing.Optional[ConversationalConfig] + Conversation configuration for an agent + + platform_settings : typing.Optional[AgentPlatformSettingsRequestModel] + Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + + workflow : typing.Optional[AgentWorkflowRequestModel] + Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + + name : typing.Optional[str] + A name to make the agent easier to find + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + version_description : typing.Optional[str] + Description for this version when publishing changes (only applicable for versioned agents) + + procedures : typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]] + Procedure versions to publish, keyed by procedure_id. When provided, this map replaces the procedures from the current draft or branch tip. When omitted or null, unpublished procedure edits are used if present; otherwise, the branch tip's procedures are retained. Pass an empty object to remove all procedures. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + enable_versioning_if_not_enabled=True, + branch_id="branch_id", + include_procedure_generated_workflow_elements=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + agent_id, + enable_versioning_if_not_enabled=enable_versioning_if_not_enabled, + branch_id=branch_id, + include_procedure_generated_workflow_elements=include_procedure_generated_workflow_elements, + conversation_config=conversation_config, + platform_settings=platform_settings, + workflow=workflow, + name=name, + tags=tags, + version_description=version_description, + procedures=procedures, + request_options=request_options, + ) + return _response.data + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + archived: typing.Optional[bool] = None, + show_only_owned_agents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[AgentSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentsPageResponseModel: + """ + Returns a list of your agents and their metadata. + + Parameters + ---------- + page_size : typing.Optional[int] + How many Agents to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search by agents name. + + archived : typing.Optional[bool] + Filter agents by archived status + + show_only_owned_agents : typing.Optional[bool] + If set to true, the endpoint will omit any agents that were shared with you by someone else and include only the ones you own. Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter agents by creator user ID. When set, only agents created by this user are returned. Takes precedence over show_only_owned_agents. Use '@me' to refer to the authenticated user. + + tags : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter agents by tag. Repeat the parameter to match any of several tags. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[AgentSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentsPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.list( + page_size=1, + search="search", + archived=True, + show_only_owned_agents=True, + created_by_user_id="created_by_user_id", + tags=["tags"], + sort_direction="asc", + sort_by="name", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + page_size=page_size, + search=search, + archived=archived, + show_only_owned_agents=show_only_owned_agents, + created_by_user_id=created_by_user_id, + tags=tags, + sort_direction=sort_direction, + sort_by=sort_by, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def duplicate( + self, + agent_id: str, + *, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentResponseModel: + """ + Create a new agent by duplicating an existing one. The new agent gets a copy of every unarchived branch of the source agent, each with the same name and description and starting from the latest version on that branch. Version history, drafts, archived branches and traffic deployments are not copied, so the new agent routes all traffic to its main branch. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + name : typing.Optional[str] + A name to make the agent easier to find + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.duplicate( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.duplicate(agent_id, name=name, request_options=request_options) + return _response.data + + async def simulate_conversation( + self, + agent_id: str, + *, + simulation_specification: ConversationSimulationSpecification, + extra_evaluation_criteria: typing.Optional[typing.Sequence[PromptEvaluationCriteria]] = OMIT, + new_turns_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentSimulatedChatTestResponseModel: + """ + Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + simulation_specification : ConversationSimulationSpecification + A specification detailing how the conversation should be simulated + + extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]] + A list of evaluation criteria to test + + new_turns_limit : typing.Optional[int] + Maximum number of new turns to generate in the conversation simulation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentSimulatedChatTestResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AgentConfig, + AsyncElevenLabs, + ConversationSimulationSpecification, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.simulate_conversation( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + simulation_specification=ConversationSimulationSpecification( + simulated_user_config=AgentConfig( + first_message="Hello, how can I help you today?", + language="en", + disable_first_message_interruptions=False, + ), + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.simulate_conversation( + agent_id, + simulation_specification=simulation_specification, + extra_evaluation_criteria=extra_evaluation_criteria, + new_turns_limit=new_turns_limit, + request_options=request_options, + ) + return _response.data + + async def simulate_conversation_stream( + self, + agent_id: str, + *, + simulation_specification: ConversationSimulationSpecification, + extra_evaluation_criteria: typing.Optional[typing.Sequence[PromptEvaluationCriteria]] = OMIT, + new_turns_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user and stream back the response. Response is streamed back as partial lists of messages that should be concatenated and once the conversation has complete a single final message with the conversation analysis will be sent. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + simulation_specification : ConversationSimulationSpecification + A specification detailing how the conversation should be simulated + + extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]] + A list of evaluation criteria to test + + new_turns_limit : typing.Optional[int] + Maximum number of new turns to generate in the conversation simulation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import ( + AgentConfig, + AsyncElevenLabs, + ConversationSimulationSpecification, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.simulate_conversation_stream( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + simulation_specification=ConversationSimulationSpecification( + simulated_user_config=AgentConfig( + first_message="Hello, how can I help you today?", + language="en", + disable_first_message_interruptions=False, + ), + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.simulate_conversation_stream( + agent_id, + simulation_specification=simulation_specification, + extra_evaluation_criteria=extra_evaluation_criteria, + new_turns_limit=new_turns_limit, + request_options=request_options, + ) + return _response.data + + async def run_tests( + self, + agent_id: str, + *, + tests: typing.Sequence[SingleTestRunRequestModel], + agent_config_override: typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] = OMIT, + branch_id: typing.Optional[str] = OMIT, + repeat_count: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetTestSuiteInvocationResponseModel: + """ + Run selected tests on the agent with provided configuration. If the agent configuration is provided, it will be used to override default agent configuration. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + tests : typing.Sequence[SingleTestRunRequestModel] + List of tests to run on the agent + + agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] + Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + + branch_id : typing.Optional[str] + ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + + repeat_count : typing.Optional[int] + Number of times to run each test. When greater than 1, results are grouped and summarized. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestSuiteInvocationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, SingleTestRunRequestModel + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.run_tests( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + tests=[ + SingleTestRunRequestModel( + test_id="test_id", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.run_tests( + agent_id, + tests=tests, + agent_config_override=agent_config_override, + branch_id=branch_id, + repeat_count=repeat_count, + request_options=request_options, + ) + return _response.data + + @property + def summaries(self): + if self._summaries is None: + from .summaries.client import AsyncSummariesClient # noqa: E402 + + self._summaries = AsyncSummariesClient(client_wrapper=self._client_wrapper) + return self._summaries + + @property + def widget(self): + if self._widget is None: + from .widget.client import AsyncWidgetClient # noqa: E402 + + self._widget = AsyncWidgetClient(client_wrapper=self._client_wrapper) + return self._widget + + @property + def link(self): + if self._link is None: + from .link.client import AsyncLinkClient # noqa: E402 + + self._link = AsyncLinkClient(client_wrapper=self._client_wrapper) + return self._link + + @property + def hold_audio(self): + if self._hold_audio is None: + from .hold_audio.client import AsyncHoldAudioClient # noqa: E402 + + self._hold_audio = AsyncHoldAudioClient(client_wrapper=self._client_wrapper) + return self._hold_audio + + @property + def knowledge_base(self): + if self._knowledge_base is None: + from .knowledge_base.client import AsyncKnowledgeBaseClient # noqa: E402 + + self._knowledge_base = AsyncKnowledgeBaseClient(client_wrapper=self._client_wrapper) + return self._knowledge_base + + @property + def llm_usage(self): + if self._llm_usage is None: + from .llm_usage.client import AsyncLlmUsageClient # noqa: E402 + + self._llm_usage = AsyncLlmUsageClient(client_wrapper=self._client_wrapper) + return self._llm_usage + + @property + def branches(self): + if self._branches is None: + from .branches.client import AsyncBranchesClient # noqa: E402 + + self._branches = AsyncBranchesClient(client_wrapper=self._client_wrapper) + return self._branches + + @property + def versions(self): + if self._versions is None: + from .versions.client import AsyncVersionsClient # noqa: E402 + + self._versions = AsyncVersionsClient(client_wrapper=self._client_wrapper) + return self._versions + + @property + def deployments(self): + if self._deployments is None: + from .deployments.client import AsyncDeploymentsClient # noqa: E402 + + self._deployments = AsyncDeploymentsClient(client_wrapper=self._client_wrapper) + return self._deployments + + @property + def drafts(self): + if self._drafts is None: + from .drafts.client import AsyncDraftsClient # noqa: E402 + + self._drafts = AsyncDraftsClient(client_wrapper=self._client_wrapper) + return self._drafts + + @property + def merge_proposals(self): + if self._merge_proposals is None: + from .merge_proposals.client import AsyncMergeProposalsClient # noqa: E402 + + self._merge_proposals = AsyncMergeProposalsClient(client_wrapper=self._client_wrapper) + return self._merge_proposals + + @property + def procedures(self): + if self._procedures is None: + from .procedures.client import AsyncProceduresClient # noqa: E402 + + self._procedures = AsyncProceduresClient(client_wrapper=self._client_wrapper) + return self._procedures diff --git a/data/src/elevenlabs/conversational_ai/agents/deployments/__init__.py b/data/src/elevenlabs/conversational_ai/agents/deployments/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/deployments/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/deployments/client.py b/data/src/elevenlabs/conversational_ai/agents/deployments/client.py new file mode 100644 index 0000000000000000000000000000000000000000..4096417ed08817dcfcaa5dc1e55e699d00051d6f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/deployments/client.py @@ -0,0 +1,269 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.agent_deployment_request import AgentDeploymentRequest +from ....types.agent_deployment_response import AgentDeploymentResponse +from ....types.list_response_agent_deployment_history_item import ListResponseAgentDeploymentHistoryItem +from .raw_client import AsyncRawDeploymentsClient, RawDeploymentsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class DeploymentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawDeploymentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawDeploymentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawDeploymentsClient + """ + return self._raw_client + + def list( + self, + agent_id: str, + *, + page: typing.Optional[int] = None, + page_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListResponseAgentDeploymentHistoryItem: + """ + List the traffic split history of an agent, newest first + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + page : typing.Optional[int] + Page number, starting at 1 + + page_size : typing.Optional[int] + How many results at most should be returned + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListResponseAgentDeploymentHistoryItem + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.deployments.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + page=1, + page_size=1, + ) + """ + _response = self._raw_client.list(agent_id, page=page, page_size=page_size, request_options=request_options) + return _response.data + + def create( + self, + agent_id: str, + *, + deployment_request: AgentDeploymentRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentDeploymentResponse: + """ + Create a new deployment for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + deployment_request : AgentDeploymentRequest + Request to create a new deployment + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentDeploymentResponse + Successful Response + + Examples + -------- + from elevenlabs import ( + AgentDeploymentPercentageStrategy, + AgentDeploymentRequest, + AgentDeploymentRequestItem, + ElevenLabs, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.deployments.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + deployment_request=AgentDeploymentRequest( + requests=[ + AgentDeploymentRequestItem( + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + deployment_strategy=AgentDeploymentPercentageStrategy( + traffic_percentage=0.5, + ), + ) + ], + ), + ) + """ + _response = self._raw_client.create( + agent_id, deployment_request=deployment_request, request_options=request_options + ) + return _response.data + + +class AsyncDeploymentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawDeploymentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawDeploymentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawDeploymentsClient + """ + return self._raw_client + + async def list( + self, + agent_id: str, + *, + page: typing.Optional[int] = None, + page_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListResponseAgentDeploymentHistoryItem: + """ + List the traffic split history of an agent, newest first + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + page : typing.Optional[int] + Page number, starting at 1 + + page_size : typing.Optional[int] + How many results at most should be returned + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListResponseAgentDeploymentHistoryItem + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.deployments.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + page=1, + page_size=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + agent_id, page=page, page_size=page_size, request_options=request_options + ) + return _response.data + + async def create( + self, + agent_id: str, + *, + deployment_request: AgentDeploymentRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentDeploymentResponse: + """ + Create a new deployment for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + deployment_request : AgentDeploymentRequest + Request to create a new deployment + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentDeploymentResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AgentDeploymentPercentageStrategy, + AgentDeploymentRequest, + AgentDeploymentRequestItem, + AsyncElevenLabs, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.deployments.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + deployment_request=AgentDeploymentRequest( + requests=[ + AgentDeploymentRequestItem( + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + deployment_strategy=AgentDeploymentPercentageStrategy( + traffic_percentage=0.5, + ), + ) + ], + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + agent_id, deployment_request=deployment_request, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/deployments/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/deployments/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..798a3b7dacfcba0a30a59973123e0c4f97ff265f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/deployments/raw_client.py @@ -0,0 +1,309 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.agent_deployment_request import AgentDeploymentRequest +from ....types.agent_deployment_response import AgentDeploymentResponse +from ....types.list_response_agent_deployment_history_item import ListResponseAgentDeploymentHistoryItem +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawDeploymentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + agent_id: str, + *, + page: typing.Optional[int] = None, + page_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListResponseAgentDeploymentHistoryItem]: + """ + List the traffic split history of an agent, newest first + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + page : typing.Optional[int] + Page number, starting at 1 + + page_size : typing.Optional[int] + How many results at most should be returned + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListResponseAgentDeploymentHistoryItem] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/deployments", + method="GET", + params={ + "page": page, + "page_size": page_size, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListResponseAgentDeploymentHistoryItem, + construct_type( + type_=ListResponseAgentDeploymentHistoryItem, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + agent_id: str, + *, + deployment_request: AgentDeploymentRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentDeploymentResponse]: + """ + Create a new deployment for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + deployment_request : AgentDeploymentRequest + Request to create a new deployment + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentDeploymentResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/deployments", + method="POST", + json={ + "deployment_request": convert_and_respect_annotation_metadata( + object_=deployment_request, annotation=AgentDeploymentRequest, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentDeploymentResponse, + construct_type( + type_=AgentDeploymentResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawDeploymentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + agent_id: str, + *, + page: typing.Optional[int] = None, + page_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListResponseAgentDeploymentHistoryItem]: + """ + List the traffic split history of an agent, newest first + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + page : typing.Optional[int] + Page number, starting at 1 + + page_size : typing.Optional[int] + How many results at most should be returned + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListResponseAgentDeploymentHistoryItem] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/deployments", + method="GET", + params={ + "page": page, + "page_size": page_size, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListResponseAgentDeploymentHistoryItem, + construct_type( + type_=ListResponseAgentDeploymentHistoryItem, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + agent_id: str, + *, + deployment_request: AgentDeploymentRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentDeploymentResponse]: + """ + Create a new deployment for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + deployment_request : AgentDeploymentRequest + Request to create a new deployment + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentDeploymentResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/deployments", + method="POST", + json={ + "deployment_request": convert_and_respect_annotation_metadata( + object_=deployment_request, annotation=AgentDeploymentRequest, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentDeploymentResponse, + construct_type( + type_=AgentDeploymentResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/drafts/__init__.py b/data/src/elevenlabs/conversational_ai/agents/drafts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/drafts/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/drafts/client.py b/data/src/elevenlabs/conversational_ai/agents/drafts/client.py new file mode 100644 index 0000000000000000000000000000000000000000..c33277b9c9860040a960a5ca19bde0a943830786 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/drafts/client.py @@ -0,0 +1,467 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.agent_workflow_request_model import AgentWorkflowRequestModel +from .raw_client import AsyncRawDraftsClient, RawDraftsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class DraftsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawDraftsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawDraftsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawDraftsClient + """ + return self._raw_client + + def create( + self, + agent_id: str, + *, + branch_id: str, + conversation_config: typing.Dict[str, typing.Any], + platform_settings: typing.Dict[str, typing.Any], + workflow: AgentWorkflowRequestModel, + name: str, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Create a new draft for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + The ID of the agent branch to use + + conversation_config : typing.Dict[str, typing.Any] + Conversation config for the draft + + platform_settings : typing.Dict[str, typing.Any] + Platform settings for the draft + + workflow : AgentWorkflowRequestModel + Workflow for the draft + + name : str + Name for the draft + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ( + AgentWorkflowRequestModel, + AgentWorkflowRequestModelNodesValue_End, + AstNodeInput_AndOperator, + ElevenLabs, + WorkflowEdgeModelInput, + WorkflowEdgeModelInputForwardCondition_Expression, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.drafts.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + conversation_config={"key": "value"}, + platform_settings={"key": "value"}, + workflow=AgentWorkflowRequestModel( + edges={ + "entry_to_tool_a": WorkflowEdgeModelInput( + source="entry_node", + target="tool_node_a", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "start_to_entry": WorkflowEdgeModelInput( + source="start_node", + target="entry_node", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_a_to_failure": WorkflowEdgeModelInput( + source="tool_node_a", + target="failure_node", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_a_to_tool_b": WorkflowEdgeModelInput( + source="tool_node_a", + target="tool_node_b", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_b_to_agent_transfer": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_transfer", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_b_to_conversation": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_conversation", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_b_to_end": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_end", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_b_to_phone": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_phone", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + }, + nodes={ + "entry_node": AgentWorkflowRequestModelNodesValue_End(), + "failure_node": AgentWorkflowRequestModelNodesValue_End(), + "start_node": AgentWorkflowRequestModelNodesValue_End(), + "success_conversation": AgentWorkflowRequestModelNodesValue_End(), + "success_end": AgentWorkflowRequestModelNodesValue_End(), + "success_phone": AgentWorkflowRequestModelNodesValue_End(), + "success_transfer": AgentWorkflowRequestModelNodesValue_End(), + "tool_node_a": AgentWorkflowRequestModelNodesValue_End(), + "tool_node_b": AgentWorkflowRequestModelNodesValue_End(), + }, + ), + name="name", + ) + """ + _response = self._raw_client.create( + agent_id, + branch_id=branch_id, + conversation_config=conversation_config, + platform_settings=platform_settings, + workflow=workflow, + name=name, + tags=tags, + request_options=request_options, + ) + return _response.data + + def delete( + self, agent_id: str, *, branch_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a draft for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + The ID of the agent branch to use + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.drafts.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + ) + """ + _response = self._raw_client.delete(agent_id, branch_id=branch_id, request_options=request_options) + return _response.data + + +class AsyncDraftsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawDraftsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawDraftsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawDraftsClient + """ + return self._raw_client + + async def create( + self, + agent_id: str, + *, + branch_id: str, + conversation_config: typing.Dict[str, typing.Any], + platform_settings: typing.Dict[str, typing.Any], + workflow: AgentWorkflowRequestModel, + name: str, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Create a new draft for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + The ID of the agent branch to use + + conversation_config : typing.Dict[str, typing.Any] + Conversation config for the draft + + platform_settings : typing.Dict[str, typing.Any] + Platform settings for the draft + + workflow : AgentWorkflowRequestModel + Workflow for the draft + + name : str + Name for the draft + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AgentWorkflowRequestModel, + AgentWorkflowRequestModelNodesValue_End, + AstNodeInput_AndOperator, + AsyncElevenLabs, + WorkflowEdgeModelInput, + WorkflowEdgeModelInputForwardCondition_Expression, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.drafts.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + conversation_config={"key": "value"}, + platform_settings={"key": "value"}, + workflow=AgentWorkflowRequestModel( + edges={ + "entry_to_tool_a": WorkflowEdgeModelInput( + source="entry_node", + target="tool_node_a", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "start_to_entry": WorkflowEdgeModelInput( + source="start_node", + target="entry_node", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_a_to_failure": WorkflowEdgeModelInput( + source="tool_node_a", + target="failure_node", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_a_to_tool_b": WorkflowEdgeModelInput( + source="tool_node_a", + target="tool_node_b", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_b_to_agent_transfer": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_transfer", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_b_to_conversation": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_conversation", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_b_to_end": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_end", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + "tool_b_to_phone": WorkflowEdgeModelInput( + source="tool_node_b", + target="success_phone", + forward_condition=WorkflowEdgeModelInputForwardCondition_Expression( + expression=AstNodeInput_AndOperator( + children=[], + ), + ), + ), + }, + nodes={ + "entry_node": AgentWorkflowRequestModelNodesValue_End(), + "failure_node": AgentWorkflowRequestModelNodesValue_End(), + "start_node": AgentWorkflowRequestModelNodesValue_End(), + "success_conversation": AgentWorkflowRequestModelNodesValue_End(), + "success_end": AgentWorkflowRequestModelNodesValue_End(), + "success_phone": AgentWorkflowRequestModelNodesValue_End(), + "success_transfer": AgentWorkflowRequestModelNodesValue_End(), + "tool_node_a": AgentWorkflowRequestModelNodesValue_End(), + "tool_node_b": AgentWorkflowRequestModelNodesValue_End(), + }, + ), + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + agent_id, + branch_id=branch_id, + conversation_config=conversation_config, + platform_settings=platform_settings, + workflow=workflow, + name=name, + tags=tags, + request_options=request_options, + ) + return _response.data + + async def delete( + self, agent_id: str, *, branch_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a draft for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + The ID of the agent branch to use + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.drafts.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbrch_8901k4t9z5defmb8vh3e9361y7nj", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(agent_id, branch_id=branch_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/drafts/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/drafts/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..5084d37018191eca690b84024ddbd46b57c5ed6e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/drafts/raw_client.py @@ -0,0 +1,351 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.agent_workflow_request_model import AgentWorkflowRequestModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawDraftsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + agent_id: str, + *, + branch_id: str, + conversation_config: typing.Dict[str, typing.Any], + platform_settings: typing.Dict[str, typing.Any], + workflow: AgentWorkflowRequestModel, + name: str, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Create a new draft for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + The ID of the agent branch to use + + conversation_config : typing.Dict[str, typing.Any] + Conversation config for the draft + + platform_settings : typing.Dict[str, typing.Any] + Platform settings for the draft + + workflow : AgentWorkflowRequestModel + Workflow for the draft + + name : str + Name for the draft + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/drafts", + method="POST", + params={ + "branch_id": branch_id, + }, + json={ + "conversation_config": conversation_config, + "platform_settings": platform_settings, + "workflow": convert_and_respect_annotation_metadata( + object_=workflow, annotation=AgentWorkflowRequestModel, direction="write" + ), + "name": name, + "tags": tags, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, agent_id: str, *, branch_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Delete a draft for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + The ID of the agent branch to use + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/drafts", + method="DELETE", + params={ + "branch_id": branch_id, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawDraftsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + agent_id: str, + *, + branch_id: str, + conversation_config: typing.Dict[str, typing.Any], + platform_settings: typing.Dict[str, typing.Any], + workflow: AgentWorkflowRequestModel, + name: str, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Create a new draft for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + The ID of the agent branch to use + + conversation_config : typing.Dict[str, typing.Any] + Conversation config for the draft + + platform_settings : typing.Dict[str, typing.Any] + Platform settings for the draft + + workflow : AgentWorkflowRequestModel + Workflow for the draft + + name : str + Name for the draft + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/drafts", + method="POST", + params={ + "branch_id": branch_id, + }, + json={ + "conversation_config": conversation_config, + "platform_settings": platform_settings, + "workflow": convert_and_respect_annotation_metadata( + object_=workflow, annotation=AgentWorkflowRequestModel, direction="write" + ), + "name": name, + "tags": tags, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, agent_id: str, *, branch_id: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete a draft for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + branch_id : str + The ID of the agent branch to use + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/drafts", + method="DELETE", + params={ + "branch_id": branch_id, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/hold_audio/__init__.py b/data/src/elevenlabs/conversational_ai/agents/hold_audio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/hold_audio/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/hold_audio/client.py b/data/src/elevenlabs/conversational_ai/agents/hold_audio/client.py new file mode 100644 index 0000000000000000000000000000000000000000..2f0884cb07080d9105af6d7d2e73659b07390b0f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/hold_audio/client.py @@ -0,0 +1,201 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .... import core +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.delete_agent_hold_audio_response_model import DeleteAgentHoldAudioResponseModel +from ....types.post_agent_hold_audio_response_model import PostAgentHoldAudioResponseModel +from .raw_client import AsyncRawHoldAudioClient, RawHoldAudioClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class HoldAudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawHoldAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawHoldAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawHoldAudioClient + """ + return self._raw_client + + def create( + self, agent_id: str, *, hold_audio_file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> PostAgentHoldAudioResponseModel: + """ + Sets the custom hold audio played on loop to callers waiting in the agent's concurrency wait queue. Replaces any previously uploaded clip. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + hold_audio_file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PostAgentHoldAudioResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.hold_audio.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + """ + _response = self._raw_client.create(agent_id, hold_audio_file=hold_audio_file, request_options=request_options) + return _response.data + + def delete( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteAgentHoldAudioResponseModel: + """ + Removes the agent's custom hold audio; queued callers hear the default hold tone again. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteAgentHoldAudioResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.hold_audio.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + """ + _response = self._raw_client.delete(agent_id, request_options=request_options) + return _response.data + + +class AsyncHoldAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawHoldAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawHoldAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawHoldAudioClient + """ + return self._raw_client + + async def create( + self, agent_id: str, *, hold_audio_file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> PostAgentHoldAudioResponseModel: + """ + Sets the custom hold audio played on loop to callers waiting in the agent's concurrency wait queue. Replaces any previously uploaded clip. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + hold_audio_file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PostAgentHoldAudioResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.hold_audio.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + agent_id, hold_audio_file=hold_audio_file, request_options=request_options + ) + return _response.data + + async def delete( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteAgentHoldAudioResponseModel: + """ + Removes the agent's custom hold audio; queued callers hear the default hold tone again. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteAgentHoldAudioResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.hold_audio.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(agent_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/hold_audio/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/hold_audio/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..195b43afe238ad19f5cc8720d4478aaca315782e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/hold_audio/raw_client.py @@ -0,0 +1,264 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .... import core +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.delete_agent_hold_audio_response_model import DeleteAgentHoldAudioResponseModel +from ....types.post_agent_hold_audio_response_model import PostAgentHoldAudioResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawHoldAudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, agent_id: str, *, hold_audio_file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PostAgentHoldAudioResponseModel]: + """ + Sets the custom hold audio played on loop to callers waiting in the agent's concurrency wait queue. Replaces any previously uploaded clip. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + hold_audio_file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PostAgentHoldAudioResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/hold-audio", + method="POST", + data={}, + files={ + "hold_audio_file": hold_audio_file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PostAgentHoldAudioResponseModel, + construct_type( + type_=PostAgentHoldAudioResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteAgentHoldAudioResponseModel]: + """ + Removes the agent's custom hold audio; queued callers hear the default hold tone again. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteAgentHoldAudioResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/hold-audio", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteAgentHoldAudioResponseModel, + construct_type( + type_=DeleteAgentHoldAudioResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawHoldAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, agent_id: str, *, hold_audio_file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PostAgentHoldAudioResponseModel]: + """ + Sets the custom hold audio played on loop to callers waiting in the agent's concurrency wait queue. Replaces any previously uploaded clip. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + hold_audio_file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PostAgentHoldAudioResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/hold-audio", + method="POST", + data={}, + files={ + "hold_audio_file": hold_audio_file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PostAgentHoldAudioResponseModel, + construct_type( + type_=PostAgentHoldAudioResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteAgentHoldAudioResponseModel]: + """ + Removes the agent's custom hold audio; queued callers hear the default hold tone again. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteAgentHoldAudioResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/hold-audio", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteAgentHoldAudioResponseModel, + construct_type( + type_=DeleteAgentHoldAudioResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/knowledge_base/__init__.py b/data/src/elevenlabs/conversational_ai/agents/knowledge_base/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/knowledge_base/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/knowledge_base/client.py b/data/src/elevenlabs/conversational_ai/agents/knowledge_base/client.py new file mode 100644 index 0000000000000000000000000000000000000000..3af3a93f3157f4f5c605439629afb321b5a84540 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/knowledge_base/client.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.get_agent_knowledgebase_size_response_model import GetAgentKnowledgebaseSizeResponseModel +from .raw_client import AsyncRawKnowledgeBaseClient, RawKnowledgeBaseClient + + +class KnowledgeBaseClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawKnowledgeBaseClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawKnowledgeBaseClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawKnowledgeBaseClient + """ + return self._raw_client + + def size( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentKnowledgebaseSizeResponseModel: + """ + Returns the number of pages in the agent's knowledge base. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentKnowledgebaseSizeResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.knowledge_base.size( + agent_id="agent_id", + ) + """ + _response = self._raw_client.size(agent_id, request_options=request_options) + return _response.data + + +class AsyncKnowledgeBaseClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawKnowledgeBaseClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawKnowledgeBaseClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawKnowledgeBaseClient + """ + return self._raw_client + + async def size( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentKnowledgebaseSizeResponseModel: + """ + Returns the number of pages in the agent's knowledge base. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentKnowledgebaseSizeResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.knowledge_base.size( + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.size(agent_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/knowledge_base/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/knowledge_base/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..f3ef84a0ad77ba00026ed9887203276d1a424607 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/knowledge_base/raw_client.py @@ -0,0 +1,131 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.get_agent_knowledgebase_size_response_model import GetAgentKnowledgebaseSizeResponseModel +from pydantic import ValidationError + + +class RawKnowledgeBaseClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def size( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetAgentKnowledgebaseSizeResponseModel]: + """ + Returns the number of pages in the agent's knowledge base. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentKnowledgebaseSizeResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent/{jsonable_encoder(agent_id)}/knowledge-base/size", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentKnowledgebaseSizeResponseModel, + construct_type( + type_=GetAgentKnowledgebaseSizeResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawKnowledgeBaseClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def size( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetAgentKnowledgebaseSizeResponseModel]: + """ + Returns the number of pages in the agent's knowledge base. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentKnowledgebaseSizeResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent/{jsonable_encoder(agent_id)}/knowledge-base/size", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentKnowledgebaseSizeResponseModel, + construct_type( + type_=GetAgentKnowledgebaseSizeResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/link/__init__.py b/data/src/elevenlabs/conversational_ai/agents/link/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/link/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/link/client.py b/data/src/elevenlabs/conversational_ai/agents/link/client.py new file mode 100644 index 0000000000000000000000000000000000000000..58cb2c5686a498ef0defb00938bf48993a18de91 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/link/client.py @@ -0,0 +1,114 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.get_agent_link_response_model import GetAgentLinkResponseModel +from .raw_client import AsyncRawLinkClient, RawLinkClient + + +class LinkClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLinkClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLinkClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLinkClient + """ + return self._raw_client + + def get( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentLinkResponseModel: + """ + Get the current link used to share the agent with others + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentLinkResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.link.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + """ + _response = self._raw_client.get(agent_id, request_options=request_options) + return _response.data + + +class AsyncLinkClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLinkClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLinkClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLinkClient + """ + return self._raw_client + + async def get( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentLinkResponseModel: + """ + Get the current link used to share the agent with others + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentLinkResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.link.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(agent_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/link/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/link/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8b8dfcf2a75f34644e2f531eb6a2ad73b907c045 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/link/raw_client.py @@ -0,0 +1,133 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.get_agent_link_response_model import GetAgentLinkResponseModel +from pydantic import ValidationError + + +class RawLinkClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetAgentLinkResponseModel]: + """ + Get the current link used to share the agent with others + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentLinkResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/link", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentLinkResponseModel, + construct_type( + type_=GetAgentLinkResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLinkClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetAgentLinkResponseModel]: + """ + Get the current link used to share the agent with others + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentLinkResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/link", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentLinkResponseModel, + construct_type( + type_=GetAgentLinkResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/llm_usage/__init__.py b/data/src/elevenlabs/conversational_ai/agents/llm_usage/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/llm_usage/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/llm_usage/client.py b/data/src/elevenlabs/conversational_ai/agents/llm_usage/client.py new file mode 100644 index 0000000000000000000000000000000000000000..ffabd877e205c08bf125135323f79da63d44ec5c --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/llm_usage/client.py @@ -0,0 +1,157 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel +from .raw_client import AsyncRawLlmUsageClient, RawLlmUsageClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class LlmUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLlmUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLlmUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLlmUsageClient + """ + return self._raw_client + + def calculate( + self, + agent_id: str, + *, + prompt_length: typing.Optional[int] = OMIT, + number_of_pages: typing.Optional[int] = OMIT, + rag_enabled: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LlmUsageCalculatorResponseModel: + """ + Calculates expected number of LLM tokens needed for the specified agent. + + Parameters + ---------- + agent_id : str + + prompt_length : typing.Optional[int] + Length of the prompt in characters. + + number_of_pages : typing.Optional[int] + Pages of content in pdf documents OR urls in agent's Knowledge Base. + + rag_enabled : typing.Optional[bool] + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmUsageCalculatorResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.llm_usage.calculate( + agent_id="agent_id", + ) + """ + _response = self._raw_client.calculate( + agent_id, + prompt_length=prompt_length, + number_of_pages=number_of_pages, + rag_enabled=rag_enabled, + request_options=request_options, + ) + return _response.data + + +class AsyncLlmUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLlmUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLlmUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLlmUsageClient + """ + return self._raw_client + + async def calculate( + self, + agent_id: str, + *, + prompt_length: typing.Optional[int] = OMIT, + number_of_pages: typing.Optional[int] = OMIT, + rag_enabled: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LlmUsageCalculatorResponseModel: + """ + Calculates expected number of LLM tokens needed for the specified agent. + + Parameters + ---------- + agent_id : str + + prompt_length : typing.Optional[int] + Length of the prompt in characters. + + number_of_pages : typing.Optional[int] + Pages of content in pdf documents OR urls in agent's Knowledge Base. + + rag_enabled : typing.Optional[bool] + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmUsageCalculatorResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.llm_usage.calculate( + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.calculate( + agent_id, + prompt_length=prompt_length, + number_of_pages=number_of_pages, + rag_enabled=rag_enabled, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/llm_usage/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/llm_usage/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..34258549552162953e8f10711762e0d708ebcb1c --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/llm_usage/raw_client.py @@ -0,0 +1,182 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawLlmUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def calculate( + self, + agent_id: str, + *, + prompt_length: typing.Optional[int] = OMIT, + number_of_pages: typing.Optional[int] = OMIT, + rag_enabled: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[LlmUsageCalculatorResponseModel]: + """ + Calculates expected number of LLM tokens needed for the specified agent. + + Parameters + ---------- + agent_id : str + + prompt_length : typing.Optional[int] + Length of the prompt in characters. + + number_of_pages : typing.Optional[int] + Pages of content in pdf documents OR urls in agent's Knowledge Base. + + rag_enabled : typing.Optional[bool] + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[LlmUsageCalculatorResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent/{jsonable_encoder(agent_id)}/llm-usage/calculate", + method="POST", + json={ + "prompt_length": prompt_length, + "number_of_pages": number_of_pages, + "rag_enabled": rag_enabled, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmUsageCalculatorResponseModel, + construct_type( + type_=LlmUsageCalculatorResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLlmUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def calculate( + self, + agent_id: str, + *, + prompt_length: typing.Optional[int] = OMIT, + number_of_pages: typing.Optional[int] = OMIT, + rag_enabled: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[LlmUsageCalculatorResponseModel]: + """ + Calculates expected number of LLM tokens needed for the specified agent. + + Parameters + ---------- + agent_id : str + + prompt_length : typing.Optional[int] + Length of the prompt in characters. + + number_of_pages : typing.Optional[int] + Pages of content in pdf documents OR urls in agent's Knowledge Base. + + rag_enabled : typing.Optional[bool] + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[LlmUsageCalculatorResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent/{jsonable_encoder(agent_id)}/llm-usage/calculate", + method="POST", + json={ + "prompt_length": prompt_length, + "number_of_pages": number_of_pages, + "rag_enabled": rag_enabled, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmUsageCalculatorResponseModel, + construct_type( + type_=LlmUsageCalculatorResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/merge_proposals/__init__.py b/data/src/elevenlabs/conversational_ai/agents/merge_proposals/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/merge_proposals/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/merge_proposals/client.py b/data/src/elevenlabs/conversational_ai/agents/merge_proposals/client.py new file mode 100644 index 0000000000000000000000000000000000000000..681e16d72b4ceb9d82f79bdaffa796ace59acf25 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/merge_proposals/client.py @@ -0,0 +1,911 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.agent_merge_proposal_response import AgentMergeProposalResponse +from ....types.create_agent_merge_proposal_response_model import CreateAgentMergeProposalResponseModel +from ....types.merge_proposal_review_state import MergeProposalReviewState +from ....types.merge_proposal_status import MergeProposalStatus +from ....types.paginated_result_agent_merge_proposal_response import PaginatedResultAgentMergeProposalResponse +from .raw_client import AsyncRawMergeProposalsClient, RawMergeProposalsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class MergeProposalsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawMergeProposalsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawMergeProposalsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawMergeProposalsClient + """ + return self._raw_client + + def list( + self, + agent_id: str, + *, + status: typing.Optional[MergeProposalStatus] = None, + source_branch_id: typing.Optional[str] = None, + target_branch_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> PaginatedResultAgentMergeProposalResponse: + """ + List the proposals for an agent, newest first. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + status : typing.Optional[MergeProposalStatus] + Only return proposals with this status. + + source_branch_id : typing.Optional[str] + Only return proposals with this source branch. + + target_branch_id : typing.Optional[str] + Only return proposals with this target branch. + + search : typing.Optional[str] + Case-insensitive substring match over title and description. + + page_size : typing.Optional[int] + How many results at most should be returned + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PaginatedResultAgentMergeProposalResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.merge_proposals.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + status="open", + source_branch_id="source_branch_id", + target_branch_id="target_branch_id", + search="search", + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.list( + agent_id, + status=status, + source_branch_id=source_branch_id, + target_branch_id=target_branch_id, + search=search, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def create( + self, + agent_id: str, + *, + source_branch_id: str, + target_branch_id: str, + title: str, + description: typing.Optional[str] = OMIT, + requested_reviewer_user_ids: typing.Optional[typing.Sequence[str]] = OMIT, + triage_ticket_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentMergeProposalResponseModel: + """ + Record a request to merge a source branch into a target branch. Anyone with edit access can open one; merging it later is gated on write access to the target branch, so this is how a change reaches a protected branch the author cannot merge into themselves. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Branch whose changes should be merged. + + target_branch_id : str + Branch that should receive the changes. + + title : str + Short title for the merge_proposal. + + description : typing.Optional[str] + Optional longer description for reviewers. + + requested_reviewer_user_ids : typing.Optional[typing.Sequence[str]] + User IDs to request a review from. + + triage_ticket_id : typing.Optional[str] + Triage ticket of this agent that the merge_proposal resolves. Merging it resolves the ticket if still open. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentMergeProposalResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.merge_proposals.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="source_branch_id", + target_branch_id="target_branch_id", + title="title", + ) + """ + _response = self._raw_client.create( + agent_id, + source_branch_id=source_branch_id, + target_branch_id=target_branch_id, + title=title, + description=description, + requested_reviewer_user_ids=requested_reviewer_user_ids, + triage_ticket_id=triage_ticket_id, + request_options=request_options, + ) + return _response.data + + def get( + self, agent_id: str, merge_proposal_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AgentMergeProposalResponse: + """ + Get a single merge_proposal. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.merge_proposals.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + ) + """ + _response = self._raw_client.get(agent_id, merge_proposal_id, request_options=request_options) + return _response.data + + def update( + self, + agent_id: str, + merge_proposal_id: str, + *, + title: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + requested_reviewer_user_ids: typing.Optional[typing.Sequence[str]] = OMIT, + close: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentMergeProposalResponse: + """ + Edit an open merge_proposal's title or description, or close it. The author closing it is recorded as withdrawn; anyone else as rejected. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + title : typing.Optional[str] + New title for the merge_proposal. + + description : typing.Optional[str] + New description for the merge_proposal. + + requested_reviewer_user_ids : typing.Optional[typing.Sequence[str]] + Replacement list of user IDs to request a review from. + + close : typing.Optional[bool] + When true, close the merge_proposal without merging. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.merge_proposals.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + ) + """ + _response = self._raw_client.update( + agent_id, + merge_proposal_id, + title=title, + description=description, + requested_reviewer_user_ids=requested_reviewer_user_ids, + close=close, + request_options=request_options, + ) + return _response.data + + def submit_review( + self, + agent_id: str, + merge_proposal_id: str, + *, + state: MergeProposalReviewState, + comment: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentMergeProposalResponse: + """ + Approve a merge_proposal or request changes on it. A user's latest review replaces their previous one. Non-admins need an approval from another user before the merge is allowed. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + state : MergeProposalReviewState + The review verdict. + + comment : typing.Optional[str] + Optional comment to leave with the review. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.merge_proposals.submit_review( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + state="approved", + ) + """ + _response = self._raw_client.submit_review( + agent_id, merge_proposal_id, state=state, comment=comment, request_options=request_options + ) + return _response.data + + def add_comment( + self, + agent_id: str, + merge_proposal_id: str, + *, + body: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentMergeProposalResponse: + """ + Leave a comment on a merge_proposal without recording a review verdict. Unlike reviews, comments accumulate and can still be added once the merge_proposal is merged or closed. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + body : str + The comment text. Markdown is supported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.merge_proposals.add_comment( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + body="body", + ) + """ + _response = self._raw_client.add_comment( + agent_id, merge_proposal_id, body=body, request_options=request_options + ) + return _response.data + + def merge( + self, + agent_id: str, + merge_proposal_id: str, + *, + archive_source_branch: typing.Optional[bool] = OMIT, + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentMergeProposalResponse: + """ + Execute the merge. The caller must have write access to the target branch (admins only, for a protected branch), so this is where a reviewer approves and merges a request opened by someone who could not. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + archive_source_branch : typing.Optional[bool] + Whether to archive the source branch after merging. + + force : typing.Optional[bool] + Force source branch changes onto the target, overriding timestamp-based conflict resolution. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.merge_proposals.merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + ) + """ + _response = self._raw_client.merge( + agent_id, + merge_proposal_id, + archive_source_branch=archive_source_branch, + force=force, + request_options=request_options, + ) + return _response.data + + +class AsyncMergeProposalsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawMergeProposalsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawMergeProposalsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawMergeProposalsClient + """ + return self._raw_client + + async def list( + self, + agent_id: str, + *, + status: typing.Optional[MergeProposalStatus] = None, + source_branch_id: typing.Optional[str] = None, + target_branch_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> PaginatedResultAgentMergeProposalResponse: + """ + List the proposals for an agent, newest first. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + status : typing.Optional[MergeProposalStatus] + Only return proposals with this status. + + source_branch_id : typing.Optional[str] + Only return proposals with this source branch. + + target_branch_id : typing.Optional[str] + Only return proposals with this target branch. + + search : typing.Optional[str] + Case-insensitive substring match over title and description. + + page_size : typing.Optional[int] + How many results at most should be returned + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PaginatedResultAgentMergeProposalResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.merge_proposals.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + status="open", + source_branch_id="source_branch_id", + target_branch_id="target_branch_id", + search="search", + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + agent_id, + status=status, + source_branch_id=source_branch_id, + target_branch_id=target_branch_id, + search=search, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def create( + self, + agent_id: str, + *, + source_branch_id: str, + target_branch_id: str, + title: str, + description: typing.Optional[str] = OMIT, + requested_reviewer_user_ids: typing.Optional[typing.Sequence[str]] = OMIT, + triage_ticket_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentMergeProposalResponseModel: + """ + Record a request to merge a source branch into a target branch. Anyone with edit access can open one; merging it later is gated on write access to the target branch, so this is how a change reaches a protected branch the author cannot merge into themselves. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Branch whose changes should be merged. + + target_branch_id : str + Branch that should receive the changes. + + title : str + Short title for the merge_proposal. + + description : typing.Optional[str] + Optional longer description for reviewers. + + requested_reviewer_user_ids : typing.Optional[typing.Sequence[str]] + User IDs to request a review from. + + triage_ticket_id : typing.Optional[str] + Triage ticket of this agent that the merge_proposal resolves. Merging it resolves the ticket if still open. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentMergeProposalResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.merge_proposals.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + source_branch_id="source_branch_id", + target_branch_id="target_branch_id", + title="title", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + agent_id, + source_branch_id=source_branch_id, + target_branch_id=target_branch_id, + title=title, + description=description, + requested_reviewer_user_ids=requested_reviewer_user_ids, + triage_ticket_id=triage_ticket_id, + request_options=request_options, + ) + return _response.data + + async def get( + self, agent_id: str, merge_proposal_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AgentMergeProposalResponse: + """ + Get a single merge_proposal. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.merge_proposals.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(agent_id, merge_proposal_id, request_options=request_options) + return _response.data + + async def update( + self, + agent_id: str, + merge_proposal_id: str, + *, + title: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + requested_reviewer_user_ids: typing.Optional[typing.Sequence[str]] = OMIT, + close: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentMergeProposalResponse: + """ + Edit an open merge_proposal's title or description, or close it. The author closing it is recorded as withdrawn; anyone else as rejected. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + title : typing.Optional[str] + New title for the merge_proposal. + + description : typing.Optional[str] + New description for the merge_proposal. + + requested_reviewer_user_ids : typing.Optional[typing.Sequence[str]] + Replacement list of user IDs to request a review from. + + close : typing.Optional[bool] + When true, close the merge_proposal without merging. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.merge_proposals.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + agent_id, + merge_proposal_id, + title=title, + description=description, + requested_reviewer_user_ids=requested_reviewer_user_ids, + close=close, + request_options=request_options, + ) + return _response.data + + async def submit_review( + self, + agent_id: str, + merge_proposal_id: str, + *, + state: MergeProposalReviewState, + comment: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentMergeProposalResponse: + """ + Approve a merge_proposal or request changes on it. A user's latest review replaces their previous one. Non-admins need an approval from another user before the merge is allowed. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + state : MergeProposalReviewState + The review verdict. + + comment : typing.Optional[str] + Optional comment to leave with the review. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.merge_proposals.submit_review( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + state="approved", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.submit_review( + agent_id, merge_proposal_id, state=state, comment=comment, request_options=request_options + ) + return _response.data + + async def add_comment( + self, + agent_id: str, + merge_proposal_id: str, + *, + body: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentMergeProposalResponse: + """ + Leave a comment on a merge_proposal without recording a review verdict. Unlike reviews, comments accumulate and can still be added once the merge_proposal is merged or closed. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + body : str + The comment text. Markdown is supported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.merge_proposals.add_comment( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + body="body", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add_comment( + agent_id, merge_proposal_id, body=body, request_options=request_options + ) + return _response.data + + async def merge( + self, + agent_id: str, + merge_proposal_id: str, + *, + archive_source_branch: typing.Optional[bool] = OMIT, + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentMergeProposalResponse: + """ + Execute the merge. The caller must have write access to the target branch (admins only, for a protected branch), so this is where a reviewer approves and merges a request opened by someone who could not. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + archive_source_branch : typing.Optional[bool] + Whether to archive the source branch after merging. + + force : typing.Optional[bool] + Force source branch changes onto the target, overriding timestamp-based conflict resolution. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentMergeProposalResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.merge_proposals.merge( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + merge_proposal_id="agtmprop_8901k4t9z5defmb8vh3e9361y7nj", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.merge( + agent_id, + merge_proposal_id, + archive_source_branch=archive_source_branch, + force=force, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/merge_proposals/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/merge_proposals/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..56d2d2ab34df4945fcc9cfdbb12b037b8db948d2 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/merge_proposals/raw_client.py @@ -0,0 +1,1136 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.agent_merge_proposal_response import AgentMergeProposalResponse +from ....types.create_agent_merge_proposal_response_model import CreateAgentMergeProposalResponseModel +from ....types.merge_proposal_review_state import MergeProposalReviewState +from ....types.merge_proposal_status import MergeProposalStatus +from ....types.paginated_result_agent_merge_proposal_response import PaginatedResultAgentMergeProposalResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawMergeProposalsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + agent_id: str, + *, + status: typing.Optional[MergeProposalStatus] = None, + source_branch_id: typing.Optional[str] = None, + target_branch_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[PaginatedResultAgentMergeProposalResponse]: + """ + List the proposals for an agent, newest first. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + status : typing.Optional[MergeProposalStatus] + Only return proposals with this status. + + source_branch_id : typing.Optional[str] + Only return proposals with this source branch. + + target_branch_id : typing.Optional[str] + Only return proposals with this target branch. + + search : typing.Optional[str] + Case-insensitive substring match over title and description. + + page_size : typing.Optional[int] + How many results at most should be returned + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PaginatedResultAgentMergeProposalResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals", + method="GET", + params={ + "status": status, + "source_branch_id": source_branch_id, + "target_branch_id": target_branch_id, + "search": search, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedResultAgentMergeProposalResponse, + construct_type( + type_=PaginatedResultAgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + agent_id: str, + *, + source_branch_id: str, + target_branch_id: str, + title: str, + description: typing.Optional[str] = OMIT, + requested_reviewer_user_ids: typing.Optional[typing.Sequence[str]] = OMIT, + triage_ticket_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateAgentMergeProposalResponseModel]: + """ + Record a request to merge a source branch into a target branch. Anyone with edit access can open one; merging it later is gated on write access to the target branch, so this is how a change reaches a protected branch the author cannot merge into themselves. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Branch whose changes should be merged. + + target_branch_id : str + Branch that should receive the changes. + + title : str + Short title for the merge_proposal. + + description : typing.Optional[str] + Optional longer description for reviewers. + + requested_reviewer_user_ids : typing.Optional[typing.Sequence[str]] + User IDs to request a review from. + + triage_ticket_id : typing.Optional[str] + Triage ticket of this agent that the merge_proposal resolves. Merging it resolves the ticket if still open. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateAgentMergeProposalResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals", + method="POST", + json={ + "source_branch_id": source_branch_id, + "target_branch_id": target_branch_id, + "title": title, + "description": description, + "requested_reviewer_user_ids": requested_reviewer_user_ids, + "triage_ticket_id": triage_ticket_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentMergeProposalResponseModel, + construct_type( + type_=CreateAgentMergeProposalResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, agent_id: str, merge_proposal_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AgentMergeProposalResponse]: + """ + Get a single merge_proposal. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + agent_id: str, + merge_proposal_id: str, + *, + title: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + requested_reviewer_user_ids: typing.Optional[typing.Sequence[str]] = OMIT, + close: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentMergeProposalResponse]: + """ + Edit an open merge_proposal's title or description, or close it. The author closing it is recorded as withdrawn; anyone else as rejected. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + title : typing.Optional[str] + New title for the merge_proposal. + + description : typing.Optional[str] + New description for the merge_proposal. + + requested_reviewer_user_ids : typing.Optional[typing.Sequence[str]] + Replacement list of user IDs to request a review from. + + close : typing.Optional[bool] + When true, close the merge_proposal without merging. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}", + method="PATCH", + json={ + "title": title, + "description": description, + "requested_reviewer_user_ids": requested_reviewer_user_ids, + "close": close, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def submit_review( + self, + agent_id: str, + merge_proposal_id: str, + *, + state: MergeProposalReviewState, + comment: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentMergeProposalResponse]: + """ + Approve a merge_proposal or request changes on it. A user's latest review replaces their previous one. Non-admins need an approval from another user before the merge is allowed. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + state : MergeProposalReviewState + The review verdict. + + comment : typing.Optional[str] + Optional comment to leave with the review. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}/reviews", + method="POST", + json={ + "state": state, + "comment": comment, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def add_comment( + self, + agent_id: str, + merge_proposal_id: str, + *, + body: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentMergeProposalResponse]: + """ + Leave a comment on a merge_proposal without recording a review verdict. Unlike reviews, comments accumulate and can still be added once the merge_proposal is merged or closed. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + body : str + The comment text. Markdown is supported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}/comments", + method="POST", + json={ + "body": body, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def merge( + self, + agent_id: str, + merge_proposal_id: str, + *, + archive_source_branch: typing.Optional[bool] = OMIT, + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentMergeProposalResponse]: + """ + Execute the merge. The caller must have write access to the target branch (admins only, for a protected branch), so this is where a reviewer approves and merges a request opened by someone who could not. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + archive_source_branch : typing.Optional[bool] + Whether to archive the source branch after merging. + + force : typing.Optional[bool] + Force source branch changes onto the target, overriding timestamp-based conflict resolution. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}/merge", + method="POST", + json={ + "archive_source_branch": archive_source_branch, + "force": force, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawMergeProposalsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + agent_id: str, + *, + status: typing.Optional[MergeProposalStatus] = None, + source_branch_id: typing.Optional[str] = None, + target_branch_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[PaginatedResultAgentMergeProposalResponse]: + """ + List the proposals for an agent, newest first. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + status : typing.Optional[MergeProposalStatus] + Only return proposals with this status. + + source_branch_id : typing.Optional[str] + Only return proposals with this source branch. + + target_branch_id : typing.Optional[str] + Only return proposals with this target branch. + + search : typing.Optional[str] + Case-insensitive substring match over title and description. + + page_size : typing.Optional[int] + How many results at most should be returned + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PaginatedResultAgentMergeProposalResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals", + method="GET", + params={ + "status": status, + "source_branch_id": source_branch_id, + "target_branch_id": target_branch_id, + "search": search, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PaginatedResultAgentMergeProposalResponse, + construct_type( + type_=PaginatedResultAgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + agent_id: str, + *, + source_branch_id: str, + target_branch_id: str, + title: str, + description: typing.Optional[str] = OMIT, + requested_reviewer_user_ids: typing.Optional[typing.Sequence[str]] = OMIT, + triage_ticket_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateAgentMergeProposalResponseModel]: + """ + Record a request to merge a source branch into a target branch. Anyone with edit access can open one; merging it later is gated on write access to the target branch, so this is how a change reaches a protected branch the author cannot merge into themselves. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + source_branch_id : str + Branch whose changes should be merged. + + target_branch_id : str + Branch that should receive the changes. + + title : str + Short title for the merge_proposal. + + description : typing.Optional[str] + Optional longer description for reviewers. + + requested_reviewer_user_ids : typing.Optional[typing.Sequence[str]] + User IDs to request a review from. + + triage_ticket_id : typing.Optional[str] + Triage ticket of this agent that the merge_proposal resolves. Merging it resolves the ticket if still open. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateAgentMergeProposalResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals", + method="POST", + json={ + "source_branch_id": source_branch_id, + "target_branch_id": target_branch_id, + "title": title, + "description": description, + "requested_reviewer_user_ids": requested_reviewer_user_ids, + "triage_ticket_id": triage_ticket_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentMergeProposalResponseModel, + construct_type( + type_=CreateAgentMergeProposalResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, agent_id: str, merge_proposal_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AgentMergeProposalResponse]: + """ + Get a single merge_proposal. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + agent_id: str, + merge_proposal_id: str, + *, + title: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + requested_reviewer_user_ids: typing.Optional[typing.Sequence[str]] = OMIT, + close: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentMergeProposalResponse]: + """ + Edit an open merge_proposal's title or description, or close it. The author closing it is recorded as withdrawn; anyone else as rejected. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + title : typing.Optional[str] + New title for the merge_proposal. + + description : typing.Optional[str] + New description for the merge_proposal. + + requested_reviewer_user_ids : typing.Optional[typing.Sequence[str]] + Replacement list of user IDs to request a review from. + + close : typing.Optional[bool] + When true, close the merge_proposal without merging. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}", + method="PATCH", + json={ + "title": title, + "description": description, + "requested_reviewer_user_ids": requested_reviewer_user_ids, + "close": close, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def submit_review( + self, + agent_id: str, + merge_proposal_id: str, + *, + state: MergeProposalReviewState, + comment: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentMergeProposalResponse]: + """ + Approve a merge_proposal or request changes on it. A user's latest review replaces their previous one. Non-admins need an approval from another user before the merge is allowed. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + state : MergeProposalReviewState + The review verdict. + + comment : typing.Optional[str] + Optional comment to leave with the review. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}/reviews", + method="POST", + json={ + "state": state, + "comment": comment, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def add_comment( + self, + agent_id: str, + merge_proposal_id: str, + *, + body: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentMergeProposalResponse]: + """ + Leave a comment on a merge_proposal without recording a review verdict. Unlike reviews, comments accumulate and can still be added once the merge_proposal is merged or closed. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + body : str + The comment text. Markdown is supported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}/comments", + method="POST", + json={ + "body": body, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def merge( + self, + agent_id: str, + merge_proposal_id: str, + *, + archive_source_branch: typing.Optional[bool] = OMIT, + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentMergeProposalResponse]: + """ + Execute the merge. The caller must have write access to the target branch (admins only, for a protected branch), so this is where a reviewer approves and merges a request opened by someone who could not. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + merge_proposal_id : str + Unique identifier for the merge_proposal. + + archive_source_branch : typing.Optional[bool] + Whether to archive the source branch after merging. + + force : typing.Optional[bool] + Force source branch changes onto the target, overriding timestamp-based conflict resolution. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentMergeProposalResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/merge-proposals/{jsonable_encoder(merge_proposal_id)}/merge", + method="POST", + json={ + "archive_source_branch": archive_source_branch, + "force": force, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentMergeProposalResponse, + construct_type( + type_=AgentMergeProposalResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/procedures/__init__.py b/data/src/elevenlabs/conversational_ai/agents/procedures/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c962bdebc04b660e781552c8ed6d893c7c772e04 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/procedures/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import drafts +_dynamic_imports: typing.Dict[str, str] = {"drafts": ".drafts"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["drafts"] diff --git a/data/src/elevenlabs/conversational_ai/agents/procedures/client.py b/data/src/elevenlabs/conversational_ai/agents/procedures/client.py new file mode 100644 index 0000000000000000000000000000000000000000..2dff3ae1e6e8160e060a6dc9ad8742498982cdb4 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/procedures/client.py @@ -0,0 +1,589 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.compile_procedures_response_model import CompileProceduresResponseModel +from ....types.create_procedure_request_model import CreateProcedureRequestModel +from ....types.create_procedure_response_model import CreateProcedureResponseModel +from ....types.list_procedures_response_model import ListProceduresResponseModel +from ....types.procedure_at_version_response_model import ProcedureAtVersionResponseModel +from .raw_client import AsyncRawProceduresClient, RawProceduresClient + +if typing.TYPE_CHECKING: + from .drafts.client import AsyncDraftsClient, DraftsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ProceduresClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawProceduresClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._drafts: typing.Optional[DraftsClient] = None + + @property + def with_raw_response(self) -> RawProceduresClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawProceduresClient + """ + return self._raw_client + + def list( + self, + agent_id: str, + branch_id: str, + *, + agent_version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListProceduresResponseModel: + """ + List the procedures attached to this agent branch. By default, unpublished drafts take precedence over the latest committed version. Pass agent_version_id to list a published snapshot instead. has_draft is true when a procedure has unpublished draft changes on this branch. Procedure content is not included; use Get Procedure to read a procedure's body. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + agent_version_id : typing.Optional[str] + The agent version ID to retrieve the procedure for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListProceduresResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.procedures.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + agent_version_id="agent_version_id", + ) + """ + _response = self._raw_client.list( + agent_id, branch_id, agent_version_id=agent_version_id, request_options=request_options + ) + return _response.data + + def create( + self, + agent_id: str, + branch_id: str, + *, + request: typing.Optional[CreateProcedureRequestModel] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateProcedureResponseModel: + """ + Create a new procedure for the agent on a branch. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + request : typing.Optional[CreateProcedureRequestModel] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateProcedureResponseModel + Successful Response + + Examples + -------- + from elevenlabs import CreateProcedureRequestModel, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.procedures.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + request=CreateProcedureRequestModel(), + ) + """ + _response = self._raw_client.create(agent_id, branch_id, request=request, request_options=request_options) + return _response.data + + def compile( + self, agent_id: str, branch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> CompileProceduresResponseModel: + """ + Legacy. Do not use. Saving an agent draft (`POST /v1/convai/agents/{agent_id}/drafts`) and publishing an agent (`PATCH /v1/convai/agents/{agent_id}`) compile structured procedures into workflow nodes and edges, save the compiled workflow with the draft or version, and return validation errors, so a separate compile call is no longer needed. This endpoint remains available for the time being so existing callers do not break, as a dry-run that compiles the current procedure drafts into a workflow without persisting anything. It will eventually be deprecated. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CompileProceduresResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.procedures.compile( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + ) + """ + _response = self._raw_client.compile(agent_id, branch_id, request_options=request_options) + return _response.data + + def get( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + version_id: typing.Optional[str] = None, + agent_version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProcedureAtVersionResponseModel: + """ + Retrieve a procedure at a specific version or the current branch HEAD. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + version_id : typing.Optional[str] + The version ID to retrieve. If omitted, returns the version at branch HEAD. + + agent_version_id : typing.Optional[str] + The agent version ID to retrieve the procedure for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProcedureAtVersionResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.procedures.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + version_id="version_id", + agent_version_id="agent_version_id", + ) + """ + _response = self._raw_client.get( + agent_id, + branch_id, + procedure_id, + version_id=version_id, + agent_version_id=agent_version_id, + request_options=request_options, + ) + return _response.data + + def remove( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Remove a procedure from the agent's draft working set. Removing a folder cascades to its entire subtree, rejected if any procedure outside the subtree hands off into it. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.procedures.remove( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + ) + """ + _response = self._raw_client.remove(agent_id, branch_id, procedure_id, request_options=request_options) + return _response.data + + @property + def drafts(self): + if self._drafts is None: + from .drafts.client import DraftsClient # noqa: E402 + + self._drafts = DraftsClient(client_wrapper=self._client_wrapper) + return self._drafts + + +class AsyncProceduresClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawProceduresClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._drafts: typing.Optional[AsyncDraftsClient] = None + + @property + def with_raw_response(self) -> AsyncRawProceduresClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawProceduresClient + """ + return self._raw_client + + async def list( + self, + agent_id: str, + branch_id: str, + *, + agent_version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListProceduresResponseModel: + """ + List the procedures attached to this agent branch. By default, unpublished drafts take precedence over the latest committed version. Pass agent_version_id to list a published snapshot instead. has_draft is true when a procedure has unpublished draft changes on this branch. Procedure content is not included; use Get Procedure to read a procedure's body. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + agent_version_id : typing.Optional[str] + The agent version ID to retrieve the procedure for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListProceduresResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.procedures.list( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + agent_version_id="agent_version_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + agent_id, branch_id, agent_version_id=agent_version_id, request_options=request_options + ) + return _response.data + + async def create( + self, + agent_id: str, + branch_id: str, + *, + request: typing.Optional[CreateProcedureRequestModel] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateProcedureResponseModel: + """ + Create a new procedure for the agent on a branch. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + request : typing.Optional[CreateProcedureRequestModel] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateProcedureResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, CreateProcedureRequestModel + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.procedures.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + request=CreateProcedureRequestModel(), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(agent_id, branch_id, request=request, request_options=request_options) + return _response.data + + async def compile( + self, agent_id: str, branch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> CompileProceduresResponseModel: + """ + Legacy. Do not use. Saving an agent draft (`POST /v1/convai/agents/{agent_id}/drafts`) and publishing an agent (`PATCH /v1/convai/agents/{agent_id}`) compile structured procedures into workflow nodes and edges, save the compiled workflow with the draft or version, and return validation errors, so a separate compile call is no longer needed. This endpoint remains available for the time being so existing callers do not break, as a dry-run that compiles the current procedure drafts into a workflow without persisting anything. It will eventually be deprecated. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CompileProceduresResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.procedures.compile( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.compile(agent_id, branch_id, request_options=request_options) + return _response.data + + async def get( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + version_id: typing.Optional[str] = None, + agent_version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProcedureAtVersionResponseModel: + """ + Retrieve a procedure at a specific version or the current branch HEAD. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + version_id : typing.Optional[str] + The version ID to retrieve. If omitted, returns the version at branch HEAD. + + agent_version_id : typing.Optional[str] + The agent version ID to retrieve the procedure for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProcedureAtVersionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.procedures.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + version_id="version_id", + agent_version_id="agent_version_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + agent_id, + branch_id, + procedure_id, + version_id=version_id, + agent_version_id=agent_version_id, + request_options=request_options, + ) + return _response.data + + async def remove( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Remove a procedure from the agent's draft working set. Removing a folder cascades to its entire subtree, rejected if any procedure outside the subtree hands off into it. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.procedures.remove( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.remove(agent_id, branch_id, procedure_id, request_options=request_options) + return _response.data + + @property + def drafts(self): + if self._drafts is None: + from .drafts.client import AsyncDraftsClient # noqa: E402 + + self._drafts = AsyncDraftsClient(client_wrapper=self._client_wrapper) + return self._drafts diff --git a/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/__init__.py b/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/client.py b/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/client.py new file mode 100644 index 0000000000000000000000000000000000000000..0813c11cfde14b8e60a2eba5af0917865c1f7707 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/client.py @@ -0,0 +1,400 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.procedure_draft_response_model import ProcedureDraftResponseModel +from .....types.procedure_type import ProcedureType +from .raw_client import AsyncRawDraftsClient, RawDraftsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class DraftsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawDraftsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawDraftsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawDraftsClient + """ + return self._raw_client + + def get( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProcedureDraftResponseModel: + """ + Get user's draft for a procedure + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProcedureDraftResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.procedures.drafts.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + ) + """ + _response = self._raw_client.get(agent_id, branch_id, procedure_id, request_options=request_options) + return _response.data + + def delete( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Delete user's draft for a procedure, resetting to the committed version + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.procedures.drafts.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + ) + """ + _response = self._raw_client.delete(agent_id, branch_id, procedure_id, request_options=request_options) + return _response.data + + def update( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + name: str, + content: str, + type: ProcedureType, + trigger: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProcedureDraftResponseModel: + """ + Create or update user's draft for a procedure + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + name : str + Procedure name + + content : str + Procedure content + + type : ProcedureType + Procedure type + + trigger : typing.Optional[str] + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. Omit this field (or send null) to keep the stored trigger, which is empty on create. Send `""` to clear it. `description` is accepted as an alias. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProcedureDraftResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.procedures.drafts.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + name="name", + content="content", + type="free_form", + ) + """ + _response = self._raw_client.update( + agent_id, + branch_id, + procedure_id, + name=name, + content=content, + type=type, + trigger=trigger, + request_options=request_options, + ) + return _response.data + + +class AsyncDraftsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawDraftsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawDraftsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawDraftsClient + """ + return self._raw_client + + async def get( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProcedureDraftResponseModel: + """ + Get user's draft for a procedure + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProcedureDraftResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.procedures.drafts.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(agent_id, branch_id, procedure_id, request_options=request_options) + return _response.data + + async def delete( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Delete user's draft for a procedure, resetting to the committed version + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.procedures.drafts.delete( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(agent_id, branch_id, procedure_id, request_options=request_options) + return _response.data + + async def update( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + name: str, + content: str, + type: ProcedureType, + trigger: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProcedureDraftResponseModel: + """ + Create or update user's draft for a procedure + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + name : str + Procedure name + + content : str + Procedure content + + type : ProcedureType + Procedure type + + trigger : typing.Optional[str] + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. Omit this field (or send null) to keep the stored trigger, which is empty on create. Send `""` to clear it. `description` is accepted as an alias. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProcedureDraftResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.procedures.drafts.update( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + branch_id="agtbranch_0901k4aafjxxfxt93gd841r7tv5t", + procedure_id="agtprc_6qbpwdq8n01bxhk44bgjy6f10ck3", + name="name", + content="content", + type="free_form", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + agent_id, + branch_id, + procedure_id, + name=name, + content=content, + type=type, + trigger=trigger, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..a559eabdbd5816adef3843dfdd5fd5bc7725098a --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/procedures/drafts/raw_client.py @@ -0,0 +1,475 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.procedure_draft_response_model import ProcedureDraftResponseModel +from .....types.procedure_type import ProcedureType +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawDraftsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ProcedureDraftResponseModel]: + """ + Get user's draft for a procedure + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProcedureDraftResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}/draft", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProcedureDraftResponseModel, + construct_type( + type_=ProcedureDraftResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Delete user's draft for a procedure, resetting to the committed version + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}/draft", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + name: str, + content: str, + type: ProcedureType, + trigger: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ProcedureDraftResponseModel]: + """ + Create or update user's draft for a procedure + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + name : str + Procedure name + + content : str + Procedure content + + type : ProcedureType + Procedure type + + trigger : typing.Optional[str] + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. Omit this field (or send null) to keep the stored trigger, which is empty on create. Send `""` to clear it. `description` is accepted as an alias. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProcedureDraftResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}/draft", + method="PATCH", + json={ + "name": name, + "content": content, + "type": type, + "trigger": trigger, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProcedureDraftResponseModel, + construct_type( + type_=ProcedureDraftResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawDraftsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ProcedureDraftResponseModel]: + """ + Get user's draft for a procedure + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProcedureDraftResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}/draft", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProcedureDraftResponseModel, + construct_type( + type_=ProcedureDraftResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete user's draft for a procedure, resetting to the committed version + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}/draft", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + name: str, + content: str, + type: ProcedureType, + trigger: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ProcedureDraftResponseModel]: + """ + Create or update user's draft for a procedure + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + name : str + Procedure name + + content : str + Procedure content + + type : ProcedureType + Procedure type + + trigger : typing.Optional[str] + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. Omit this field (or send null) to keep the stored trigger, which is empty on create. Send `""` to clear it. `description` is accepted as an alias. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProcedureDraftResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}/draft", + method="PATCH", + json={ + "name": name, + "content": content, + "type": type, + "trigger": trigger, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProcedureDraftResponseModel, + construct_type( + type_=ProcedureDraftResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/procedures/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/procedures/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..384fffd5edc4307ee5c5e9b4bed0d03e2fa901fc --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/procedures/raw_client.py @@ -0,0 +1,730 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.bad_request_error import BadRequestError +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.compile_procedures_response_model import CompileProceduresResponseModel +from ....types.create_procedure_request_model import CreateProcedureRequestModel +from ....types.create_procedure_response_model import CreateProcedureResponseModel +from ....types.list_procedures_response_model import ListProceduresResponseModel +from ....types.procedure_at_version_response_model import ProcedureAtVersionResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawProceduresClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + agent_id: str, + branch_id: str, + *, + agent_version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListProceduresResponseModel]: + """ + List the procedures attached to this agent branch. By default, unpublished drafts take precedence over the latest committed version. Pass agent_version_id to list a published snapshot instead. has_draft is true when a procedure has unpublished draft changes on this branch. Procedure content is not included; use Get Procedure to read a procedure's body. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + agent_version_id : typing.Optional[str] + The agent version ID to retrieve the procedure for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListProceduresResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures", + method="GET", + params={ + "agent_version_id": agent_version_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListProceduresResponseModel, + construct_type( + type_=ListProceduresResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + agent_id: str, + branch_id: str, + *, + request: typing.Optional[CreateProcedureRequestModel] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateProcedureResponseModel]: + """ + Create a new procedure for the agent on a branch. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + request : typing.Optional[CreateProcedureRequestModel] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateProcedureResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=CreateProcedureRequestModel, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateProcedureResponseModel, + construct_type( + type_=CreateProcedureResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def compile( + self, agent_id: str, branch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[CompileProceduresResponseModel]: + """ + Legacy. Do not use. Saving an agent draft (`POST /v1/convai/agents/{agent_id}/drafts`) and publishing an agent (`PATCH /v1/convai/agents/{agent_id}`) compile structured procedures into workflow nodes and edges, save the compiled workflow with the draft or version, and return validation errors, so a separate compile call is no longer needed. This endpoint remains available for the time being so existing callers do not break, as a dry-run that compiles the current procedure drafts into a workflow without persisting anything. It will eventually be deprecated. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CompileProceduresResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/compile", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CompileProceduresResponseModel, + construct_type( + type_=CompileProceduresResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + version_id: typing.Optional[str] = None, + agent_version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ProcedureAtVersionResponseModel]: + """ + Retrieve a procedure at a specific version or the current branch HEAD. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + version_id : typing.Optional[str] + The version ID to retrieve. If omitted, returns the version at branch HEAD. + + agent_version_id : typing.Optional[str] + The agent version ID to retrieve the procedure for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProcedureAtVersionResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}", + method="GET", + params={ + "version_id": version_id, + "agent_version_id": agent_version_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProcedureAtVersionResponseModel, + construct_type( + type_=ProcedureAtVersionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def remove( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Remove a procedure from the agent's draft working set. Removing a folder cascades to its entire subtree, rejected if any procedure outside the subtree hands off into it. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawProceduresClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + agent_id: str, + branch_id: str, + *, + agent_version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListProceduresResponseModel]: + """ + List the procedures attached to this agent branch. By default, unpublished drafts take precedence over the latest committed version. Pass agent_version_id to list a published snapshot instead. has_draft is true when a procedure has unpublished draft changes on this branch. Procedure content is not included; use Get Procedure to read a procedure's body. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + agent_version_id : typing.Optional[str] + The agent version ID to retrieve the procedure for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListProceduresResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures", + method="GET", + params={ + "agent_version_id": agent_version_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListProceduresResponseModel, + construct_type( + type_=ListProceduresResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + agent_id: str, + branch_id: str, + *, + request: typing.Optional[CreateProcedureRequestModel] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateProcedureResponseModel]: + """ + Create a new procedure for the agent on a branch. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + request : typing.Optional[CreateProcedureRequestModel] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateProcedureResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=CreateProcedureRequestModel, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateProcedureResponseModel, + construct_type( + type_=CreateProcedureResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def compile( + self, agent_id: str, branch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[CompileProceduresResponseModel]: + """ + Legacy. Do not use. Saving an agent draft (`POST /v1/convai/agents/{agent_id}/drafts`) and publishing an agent (`PATCH /v1/convai/agents/{agent_id}`) compile structured procedures into workflow nodes and edges, save the compiled workflow with the draft or version, and return validation errors, so a separate compile call is no longer needed. This endpoint remains available for the time being so existing callers do not break, as a dry-run that compiles the current procedure drafts into a workflow without persisting anything. It will eventually be deprecated. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CompileProceduresResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/compile", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CompileProceduresResponseModel, + construct_type( + type_=CompileProceduresResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + version_id: typing.Optional[str] = None, + agent_version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ProcedureAtVersionResponseModel]: + """ + Retrieve a procedure at a specific version or the current branch HEAD. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + version_id : typing.Optional[str] + The version ID to retrieve. If omitted, returns the version at branch HEAD. + + agent_version_id : typing.Optional[str] + The agent version ID to retrieve the procedure for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProcedureAtVersionResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}", + method="GET", + params={ + "version_id": version_id, + "agent_version_id": agent_version_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProcedureAtVersionResponseModel, + construct_type( + type_=ProcedureAtVersionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def remove( + self, + agent_id: str, + branch_id: str, + procedure_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Remove a procedure from the agent's draft working set. Removing a folder cascades to its entire subtree, rejected if any procedure outside the subtree hands off into it. + + Parameters + ---------- + agent_id : str + Agent ID to get the procedure draft from + + branch_id : str + Branch ID to get the procedure draft from + + procedure_id : str + The procedure ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/branches/{jsonable_encoder(branch_id)}/procedures/{jsonable_encoder(procedure_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..9719c4535e2278089fd1d7dd86f5a82cc31b3efd --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/raw_client.py @@ -0,0 +1,1581 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.adhoc_agent_config_override_for_test_request_model import AdhocAgentConfigOverrideForTestRequestModel +from ...types.agent_platform_settings_request_model import AgentPlatformSettingsRequestModel +from ...types.agent_simulated_chat_test_response_model import AgentSimulatedChatTestResponseModel +from ...types.agent_sort_by import AgentSortBy +from ...types.agent_workflow_request_model import AgentWorkflowRequestModel +from ...types.conversation_simulation_specification import ConversationSimulationSpecification +from ...types.conversational_config import ConversationalConfig +from ...types.create_agent_response_model import CreateAgentResponseModel +from ...types.get_agent_response_model import GetAgentResponseModel +from ...types.get_agents_page_response_model import GetAgentsPageResponseModel +from ...types.get_test_suite_invocation_response_model import GetTestSuiteInvocationResponseModel +from ...types.procedure_version_ref import ProcedureVersionRef +from ...types.prompt_evaluation_criteria import PromptEvaluationCriteria +from ...types.single_test_run_request_model import SingleTestRunRequestModel +from ...types.sort_direction import SortDirection +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAgentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + conversation_config: ConversationalConfig, + enable_versioning: typing.Optional[bool] = None, + platform_settings: typing.Optional[AgentPlatformSettingsRequestModel] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateAgentResponseModel]: + """ + Create an agent from a config object + + Parameters + ---------- + conversation_config : ConversationalConfig + Conversation configuration for an agent + + enable_versioning : typing.Optional[bool] + Deprecated: all agents are versioned. This parameter is ignored. + + platform_settings : typing.Optional[AgentPlatformSettingsRequestModel] + Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + + workflow : typing.Optional[AgentWorkflowRequestModel] + Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + + name : typing.Optional[str] + A name to make the agent easier to find + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateAgentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/agents/create", + method="POST", + params={ + "enable_versioning": enable_versioning, + }, + json={ + "conversation_config": convert_and_respect_annotation_metadata( + object_=conversation_config, annotation=ConversationalConfig, direction="write" + ), + "platform_settings": convert_and_respect_annotation_metadata( + object_=platform_settings, annotation=AgentPlatformSettingsRequestModel, direction="write" + ), + "workflow": convert_and_respect_annotation_metadata( + object_=workflow, annotation=AgentWorkflowRequestModel, direction="write" + ), + "name": name, + "tags": tags, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentResponseModel, + construct_type( + type_=CreateAgentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + agent_id: str, + *, + version_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetAgentResponseModel]: + """ + Retrieve config for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + version_id : typing.Optional[str] + The ID of the agent version to use + + branch_id : typing.Optional[str] + The ID of the branch to use + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}", + method="GET", + params={ + "version_id": version_id, + "branch_id": branch_id, + "include_procedure_generated_workflow_elements": include_procedure_generated_workflow_elements, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentResponseModel, + construct_type( + type_=GetAgentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, + agent_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[None]: + """ + Delete an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + force : typing.Optional[bool] + If set to true, the agent is deleted even if other agents use it as a subagent, and it is removed from those agents and their branches. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}", + method="DELETE", + params={ + "force": force, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + agent_id: str, + *, + enable_versioning_if_not_enabled: typing.Optional[bool] = None, + branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + conversation_config: typing.Optional[ConversationalConfig] = OMIT, + platform_settings: typing.Optional[AgentPlatformSettingsRequestModel] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + version_description: typing.Optional[str] = OMIT, + procedures: typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetAgentResponseModel]: + """ + Patches an Agent settings + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + enable_versioning_if_not_enabled : typing.Optional[bool] + Deprecated: all agents are versioned. This parameter is ignored. + + branch_id : typing.Optional[str] + The ID of the branch to use + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + conversation_config : typing.Optional[ConversationalConfig] + Conversation configuration for an agent + + platform_settings : typing.Optional[AgentPlatformSettingsRequestModel] + Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + + workflow : typing.Optional[AgentWorkflowRequestModel] + Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + + name : typing.Optional[str] + A name to make the agent easier to find + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + version_description : typing.Optional[str] + Description for this version when publishing changes (only applicable for versioned agents) + + procedures : typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]] + Procedure versions to publish, keyed by procedure_id. When provided, this map replaces the procedures from the current draft or branch tip. When omitted or null, unpublished procedure edits are used if present; otherwise, the branch tip's procedures are retained. Pass an empty object to remove all procedures. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}", + method="PATCH", + params={ + "enable_versioning_if_not_enabled": enable_versioning_if_not_enabled, + "branch_id": branch_id, + "include_procedure_generated_workflow_elements": include_procedure_generated_workflow_elements, + }, + json={ + "conversation_config": convert_and_respect_annotation_metadata( + object_=conversation_config, annotation=ConversationalConfig, direction="write" + ), + "platform_settings": convert_and_respect_annotation_metadata( + object_=platform_settings, annotation=AgentPlatformSettingsRequestModel, direction="write" + ), + "workflow": convert_and_respect_annotation_metadata( + object_=workflow, annotation=AgentWorkflowRequestModel, direction="write" + ), + "name": name, + "tags": tags, + "version_description": version_description, + "procedures": convert_and_respect_annotation_metadata( + object_=procedures, + annotation=typing.Dict[str, typing.Optional[ProcedureVersionRef]], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentResponseModel, + construct_type( + type_=GetAgentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + archived: typing.Optional[bool] = None, + show_only_owned_agents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[AgentSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetAgentsPageResponseModel]: + """ + Returns a list of your agents and their metadata. + + Parameters + ---------- + page_size : typing.Optional[int] + How many Agents to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search by agents name. + + archived : typing.Optional[bool] + Filter agents by archived status + + show_only_owned_agents : typing.Optional[bool] + If set to true, the endpoint will omit any agents that were shared with you by someone else and include only the ones you own. Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter agents by creator user ID. When set, only agents created by this user are returned. Takes precedence over show_only_owned_agents. Use '@me' to refer to the authenticated user. + + tags : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter agents by tag. Repeat the parameter to match any of several tags. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[AgentSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentsPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/agents", + method="GET", + params={ + "page_size": page_size, + "search": search, + "archived": archived, + "show_only_owned_agents": show_only_owned_agents, + "created_by_user_id": created_by_user_id, + "tags": tags, + "sort_direction": sort_direction, + "sort_by": sort_by, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentsPageResponseModel, + construct_type( + type_=GetAgentsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def duplicate( + self, + agent_id: str, + *, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateAgentResponseModel]: + """ + Create a new agent by duplicating an existing one. The new agent gets a copy of every unarchived branch of the source agent, each with the same name and description and starting from the latest version on that branch. Version history, drafts, archived branches and traffic deployments are not copied, so the new agent routes all traffic to its main branch. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + name : typing.Optional[str] + A name to make the agent easier to find + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateAgentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/duplicate", + method="POST", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentResponseModel, + construct_type( + type_=CreateAgentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def simulate_conversation( + self, + agent_id: str, + *, + simulation_specification: ConversationSimulationSpecification, + extra_evaluation_criteria: typing.Optional[typing.Sequence[PromptEvaluationCriteria]] = OMIT, + new_turns_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentSimulatedChatTestResponseModel]: + """ + Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + simulation_specification : ConversationSimulationSpecification + A specification detailing how the conversation should be simulated + + extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]] + A list of evaluation criteria to test + + new_turns_limit : typing.Optional[int] + Maximum number of new turns to generate in the conversation simulation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentSimulatedChatTestResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/simulate-conversation", + method="POST", + json={ + "simulation_specification": convert_and_respect_annotation_metadata( + object_=simulation_specification, annotation=ConversationSimulationSpecification, direction="write" + ), + "extra_evaluation_criteria": convert_and_respect_annotation_metadata( + object_=extra_evaluation_criteria, + annotation=typing.Sequence[PromptEvaluationCriteria], + direction="write", + ), + "new_turns_limit": new_turns_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentSimulatedChatTestResponseModel, + construct_type( + type_=AgentSimulatedChatTestResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def simulate_conversation_stream( + self, + agent_id: str, + *, + simulation_specification: ConversationSimulationSpecification, + extra_evaluation_criteria: typing.Optional[typing.Sequence[PromptEvaluationCriteria]] = OMIT, + new_turns_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[None]: + """ + Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user and stream back the response. Response is streamed back as partial lists of messages that should be concatenated and once the conversation has complete a single final message with the conversation analysis will be sent. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + simulation_specification : ConversationSimulationSpecification + A specification detailing how the conversation should be simulated + + extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]] + A list of evaluation criteria to test + + new_turns_limit : typing.Optional[int] + Maximum number of new turns to generate in the conversation simulation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/simulate-conversation/stream", + method="POST", + json={ + "simulation_specification": convert_and_respect_annotation_metadata( + object_=simulation_specification, annotation=ConversationSimulationSpecification, direction="write" + ), + "extra_evaluation_criteria": convert_and_respect_annotation_metadata( + object_=extra_evaluation_criteria, + annotation=typing.Sequence[PromptEvaluationCriteria], + direction="write", + ), + "new_turns_limit": new_turns_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def run_tests( + self, + agent_id: str, + *, + tests: typing.Sequence[SingleTestRunRequestModel], + agent_config_override: typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] = OMIT, + branch_id: typing.Optional[str] = OMIT, + repeat_count: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetTestSuiteInvocationResponseModel]: + """ + Run selected tests on the agent with provided configuration. If the agent configuration is provided, it will be used to override default agent configuration. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + tests : typing.Sequence[SingleTestRunRequestModel] + List of tests to run on the agent + + agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] + Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + + branch_id : typing.Optional[str] + ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + + repeat_count : typing.Optional[int] + Number of times to run each test. When greater than 1, results are grouped and summarized. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetTestSuiteInvocationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/run-tests", + method="POST", + json={ + "tests": convert_and_respect_annotation_metadata( + object_=tests, annotation=typing.Sequence[SingleTestRunRequestModel], direction="write" + ), + "agent_config_override": convert_and_respect_annotation_metadata( + object_=agent_config_override, + annotation=AdhocAgentConfigOverrideForTestRequestModel, + direction="write", + ), + "branch_id": branch_id, + "repeat_count": repeat_count, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestSuiteInvocationResponseModel, + construct_type( + type_=GetTestSuiteInvocationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAgentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + conversation_config: ConversationalConfig, + enable_versioning: typing.Optional[bool] = None, + platform_settings: typing.Optional[AgentPlatformSettingsRequestModel] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateAgentResponseModel]: + """ + Create an agent from a config object + + Parameters + ---------- + conversation_config : ConversationalConfig + Conversation configuration for an agent + + enable_versioning : typing.Optional[bool] + Deprecated: all agents are versioned. This parameter is ignored. + + platform_settings : typing.Optional[AgentPlatformSettingsRequestModel] + Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + + workflow : typing.Optional[AgentWorkflowRequestModel] + Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + + name : typing.Optional[str] + A name to make the agent easier to find + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateAgentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/agents/create", + method="POST", + params={ + "enable_versioning": enable_versioning, + }, + json={ + "conversation_config": convert_and_respect_annotation_metadata( + object_=conversation_config, annotation=ConversationalConfig, direction="write" + ), + "platform_settings": convert_and_respect_annotation_metadata( + object_=platform_settings, annotation=AgentPlatformSettingsRequestModel, direction="write" + ), + "workflow": convert_and_respect_annotation_metadata( + object_=workflow, annotation=AgentWorkflowRequestModel, direction="write" + ), + "name": name, + "tags": tags, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentResponseModel, + construct_type( + type_=CreateAgentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + agent_id: str, + *, + version_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetAgentResponseModel]: + """ + Retrieve config for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + version_id : typing.Optional[str] + The ID of the agent version to use + + branch_id : typing.Optional[str] + The ID of the branch to use + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}", + method="GET", + params={ + "version_id": version_id, + "branch_id": branch_id, + "include_procedure_generated_workflow_elements": include_procedure_generated_workflow_elements, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentResponseModel, + construct_type( + type_=GetAgentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, + agent_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[None]: + """ + Delete an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + force : typing.Optional[bool] + If set to true, the agent is deleted even if other agents use it as a subagent, and it is removed from those agents and their branches. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}", + method="DELETE", + params={ + "force": force, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + agent_id: str, + *, + enable_versioning_if_not_enabled: typing.Optional[bool] = None, + branch_id: typing.Optional[str] = None, + include_procedure_generated_workflow_elements: typing.Optional[bool] = None, + conversation_config: typing.Optional[ConversationalConfig] = OMIT, + platform_settings: typing.Optional[AgentPlatformSettingsRequestModel] = OMIT, + workflow: typing.Optional[AgentWorkflowRequestModel] = OMIT, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + version_description: typing.Optional[str] = OMIT, + procedures: typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetAgentResponseModel]: + """ + Patches an Agent settings + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + enable_versioning_if_not_enabled : typing.Optional[bool] + Deprecated: all agents are versioned. This parameter is ignored. + + branch_id : typing.Optional[str] + The ID of the branch to use + + include_procedure_generated_workflow_elements : typing.Optional[bool] + Whether to include the workflow nodes and edges generated from structured procedures. When false, the workflow contains only authored elements. + + conversation_config : typing.Optional[ConversationalConfig] + Conversation configuration for an agent + + platform_settings : typing.Optional[AgentPlatformSettingsRequestModel] + Platform settings for the agent are all settings that aren't related to the conversation orchestration and content. + + workflow : typing.Optional[AgentWorkflowRequestModel] + Workflow for the agent. This is used to define the flow of the conversation and how the agent interacts with tools. + + name : typing.Optional[str] + A name to make the agent easier to find + + tags : typing.Optional[typing.Sequence[str]] + Tags to help classify and filter the agent + + version_description : typing.Optional[str] + Description for this version when publishing changes (only applicable for versioned agents) + + procedures : typing.Optional[typing.Dict[str, typing.Optional[ProcedureVersionRef]]] + Procedure versions to publish, keyed by procedure_id. When provided, this map replaces the procedures from the current draft or branch tip. When omitted or null, unpublished procedure edits are used if present; otherwise, the branch tip's procedures are retained. Pass an empty object to remove all procedures. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}", + method="PATCH", + params={ + "enable_versioning_if_not_enabled": enable_versioning_if_not_enabled, + "branch_id": branch_id, + "include_procedure_generated_workflow_elements": include_procedure_generated_workflow_elements, + }, + json={ + "conversation_config": convert_and_respect_annotation_metadata( + object_=conversation_config, annotation=ConversationalConfig, direction="write" + ), + "platform_settings": convert_and_respect_annotation_metadata( + object_=platform_settings, annotation=AgentPlatformSettingsRequestModel, direction="write" + ), + "workflow": convert_and_respect_annotation_metadata( + object_=workflow, annotation=AgentWorkflowRequestModel, direction="write" + ), + "name": name, + "tags": tags, + "version_description": version_description, + "procedures": convert_and_respect_annotation_metadata( + object_=procedures, + annotation=typing.Dict[str, typing.Optional[ProcedureVersionRef]], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentResponseModel, + construct_type( + type_=GetAgentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + archived: typing.Optional[bool] = None, + show_only_owned_agents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + tags: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[AgentSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetAgentsPageResponseModel]: + """ + Returns a list of your agents and their metadata. + + Parameters + ---------- + page_size : typing.Optional[int] + How many Agents to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search by agents name. + + archived : typing.Optional[bool] + Filter agents by archived status + + show_only_owned_agents : typing.Optional[bool] + If set to true, the endpoint will omit any agents that were shared with you by someone else and include only the ones you own. Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter agents by creator user ID. When set, only agents created by this user are returned. Takes precedence over show_only_owned_agents. Use '@me' to refer to the authenticated user. + + tags : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter agents by tag. Repeat the parameter to match any of several tags. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[AgentSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentsPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/agents", + method="GET", + params={ + "page_size": page_size, + "search": search, + "archived": archived, + "show_only_owned_agents": show_only_owned_agents, + "created_by_user_id": created_by_user_id, + "tags": tags, + "sort_direction": sort_direction, + "sort_by": sort_by, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentsPageResponseModel, + construct_type( + type_=GetAgentsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def duplicate( + self, + agent_id: str, + *, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateAgentResponseModel]: + """ + Create a new agent by duplicating an existing one. The new agent gets a copy of every unarchived branch of the source agent, each with the same name and description and starting from the latest version on that branch. Version history, drafts, archived branches and traffic deployments are not copied, so the new agent routes all traffic to its main branch. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + name : typing.Optional[str] + A name to make the agent easier to find + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateAgentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/duplicate", + method="POST", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentResponseModel, + construct_type( + type_=CreateAgentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def simulate_conversation( + self, + agent_id: str, + *, + simulation_specification: ConversationSimulationSpecification, + extra_evaluation_criteria: typing.Optional[typing.Sequence[PromptEvaluationCriteria]] = OMIT, + new_turns_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentSimulatedChatTestResponseModel]: + """ + Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + simulation_specification : ConversationSimulationSpecification + A specification detailing how the conversation should be simulated + + extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]] + A list of evaluation criteria to test + + new_turns_limit : typing.Optional[int] + Maximum number of new turns to generate in the conversation simulation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentSimulatedChatTestResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/simulate-conversation", + method="POST", + json={ + "simulation_specification": convert_and_respect_annotation_metadata( + object_=simulation_specification, annotation=ConversationSimulationSpecification, direction="write" + ), + "extra_evaluation_criteria": convert_and_respect_annotation_metadata( + object_=extra_evaluation_criteria, + annotation=typing.Sequence[PromptEvaluationCriteria], + direction="write", + ), + "new_turns_limit": new_turns_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentSimulatedChatTestResponseModel, + construct_type( + type_=AgentSimulatedChatTestResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def simulate_conversation_stream( + self, + agent_id: str, + *, + simulation_specification: ConversationSimulationSpecification, + extra_evaluation_criteria: typing.Optional[typing.Sequence[PromptEvaluationCriteria]] = OMIT, + new_turns_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[None]: + """ + Deprecated. This endpoint will be removed on 31 Oct 2026. Use the `/v1/convai/agent-testing/create` and `/v1/convai/agents/:agent_id/run-tests` endpoints to create and run simulations. Run a conversation between the agent and a simulated user and stream back the response. Response is streamed back as partial lists of messages that should be concatenated and once the conversation has complete a single final message with the conversation analysis will be sent. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + simulation_specification : ConversationSimulationSpecification + A specification detailing how the conversation should be simulated + + extra_evaluation_criteria : typing.Optional[typing.Sequence[PromptEvaluationCriteria]] + A list of evaluation criteria to test + + new_turns_limit : typing.Optional[int] + Maximum number of new turns to generate in the conversation simulation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/simulate-conversation/stream", + method="POST", + json={ + "simulation_specification": convert_and_respect_annotation_metadata( + object_=simulation_specification, annotation=ConversationSimulationSpecification, direction="write" + ), + "extra_evaluation_criteria": convert_and_respect_annotation_metadata( + object_=extra_evaluation_criteria, + annotation=typing.Sequence[PromptEvaluationCriteria], + direction="write", + ), + "new_turns_limit": new_turns_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def run_tests( + self, + agent_id: str, + *, + tests: typing.Sequence[SingleTestRunRequestModel], + agent_config_override: typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] = OMIT, + branch_id: typing.Optional[str] = OMIT, + repeat_count: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetTestSuiteInvocationResponseModel]: + """ + Run selected tests on the agent with provided configuration. If the agent configuration is provided, it will be used to override default agent configuration. + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + tests : typing.Sequence[SingleTestRunRequestModel] + List of tests to run on the agent + + agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] + Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + + branch_id : typing.Optional[str] + ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + + repeat_count : typing.Optional[int] + Number of times to run each test. When greater than 1, results are grouped and summarized. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetTestSuiteInvocationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/run-tests", + method="POST", + json={ + "tests": convert_and_respect_annotation_metadata( + object_=tests, annotation=typing.Sequence[SingleTestRunRequestModel], direction="write" + ), + "agent_config_override": convert_and_respect_annotation_metadata( + object_=agent_config_override, + annotation=AdhocAgentConfigOverrideForTestRequestModel, + direction="write", + ), + "branch_id": branch_id, + "repeat_count": repeat_count, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestSuiteInvocationResponseModel, + construct_type( + type_=GetTestSuiteInvocationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/summaries/__init__.py b/data/src/elevenlabs/conversational_ai/agents/summaries/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a644d928b732fc3a0e6c208f991f2d5225a0f291 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/summaries/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import SummariesGetResponseValue, SummariesGetResponseValue_Failure, SummariesGetResponseValue_Success +_dynamic_imports: typing.Dict[str, str] = { + "SummariesGetResponseValue": ".types", + "SummariesGetResponseValue_Failure": ".types", + "SummariesGetResponseValue_Success": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["SummariesGetResponseValue", "SummariesGetResponseValue_Failure", "SummariesGetResponseValue_Success"] diff --git a/data/src/elevenlabs/conversational_ai/agents/summaries/client.py b/data/src/elevenlabs/conversational_ai/agents/summaries/client.py new file mode 100644 index 0000000000000000000000000000000000000000..905af664fbc40fe49b2db56a79441a805182190d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/summaries/client.py @@ -0,0 +1,120 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from .raw_client import AsyncRawSummariesClient, RawSummariesClient +from .types.summaries_get_response_value import SummariesGetResponseValue + + +class SummariesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSummariesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSummariesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSummariesClient + """ + return self._raw_client + + def get( + self, + *, + agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Dict[str, SummariesGetResponseValue]: + """ + Returns summaries for the specified agents. + + Parameters + ---------- + agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + List of agent IDs to fetch summaries for + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, SummariesGetResponseValue] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.summaries.get( + agent_ids=["agent_ids"], + ) + """ + _response = self._raw_client.get(agent_ids=agent_ids, request_options=request_options) + return _response.data + + +class AsyncSummariesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSummariesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSummariesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSummariesClient + """ + return self._raw_client + + async def get( + self, + *, + agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Dict[str, SummariesGetResponseValue]: + """ + Returns summaries for the specified agents. + + Parameters + ---------- + agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + List of agent IDs to fetch summaries for + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, SummariesGetResponseValue] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.summaries.get( + agent_ids=["agent_ids"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(agent_ids=agent_ids, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/summaries/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/summaries/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..5b5b7076381987e3e170c2aab81edd1d0636015c --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/summaries/raw_client.py @@ -0,0 +1,144 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from .types.summaries_get_response_value import SummariesGetResponseValue +from pydantic import ValidationError + + +class RawSummariesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + *, + agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Dict[str, SummariesGetResponseValue]]: + """ + Returns summaries for the specified agents. + + Parameters + ---------- + agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + List of agent IDs to fetch summaries for + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Dict[str, SummariesGetResponseValue]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/agents/summaries", + method="GET", + params={ + "agent_ids": agent_ids, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, SummariesGetResponseValue], + construct_type( + type_=typing.Dict[str, SummariesGetResponseValue], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSummariesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + *, + agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Dict[str, SummariesGetResponseValue]]: + """ + Returns summaries for the specified agents. + + Parameters + ---------- + agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + List of agent IDs to fetch summaries for + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Dict[str, SummariesGetResponseValue]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/agents/summaries", + method="GET", + params={ + "agent_ids": agent_ids, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, SummariesGetResponseValue], + construct_type( + type_=typing.Dict[str, SummariesGetResponseValue], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/summaries/types/__init__.py b/data/src/elevenlabs/conversational_ai/agents/summaries/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..61ec6579434518cc7cfaeaf5bdeba9017e6f3a56 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/summaries/types/__init__.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .summaries_get_response_value import ( + SummariesGetResponseValue, + SummariesGetResponseValue_Failure, + SummariesGetResponseValue_Success, + ) +_dynamic_imports: typing.Dict[str, str] = { + "SummariesGetResponseValue": ".summaries_get_response_value", + "SummariesGetResponseValue_Failure": ".summaries_get_response_value", + "SummariesGetResponseValue_Success": ".summaries_get_response_value", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["SummariesGetResponseValue", "SummariesGetResponseValue_Failure", "SummariesGetResponseValue_Success"] diff --git a/data/src/elevenlabs/conversational_ai/agents/summaries/types/summaries_get_response_value.py b/data/src/elevenlabs/conversational_ai/agents/summaries/types/summaries_get_response_value.py new file mode 100644 index 0000000000000000000000000000000000000000..5b69c5a549d5c6bd93d47b62d3c190354e718728 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/summaries/types/summaries_get_response_value.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .....types.agent_summary_response_model import AgentSummaryResponseModel + + +class SummariesGetResponseValue_Success(UncheckedBaseModel): + status: typing.Literal["success"] = "success" + data: AgentSummaryResponseModel + + 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 + + +class SummariesGetResponseValue_Failure(UncheckedBaseModel): + status: typing.Literal["failure"] = "failure" + error_code: int + error_status: str + error_message: 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 + + +SummariesGetResponseValue = typing_extensions.Annotated[ + typing.Union[SummariesGetResponseValue_Success, SummariesGetResponseValue_Failure], + UnionMetadata(discriminant="status"), +] diff --git a/data/src/elevenlabs/conversational_ai/agents/versions/__init__.py b/data/src/elevenlabs/conversational_ai/agents/versions/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/versions/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/versions/client.py b/data/src/elevenlabs/conversational_ai/agents/versions/client.py new file mode 100644 index 0000000000000000000000000000000000000000..056198633396c28994287e208edb6237b89a6d3c --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/versions/client.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.agent_version_metadata import AgentVersionMetadata +from .raw_client import AsyncRawVersionsClient, RawVersionsClient + + +class VersionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawVersionsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawVersionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawVersionsClient + """ + return self._raw_client + + def get( + self, agent_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AgentVersionMetadata: + """ + Get metadata for a specific agent version + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + version_id : str + Unique identifier for the version. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentVersionMetadata + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.versions.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + version_id="agtvrsn_0901k4aafjxxfxt93gd841r7tv5t", + ) + """ + _response = self._raw_client.get(agent_id, version_id, request_options=request_options) + return _response.data + + +class AsyncVersionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawVersionsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawVersionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawVersionsClient + """ + return self._raw_client + + async def get( + self, agent_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AgentVersionMetadata: + """ + Get metadata for a specific agent version + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + version_id : str + Unique identifier for the version. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentVersionMetadata + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.versions.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + version_id="agtvrsn_0901k4aafjxxfxt93gd841r7tv5t", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(agent_id, version_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/versions/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/versions/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..3dd3585fb63e619d03cb816a6855b769c4507dcd --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/versions/raw_client.py @@ -0,0 +1,139 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.agent_version_metadata import AgentVersionMetadata +from pydantic import ValidationError + + +class RawVersionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, agent_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AgentVersionMetadata]: + """ + Get metadata for a specific agent version + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + version_id : str + Unique identifier for the version. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentVersionMetadata] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/versions/{jsonable_encoder(version_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentVersionMetadata, + construct_type( + type_=AgentVersionMetadata, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawVersionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, agent_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AgentVersionMetadata]: + """ + Get metadata for a specific agent version + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + version_id : str + Unique identifier for the version. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentVersionMetadata] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/versions/{jsonable_encoder(version_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentVersionMetadata, + construct_type( + type_=AgentVersionMetadata, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/widget/__init__.py b/data/src/elevenlabs/conversational_ai/agents/widget/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..95dbe0a16963cf4bac67ff12a50fe2f4a5c7002d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/widget/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import avatar +_dynamic_imports: typing.Dict[str, str] = {"avatar": ".avatar"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["avatar"] diff --git a/data/src/elevenlabs/conversational_ai/agents/widget/avatar/__init__.py b/data/src/elevenlabs/conversational_ai/agents/widget/avatar/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/widget/avatar/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/agents/widget/avatar/client.py b/data/src/elevenlabs/conversational_ai/agents/widget/avatar/client.py new file mode 100644 index 0000000000000000000000000000000000000000..576afab508bc7252fc6ee8b6937004e8c13e40a4 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/widget/avatar/client.py @@ -0,0 +1,124 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..... import core +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.post_agent_avatar_response_model import PostAgentAvatarResponseModel +from .raw_client import AsyncRawAvatarClient, RawAvatarClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AvatarClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAvatarClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAvatarClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAvatarClient + """ + return self._raw_client + + def create( + self, agent_id: str, *, avatar_file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> PostAgentAvatarResponseModel: + """ + Sets the avatar for an agent displayed in the widget + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + avatar_file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PostAgentAvatarResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.widget.avatar.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + """ + _response = self._raw_client.create(agent_id, avatar_file=avatar_file, request_options=request_options) + return _response.data + + +class AsyncAvatarClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAvatarClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAvatarClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAvatarClient + """ + return self._raw_client + + async def create( + self, agent_id: str, *, avatar_file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> PostAgentAvatarResponseModel: + """ + Sets the avatar for an agent displayed in the widget + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + avatar_file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PostAgentAvatarResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.widget.avatar.create( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(agent_id, avatar_file=avatar_file, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/agents/widget/avatar/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/widget/avatar/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..7c485596356db7afbc0fdb23454a4740b47630e9 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/widget/avatar/raw_client.py @@ -0,0 +1,155 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..... import core +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.post_agent_avatar_response_model import PostAgentAvatarResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAvatarClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, agent_id: str, *, avatar_file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PostAgentAvatarResponseModel]: + """ + Sets the avatar for an agent displayed in the widget + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + avatar_file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PostAgentAvatarResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/avatar", + method="POST", + data={}, + files={ + "avatar_file": avatar_file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PostAgentAvatarResponseModel, + construct_type( + type_=PostAgentAvatarResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAvatarClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, agent_id: str, *, avatar_file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PostAgentAvatarResponseModel]: + """ + Sets the avatar for an agent displayed in the widget + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + avatar_file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PostAgentAvatarResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/avatar", + method="POST", + data={}, + files={ + "avatar_file": avatar_file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PostAgentAvatarResponseModel, + construct_type( + type_=PostAgentAvatarResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/agents/widget/client.py b/data/src/elevenlabs/conversational_ai/agents/widget/client.py new file mode 100644 index 0000000000000000000000000000000000000000..bd8994bb4fda82e50a9bf9ffe37f9ef648551c93 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/widget/client.py @@ -0,0 +1,159 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.get_agent_embed_response_model import GetAgentEmbedResponseModel +from .raw_client import AsyncRawWidgetClient, RawWidgetClient + +if typing.TYPE_CHECKING: + from .avatar.client import AsyncAvatarClient, AvatarClient + + +class WidgetClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawWidgetClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._avatar: typing.Optional[AvatarClient] = None + + @property + def with_raw_response(self) -> RawWidgetClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawWidgetClient + """ + return self._raw_client + + def get( + self, + agent_id: str, + *, + conversation_signature: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentEmbedResponseModel: + """ + Retrieve the widget configuration for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + conversation_signature : typing.Optional[str] + An expiring token that enables a websocket conversation to start. These can be generated for an agent using the /v1/convai/conversation/get_signed_url endpoint + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentEmbedResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.agents.widget.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + conversation_signature="conversation_signature", + ) + """ + _response = self._raw_client.get( + agent_id, conversation_signature=conversation_signature, request_options=request_options + ) + return _response.data + + @property + def avatar(self): + if self._avatar is None: + from .avatar.client import AvatarClient # noqa: E402 + + self._avatar = AvatarClient(client_wrapper=self._client_wrapper) + return self._avatar + + +class AsyncWidgetClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawWidgetClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._avatar: typing.Optional[AsyncAvatarClient] = None + + @property + def with_raw_response(self) -> AsyncRawWidgetClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawWidgetClient + """ + return self._raw_client + + async def get( + self, + agent_id: str, + *, + conversation_signature: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentEmbedResponseModel: + """ + Retrieve the widget configuration for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + conversation_signature : typing.Optional[str] + An expiring token that enables a websocket conversation to start. These can be generated for an agent using the /v1/convai/conversation/get_signed_url endpoint + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentEmbedResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.agents.widget.get( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + conversation_signature="conversation_signature", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + agent_id, conversation_signature=conversation_signature, request_options=request_options + ) + return _response.data + + @property + def avatar(self): + if self._avatar is None: + from .avatar.client import AsyncAvatarClient # noqa: E402 + + self._avatar = AsyncAvatarClient(client_wrapper=self._client_wrapper) + return self._avatar diff --git a/data/src/elevenlabs/conversational_ai/agents/widget/raw_client.py b/data/src/elevenlabs/conversational_ai/agents/widget/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..877a066d37fe2ee1f7575b8dcb5192b5db079558 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/agents/widget/raw_client.py @@ -0,0 +1,153 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.get_agent_embed_response_model import GetAgentEmbedResponseModel +from pydantic import ValidationError + + +class RawWidgetClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + agent_id: str, + *, + conversation_signature: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetAgentEmbedResponseModel]: + """ + Retrieve the widget configuration for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + conversation_signature : typing.Optional[str] + An expiring token that enables a websocket conversation to start. These can be generated for an agent using the /v1/convai/conversation/get_signed_url endpoint + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentEmbedResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/widget", + method="GET", + params={ + "conversation_signature": conversation_signature, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentEmbedResponseModel, + construct_type( + type_=GetAgentEmbedResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawWidgetClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + agent_id: str, + *, + conversation_signature: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetAgentEmbedResponseModel]: + """ + Retrieve the widget configuration for an agent + + Parameters + ---------- + agent_id : str + The id of an agent. This is returned on agent creation. + + conversation_signature : typing.Optional[str] + An expiring token that enables a websocket conversation to start. These can be generated for an agent using the /v1/convai/conversation/get_signed_url endpoint + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentEmbedResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/widget", + method="GET", + params={ + "conversation_signature": conversation_signature, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentEmbedResponseModel, + construct_type( + type_=GetAgentEmbedResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/analytics/__init__.py b/data/src/elevenlabs/conversational_ai/analytics/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..338b70ddc4ff6d6d0e208f1c05f2593b67220162 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/analytics/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import live_count +_dynamic_imports: typing.Dict[str, str] = {"live_count": ".live_count"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["live_count"] diff --git a/data/src/elevenlabs/conversational_ai/analytics/client.py b/data/src/elevenlabs/conversational_ai/analytics/client.py new file mode 100644 index 0000000000000000000000000000000000000000..aa01ccef952aaef9867bd2e53ff14a83c3f9a934 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/analytics/client.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .raw_client import AsyncRawAnalyticsClient, RawAnalyticsClient + +if typing.TYPE_CHECKING: + from .live_count.client import AsyncLiveCountClient, LiveCountClient + + +class AnalyticsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAnalyticsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._live_count: typing.Optional[LiveCountClient] = None + + @property + def with_raw_response(self) -> RawAnalyticsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAnalyticsClient + """ + return self._raw_client + + @property + def live_count(self): + if self._live_count is None: + from .live_count.client import LiveCountClient # noqa: E402 + + self._live_count = LiveCountClient(client_wrapper=self._client_wrapper) + return self._live_count + + +class AsyncAnalyticsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAnalyticsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._live_count: typing.Optional[AsyncLiveCountClient] = None + + @property + def with_raw_response(self) -> AsyncRawAnalyticsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAnalyticsClient + """ + return self._raw_client + + @property + def live_count(self): + if self._live_count is None: + from .live_count.client import AsyncLiveCountClient # noqa: E402 + + self._live_count = AsyncLiveCountClient(client_wrapper=self._client_wrapper) + return self._live_count diff --git a/data/src/elevenlabs/conversational_ai/analytics/live_count/__init__.py b/data/src/elevenlabs/conversational_ai/analytics/live_count/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/analytics/live_count/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/analytics/live_count/client.py b/data/src/elevenlabs/conversational_ai/analytics/live_count/client.py new file mode 100644 index 0000000000000000000000000000000000000000..8bbd8ea5ef06a1895257dce337c5dc616f211b13 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/analytics/live_count/client.py @@ -0,0 +1,130 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.get_live_count_response import GetLiveCountResponse +from .raw_client import AsyncRawLiveCountClient, RawLiveCountClient + + +class LiveCountClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLiveCountClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLiveCountClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLiveCountClient + """ + return self._raw_client + + def get( + self, + *, + agent_id: typing.Optional[str] = None, + agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetLiveCountResponse: + """ + Get the live count of the ongoing conversations. + + Parameters + ---------- + agent_id : typing.Optional[str] + The id of an agent to restrict the analytics to. + + agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Restrict analytics to the union of the given agents. Takes precedence over `agent_id` when both are supplied. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetLiveCountResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.analytics.live_count.get( + agent_id="agent_id", + agent_ids=["agent_ids"], + ) + """ + _response = self._raw_client.get(agent_id=agent_id, agent_ids=agent_ids, request_options=request_options) + return _response.data + + +class AsyncLiveCountClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLiveCountClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLiveCountClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLiveCountClient + """ + return self._raw_client + + async def get( + self, + *, + agent_id: typing.Optional[str] = None, + agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetLiveCountResponse: + """ + Get the live count of the ongoing conversations. + + Parameters + ---------- + agent_id : typing.Optional[str] + The id of an agent to restrict the analytics to. + + agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Restrict analytics to the union of the given agents. Takes precedence over `agent_id` when both are supplied. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetLiveCountResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.analytics.live_count.get( + agent_id="agent_id", + agent_ids=["agent_ids"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(agent_id=agent_id, agent_ids=agent_ids, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/analytics/live_count/raw_client.py b/data/src/elevenlabs/conversational_ai/analytics/live_count/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..2494769018127045690794ecce35c42d98913882 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/analytics/live_count/raw_client.py @@ -0,0 +1,154 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.get_live_count_response import GetLiveCountResponse +from pydantic import ValidationError + + +class RawLiveCountClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + *, + agent_id: typing.Optional[str] = None, + agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetLiveCountResponse]: + """ + Get the live count of the ongoing conversations. + + Parameters + ---------- + agent_id : typing.Optional[str] + The id of an agent to restrict the analytics to. + + agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Restrict analytics to the union of the given agents. Takes precedence over `agent_id` when both are supplied. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetLiveCountResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/analytics/live-count", + method="GET", + params={ + "agent_id": agent_id, + "agent_ids": agent_ids, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetLiveCountResponse, + construct_type( + type_=GetLiveCountResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLiveCountClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + *, + agent_id: typing.Optional[str] = None, + agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetLiveCountResponse]: + """ + Get the live count of the ongoing conversations. + + Parameters + ---------- + agent_id : typing.Optional[str] + The id of an agent to restrict the analytics to. + + agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Restrict analytics to the union of the given agents. Takes precedence over `agent_id` when both are supplied. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetLiveCountResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/analytics/live-count", + method="GET", + params={ + "agent_id": agent_id, + "agent_ids": agent_ids, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetLiveCountResponse, + construct_type( + type_=GetLiveCountResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/analytics/raw_client.py b/data/src/elevenlabs/conversational_ai/analytics/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9456724531c129704eb0bffcabb6fd520344dd --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/analytics/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawAnalyticsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawAnalyticsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/data/src/elevenlabs/conversational_ai/batch_calls/__init__.py b/data/src/elevenlabs/conversational_ai/batch_calls/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/batch_calls/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/batch_calls/client.py b/data/src/elevenlabs/conversational_ai/batch_calls/client.py new file mode 100644 index 0000000000000000000000000000000000000000..b11d9fcc103a10a45af4fcdab9718d17633ad8ce --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/batch_calls/client.py @@ -0,0 +1,683 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.batch_call_detailed_response import BatchCallDetailedResponse +from ...types.batch_call_response import BatchCallResponse +from ...types.batch_call_whats_app_params import BatchCallWhatsAppParams +from ...types.outbound_call_recipient import OutboundCallRecipient +from ...types.telephony_call_config_input import TelephonyCallConfigInput +from ...types.workspace_batch_calls_response import WorkspaceBatchCallsResponse +from .raw_client import AsyncRawBatchCallsClient, RawBatchCallsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class BatchCallsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawBatchCallsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawBatchCallsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawBatchCallsClient + """ + return self._raw_client + + def create( + self, + *, + call_name: str, + agent_id: str, + recipients: typing.Sequence[OutboundCallRecipient], + scheduled_time_unix: typing.Optional[int] = OMIT, + agent_phone_number_id: typing.Optional[str] = OMIT, + whatsapp_params: typing.Optional[BatchCallWhatsAppParams] = OMIT, + timezone: typing.Optional[str] = OMIT, + branch_id: typing.Optional[str] = OMIT, + environment: typing.Optional[str] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + target_concurrency_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> BatchCallResponse: + """ + Submit a batch call request to schedule calls for multiple recipients. + + Parameters + ---------- + call_name : str + + agent_id : str + + recipients : typing.Sequence[OutboundCallRecipient] + + scheduled_time_unix : typing.Optional[int] + + agent_phone_number_id : typing.Optional[str] + + whatsapp_params : typing.Optional[BatchCallWhatsAppParams] + + timezone : typing.Optional[str] + + branch_id : typing.Optional[str] + + environment : typing.Optional[str] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + target_concurrency_limit : typing.Optional[int] + Maximum number of simultaneous calls for this batch. When set, dispatch is governed by this limit rather than workspace/agent capacity percentages. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BatchCallResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, OutboundCallRecipient + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.batch_calls.create( + call_name="call_name", + agent_id="agent_id", + recipients=[OutboundCallRecipient()], + ) + """ + _response = self._raw_client.create( + call_name=call_name, + agent_id=agent_id, + recipients=recipients, + scheduled_time_unix=scheduled_time_unix, + agent_phone_number_id=agent_phone_number_id, + whatsapp_params=whatsapp_params, + timezone=timezone, + branch_id=branch_id, + environment=environment, + telephony_call_config=telephony_call_config, + target_concurrency_limit=target_concurrency_limit, + request_options=request_options, + ) + return _response.data + + def list( + self, + *, + limit: typing.Optional[int] = None, + last_doc: typing.Optional[str] = None, + agent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceBatchCallsResponse: + """ + Get all batch calls for the current workspace. + + Parameters + ---------- + limit : typing.Optional[int] + + last_doc : typing.Optional[str] + + agent_id : typing.Optional[str] + Filter batch calls to a single agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceBatchCallsResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.batch_calls.list( + limit=1, + last_doc="last_doc", + agent_id="agent_id", + ) + """ + _response = self._raw_client.list( + limit=limit, last_doc=last_doc, agent_id=agent_id, request_options=request_options + ) + return _response.data + + def get( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> BatchCallDetailedResponse: + """ + Get detailed information about a batch call including all recipients. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BatchCallDetailedResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.batch_calls.get( + batch_id="batch_id", + ) + """ + _response = self._raw_client.get(batch_id, request_options=request_options) + return _response.data + + def delete(self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Permanently delete a batch call and all recipient records. Conversations remain in history. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.batch_calls.delete( + batch_id="batch_id", + ) + """ + _response = self._raw_client.delete(batch_id, request_options=request_options) + return _response.data + + def cancel(self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> BatchCallResponse: + """ + Cancel a running batch call and set all recipients to cancelled status. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BatchCallResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.batch_calls.cancel( + batch_id="batch_id", + ) + """ + _response = self._raw_client.cancel(batch_id, request_options=request_options) + return _response.data + + def retry(self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> BatchCallResponse: + """ + Retry a batch call, calling failed and no-response recipients again. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BatchCallResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.batch_calls.retry( + batch_id="batch_id", + ) + """ + _response = self._raw_client.retry(batch_id, request_options=request_options) + return _response.data + + def export( + self, + batch_id: str, + *, + limit: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Download all recipients and conversation results for a terminal batch call as CSV. + + Parameters + ---------- + batch_id : str + + limit : typing.Optional[int] + Only export the first N recipients; used to preview the columns. Omit to export every recipient. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Batch call results CSV. + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.batch_calls.export( + batch_id="batch_id", + ) + """ + with self._raw_client.export(batch_id, limit=limit, request_options=request_options) as r: + yield from r.data + + +class AsyncBatchCallsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawBatchCallsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawBatchCallsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawBatchCallsClient + """ + return self._raw_client + + async def create( + self, + *, + call_name: str, + agent_id: str, + recipients: typing.Sequence[OutboundCallRecipient], + scheduled_time_unix: typing.Optional[int] = OMIT, + agent_phone_number_id: typing.Optional[str] = OMIT, + whatsapp_params: typing.Optional[BatchCallWhatsAppParams] = OMIT, + timezone: typing.Optional[str] = OMIT, + branch_id: typing.Optional[str] = OMIT, + environment: typing.Optional[str] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + target_concurrency_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> BatchCallResponse: + """ + Submit a batch call request to schedule calls for multiple recipients. + + Parameters + ---------- + call_name : str + + agent_id : str + + recipients : typing.Sequence[OutboundCallRecipient] + + scheduled_time_unix : typing.Optional[int] + + agent_phone_number_id : typing.Optional[str] + + whatsapp_params : typing.Optional[BatchCallWhatsAppParams] + + timezone : typing.Optional[str] + + branch_id : typing.Optional[str] + + environment : typing.Optional[str] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + target_concurrency_limit : typing.Optional[int] + Maximum number of simultaneous calls for this batch. When set, dispatch is governed by this limit rather than workspace/agent capacity percentages. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BatchCallResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, OutboundCallRecipient + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.batch_calls.create( + call_name="call_name", + agent_id="agent_id", + recipients=[OutboundCallRecipient()], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + call_name=call_name, + agent_id=agent_id, + recipients=recipients, + scheduled_time_unix=scheduled_time_unix, + agent_phone_number_id=agent_phone_number_id, + whatsapp_params=whatsapp_params, + timezone=timezone, + branch_id=branch_id, + environment=environment, + telephony_call_config=telephony_call_config, + target_concurrency_limit=target_concurrency_limit, + request_options=request_options, + ) + return _response.data + + async def list( + self, + *, + limit: typing.Optional[int] = None, + last_doc: typing.Optional[str] = None, + agent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceBatchCallsResponse: + """ + Get all batch calls for the current workspace. + + Parameters + ---------- + limit : typing.Optional[int] + + last_doc : typing.Optional[str] + + agent_id : typing.Optional[str] + Filter batch calls to a single agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceBatchCallsResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.batch_calls.list( + limit=1, + last_doc="last_doc", + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + limit=limit, last_doc=last_doc, agent_id=agent_id, request_options=request_options + ) + return _response.data + + async def get( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> BatchCallDetailedResponse: + """ + Get detailed information about a batch call including all recipients. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BatchCallDetailedResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.batch_calls.get( + batch_id="batch_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(batch_id, request_options=request_options) + return _response.data + + async def delete(self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Permanently delete a batch call and all recipient records. Conversations remain in history. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.batch_calls.delete( + batch_id="batch_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(batch_id, request_options=request_options) + return _response.data + + async def cancel( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> BatchCallResponse: + """ + Cancel a running batch call and set all recipients to cancelled status. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BatchCallResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.batch_calls.cancel( + batch_id="batch_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.cancel(batch_id, request_options=request_options) + return _response.data + + async def retry( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> BatchCallResponse: + """ + Retry a batch call, calling failed and no-response recipients again. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BatchCallResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.batch_calls.retry( + batch_id="batch_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.retry(batch_id, request_options=request_options) + return _response.data + + async def export( + self, + batch_id: str, + *, + limit: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Download all recipients and conversation results for a terminal batch call as CSV. + + Parameters + ---------- + batch_id : str + + limit : typing.Optional[int] + Only export the first N recipients; used to preview the columns. Omit to export every recipient. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Batch call results CSV. + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.batch_calls.export( + batch_id="batch_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.export(batch_id, limit=limit, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/conversational_ai/batch_calls/raw_client.py b/data/src/elevenlabs/conversational_ai/batch_calls/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..010673d6a884b8954d15efde72edc12f2c6654be --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/batch_calls/raw_client.py @@ -0,0 +1,938 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.batch_call_detailed_response import BatchCallDetailedResponse +from ...types.batch_call_response import BatchCallResponse +from ...types.batch_call_whats_app_params import BatchCallWhatsAppParams +from ...types.outbound_call_recipient import OutboundCallRecipient +from ...types.telephony_call_config_input import TelephonyCallConfigInput +from ...types.workspace_batch_calls_response import WorkspaceBatchCallsResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawBatchCallsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + call_name: str, + agent_id: str, + recipients: typing.Sequence[OutboundCallRecipient], + scheduled_time_unix: typing.Optional[int] = OMIT, + agent_phone_number_id: typing.Optional[str] = OMIT, + whatsapp_params: typing.Optional[BatchCallWhatsAppParams] = OMIT, + timezone: typing.Optional[str] = OMIT, + branch_id: typing.Optional[str] = OMIT, + environment: typing.Optional[str] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + target_concurrency_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[BatchCallResponse]: + """ + Submit a batch call request to schedule calls for multiple recipients. + + Parameters + ---------- + call_name : str + + agent_id : str + + recipients : typing.Sequence[OutboundCallRecipient] + + scheduled_time_unix : typing.Optional[int] + + agent_phone_number_id : typing.Optional[str] + + whatsapp_params : typing.Optional[BatchCallWhatsAppParams] + + timezone : typing.Optional[str] + + branch_id : typing.Optional[str] + + environment : typing.Optional[str] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + target_concurrency_limit : typing.Optional[int] + Maximum number of simultaneous calls for this batch. When set, dispatch is governed by this limit rather than workspace/agent capacity percentages. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[BatchCallResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/batch-calling/submit", + method="POST", + json={ + "call_name": call_name, + "agent_id": agent_id, + "recipients": convert_and_respect_annotation_metadata( + object_=recipients, annotation=typing.Sequence[OutboundCallRecipient], direction="write" + ), + "scheduled_time_unix": scheduled_time_unix, + "agent_phone_number_id": agent_phone_number_id, + "whatsapp_params": convert_and_respect_annotation_metadata( + object_=whatsapp_params, annotation=BatchCallWhatsAppParams, direction="write" + ), + "timezone": timezone, + "branch_id": branch_id, + "environment": environment, + "telephony_call_config": convert_and_respect_annotation_metadata( + object_=telephony_call_config, annotation=TelephonyCallConfigInput, direction="write" + ), + "target_concurrency_limit": target_concurrency_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + BatchCallResponse, + construct_type( + type_=BatchCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list( + self, + *, + limit: typing.Optional[int] = None, + last_doc: typing.Optional[str] = None, + agent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[WorkspaceBatchCallsResponse]: + """ + Get all batch calls for the current workspace. + + Parameters + ---------- + limit : typing.Optional[int] + + last_doc : typing.Optional[str] + + agent_id : typing.Optional[str] + Filter batch calls to a single agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceBatchCallsResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/batch-calling/workspace", + method="GET", + params={ + "limit": limit, + "last_doc": last_doc, + "agent_id": agent_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceBatchCallsResponse, + construct_type( + type_=WorkspaceBatchCallsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[BatchCallDetailedResponse]: + """ + Get detailed information about a batch call including all recipients. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[BatchCallDetailedResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + BatchCallDetailedResponse, + construct_type( + type_=BatchCallDetailedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete(self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Permanently delete a batch call and all recipient records. Conversations remain in history. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def cancel( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[BatchCallResponse]: + """ + Cancel a running batch call and set all recipients to cancelled status. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[BatchCallResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}/cancel", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + BatchCallResponse, + construct_type( + type_=BatchCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def retry( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[BatchCallResponse]: + """ + Retry a batch call, calling failed and no-response recipients again. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[BatchCallResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}/retry", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + BatchCallResponse, + construct_type( + type_=BatchCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def export( + self, + batch_id: str, + *, + limit: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Download all recipients and conversation results for a terminal batch call as CSV. + + Parameters + ---------- + batch_id : str + + limit : typing.Optional[int] + Only export the first N recipients; used to preview the columns. Omit to export every recipient. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Batch call results CSV. + """ + with self._client_wrapper.httpx_client.stream( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}/export", + method="GET", + params={ + "limit": limit, + }, + request_options=request_options, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawBatchCallsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + call_name: str, + agent_id: str, + recipients: typing.Sequence[OutboundCallRecipient], + scheduled_time_unix: typing.Optional[int] = OMIT, + agent_phone_number_id: typing.Optional[str] = OMIT, + whatsapp_params: typing.Optional[BatchCallWhatsAppParams] = OMIT, + timezone: typing.Optional[str] = OMIT, + branch_id: typing.Optional[str] = OMIT, + environment: typing.Optional[str] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + target_concurrency_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[BatchCallResponse]: + """ + Submit a batch call request to schedule calls for multiple recipients. + + Parameters + ---------- + call_name : str + + agent_id : str + + recipients : typing.Sequence[OutboundCallRecipient] + + scheduled_time_unix : typing.Optional[int] + + agent_phone_number_id : typing.Optional[str] + + whatsapp_params : typing.Optional[BatchCallWhatsAppParams] + + timezone : typing.Optional[str] + + branch_id : typing.Optional[str] + + environment : typing.Optional[str] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + target_concurrency_limit : typing.Optional[int] + Maximum number of simultaneous calls for this batch. When set, dispatch is governed by this limit rather than workspace/agent capacity percentages. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[BatchCallResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/batch-calling/submit", + method="POST", + json={ + "call_name": call_name, + "agent_id": agent_id, + "recipients": convert_and_respect_annotation_metadata( + object_=recipients, annotation=typing.Sequence[OutboundCallRecipient], direction="write" + ), + "scheduled_time_unix": scheduled_time_unix, + "agent_phone_number_id": agent_phone_number_id, + "whatsapp_params": convert_and_respect_annotation_metadata( + object_=whatsapp_params, annotation=BatchCallWhatsAppParams, direction="write" + ), + "timezone": timezone, + "branch_id": branch_id, + "environment": environment, + "telephony_call_config": convert_and_respect_annotation_metadata( + object_=telephony_call_config, annotation=TelephonyCallConfigInput, direction="write" + ), + "target_concurrency_limit": target_concurrency_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + BatchCallResponse, + construct_type( + type_=BatchCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list( + self, + *, + limit: typing.Optional[int] = None, + last_doc: typing.Optional[str] = None, + agent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[WorkspaceBatchCallsResponse]: + """ + Get all batch calls for the current workspace. + + Parameters + ---------- + limit : typing.Optional[int] + + last_doc : typing.Optional[str] + + agent_id : typing.Optional[str] + Filter batch calls to a single agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceBatchCallsResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/batch-calling/workspace", + method="GET", + params={ + "limit": limit, + "last_doc": last_doc, + "agent_id": agent_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceBatchCallsResponse, + construct_type( + type_=WorkspaceBatchCallsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[BatchCallDetailedResponse]: + """ + Get detailed information about a batch call including all recipients. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[BatchCallDetailedResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + BatchCallDetailedResponse, + construct_type( + type_=BatchCallDetailedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Permanently delete a batch call and all recipient records. Conversations remain in history. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def cancel( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[BatchCallResponse]: + """ + Cancel a running batch call and set all recipients to cancelled status. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[BatchCallResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}/cancel", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + BatchCallResponse, + construct_type( + type_=BatchCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def retry( + self, batch_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[BatchCallResponse]: + """ + Retry a batch call, calling failed and no-response recipients again. + + Parameters + ---------- + batch_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[BatchCallResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}/retry", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + BatchCallResponse, + construct_type( + type_=BatchCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def export( + self, + batch_id: str, + *, + limit: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Download all recipients and conversation results for a terminal batch call as CSV. + + Parameters + ---------- + batch_id : str + + limit : typing.Optional[int] + Only export the first N recipients; used to preview the columns. Omit to export every recipient. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Batch call results CSV. + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/convai/batch-calling/{jsonable_encoder(batch_id)}/export", + method="GET", + params={ + "limit": limit, + }, + request_options=request_options, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/conversational_ai/client.py b/data/src/elevenlabs/conversational_ai/client.py new file mode 100644 index 0000000000000000000000000000000000000000..393b26bcfceb82a5a6072d58ebcc4b76478e5e34 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/client.py @@ -0,0 +1,800 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.add_knowledge_base_response_model import AddKnowledgeBaseResponseModel +from ..types.rag_document_index_response_model import RagDocumentIndexResponseModel +from ..types.rag_document_indexes_response_model import RagDocumentIndexesResponseModel +from ..types.rag_index_overview_response_model import RagIndexOverviewResponseModel +from .raw_client import AsyncRawConversationalAiClient, RawConversationalAiClient + +if typing.TYPE_CHECKING: + from .agents.client import AgentsClient, AsyncAgentsClient + from .analytics.client import AnalyticsClient, AsyncAnalyticsClient + from .batch_calls.client import AsyncBatchCallsClient, BatchCallsClient + from .conversations.client import AsyncConversationsClient, ConversationsClient + from .dashboard.client import AsyncDashboardClient, DashboardClient + from .exotel.client import AsyncExotelClient, ExotelClient + from .knowledge_base.client import AsyncKnowledgeBaseClient, KnowledgeBaseClient + from .llm.client import AsyncLlmClient, LlmClient + from .llm_usage.client import AsyncLlmUsageClient, LlmUsageClient + from .mcp_servers.client import AsyncMcpServersClient, McpServersClient + from .phone_numbers.client import AsyncPhoneNumbersClient, PhoneNumbersClient + from .realtime.client import AsyncRealtimeClient, RealtimeClient + from .secrets.client import AsyncSecretsClient, SecretsClient + from .settings.client import AsyncSettingsClient, SettingsClient + from .sip_trunk.client import AsyncSipTrunkClient, SipTrunkClient + from .tests.client import AsyncTestsClient, TestsClient + from .tools.client import AsyncToolsClient, ToolsClient + from .triage_tickets.client import AsyncTriageTicketsClient, TriageTicketsClient + from .twilio.client import AsyncTwilioClient, TwilioClient + from .users.client import AsyncUsersClient, UsersClient + from .whatsapp.client import AsyncWhatsappClient, WhatsappClient + from .whatsapp_accounts.client import AsyncWhatsappAccountsClient, WhatsappAccountsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ConversationalAiClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawConversationalAiClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._conversations: typing.Optional[ConversationsClient] = None + self._twilio: typing.Optional[TwilioClient] = None + self._exotel: typing.Optional[ExotelClient] = None + self._whatsapp: typing.Optional[WhatsappClient] = None + self._agents: typing.Optional[AgentsClient] = None + self._tests: typing.Optional[TestsClient] = None + self._users: typing.Optional[UsersClient] = None + self._triage_tickets: typing.Optional[TriageTicketsClient] = None + self._phone_numbers: typing.Optional[PhoneNumbersClient] = None + self._llm_usage: typing.Optional[LlmUsageClient] = None + self._llm: typing.Optional[LlmClient] = None + self._knowledge_base: typing.Optional[KnowledgeBaseClient] = None + self._tools: typing.Optional[ToolsClient] = None + self._settings: typing.Optional[SettingsClient] = None + self._secrets: typing.Optional[SecretsClient] = None + self._batch_calls: typing.Optional[BatchCallsClient] = None + self._sip_trunk: typing.Optional[SipTrunkClient] = None + self._mcp_servers: typing.Optional[McpServersClient] = None + self._whatsapp_accounts: typing.Optional[WhatsappAccountsClient] = None + self._realtime: typing.Optional[RealtimeClient] = None + self._analytics: typing.Optional[AnalyticsClient] = None + self._dashboard: typing.Optional[DashboardClient] = None + + @property + def with_raw_response(self) -> RawConversationalAiClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawConversationalAiClient + """ + return self._raw_client + + def add_to_knowledge_base( + self, + *, + agent_id: typing.Optional[str] = None, + name: typing.Optional[str] = OMIT, + url: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Upload a file or webpage URL to create a knowledge base document.
After creating the document, update the agent's knowledge base by calling [Update agent](/docs/api-reference/agents/update). + + Parameters + ---------- + agent_id : typing.Optional[str] + + name : typing.Optional[str] + A custom, human-readable name for the document. + + url : typing.Optional[str] + URL to a page of documentation that the agent will have access to in order to interact with users. + + file : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.add_to_knowledge_base( + agent_id="agent_id", + ) + """ + _response = self._raw_client.add_to_knowledge_base( + agent_id=agent_id, name=name, url=url, file=file, request_options=request_options + ) + return _response.data + + def rag_index_overview( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> RagIndexOverviewResponseModel: + """ + Provides total size and other information of RAG indexes used by knowledgebase documents + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RagIndexOverviewResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.rag_index_overview() + """ + _response = self._raw_client.rag_index_overview(request_options=request_options) + return _response.data + + def get_document_rag_indexes( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> RagDocumentIndexesResponseModel: + """ + Provides information about all RAG indexes of the specified knowledgebase document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RagDocumentIndexesResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.get_document_rag_indexes( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get_document_rag_indexes(documentation_id, request_options=request_options) + return _response.data + + def delete_document_rag_index( + self, documentation_id: str, rag_index_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> RagDocumentIndexResponseModel: + """ + Delete RAG index for the knowledgebase document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + rag_index_id : str + The id of RAG index of document from the knowledge base. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RagDocumentIndexResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.delete_document_rag_index( + documentation_id="21m00Tcm4TlvDq8ikWAM", + rag_index_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.delete_document_rag_index( + documentation_id, rag_index_id, request_options=request_options + ) + return _response.data + + @property + def conversations(self): + if self._conversations is None: + from .conversations.client import ConversationsClient # noqa: E402 + + self._conversations = ConversationsClient(client_wrapper=self._client_wrapper) + return self._conversations + + @property + def twilio(self): + if self._twilio is None: + from .twilio.client import TwilioClient # noqa: E402 + + self._twilio = TwilioClient(client_wrapper=self._client_wrapper) + return self._twilio + + @property + def exotel(self): + if self._exotel is None: + from .exotel.client import ExotelClient # noqa: E402 + + self._exotel = ExotelClient(client_wrapper=self._client_wrapper) + return self._exotel + + @property + def whatsapp(self): + if self._whatsapp is None: + from .whatsapp.client import WhatsappClient # noqa: E402 + + self._whatsapp = WhatsappClient(client_wrapper=self._client_wrapper) + return self._whatsapp + + @property + def agents(self): + if self._agents is None: + from .agents.client import AgentsClient # noqa: E402 + + self._agents = AgentsClient(client_wrapper=self._client_wrapper) + return self._agents + + @property + def tests(self): + if self._tests is None: + from .tests.client import TestsClient # noqa: E402 + + self._tests = TestsClient(client_wrapper=self._client_wrapper) + return self._tests + + @property + def users(self): + if self._users is None: + from .users.client import UsersClient # noqa: E402 + + self._users = UsersClient(client_wrapper=self._client_wrapper) + return self._users + + @property + def triage_tickets(self): + if self._triage_tickets is None: + from .triage_tickets.client import TriageTicketsClient # noqa: E402 + + self._triage_tickets = TriageTicketsClient(client_wrapper=self._client_wrapper) + return self._triage_tickets + + @property + def phone_numbers(self): + if self._phone_numbers is None: + from .phone_numbers.client import PhoneNumbersClient # noqa: E402 + + self._phone_numbers = PhoneNumbersClient(client_wrapper=self._client_wrapper) + return self._phone_numbers + + @property + def llm_usage(self): + if self._llm_usage is None: + from .llm_usage.client import LlmUsageClient # noqa: E402 + + self._llm_usage = LlmUsageClient(client_wrapper=self._client_wrapper) + return self._llm_usage + + @property + def llm(self): + if self._llm is None: + from .llm.client import LlmClient # noqa: E402 + + self._llm = LlmClient(client_wrapper=self._client_wrapper) + return self._llm + + @property + def knowledge_base(self): + if self._knowledge_base is None: + from .knowledge_base.client import KnowledgeBaseClient # noqa: E402 + + self._knowledge_base = KnowledgeBaseClient(client_wrapper=self._client_wrapper) + return self._knowledge_base + + @property + def tools(self): + if self._tools is None: + from .tools.client import ToolsClient # noqa: E402 + + self._tools = ToolsClient(client_wrapper=self._client_wrapper) + return self._tools + + @property + def settings(self): + if self._settings is None: + from .settings.client import SettingsClient # noqa: E402 + + self._settings = SettingsClient(client_wrapper=self._client_wrapper) + return self._settings + + @property + def secrets(self): + if self._secrets is None: + from .secrets.client import SecretsClient # noqa: E402 + + self._secrets = SecretsClient(client_wrapper=self._client_wrapper) + return self._secrets + + @property + def batch_calls(self): + if self._batch_calls is None: + from .batch_calls.client import BatchCallsClient # noqa: E402 + + self._batch_calls = BatchCallsClient(client_wrapper=self._client_wrapper) + return self._batch_calls + + @property + def sip_trunk(self): + if self._sip_trunk is None: + from .sip_trunk.client import SipTrunkClient # noqa: E402 + + self._sip_trunk = SipTrunkClient(client_wrapper=self._client_wrapper) + return self._sip_trunk + + @property + def mcp_servers(self): + if self._mcp_servers is None: + from .mcp_servers.client import McpServersClient # noqa: E402 + + self._mcp_servers = McpServersClient(client_wrapper=self._client_wrapper) + return self._mcp_servers + + @property + def whatsapp_accounts(self): + if self._whatsapp_accounts is None: + from .whatsapp_accounts.client import WhatsappAccountsClient # noqa: E402 + + self._whatsapp_accounts = WhatsappAccountsClient(client_wrapper=self._client_wrapper) + return self._whatsapp_accounts + + @property + def realtime(self): + if self._realtime is None: + from .realtime.client import RealtimeClient # noqa: E402 + + self._realtime = RealtimeClient(client_wrapper=self._client_wrapper) + return self._realtime + + @property + def analytics(self): + if self._analytics is None: + from .analytics.client import AnalyticsClient # noqa: E402 + + self._analytics = AnalyticsClient(client_wrapper=self._client_wrapper) + return self._analytics + + @property + def dashboard(self): + if self._dashboard is None: + from .dashboard.client import DashboardClient # noqa: E402 + + self._dashboard = DashboardClient(client_wrapper=self._client_wrapper) + return self._dashboard + + +class AsyncConversationalAiClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawConversationalAiClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._conversations: typing.Optional[AsyncConversationsClient] = None + self._twilio: typing.Optional[AsyncTwilioClient] = None + self._exotel: typing.Optional[AsyncExotelClient] = None + self._whatsapp: typing.Optional[AsyncWhatsappClient] = None + self._agents: typing.Optional[AsyncAgentsClient] = None + self._tests: typing.Optional[AsyncTestsClient] = None + self._users: typing.Optional[AsyncUsersClient] = None + self._triage_tickets: typing.Optional[AsyncTriageTicketsClient] = None + self._phone_numbers: typing.Optional[AsyncPhoneNumbersClient] = None + self._llm_usage: typing.Optional[AsyncLlmUsageClient] = None + self._llm: typing.Optional[AsyncLlmClient] = None + self._knowledge_base: typing.Optional[AsyncKnowledgeBaseClient] = None + self._tools: typing.Optional[AsyncToolsClient] = None + self._settings: typing.Optional[AsyncSettingsClient] = None + self._secrets: typing.Optional[AsyncSecretsClient] = None + self._batch_calls: typing.Optional[AsyncBatchCallsClient] = None + self._sip_trunk: typing.Optional[AsyncSipTrunkClient] = None + self._mcp_servers: typing.Optional[AsyncMcpServersClient] = None + self._whatsapp_accounts: typing.Optional[AsyncWhatsappAccountsClient] = None + self._realtime: typing.Optional[AsyncRealtimeClient] = None + self._analytics: typing.Optional[AsyncAnalyticsClient] = None + self._dashboard: typing.Optional[AsyncDashboardClient] = None + + @property + def with_raw_response(self) -> AsyncRawConversationalAiClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawConversationalAiClient + """ + return self._raw_client + + async def add_to_knowledge_base( + self, + *, + agent_id: typing.Optional[str] = None, + name: typing.Optional[str] = OMIT, + url: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Upload a file or webpage URL to create a knowledge base document.
After creating the document, update the agent's knowledge base by calling [Update agent](/docs/api-reference/agents/update). + + Parameters + ---------- + agent_id : typing.Optional[str] + + name : typing.Optional[str] + A custom, human-readable name for the document. + + url : typing.Optional[str] + URL to a page of documentation that the agent will have access to in order to interact with users. + + file : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.add_to_knowledge_base( + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add_to_knowledge_base( + agent_id=agent_id, name=name, url=url, file=file, request_options=request_options + ) + return _response.data + + async def rag_index_overview( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> RagIndexOverviewResponseModel: + """ + Provides total size and other information of RAG indexes used by knowledgebase documents + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RagIndexOverviewResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.rag_index_overview() + + + asyncio.run(main()) + """ + _response = await self._raw_client.rag_index_overview(request_options=request_options) + return _response.data + + async def get_document_rag_indexes( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> RagDocumentIndexesResponseModel: + """ + Provides information about all RAG indexes of the specified knowledgebase document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RagDocumentIndexesResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.get_document_rag_indexes( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_document_rag_indexes(documentation_id, request_options=request_options) + return _response.data + + async def delete_document_rag_index( + self, documentation_id: str, rag_index_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> RagDocumentIndexResponseModel: + """ + Delete RAG index for the knowledgebase document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + rag_index_id : str + The id of RAG index of document from the knowledge base. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RagDocumentIndexResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.delete_document_rag_index( + documentation_id="21m00Tcm4TlvDq8ikWAM", + rag_index_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete_document_rag_index( + documentation_id, rag_index_id, request_options=request_options + ) + return _response.data + + @property + def conversations(self): + if self._conversations is None: + from .conversations.client import AsyncConversationsClient # noqa: E402 + + self._conversations = AsyncConversationsClient(client_wrapper=self._client_wrapper) + return self._conversations + + @property + def twilio(self): + if self._twilio is None: + from .twilio.client import AsyncTwilioClient # noqa: E402 + + self._twilio = AsyncTwilioClient(client_wrapper=self._client_wrapper) + return self._twilio + + @property + def exotel(self): + if self._exotel is None: + from .exotel.client import AsyncExotelClient # noqa: E402 + + self._exotel = AsyncExotelClient(client_wrapper=self._client_wrapper) + return self._exotel + + @property + def whatsapp(self): + if self._whatsapp is None: + from .whatsapp.client import AsyncWhatsappClient # noqa: E402 + + self._whatsapp = AsyncWhatsappClient(client_wrapper=self._client_wrapper) + return self._whatsapp + + @property + def agents(self): + if self._agents is None: + from .agents.client import AsyncAgentsClient # noqa: E402 + + self._agents = AsyncAgentsClient(client_wrapper=self._client_wrapper) + return self._agents + + @property + def tests(self): + if self._tests is None: + from .tests.client import AsyncTestsClient # noqa: E402 + + self._tests = AsyncTestsClient(client_wrapper=self._client_wrapper) + return self._tests + + @property + def users(self): + if self._users is None: + from .users.client import AsyncUsersClient # noqa: E402 + + self._users = AsyncUsersClient(client_wrapper=self._client_wrapper) + return self._users + + @property + def triage_tickets(self): + if self._triage_tickets is None: + from .triage_tickets.client import AsyncTriageTicketsClient # noqa: E402 + + self._triage_tickets = AsyncTriageTicketsClient(client_wrapper=self._client_wrapper) + return self._triage_tickets + + @property + def phone_numbers(self): + if self._phone_numbers is None: + from .phone_numbers.client import AsyncPhoneNumbersClient # noqa: E402 + + self._phone_numbers = AsyncPhoneNumbersClient(client_wrapper=self._client_wrapper) + return self._phone_numbers + + @property + def llm_usage(self): + if self._llm_usage is None: + from .llm_usage.client import AsyncLlmUsageClient # noqa: E402 + + self._llm_usage = AsyncLlmUsageClient(client_wrapper=self._client_wrapper) + return self._llm_usage + + @property + def llm(self): + if self._llm is None: + from .llm.client import AsyncLlmClient # noqa: E402 + + self._llm = AsyncLlmClient(client_wrapper=self._client_wrapper) + return self._llm + + @property + def knowledge_base(self): + if self._knowledge_base is None: + from .knowledge_base.client import AsyncKnowledgeBaseClient # noqa: E402 + + self._knowledge_base = AsyncKnowledgeBaseClient(client_wrapper=self._client_wrapper) + return self._knowledge_base + + @property + def tools(self): + if self._tools is None: + from .tools.client import AsyncToolsClient # noqa: E402 + + self._tools = AsyncToolsClient(client_wrapper=self._client_wrapper) + return self._tools + + @property + def settings(self): + if self._settings is None: + from .settings.client import AsyncSettingsClient # noqa: E402 + + self._settings = AsyncSettingsClient(client_wrapper=self._client_wrapper) + return self._settings + + @property + def secrets(self): + if self._secrets is None: + from .secrets.client import AsyncSecretsClient # noqa: E402 + + self._secrets = AsyncSecretsClient(client_wrapper=self._client_wrapper) + return self._secrets + + @property + def batch_calls(self): + if self._batch_calls is None: + from .batch_calls.client import AsyncBatchCallsClient # noqa: E402 + + self._batch_calls = AsyncBatchCallsClient(client_wrapper=self._client_wrapper) + return self._batch_calls + + @property + def sip_trunk(self): + if self._sip_trunk is None: + from .sip_trunk.client import AsyncSipTrunkClient # noqa: E402 + + self._sip_trunk = AsyncSipTrunkClient(client_wrapper=self._client_wrapper) + return self._sip_trunk + + @property + def mcp_servers(self): + if self._mcp_servers is None: + from .mcp_servers.client import AsyncMcpServersClient # noqa: E402 + + self._mcp_servers = AsyncMcpServersClient(client_wrapper=self._client_wrapper) + return self._mcp_servers + + @property + def whatsapp_accounts(self): + if self._whatsapp_accounts is None: + from .whatsapp_accounts.client import AsyncWhatsappAccountsClient # noqa: E402 + + self._whatsapp_accounts = AsyncWhatsappAccountsClient(client_wrapper=self._client_wrapper) + return self._whatsapp_accounts + + @property + def realtime(self): + if self._realtime is None: + from .realtime.client import AsyncRealtimeClient # noqa: E402 + + self._realtime = AsyncRealtimeClient(client_wrapper=self._client_wrapper) + return self._realtime + + @property + def analytics(self): + if self._analytics is None: + from .analytics.client import AsyncAnalyticsClient # noqa: E402 + + self._analytics = AsyncAnalyticsClient(client_wrapper=self._client_wrapper) + return self._analytics + + @property + def dashboard(self): + if self._dashboard is None: + from .dashboard.client import AsyncDashboardClient # noqa: E402 + + self._dashboard = AsyncDashboardClient(client_wrapper=self._client_wrapper) + return self._dashboard diff --git a/data/src/elevenlabs/conversational_ai/conversation.py b/data/src/elevenlabs/conversational_ai/conversation.py new file mode 100644 index 0000000000000000000000000000000000000000..57d20ee5917b01e0194e226969cb59342a56ef24 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversation.py @@ -0,0 +1,1329 @@ +from abc import ABC, abstractmethod +import asyncio +import base64 +from concurrent.futures import ThreadPoolExecutor +from dataclasses import dataclass +from enum import Enum +import json +import logging +import threading +from typing import Any, Awaitable, Callable, Dict, List, Literal, Optional, Tuple, Union +import urllib.parse + +import websockets +from websockets.exceptions import ConnectionClosedOK +from websockets.sync.client import Connection, connect + +from ..base_client import BaseElevenLabs +from ..url_utils import build_ws_url +from ..version import __version__ + + +logger = logging.getLogger(__name__) + + +class ClientToOrchestratorEvent(str, Enum): + """Event types that can be sent from client to orchestrator.""" + + # Response to a ping request. + PONG = "pong" + CLIENT_TOOL_RESULT = "client_tool_result" + CONVERSATION_INITIATION_CLIENT_DATA = "conversation_initiation_client_data" + FEEDBACK = "feedback" + # Non-interrupting content that is sent to the server to update the conversation state. + CONTEXTUAL_UPDATE = "contextual_update" + # User text message. + USER_MESSAGE = "user_message" + USER_ACTIVITY = "user_activity" + MULTIMODAL_MESSAGE = "multimodal_message" + + +class AgentChatResponsePartType(str, Enum): + START = "start" + DELTA = "delta" + STOP = "stop" + + +class UserMessageClientToOrchestratorEvent: + """Event for sending user text messages.""" + + def __init__(self, text: Optional[str] = None): + self.type: Literal[ClientToOrchestratorEvent.USER_MESSAGE] = ClientToOrchestratorEvent.USER_MESSAGE + self.text = text + + def to_dict(self) -> dict: + return {"type": self.type, "text": self.text} + + +class UserActivityClientToOrchestratorEvent: + """Event for registering user activity (ping to prevent timeout).""" + + def __init__(self) -> None: + self.type: Literal[ClientToOrchestratorEvent.USER_ACTIVITY] = ClientToOrchestratorEvent.USER_ACTIVITY + + def to_dict(self) -> dict: + return {"type": self.type} + + +class ContextualUpdateClientToOrchestratorEvent: + """Event for sending non-interrupting contextual updates to the conversation state.""" + + def __init__(self, text: str): + self.type: Literal[ClientToOrchestratorEvent.CONTEXTUAL_UPDATE] = ClientToOrchestratorEvent.CONTEXTUAL_UPDATE + self.text = text + + def to_dict(self) -> dict: + return {"type": self.type, "text": self.text} + + +class MultimodalMessageFile: + """File component of a multimodal message.""" + + def __init__(self, file_id: str): + self.type: Literal["file_input"] = "file_input" + self.file_id = file_id + + def to_dict(self) -> dict: + return {"type": self.type, "file_id": self.file_id} + + +class MultimodalMessageClientToOrchestratorEvent: + """Event for sending multimodal messages combining text and file references.""" + + def __init__( + self, + text: Optional[str] = None, + file_id: Optional[str] = None, + file_ids: Optional[List[str]] = None, + ): + self.type: Literal[ClientToOrchestratorEvent.MULTIMODAL_MESSAGE] = ClientToOrchestratorEvent.MULTIMODAL_MESSAGE + self.text = text + self.file_ids = list(file_ids) if file_ids else ([file_id] if file_id else []) + + def to_dict(self) -> dict: + result: Dict[str, Any] = {"type": self.type} + if self.text: + result["text"] = UserMessageClientToOrchestratorEvent(text=self.text).to_dict() + if self.file_ids: + files = [MultimodalMessageFile(file_id=fid).to_dict() for fid in self.file_ids] + result["file"] = files[0] + result["files"] = files + return result + + +class AudioInterface(ABC): + """AudioInterface provides an abstraction for handling audio input and output.""" + + @abstractmethod + def start(self, input_callback: Callable[[bytes], None]): + """Starts the audio interface. + + Called one time before the conversation starts. + The `input_callback` should be called regularly with input audio chunks from + the user. The audio should be in 16-bit PCM mono format at 16kHz. Recommended + chunk size is 4000 samples (250 milliseconds). + """ + pass + + @abstractmethod + def stop(self): + """Stops the audio interface. + + Called one time after the conversation ends. Should clean up any resources + used by the audio interface and stop any audio streams. Do not call the + `input_callback` from `start` after this method is called. + """ + pass + + @abstractmethod + def output(self, audio: bytes): + """Output audio to the user. + + The `audio` input is in 16-bit PCM mono format at 16kHz. Implementations can + choose to do additional buffering. This method should return quickly and not + block the calling thread. + """ + pass + + @abstractmethod + def interrupt(self): + """Interruption signal to stop any audio output. + + User has interrupted the agent and all previosly buffered audio output should + be stopped. + """ + pass + + +class AsyncAudioInterface(ABC): + """AsyncAudioInterface provides an async abstraction for handling audio input and output.""" + + @abstractmethod + async def start(self, input_callback: Callable[[bytes], Awaitable[None]]): + """Starts the audio interface. + + Called one time before the conversation starts. + The `input_callback` should be called regularly with input audio chunks from + the user. The audio should be in 16-bit PCM mono format at 16kHz. Recommended + chunk size is 4000 samples (250 milliseconds). + """ + pass + + @abstractmethod + async def stop(self): + """Stops the audio interface. + + Called one time after the conversation ends. Should clean up any resources + used by the audio interface and stop any audio streams. Do not call the + `input_callback` from `start` after this method is called. + """ + pass + + @abstractmethod + async def output(self, audio: bytes): + """Output audio to the user. + + The `audio` input is in 16-bit PCM mono format at 16kHz. Implementations can + choose to do additional buffering. This method should return quickly and not + block the calling thread. + """ + pass + + @abstractmethod + async def interrupt(self): + """Interruption signal to stop any audio output. + + User has interrupted the agent and all previosly buffered audio output should + be stopped. + """ + pass + + +class ClientTools: + """Handles registration and execution of client-side tools that can be called by the agent. + + Supports both synchronous and asynchronous tools running in a dedicated event loop, + ensuring non-blocking operation of the main conversation thread. + + Args: + loop: Optional custom asyncio event loop to use for tool execution. If not provided, + a new event loop will be created and run in a separate thread. Using a custom + loop prevents "different event loop" runtime errors and allows for better + context propagation and resource management. + """ + + def __init__(self, loop: Optional[asyncio.AbstractEventLoop] = None) -> None: + self.tools: Dict[str, Tuple[Union[Callable[[dict], Any], Callable[[dict], Awaitable[Any]]], bool]] = {} + self.lock = threading.Lock() + self._custom_loop = loop + self._loop = None + self._thread = None + self._running = threading.Event() + self.thread_pool = ThreadPoolExecutor() + + def start(self): + """Start the event loop in a separate thread for handling async operations.""" + if self._running.is_set(): + return + + if self._custom_loop is not None: + # Use the provided custom event loop + self._loop = self._custom_loop + self._running.set() + else: + # Create and run our own event loop in a separate thread + def run_event_loop(): + self._loop = asyncio.new_event_loop() + asyncio.set_event_loop(self._loop) + self._running.set() + try: + self._loop.run_forever() + finally: + self._running.clear() + self._loop.close() + self._loop = None + + self._thread = threading.Thread(target=run_event_loop, daemon=True, name="ClientTools-EventLoop") + self._thread.start() + # Wait for loop to be ready + self._running.wait() + + def stop(self): + """Gracefully stop the event loop and clean up resources.""" + if self._loop and self._running.is_set(): + if self._custom_loop is not None: + # For custom loops, we don't stop the loop itself, just clear our running flag + self._running.clear() + else: + # For our own loop, stop it and join the thread + self._loop.call_soon_threadsafe(self._loop.stop) + if self._thread: + self._thread.join() + self.thread_pool.shutdown(wait=False) + + def register( + self, + tool_name: str, + handler: Union[Callable[[dict], Any], Callable[[dict], Awaitable[Any]]], + is_async: bool = False, + ) -> None: + """Register a new tool that can be called by the AI agent. + + Args: + tool_name: Unique identifier for the tool + handler: Function that implements the tool's logic + is_async: Whether the handler is an async function + """ + with self.lock: + if not callable(handler): + raise ValueError("Handler must be callable") + if tool_name in self.tools: + raise ValueError(f"Tool '{tool_name}' is already registered") + self.tools[tool_name] = (handler, is_async) + + async def handle(self, tool_name: str, parameters: dict) -> Any: + """Execute a registered tool with the given parameters. + + Returns the result of the tool execution. + """ + with self.lock: + if tool_name not in self.tools: + raise ValueError(f"Tool '{tool_name}' is not registered") + handler, is_async = self.tools[tool_name] + + if is_async: + return await handler(parameters) + else: + return await asyncio.get_event_loop().run_in_executor(self.thread_pool, handler, parameters) + + def execute_tool(self, tool_name: str, parameters: dict, callback: Callable[[dict], None]): + """Execute a tool and send its result via the provided callback. + + This method is non-blocking and handles both sync and async tools. + """ + if not self._running.is_set(): + raise RuntimeError("ClientTools event loop is not running") + + if self._loop is None: + raise RuntimeError("Event loop is not available") + + async def _execute_and_callback(): + try: + result = await self.handle(tool_name, parameters) + response = { + "type": "client_tool_result", + "tool_call_id": parameters.get("tool_call_id"), + "result": result or f"Client tool: {tool_name} called successfully.", + "is_error": False, + } + except Exception as e: + response = { + "type": "client_tool_result", + "tool_call_id": parameters.get("tool_call_id"), + "result": str(e), + "is_error": True, + } + callback(response) + + self._schedule_coroutine(_execute_and_callback()) + + def _schedule_coroutine(self, coro): + """Schedule a coroutine on the appropriate event loop.""" + if self._custom_loop is not None: + return self._loop.create_task(coro) + else: + return asyncio.run_coroutine_threadsafe(coro, self._loop) + + +class ConversationInitiationData: + """Configuration options for the Conversation.""" + + def __init__( + self, + extra_body: Optional[dict] = None, + conversation_config_override: Optional[dict] = None, + dynamic_variables: Optional[dict] = None, + user_id: Optional[str] = None, + ): + self.extra_body = extra_body or {} + self.conversation_config_override = conversation_config_override or {} + self.dynamic_variables = dynamic_variables or {} + self.user_id = user_id + + +@dataclass +class PostCallWebhookConfig: + """Post-call webhook destination for on-prem deployments. + + When ``hmac_secret`` is set, each delivery carries an ``ElevenLabs-Signature`` + header: ``t=,v0=``. The + orchestrator enforces a 16-character minimum on the secret and rejects the + connection at setup otherwise. + """ + + url: str + hmac_secret: Optional[str] = None + + def to_dict(self) -> dict: + message: dict = {"url": self.url} + if self.hmac_secret is not None: + message["hmac_secret"] = self.hmac_secret + return message + + +class OnPremInitiationData: + """Configuration options for the Conversation in on-prem mode.""" + + #: Keys this class writes into the setup message itself. `extra_setup_config` + #: may not contain them, so an escape-hatch value can never silently defeat + #: the validation on the typed fields. + _RESERVED_SETUP_KEYS = frozenset( + { + "type", + "agent_config_dict", + "override_agent_config_list", + "tools_config_list", + "post_call_transcription_webhook_url", + "post_call_audio_webhook_url", + "post_call_transcription_webhook", + "post_call_audio_webhook", + "prompt_knowledge_base", + "bedrock_inference_profile", + } + ) + + def __init__( + self, + on_prem_conversation_url: str, + post_call_transcription_webhook_url: Optional[str] = None, + post_call_audio_webhook_url: Optional[str] = None, + agent_config_dict: Optional[dict] = None, + override_agent_config_list: Optional[List[dict]] = None, + tools_config_list: Optional[List[dict]] = None, + prompt_knowledge_base: Optional[List[str]] = None, + post_call_transcription_webhook: Optional[PostCallWebhookConfig] = None, + post_call_audio_webhook: Optional[PostCallWebhookConfig] = None, + bedrock_inference_profile: Optional[str] = None, + extra_setup_config: Optional[dict] = None, + ): + """On-prem (in-VPC) conversation setup. + + Args: + on_prem_conversation_url: WebSocket URL of the on-prem conversation + endpoint. Used verbatim, so any query parameters the deployment + supports (e.g. ``?conversation_id=...``) can be set here. + bedrock_inference_profile: Bedrock cross-region inference profile to + route Claude models through. ``"global"`` selects the + ``global.anthropic.*`` profiles where available; the server + defaults to ``"us"`` when unset. + extra_setup_config: Escape hatch for setup-message fields this SDK + version does not model yet. Merged into the message as-is. Keys + that collide with the typed fields above are rejected. + """ + # Fail early: the server rejects the connection when both forms are set. + # An empty legacy URL counts as unset server-side, hence truthiness here. + if post_call_transcription_webhook is not None and post_call_transcription_webhook_url: + raise ValueError( + "Set either post_call_transcription_webhook or post_call_transcription_webhook_url, not both." + ) + if post_call_audio_webhook is not None and post_call_audio_webhook_url: + raise ValueError( + "Set either post_call_audio_webhook or post_call_audio_webhook_url, not both." + ) + if extra_setup_config is not None: + if not isinstance(extra_setup_config, dict): + raise ValueError("extra_setup_config must be a dict.") + reserved = sorted(self._RESERVED_SETUP_KEYS.intersection(extra_setup_config)) + if reserved: + raise ValueError( + f"extra_setup_config may not override {', '.join(reserved)}; " + "pass these as named arguments instead." + ) + self.on_prem_conversation_url = on_prem_conversation_url + self.post_call_transcription_webhook_url = post_call_transcription_webhook_url + self.post_call_audio_webhook_url = post_call_audio_webhook_url + self.agent_config_dict = agent_config_dict + self.override_agent_config_list = override_agent_config_list + self.tools_config_list = tools_config_list + self.prompt_knowledge_base = prompt_knowledge_base + self.post_call_transcription_webhook = post_call_transcription_webhook + self.post_call_audio_webhook = post_call_audio_webhook + self.bedrock_inference_profile = bedrock_inference_profile + self.extra_setup_config = dict(extra_setup_config) if extra_setup_config else {} + + +@dataclass +class AudioEventAlignment: + """Audio alignment data containing character-level timing information. d""" + + chars: List[str] + char_start_times_ms: List[int] + char_durations_ms: List[int] + + +class BaseConversation: + """Base class for conversation implementations with shared parameters and logic.""" + + def __init__( + self, + client: BaseElevenLabs, + agent_id: str, + user_id: Optional[str] = None, + *, + requires_auth: bool, + audio_interface=None, + config: Optional[ConversationInitiationData] = None, + client_tools: Optional[ClientTools] = None, + on_prem_config: Optional[OnPremInitiationData] = None, + environment: Optional[str] = None, + ): + self.client = client + self.agent_id = agent_id + self.user_id = user_id + self.requires_auth = requires_auth + # Copy the config so we never mutate the caller's original object + src = config or ConversationInitiationData() + self.config = ConversationInitiationData( + extra_body=dict(src.extra_body), + conversation_config_override=dict(src.conversation_config_override), + dynamic_variables=dict(src.dynamic_variables), + user_id=src.user_id, + ) + if audio_interface is None: + self.config.conversation_config_override.setdefault("text_only", True) + self.client_tools = client_tools or ClientTools() + self.on_prem_config = on_prem_config + self.environment = environment + + self.client_tools.start() + + self._conversation_id = None + self._last_interrupt_id = 0 + + def _get_wss_url(self): + if self.on_prem_config: + return self.on_prem_config.on_prem_conversation_url + + base_http_url = self.client._client_wrapper.get_base_url() + params = [ + ("agent_id", self.agent_id), + ("source", "python_sdk"), + ("version", __version__), + ] + if self.environment: + params.append(("environment", self.environment)) + return build_ws_url(base_http_url, ["v1", "convai", "conversation"], params) + + def _get_signed_url(self): + response = self.client.conversational_ai.conversations.get_signed_url( + agent_id=self.agent_id, + environment=self.environment, + ) + signed_url = response.signed_url + # Append source and version query parameters to the signed URL + parsed = urllib.parse.urlparse(signed_url) + existing_params = urllib.parse.parse_qsl(parsed.query, keep_blank_values=True) + existing_params.extend([("source", "python_sdk"), ("version", __version__)]) + return urllib.parse.urlunparse(parsed._replace(query=urllib.parse.urlencode(existing_params, quote_via=urllib.parse.quote))) + + def _create_on_prem_initiation_message(self): + # Extras go in first; the reserved-key check in OnPremInitiationData + # guarantees the typed fields below cannot be clobbering anything. + message = dict(self.on_prem_config.extra_setup_config) + message.update( + { + "type": "enclave_setup_config", + "agent_config_dict": self.on_prem_config.agent_config_dict, + "override_agent_config_list": self.on_prem_config.override_agent_config_list, + "tools_config_list": self.on_prem_config.tools_config_list, + "post_call_transcription_webhook_url": self.on_prem_config.post_call_transcription_webhook_url, + "post_call_audio_webhook_url": self.on_prem_config.post_call_audio_webhook_url, + "prompt_knowledge_base": self.on_prem_config.prompt_knowledge_base, + } + ) + if self.on_prem_config.bedrock_inference_profile is not None: + message["bedrock_inference_profile"] = self.on_prem_config.bedrock_inference_profile + if self.on_prem_config.post_call_transcription_webhook is not None: + message["post_call_transcription_webhook"] = ( + self.on_prem_config.post_call_transcription_webhook.to_dict() + ) + if self.on_prem_config.post_call_audio_webhook is not None: + message["post_call_audio_webhook"] = ( + self.on_prem_config.post_call_audio_webhook.to_dict() + ) + return json.dumps(message) + + def _create_initiation_message(self): + return json.dumps( + { + "type": "conversation_initiation_client_data", + "custom_llm_extra_body": self.config.extra_body, + "conversation_config_override": self.config.conversation_config_override, + "dynamic_variables": self.config.dynamic_variables, + "source_info": { + "source": "python_sdk", + "version": __version__, + }, + **({"user_id": self.user_id} if self.user_id else {}), + } + ) + + def _handle_message_core(self, message, message_handler): + """Core message handling logic shared between sync and async implementations. + + Args: + message: The parsed message dictionary + message_handler: Handler object with methods for different operations + """ + if message["type"] == "conversation_initiation_metadata": + event = message["conversation_initiation_metadata_event"] + assert self._conversation_id is None + self._conversation_id = event["conversation_id"] + + elif message["type"] == "audio": + event = message["audio_event"] + if int(event["event_id"]) <= self._last_interrupt_id: + return + audio = base64.b64decode(event["audio_base_64"]) + message_handler.handle_audio_output(audio) + + if message_handler.callback_audio_alignment and "alignment" in event: + alignment_data = event["alignment"] + alignment = AudioEventAlignment( + chars=alignment_data.get("chars", []), + char_start_times_ms=alignment_data.get("char_start_times_ms", []), + char_durations_ms=alignment_data.get("char_durations_ms", []), + ) + message_handler.handle_audio_alignment(alignment) + + elif message["type"] == "agent_response": + if message_handler.callback_agent_response: + event = message["agent_response_event"] + message_handler.handle_agent_response(event["agent_response"].strip()) + + elif message["type"] == "agent_chat_response_part": + if message_handler.callback_agent_chat_response_part: + event = message.get("text_response_part", {}) + text = event.get("text", "") + part_type_str = event.get("type", "delta") + try: + part_type = AgentChatResponsePartType(part_type_str) + except ValueError: + part_type = AgentChatResponsePartType.DELTA + message_handler.handle_agent_chat_response_part(text, part_type) + + elif message["type"] == "agent_response_correction": + if message_handler.callback_agent_response_correction: + event = message["agent_response_correction_event"] + message_handler.handle_agent_response_correction( + event["original_agent_response"].strip(), event["corrected_agent_response"].strip() + ) + + elif message["type"] == "user_transcript": + if message_handler.callback_user_transcript: + event = message["user_transcription_event"] + message_handler.handle_user_transcript(event["user_transcript"].strip()) + + elif message["type"] == "interruption": + event = message["interruption_event"] + self._last_interrupt_id = int(event["event_id"]) + message_handler.handle_interruption() + + elif message["type"] == "ping": + event = message["ping_event"] + message_handler.handle_ping(event) + if message_handler.callback_latency_measurement and event["ping_ms"]: + message_handler.handle_latency_measurement(int(event["ping_ms"])) + + elif message["type"] == "client_tool_call": + tool_call = message.get("client_tool_call", {}) + tool_name = tool_call.get("tool_name") + parameters = {"tool_call_id": tool_call["tool_call_id"], **tool_call.get("parameters", {})} + message_handler.handle_client_tool_call(tool_name, parameters) + else: + pass # Ignore all other message types. + + async def _handle_message_core_async(self, message, message_handler): + """Async wrapper for core message handling logic.""" + if message["type"] == "conversation_initiation_metadata": + event = message["conversation_initiation_metadata_event"] + assert self._conversation_id is None + self._conversation_id = event["conversation_id"] + + elif message["type"] == "audio": + event = message["audio_event"] + if int(event["event_id"]) <= self._last_interrupt_id: + return + audio = base64.b64decode(event["audio_base_64"]) + await message_handler.handle_audio_output(audio) + + if message_handler.callback_audio_alignment and "alignment" in event: + alignment_data = event["alignment"] + alignment = AudioEventAlignment( + chars=alignment_data.get("chars", []), + char_start_times_ms=alignment_data.get("char_start_times_ms", []), + char_durations_ms=alignment_data.get("char_durations_ms", []), + ) + await message_handler.handle_audio_alignment(alignment) + + elif message["type"] == "agent_response": + if message_handler.callback_agent_response: + event = message["agent_response_event"] + await message_handler.handle_agent_response(event["agent_response"].strip()) + + elif message["type"] == "agent_chat_response_part": + if message_handler.callback_agent_chat_response_part: + event = message.get("text_response_part", {}) + text = event.get("text", "") + part_type_str = event.get("type", "delta") + try: + part_type = AgentChatResponsePartType(part_type_str) + except ValueError: + part_type = AgentChatResponsePartType.DELTA + await message_handler.handle_agent_chat_response_part(text, part_type) + + elif message["type"] == "agent_response_correction": + if message_handler.callback_agent_response_correction: + event = message["agent_response_correction_event"] + await message_handler.handle_agent_response_correction( + event["original_agent_response"].strip(), event["corrected_agent_response"].strip() + ) + + elif message["type"] == "user_transcript": + if message_handler.callback_user_transcript: + event = message["user_transcription_event"] + await message_handler.handle_user_transcript(event["user_transcript"].strip()) + + elif message["type"] == "interruption": + event = message["interruption_event"] + self._last_interrupt_id = int(event["event_id"]) + await message_handler.handle_interruption() + + elif message["type"] == "ping": + event = message["ping_event"] + await message_handler.handle_ping(event) + if message_handler.callback_latency_measurement and event["ping_ms"]: + await message_handler.handle_latency_measurement(int(event["ping_ms"])) + + elif message["type"] == "client_tool_call": + tool_call = message.get("client_tool_call", {}) + tool_name = tool_call.get("tool_name") + parameters = {"tool_call_id": tool_call["tool_call_id"], **tool_call.get("parameters", {})} + message_handler.handle_client_tool_call(tool_name, parameters) + else: + pass # Ignore all other message types. + + +class Conversation(BaseConversation): + audio_interface: Optional[AudioInterface] + callback_agent_response: Optional[Callable[[str], None]] + callback_agent_response_correction: Optional[Callable[[str, str], None]] + callback_agent_chat_response_part: Optional[Callable[[str, AgentChatResponsePartType], None]] + callback_user_transcript: Optional[Callable[[str], None]] + callback_latency_measurement: Optional[Callable[[int], None]] + callback_audio_alignment: Optional[Callable[[AudioEventAlignment], None]] + callback_end_session: Optional[Callable] + + _thread: Optional[threading.Thread] + _should_stop: threading.Event + _ws: Optional[Connection] + + def __init__( + self, + client: BaseElevenLabs, + agent_id: str, + user_id: Optional[str] = None, + *, + requires_auth: bool, + audio_interface: Optional[AudioInterface] = None, + config: Optional[ConversationInitiationData] = None, + client_tools: Optional[ClientTools] = None, + callback_agent_response: Optional[Callable[[str], None]] = None, + callback_agent_response_correction: Optional[Callable[[str, str], None]] = None, + callback_agent_chat_response_part: Optional[Callable[[str, AgentChatResponsePartType], None]] = None, + callback_user_transcript: Optional[Callable[[str], None]] = None, + callback_latency_measurement: Optional[Callable[[int], None]] = None, + callback_audio_alignment: Optional[Callable[[AudioEventAlignment], None]] = None, + callback_end_session: Optional[Callable] = None, + on_prem_config: Optional[OnPremInitiationData] = None, + environment: Optional[str] = None, + ): + """Conversational AI session. + + BETA: This API is subject to change without regard to backwards compatibility. + + Args: + client: The ElevenLabs client to use for the conversation. + agent_id: The ID of the agent to converse with. + user_id: The ID of the user conversing with the agent. + requires_auth: Whether the agent requires authentication. + audio_interface: The audio interface to use for input and output. + Can be omitted for text-only (chat) mode. + client_tools: The client tools to use for the conversation. + callback_agent_response: Callback for agent responses. + callback_agent_response_correction: Callback for agent response corrections. + First argument is the original response (previously given to + callback_agent_response), second argument is the corrected response. + callback_agent_chat_response_part: Callback for streaming text response chunks. + First argument is the text chunk, second argument is the type (START, DELTA, STOP). + callback_user_transcript: Callback for user transcripts. + callback_latency_measurement: Callback for latency measurements (in milliseconds). + callback_audio_alignment: Callback for audio alignment data with character-level timing. + environment: The environment to use. Defaults to "production" on the server. + """ + + super().__init__( + client=client, + agent_id=agent_id, + user_id=user_id, + requires_auth=requires_auth, + audio_interface=audio_interface, + config=config, + client_tools=client_tools, + on_prem_config=on_prem_config, + environment=environment, + ) + + self.audio_interface = audio_interface + self.callback_agent_response = callback_agent_response + self.callback_agent_response_correction = callback_agent_response_correction + self.callback_agent_chat_response_part = callback_agent_chat_response_part + self.callback_user_transcript = callback_user_transcript + self.callback_latency_measurement = callback_latency_measurement + self.callback_audio_alignment = callback_audio_alignment + self.callback_end_session = callback_end_session + + self._thread = None + self._ws: Optional[Connection] = None + self._should_stop = threading.Event() + + def start_session(self): + """Starts the conversation session. + + Will run in background thread until `end_session` is called. + """ + ws_url = self._get_signed_url() if self.requires_auth else self._get_wss_url() + self._thread = threading.Thread(target=self._run, args=(ws_url,)) + self._thread.start() + + def end_session(self): + """Ends the conversation session and cleans up resources.""" + if self.audio_interface is not None: + self.audio_interface.stop() + self.client_tools.stop() + self._ws = None + self._should_stop.set() + + if self.callback_end_session: + self.callback_end_session() + + def wait_for_session_end(self) -> Optional[str]: + """Waits for the conversation session to end. + + You must call `end_session` before calling this method, otherwise it will block. + + Returns the conversation ID, if available. + """ + if not self._thread: + raise RuntimeError("Session not started.") + self._thread.join() + return self._conversation_id + + def send_user_message(self, text: str): + """Send a text message from the user to the agent. + + Args: + text: The text message to send to the agent. + + Raises: + RuntimeError: If the session is not active or websocket is not connected. + """ + if not self._ws: + raise RuntimeError("Session not started or websocket not connected.") + + event = UserMessageClientToOrchestratorEvent(text=text) + try: + self._ws.send(json.dumps(event.to_dict())) + except Exception as e: + logger.error(f"Error sending user message: {e}") + raise + + def register_user_activity(self): + """Register user activity to prevent session timeout. + + This sends a ping to the orchestrator to reset the timeout timer. + + Raises: + RuntimeError: If the session is not active or websocket is not connected. + """ + if not self._ws: + raise RuntimeError("Session not started or websocket not connected.") + + event = UserActivityClientToOrchestratorEvent() + try: + self._ws.send(json.dumps(event.to_dict())) + except Exception as e: + logger.error(f"Error registering user activity: {e}") + raise + + def send_contextual_update(self, text: str): + """Send a contextual update to the conversation. + + Contextual updates are non-interrupting content that is sent to the server + to update the conversation state without directly prompting the agent. + + Args: + content: The contextual information to send to the conversation. + + Raises: + RuntimeError: If the session is not active or websocket is not connected. + """ + if not self._ws: + raise RuntimeError("Session not started or websocket not connected.") + + event = ContextualUpdateClientToOrchestratorEvent(text=text) + try: + self._ws.send(json.dumps(event.to_dict())) + except Exception as e: + logger.error(f"Error sending contextual update: {e}") + raise + + def send_multimodal_message( + self, + text: Optional[str] = None, + file_id: Optional[str] = None, + file_ids: Optional[List[str]] = None, + ): + """Send a multimodal message combining text and/or file references. + + Args: + text: Optional text message to include. + file_id: Deprecated: use file_ids. + file_ids: Optional file IDs to include (must be previously uploaded files). + + Raises: + RuntimeError: If the session is not active or websocket is not connected. + ValueError: If none of text, file_id, or file_ids is provided. + """ + if not self._ws: + raise RuntimeError("Session not started or websocket not connected.") + if not text and not file_id and not file_ids: + raise ValueError("At least one of text, file_id, or file_ids must be provided.") + + event = MultimodalMessageClientToOrchestratorEvent(text=text, file_id=file_id, file_ids=file_ids) + try: + self._ws.send(json.dumps(event.to_dict())) + except Exception as e: + logger.error(f"Error sending multimodal message: {e}") + raise + + def _run(self, ws_url: str): + with connect(ws_url, max_size=16 * 1024 * 1024) as ws: + self._ws = ws + if self.on_prem_config: + ws.send(self._create_on_prem_initiation_message()) + ws.send(self._create_initiation_message()) + self._ws = ws + + def input_callback(audio): + try: + ws.send( + json.dumps( + { + "user_audio_chunk": base64.b64encode(audio).decode(), + } + ) + ) + except ConnectionClosedOK: + self.end_session() + except Exception as e: + logger.error(f"Error sending user audio chunk: {e}") + self.end_session() + + if self.audio_interface is not None: + self.audio_interface.start(input_callback) + while not self._should_stop.is_set(): + try: + message = json.loads(ws.recv(timeout=0.5)) + if self._should_stop.is_set(): + return + self._handle_message(message, ws) + except ConnectionClosedOK as e: + self.end_session() + except TimeoutError: + pass + except Exception as e: + logger.error(f"Error receiving message: {e}") + self.end_session() + + self._ws = None + + def _handle_message(self, message, ws): + class SyncMessageHandler: + def __init__(self, conversation, ws): + self.conversation = conversation + self.ws = ws + self.callback_agent_response = conversation.callback_agent_response + self.callback_agent_response_correction = conversation.callback_agent_response_correction + self.callback_agent_chat_response_part = conversation.callback_agent_chat_response_part + self.callback_user_transcript = conversation.callback_user_transcript + self.callback_latency_measurement = conversation.callback_latency_measurement + self.callback_audio_alignment = conversation.callback_audio_alignment + + def handle_audio_output(self, audio): + if self.conversation.audio_interface is not None: + self.conversation.audio_interface.output(audio) + + def handle_audio_alignment(self, alignment): + self.conversation.callback_audio_alignment(alignment) + + def handle_agent_response(self, response): + self.conversation.callback_agent_response(response) + + def handle_agent_response_correction(self, original, corrected): + self.conversation.callback_agent_response_correction(original, corrected) + + def handle_agent_chat_response_part(self, text, part_type): + self.conversation.callback_agent_chat_response_part(text, part_type) + + def handle_user_transcript(self, transcript): + self.conversation.callback_user_transcript(transcript) + + def handle_interruption(self): + if self.conversation.audio_interface is not None: + self.conversation.audio_interface.interrupt() + + def handle_ping(self, event): + self.ws.send( + json.dumps( + { + "type": "pong", + "event_id": event["event_id"], + } + ) + ) + + def handle_latency_measurement(self, latency): + self.conversation.callback_latency_measurement(latency) + + def handle_client_tool_call(self, tool_name, parameters): + def send_response(response): + if not self.conversation._should_stop.is_set(): + self.ws.send(json.dumps(response)) + + self.conversation.client_tools.execute_tool(tool_name, parameters, send_response) + + handler = SyncMessageHandler(self, ws) + self._handle_message_core(message, handler) + + +class AsyncConversation(BaseConversation): + audio_interface: Optional[AsyncAudioInterface] + callback_agent_response: Optional[Callable[[str], Awaitable[None]]] + callback_agent_response_correction: Optional[Callable[[str, str], Awaitable[None]]] + callback_agent_chat_response_part: Optional[Callable[[str, AgentChatResponsePartType], Awaitable[None]]] + callback_user_transcript: Optional[Callable[[str], Awaitable[None]]] + callback_latency_measurement: Optional[Callable[[int], Awaitable[None]]] + callback_audio_alignment: Optional[Callable[[AudioEventAlignment], Awaitable[None]]] + callback_end_session: Optional[Callable[[], Awaitable[None]]] + + _task: Optional[asyncio.Task] + _should_stop: asyncio.Event + _ws: Optional[websockets.WebSocketClientProtocol] + + def __init__( + self, + client: BaseElevenLabs, + agent_id: str, + user_id: Optional[str] = None, + *, + requires_auth: bool, + audio_interface: Optional[AsyncAudioInterface] = None, + config: Optional[ConversationInitiationData] = None, + client_tools: Optional[ClientTools] = None, + callback_agent_response: Optional[Callable[[str], Awaitable[None]]] = None, + callback_agent_response_correction: Optional[Callable[[str, str], Awaitable[None]]] = None, + callback_agent_chat_response_part: Optional[Callable[[str, AgentChatResponsePartType], Awaitable[None]]] = None, + callback_user_transcript: Optional[Callable[[str], Awaitable[None]]] = None, + callback_latency_measurement: Optional[Callable[[int], Awaitable[None]]] = None, + callback_audio_alignment: Optional[Callable[[AudioEventAlignment], Awaitable[None]]] = None, + callback_end_session: Optional[Callable[[], Awaitable[None]]] = None, + on_prem_config: Optional[OnPremInitiationData] = None, + environment: Optional[str] = None, + ): + """Async Conversational AI session. + + BETA: This API is subject to change without regard to backwards compatibility. + + Args: + client: The ElevenLabs client to use for the conversation. + agent_id: The ID of the agent to converse with. + user_id: The ID of the user conversing with the agent. + requires_auth: Whether the agent requires authentication. + audio_interface: The async audio interface to use for input and output. + Can be omitted for text-only (chat) mode. + client_tools: The client tools to use for the conversation. + callback_agent_response: Async callback for agent responses. + callback_agent_response_correction: Async callback for agent response corrections. + First argument is the original response (previously given to + callback_agent_response), second argument is the corrected response. + callback_agent_chat_response_part: Async callback for streaming text response chunks. + First argument is the text chunk, second argument is the type (START, DELTA, STOP). + callback_user_transcript: Async callback for user transcripts. + callback_latency_measurement: Async callback for latency measurements (in milliseconds). + callback_audio_alignment: Async callback for audio alignment data with character-level timing. + callback_end_session: Async callback for when session ends. + environment: The environment to use. Defaults to "production" on the server. + """ + + super().__init__( + client=client, + agent_id=agent_id, + user_id=user_id, + requires_auth=requires_auth, + audio_interface=audio_interface, + config=config, + client_tools=client_tools, + on_prem_config=on_prem_config, + environment=environment, + ) + + self.audio_interface = audio_interface + self.callback_agent_response = callback_agent_response + self.callback_agent_response_correction = callback_agent_response_correction + self.callback_agent_chat_response_part = callback_agent_chat_response_part + self.callback_user_transcript = callback_user_transcript + self.callback_latency_measurement = callback_latency_measurement + self.callback_audio_alignment = callback_audio_alignment + self.callback_end_session = callback_end_session + + self._task = None + self._ws = None + self._should_stop = asyncio.Event() + + async def start_session(self): + """Starts the conversation session. + + Will run in background task until `end_session` is called. + """ + if self.requires_auth: + ws_url = await asyncio.get_running_loop().run_in_executor(None, self._get_signed_url) + else: + ws_url = self._get_wss_url() + self._task = asyncio.create_task(self._run(ws_url)) + + async def end_session(self): + """Ends the conversation session and cleans up resources.""" + if self.audio_interface is not None: + await self.audio_interface.stop() + self.client_tools.stop() + self._ws = None + self._should_stop.set() + + if self.callback_end_session: + await self.callback_end_session() + + async def wait_for_session_end(self) -> Optional[str]: + """Waits for the conversation session to end. + + You must call `end_session` before calling this method, otherwise it will block. + + Returns the conversation ID, if available. + """ + if not self._task: + raise RuntimeError("Session not started.") + await self._task + return self._conversation_id + + async def send_user_message(self, text: str): + """Send a text message from the user to the agent. + + Args: + text: The text message to send to the agent. + + Raises: + RuntimeError: If the session is not active or websocket is not connected. + """ + if not self._ws: + raise RuntimeError("Session not started or websocket not connected.") + + event = UserMessageClientToOrchestratorEvent(text=text) + try: + await self._ws.send(json.dumps(event.to_dict())) + except Exception as e: + logger.error(f"Error sending user message: {e}") + raise + + async def register_user_activity(self): + """Register user activity to prevent session timeout. + + This sends a ping to the orchestrator to reset the timeout timer. + + Raises: + RuntimeError: If the session is not active or websocket is not connected. + """ + if not self._ws: + raise RuntimeError("Session not started or websocket not connected.") + + event = UserActivityClientToOrchestratorEvent() + try: + await self._ws.send(json.dumps(event.to_dict())) + except Exception as e: + logger.error(f"Error registering user activity: {e}") + raise + + async def send_contextual_update(self, text: str): + """Send a contextual update to the conversation. + + Contextual updates are non-interrupting content that is sent to the server + to update the conversation state without directly prompting the agent. + + Args: + text: The contextual information to send to the conversation. + + Raises: + RuntimeError: If the session is not active or websocket is not connected. + """ + if not self._ws: + raise RuntimeError("Session not started or websocket not connected.") + + event = ContextualUpdateClientToOrchestratorEvent(text=text) + try: + await self._ws.send(json.dumps(event.to_dict())) + except Exception as e: + logger.error(f"Error sending contextual update: {e}") + raise + + async def send_multimodal_message( + self, + text: Optional[str] = None, + file_id: Optional[str] = None, + file_ids: Optional[List[str]] = None, + ): + """Send a multimodal message combining text and/or file references. + + Args: + text: Optional text message to include. + file_id: Deprecated: use file_ids. + file_ids: Optional file IDs to include (must be previously uploaded files). + + Raises: + RuntimeError: If the session is not active or websocket is not connected. + ValueError: If none of text, file_id, or file_ids is provided. + """ + if not self._ws: + raise RuntimeError("Session not started or websocket not connected.") + if not text and not file_id and not file_ids: + raise ValueError("At least one of text, file_id, or file_ids must be provided.") + + event = MultimodalMessageClientToOrchestratorEvent(text=text, file_id=file_id, file_ids=file_ids) + try: + await self._ws.send(json.dumps(event.to_dict())) + except Exception as e: + logger.error(f"Error sending multimodal message: {e}") + raise + + async def _run(self, ws_url: str): + async with websockets.connect(ws_url, max_size=16 * 1024 * 1024) as ws: + self._ws = ws + if self.on_prem_config: + await ws.send(self._create_on_prem_initiation_message()) + await ws.send(self._create_initiation_message()) + + async def input_callback(audio): + try: + await ws.send( + json.dumps( + { + "user_audio_chunk": base64.b64encode(audio).decode(), + } + ) + ) + except ConnectionClosedOK: + await self.end_session() + except Exception as e: + logger.error(f"Error sending user audio chunk: {e}") + await self.end_session() + + if self.audio_interface is not None: + await self.audio_interface.start(input_callback) + + try: + while not self._should_stop.is_set(): + try: + message_str = await asyncio.wait_for(ws.recv(), timeout=0.5) + if self._should_stop.is_set(): + return + message = json.loads(message_str) + await self._handle_message(message, ws) + except asyncio.TimeoutError: + pass + except ConnectionClosedOK: + await self.end_session() + break + except Exception as e: + logger.error(f"Error receiving message: {e}") + await self.end_session() + break + finally: + self._ws = None + + async def _handle_message(self, message, ws): + class AsyncMessageHandler: + def __init__(self, conversation, ws): + self.conversation = conversation + self.ws = ws + self.callback_agent_response = conversation.callback_agent_response + self.callback_agent_response_correction = conversation.callback_agent_response_correction + self.callback_agent_chat_response_part = conversation.callback_agent_chat_response_part + self.callback_user_transcript = conversation.callback_user_transcript + self.callback_latency_measurement = conversation.callback_latency_measurement + self.callback_audio_alignment = conversation.callback_audio_alignment + + async def handle_audio_output(self, audio): + if self.conversation.audio_interface is not None: + await self.conversation.audio_interface.output(audio) + + async def handle_audio_alignment(self, alignment): + await self.conversation.callback_audio_alignment(alignment) + + async def handle_agent_response(self, response): + await self.conversation.callback_agent_response(response) + + async def handle_agent_response_correction(self, original, corrected): + await self.conversation.callback_agent_response_correction(original, corrected) + + async def handle_agent_chat_response_part(self, text, part_type): + await self.conversation.callback_agent_chat_response_part(text, part_type) + + async def handle_user_transcript(self, transcript): + await self.conversation.callback_user_transcript(transcript) + + async def handle_interruption(self): + if self.conversation.audio_interface is not None: + await self.conversation.audio_interface.interrupt() + + async def handle_ping(self, event): + await self.ws.send( + json.dumps( + { + "type": "pong", + "event_id": event["event_id"], + } + ) + ) + + async def handle_latency_measurement(self, latency): + await self.conversation.callback_latency_measurement(latency) + + def handle_client_tool_call(self, tool_name, parameters): + def send_response(response): + if not self.conversation._should_stop.is_set(): + asyncio.create_task(self.ws.send(json.dumps(response))) + + self.conversation.client_tools.execute_tool(tool_name, parameters, send_response) + + handler = AsyncMessageHandler(self, ws) + + # Use the shared core message handling logic with async wrapper + await self._handle_message_core_async(message, handler) diff --git a/data/src/elevenlabs/conversational_ai/conversations/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c6c8755d2636c0271aa93c1e46c7cd61ad72b2f8 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/__init__.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + ConversationsGetRequestFormat, + ConversationsListRequestExcludeStatusesItem, + ConversationsListRequestSummaryMode, + ) + from . import analysis, audio, feedback, files, messages, tags, topics + from .messages import MessagesTextSearchRequestExcludeStatusesItem, MessagesTextSearchRequestSummaryMode +_dynamic_imports: typing.Dict[str, str] = { + "ConversationsGetRequestFormat": ".types", + "ConversationsListRequestExcludeStatusesItem": ".types", + "ConversationsListRequestSummaryMode": ".types", + "MessagesTextSearchRequestExcludeStatusesItem": ".messages", + "MessagesTextSearchRequestSummaryMode": ".messages", + "analysis": ".analysis", + "audio": ".audio", + "feedback": ".feedback", + "files": ".files", + "messages": ".messages", + "tags": ".tags", + "topics": ".topics", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ConversationsGetRequestFormat", + "ConversationsListRequestExcludeStatusesItem", + "ConversationsListRequestSummaryMode", + "MessagesTextSearchRequestExcludeStatusesItem", + "MessagesTextSearchRequestSummaryMode", + "analysis", + "audio", + "feedback", + "files", + "messages", + "tags", + "topics", +] diff --git a/data/src/elevenlabs/conversational_ai/conversations/analysis/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/analysis/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/analysis/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/conversations/analysis/client.py b/data/src/elevenlabs/conversational_ai/conversations/analysis/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7d1110bd5131176c0db364d6be3656423b3e4215 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/analysis/client.py @@ -0,0 +1,218 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.analysis_scope import AnalysisScope +from ....types.get_conversation_response_model import GetConversationResponseModel +from .raw_client import AsyncRawAnalysisClient, RawAnalysisClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AnalysisClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAnalysisClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAnalysisClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAnalysisClient + """ + return self._raw_client + + def run( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetConversationResponseModel: + """ + Run the analysis for a conversation using the agent's current evaluation criteria and data collection settings. + + Parameters + ---------- + conversation_id : str + ID of the conversation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.analysis.run( + conversation_id="conversation_id", + ) + """ + _response = self._raw_client.run(conversation_id, request_options=request_options) + return _response.data + + def run_evaluation( + self, + conversation_id: str, + *, + evaluation_id: str, + scope: typing.Optional[AnalysisScope] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationResponseModel: + """ + Rerun a specific evaluation for a conversation. + + Parameters + ---------- + conversation_id : str + ID of the conversation + + evaluation_id : str + ID of the single evaluation criterion to rerun. + + scope : typing.Optional[AnalysisScope] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.analysis.run_evaluation( + conversation_id="conversation_id", + evaluation_id="evaluation_id", + ) + """ + _response = self._raw_client.run_evaluation( + conversation_id, evaluation_id=evaluation_id, scope=scope, request_options=request_options + ) + return _response.data + + +class AsyncAnalysisClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAnalysisClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAnalysisClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAnalysisClient + """ + return self._raw_client + + async def run( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetConversationResponseModel: + """ + Run the analysis for a conversation using the agent's current evaluation criteria and data collection settings. + + Parameters + ---------- + conversation_id : str + ID of the conversation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.analysis.run( + conversation_id="conversation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.run(conversation_id, request_options=request_options) + return _response.data + + async def run_evaluation( + self, + conversation_id: str, + *, + evaluation_id: str, + scope: typing.Optional[AnalysisScope] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationResponseModel: + """ + Rerun a specific evaluation for a conversation. + + Parameters + ---------- + conversation_id : str + ID of the conversation + + evaluation_id : str + ID of the single evaluation criterion to rerun. + + scope : typing.Optional[AnalysisScope] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.analysis.run_evaluation( + conversation_id="conversation_id", + evaluation_id="evaluation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.run_evaluation( + conversation_id, evaluation_id=evaluation_id, scope=scope, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/conversations/analysis/raw_client.py b/data/src/elevenlabs/conversational_ai/conversations/analysis/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..7f77ac499107093c0e6a10d4a9d8e0a846665b18 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/analysis/raw_client.py @@ -0,0 +1,281 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.analysis_scope import AnalysisScope +from ....types.get_conversation_response_model import GetConversationResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAnalysisClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def run( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetConversationResponseModel]: + """ + Run the analysis for a conversation using the agent's current evaluation criteria and data collection settings. + + Parameters + ---------- + conversation_id : str + ID of the conversation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConversationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/analysis/run", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationResponseModel, + construct_type( + type_=GetConversationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def run_evaluation( + self, + conversation_id: str, + *, + evaluation_id: str, + scope: typing.Optional[AnalysisScope] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetConversationResponseModel]: + """ + Rerun a specific evaluation for a conversation. + + Parameters + ---------- + conversation_id : str + ID of the conversation + + evaluation_id : str + ID of the single evaluation criterion to rerun. + + scope : typing.Optional[AnalysisScope] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConversationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/analysis/evaluations/run", + method="POST", + json={ + "evaluation_id": evaluation_id, + "scope": scope, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationResponseModel, + construct_type( + type_=GetConversationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAnalysisClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def run( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetConversationResponseModel]: + """ + Run the analysis for a conversation using the agent's current evaluation criteria and data collection settings. + + Parameters + ---------- + conversation_id : str + ID of the conversation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConversationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/analysis/run", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationResponseModel, + construct_type( + type_=GetConversationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def run_evaluation( + self, + conversation_id: str, + *, + evaluation_id: str, + scope: typing.Optional[AnalysisScope] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetConversationResponseModel]: + """ + Rerun a specific evaluation for a conversation. + + Parameters + ---------- + conversation_id : str + ID of the conversation + + evaluation_id : str + ID of the single evaluation criterion to rerun. + + scope : typing.Optional[AnalysisScope] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConversationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/analysis/evaluations/run", + method="POST", + json={ + "evaluation_id": evaluation_id, + "scope": scope, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationResponseModel, + construct_type( + type_=GetConversationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/conversations/audio/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/audio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/audio/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/conversations/audio/client.py b/data/src/elevenlabs/conversational_ai/conversations/audio/client.py new file mode 100644 index 0000000000000000000000000000000000000000..3c329fc0d0f4fde05cf5c17665cab9b60dc84136 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/audio/client.py @@ -0,0 +1,114 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from .raw_client import AsyncRawAudioClient, RawAudioClient + + +class AudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAudioClient + """ + return self._raw_client + + def get( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Get the audio recording of a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.audio.get( + conversation_id="conversation_id", + ) + """ + with self._raw_client.get(conversation_id, request_options=request_options) as r: + yield from r.data + + +class AsyncAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAudioClient + """ + return self._raw_client + + async def get( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Get the audio recording of a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.audio.get( + conversation_id="conversation_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.get(conversation_id, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/conversational_ai/conversations/audio/raw_client.py b/data/src/elevenlabs/conversational_ai/conversations/audio/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..e30bef2a28a0f3061f437e90f5e1c0b5a9b7d601 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/audio/raw_client.py @@ -0,0 +1,148 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from pydantic import ValidationError + + +class RawAudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def get( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Get the audio recording of a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Successful Response + """ + with self._client_wrapper.httpx_client.stream( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/audio", + method="GET", + request_options=request_options, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def get( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Get the audio recording of a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Successful Response + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/audio", + method="GET", + request_options=request_options, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/conversational_ai/conversations/client.py b/data/src/elevenlabs/conversational_ai/conversations/client.py new file mode 100644 index 0000000000000000000000000000000000000000..89995a597af6e21650eaa6a49b5843ee4609b0ff --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/client.py @@ -0,0 +1,1498 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.conversation_initiation_source import ConversationInitiationSource +from ...types.conversation_product import ConversationProduct +from ...types.conversation_signed_url_response_model import ConversationSignedUrlResponseModel +from ...types.evaluation_result_filter import EvaluationResultFilter +from ...types.get_conversation_response_model import GetConversationResponseModel +from ...types.get_conversation_summary_response_model import GetConversationSummaryResponseModel +from ...types.get_conversations_page_response_model import GetConversationsPageResponseModel +from ...types.get_sip_log_messages_response import GetSipLogMessagesResponse +from ...types.guardrail_type import GuardrailType +from ...types.sort_direction import SortDirection +from ...types.token_response_model import TokenResponseModel +from .raw_client import AsyncRawConversationsClient, RawConversationsClient +from .types.conversations_get_request_format import ConversationsGetRequestFormat +from .types.conversations_list_request_exclude_statuses_item import ConversationsListRequestExcludeStatusesItem +from .types.conversations_list_request_summary_mode import ConversationsListRequestSummaryMode + +if typing.TYPE_CHECKING: + from .analysis.client import AnalysisClient, AsyncAnalysisClient + from .audio.client import AsyncAudioClient, AudioClient + from .feedback.client import AsyncFeedbackClient, FeedbackClient + from .files.client import AsyncFilesClient, FilesClient + from .messages.client import AsyncMessagesClient, MessagesClient + from .tags.client import AsyncTagsClient, TagsClient + from .topics.client import AsyncTopicsClient, TopicsClient + + +class ConversationsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawConversationsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audio: typing.Optional[AudioClient] = None + self._feedback: typing.Optional[FeedbackClient] = None + self._messages: typing.Optional[MessagesClient] = None + self._tags: typing.Optional[TagsClient] = None + self._files: typing.Optional[FilesClient] = None + self._topics: typing.Optional[TopicsClient] = None + self._analysis: typing.Optional[AnalysisClient] = None + + @property + def with_raw_response(self) -> RawConversationsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawConversationsClient + """ + return self._raw_client + + def get_signed_url( + self, + *, + agent_id: str, + include_conversation_id: typing.Optional[bool] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + debug_events_request: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ConversationSignedUrlResponseModel: + """ + Get a signed url to start a conversation with an agent with an agent that requires authorization + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + include_conversation_id : typing.Optional[bool] + Whether to include a conversation_id with the response. If included, the conversation_signature cannot be used again. + + branch_id : typing.Optional[str] + The ID of the branch to use + + version_id : typing.Optional[str] + The ID of the version to use + + environment : typing.Optional[str] + The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + + debug_events_request : typing.Optional[bool] + Whether to enable debug events. Only available for users with editor access to the agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConversationSignedUrlResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.get_signed_url( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + include_conversation_id=True, + branch_id="branch_id", + version_id="version_id", + environment="environment", + debug_events_request=True, + ) + """ + _response = self._raw_client.get_signed_url( + agent_id=agent_id, + include_conversation_id=include_conversation_id, + branch_id=branch_id, + version_id=version_id, + environment=environment, + debug_events_request=debug_events_request, + request_options=request_options, + ) + return _response.data + + def get_webrtc_token( + self, + *, + agent_id: str, + participant_name: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + debug_events_request: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TokenResponseModel: + """ + Get a WebRTC session token for real-time communication. + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + participant_name : typing.Optional[str] + Optional custom participant name. If not provided, user ID will be used + + branch_id : typing.Optional[str] + The ID of the branch to use + + version_id : typing.Optional[str] + The ID of the version to use + + environment : typing.Optional[str] + The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + + debug_events_request : typing.Optional[bool] + Whether to enable debug events. Only available for users with editor access to the agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TokenResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.get_webrtc_token( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + participant_name="participant_name", + branch_id="branch_id", + version_id="version_id", + environment="environment", + debug_events_request=True, + ) + """ + _response = self._raw_client.get_webrtc_token( + agent_id=agent_id, + participant_name=participant_name, + branch_id=branch_id, + version_id=version_id, + environment=environment, + debug_events_request=debug_events_request, + request_options=request_options, + ) + return _response.data + + def list( + self, + *, + cursor: typing.Optional[str] = None, + agent_id: typing.Optional[str] = None, + visited_agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + visited_agent_branch_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + triggered_procedure_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + call_successful: typing.Optional[EvaluationResultFilter] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + call_duration_min_secs: typing.Optional[int] = None, + call_duration_max_secs: typing.Optional[int] = None, + rating_max: typing.Optional[int] = None, + rating_min: typing.Optional[int] = None, + has_feedback_comment: typing.Optional[bool] = None, + user_id: typing.Optional[str] = None, + evaluation_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + dynamic_variable_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + evaluation_criteria_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_successful: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_errored: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_invalid_tool_calls: typing.Optional[bool] = None, + main_languages: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + summary_mode: typing.Optional[ConversationsListRequestSummaryMode] = None, + search: typing.Optional[str] = None, + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None, + text_only: typing.Optional[bool] = None, + conversation_product_type: typing.Optional[ConversationProduct] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + parent_conversation_id: typing.Optional[str] = None, + topic_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + exclude_statuses: typing.Optional[ + typing.Union[ + ConversationsListRequestExcludeStatusesItem, + typing.Sequence[ConversationsListRequestExcludeStatusesItem], + ] + ] = None, + tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + workflow_node_entered_id: typing.Optional[str] = None, + termination_reasons: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + guardrail_types: typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]] = None, + custom_guardrail_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationsPageResponseModel: + """ + Get all conversations of agents that user owns. With option to restrict to a specific agent. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + visited_agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agents participated. Can not exceed 50 values. + + visited_agent_branch_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agent branches participated. Can not exceed 50 values. + + triggered_procedure_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + + call_successful : typing.Optional[EvaluationResultFilter] + The result of the success evaluation + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + call_duration_min_secs : typing.Optional[int] + Minimum call duration in seconds. + + call_duration_max_secs : typing.Optional[int] + Maximum call duration in seconds. + + rating_max : typing.Optional[int] + Maximum overall rating (1-5). + + rating_min : typing.Optional[int] + Minimum overall rating (1-5). + + has_feedback_comment : typing.Optional[bool] + Filter conversations with user feedback comments. + + user_id : typing.Optional[str] + Filter conversations by the user ID who initiated them. + + evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + + data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + + dynamic_variable_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + + data_collection_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection field IDs to include in each conversation summary. Repeat param. When omitted, data_collection_results is not returned. + + evaluation_criteria_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation criteria IDs to include in each conversation summary. Repeat param. When omitted, evaluation_criteria_results is not returned. + + tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names used during the call. + + tool_names_successful : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had successful calls. + + tool_names_errored : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had errored calls. + + include_invalid_tool_calls : typing.Optional[bool] + Also match tool calls that never ran. + + main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by detected main language (language code). + + page_size : typing.Optional[int] + How many conversations to return at maximum. Can not exceed 100, defaults to 30. + + summary_mode : typing.Optional[ConversationsListRequestSummaryMode] + Whether to include transcript summaries in the response. + + search : typing.Optional[str] + Full-text or fuzzy search over transcript messages + + conversation_initiation_source : typing.Optional[ConversationInitiationSource] + + text_only : typing.Optional[bool] + + conversation_product_type : typing.Optional[ConversationProduct] + Restrict results to a single conversation product surface. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + version_id : typing.Optional[str] + Filter conversations by version ID. + + parent_conversation_id : typing.Optional[str] + Filter conversations by parent conversation ID for subagent conversations. + + topic_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by topic IDs assigned during topic discovery. + + exclude_statuses : typing.Optional[typing.Union[ConversationsListRequestExcludeStatusesItem, typing.Sequence[ConversationsListRequestExcludeStatusesItem]]] + Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + + tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by conversation tag IDs assigned via the conversation-tags endpoints. + + workflow_node_entered_id : typing.Optional[str] + Filter conversations to only those that entered the given node. + + termination_reasons : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + + guardrail_types : typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]] + Filter to conversations where a guardrail of any of these types triggered (metadata.triggered_guardrails.guardrail_type). Repeat param to match any of several. + + custom_guardrail_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter to conversations where a custom guardrail with any of these names triggered (metadata.triggered_guardrails.guardrail_name). Only custom guardrails carry a name. Repeat param to match any of several. + + sort_direction : typing.Optional[SortDirection] + The direction to sort conversations by call start time. Defaults to descending (newest first). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationsPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.list( + cursor="cursor", + agent_id="agent_id", + visited_agent_ids=["visited_agent_ids"], + visited_agent_branch_ids=["visited_agent_branch_ids"], + triggered_procedure_ids=["triggered_procedure_ids"], + call_successful="success", + call_start_before_unix=1, + call_start_after_unix=1, + call_duration_min_secs=1, + call_duration_max_secs=1, + rating_max=1, + rating_min=1, + has_feedback_comment=True, + user_id="user_id", + evaluation_params=["evaluation_params"], + data_collection_params=["data_collection_params"], + dynamic_variable_params=["dynamic_variable_params"], + data_collection_ids=["data_collection_ids"], + evaluation_criteria_ids=["evaluation_criteria_ids"], + tool_names=["tool_names"], + tool_names_successful=["tool_names_successful"], + tool_names_errored=["tool_names_errored"], + include_invalid_tool_calls=True, + main_languages=["main_languages"], + page_size=1, + summary_mode="exclude", + search="search", + conversation_initiation_source="unknown", + text_only=True, + conversation_product_type="agents", + branch_id="branch_id", + version_id="version_id", + parent_conversation_id="parent_conversation_id", + topic_ids=["topic_ids"], + exclude_statuses=["initiated"], + tag_ids=["tag_ids"], + workflow_node_entered_id="workflow_node_entered_id", + termination_reasons=["termination_reasons"], + guardrail_types=["custom"], + custom_guardrail_names=["custom_guardrail_names"], + sort_direction="asc", + ) + """ + _response = self._raw_client.list( + cursor=cursor, + agent_id=agent_id, + visited_agent_ids=visited_agent_ids, + visited_agent_branch_ids=visited_agent_branch_ids, + triggered_procedure_ids=triggered_procedure_ids, + call_successful=call_successful, + call_start_before_unix=call_start_before_unix, + call_start_after_unix=call_start_after_unix, + call_duration_min_secs=call_duration_min_secs, + call_duration_max_secs=call_duration_max_secs, + rating_max=rating_max, + rating_min=rating_min, + has_feedback_comment=has_feedback_comment, + user_id=user_id, + evaluation_params=evaluation_params, + data_collection_params=data_collection_params, + dynamic_variable_params=dynamic_variable_params, + data_collection_ids=data_collection_ids, + evaluation_criteria_ids=evaluation_criteria_ids, + tool_names=tool_names, + tool_names_successful=tool_names_successful, + tool_names_errored=tool_names_errored, + include_invalid_tool_calls=include_invalid_tool_calls, + main_languages=main_languages, + page_size=page_size, + summary_mode=summary_mode, + search=search, + conversation_initiation_source=conversation_initiation_source, + text_only=text_only, + conversation_product_type=conversation_product_type, + branch_id=branch_id, + version_id=version_id, + parent_conversation_id=parent_conversation_id, + topic_ids=topic_ids, + exclude_statuses=exclude_statuses, + tag_ids=tag_ids, + workflow_node_entered_id=workflow_node_entered_id, + termination_reasons=termination_reasons, + guardrail_types=guardrail_types, + custom_guardrail_names=custom_guardrail_names, + sort_direction=sort_direction, + request_options=request_options, + ) + return _response.data + + def resolve( + self, *, agent_id: str, reference: str, request_options: typing.Optional[RequestOptions] = None + ) -> GetConversationResponseModel: + """ + Resolve a conversation URL (a Slack message URL or a Zendesk ticket URL) to the deterministic conversation ID for the given agent, then confirm the conversation exists. + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + reference : str + A Slack message URL or a Zendesk ticket URL. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.resolve( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + reference="https://your-domain.zendesk.com/agent/tickets/12345", + ) + """ + _response = self._raw_client.resolve(agent_id=agent_id, reference=reference, request_options=request_options) + return _response.data + + def get( + self, + conversation_id: str, + *, + format: typing.Optional[ConversationsGetRequestFormat] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationResponseModel: + """ + Get the details of a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + format : typing.Optional[ConversationsGetRequestFormat] + Response format. Defaults to 'json'. Set to 'opentelemetry' for an OTLP-compatible trace payload using the same structure as the post-call webhook. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.get( + conversation_id="21m00Tcm4TlvDq8ikWAM", + format="json", + ) + """ + _response = self._raw_client.get(conversation_id, format=format, request_options=request_options) + return _response.data + + def delete(self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.delete( + conversation_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.delete(conversation_id, request_options=request_options) + return _response.data + + def get_summary( + self, + conversation_id: str, + *, + max_messages: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationSummaryResponseModel: + """ + Get a lightweight summary of a conversation: its title, the generated transcript summary, whether the call was successful, and — only when the conversation is short — the plain chat messages. Tool calls, tool results, and contextual updates are omitted so the response stays small. Use this instead of the full conversation endpoint when you only need the gist (e.g. an agent reading many conversations); use GET /v1/convai/conversations/{conversation_id} when you need the full transcript with tool calls and contextual updates. + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + max_messages : typing.Optional[int] + Maximum number of chat message turns to include inline. When the conversation has more than this, the messages are omitted and messages_omitted is set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationSummaryResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.get_summary( + conversation_id="21m00Tcm4TlvDq8ikWAM", + max_messages=1, + ) + """ + _response = self._raw_client.get_summary( + conversation_id, max_messages=max_messages, request_options=request_options + ) + return _response.data + + def get_sip_messages( + self, + conversation_id: str, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetSipLogMessagesResponse: + """ + Get SIP messages associated with a conversation's phone call + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + page_size : typing.Optional[int] + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetSipLogMessagesResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.get_sip_messages( + conversation_id="21m00Tcm4TlvDq8ikWAM", + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.get_sip_messages( + conversation_id, page_size=page_size, cursor=cursor, request_options=request_options + ) + return _response.data + + @property + def audio(self): + if self._audio is None: + from .audio.client import AudioClient # noqa: E402 + + self._audio = AudioClient(client_wrapper=self._client_wrapper) + return self._audio + + @property + def feedback(self): + if self._feedback is None: + from .feedback.client import FeedbackClient # noqa: E402 + + self._feedback = FeedbackClient(client_wrapper=self._client_wrapper) + return self._feedback + + @property + def messages(self): + if self._messages is None: + from .messages.client import MessagesClient # noqa: E402 + + self._messages = MessagesClient(client_wrapper=self._client_wrapper) + return self._messages + + @property + def tags(self): + if self._tags is None: + from .tags.client import TagsClient # noqa: E402 + + self._tags = TagsClient(client_wrapper=self._client_wrapper) + return self._tags + + @property + def files(self): + if self._files is None: + from .files.client import FilesClient # noqa: E402 + + self._files = FilesClient(client_wrapper=self._client_wrapper) + return self._files + + @property + def topics(self): + if self._topics is None: + from .topics.client import TopicsClient # noqa: E402 + + self._topics = TopicsClient(client_wrapper=self._client_wrapper) + return self._topics + + @property + def analysis(self): + if self._analysis is None: + from .analysis.client import AnalysisClient # noqa: E402 + + self._analysis = AnalysisClient(client_wrapper=self._client_wrapper) + return self._analysis + + +class AsyncConversationsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawConversationsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audio: typing.Optional[AsyncAudioClient] = None + self._feedback: typing.Optional[AsyncFeedbackClient] = None + self._messages: typing.Optional[AsyncMessagesClient] = None + self._tags: typing.Optional[AsyncTagsClient] = None + self._files: typing.Optional[AsyncFilesClient] = None + self._topics: typing.Optional[AsyncTopicsClient] = None + self._analysis: typing.Optional[AsyncAnalysisClient] = None + + @property + def with_raw_response(self) -> AsyncRawConversationsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawConversationsClient + """ + return self._raw_client + + async def get_signed_url( + self, + *, + agent_id: str, + include_conversation_id: typing.Optional[bool] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + debug_events_request: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ConversationSignedUrlResponseModel: + """ + Get a signed url to start a conversation with an agent with an agent that requires authorization + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + include_conversation_id : typing.Optional[bool] + Whether to include a conversation_id with the response. If included, the conversation_signature cannot be used again. + + branch_id : typing.Optional[str] + The ID of the branch to use + + version_id : typing.Optional[str] + The ID of the version to use + + environment : typing.Optional[str] + The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + + debug_events_request : typing.Optional[bool] + Whether to enable debug events. Only available for users with editor access to the agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConversationSignedUrlResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.get_signed_url( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + include_conversation_id=True, + branch_id="branch_id", + version_id="version_id", + environment="environment", + debug_events_request=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_signed_url( + agent_id=agent_id, + include_conversation_id=include_conversation_id, + branch_id=branch_id, + version_id=version_id, + environment=environment, + debug_events_request=debug_events_request, + request_options=request_options, + ) + return _response.data + + async def get_webrtc_token( + self, + *, + agent_id: str, + participant_name: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + debug_events_request: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TokenResponseModel: + """ + Get a WebRTC session token for real-time communication. + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + participant_name : typing.Optional[str] + Optional custom participant name. If not provided, user ID will be used + + branch_id : typing.Optional[str] + The ID of the branch to use + + version_id : typing.Optional[str] + The ID of the version to use + + environment : typing.Optional[str] + The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + + debug_events_request : typing.Optional[bool] + Whether to enable debug events. Only available for users with editor access to the agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TokenResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.get_webrtc_token( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + participant_name="participant_name", + branch_id="branch_id", + version_id="version_id", + environment="environment", + debug_events_request=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_webrtc_token( + agent_id=agent_id, + participant_name=participant_name, + branch_id=branch_id, + version_id=version_id, + environment=environment, + debug_events_request=debug_events_request, + request_options=request_options, + ) + return _response.data + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + agent_id: typing.Optional[str] = None, + visited_agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + visited_agent_branch_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + triggered_procedure_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + call_successful: typing.Optional[EvaluationResultFilter] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + call_duration_min_secs: typing.Optional[int] = None, + call_duration_max_secs: typing.Optional[int] = None, + rating_max: typing.Optional[int] = None, + rating_min: typing.Optional[int] = None, + has_feedback_comment: typing.Optional[bool] = None, + user_id: typing.Optional[str] = None, + evaluation_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + dynamic_variable_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + evaluation_criteria_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_successful: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_errored: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_invalid_tool_calls: typing.Optional[bool] = None, + main_languages: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + summary_mode: typing.Optional[ConversationsListRequestSummaryMode] = None, + search: typing.Optional[str] = None, + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None, + text_only: typing.Optional[bool] = None, + conversation_product_type: typing.Optional[ConversationProduct] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + parent_conversation_id: typing.Optional[str] = None, + topic_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + exclude_statuses: typing.Optional[ + typing.Union[ + ConversationsListRequestExcludeStatusesItem, + typing.Sequence[ConversationsListRequestExcludeStatusesItem], + ] + ] = None, + tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + workflow_node_entered_id: typing.Optional[str] = None, + termination_reasons: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + guardrail_types: typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]] = None, + custom_guardrail_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationsPageResponseModel: + """ + Get all conversations of agents that user owns. With option to restrict to a specific agent. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + visited_agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agents participated. Can not exceed 50 values. + + visited_agent_branch_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agent branches participated. Can not exceed 50 values. + + triggered_procedure_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + + call_successful : typing.Optional[EvaluationResultFilter] + The result of the success evaluation + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + call_duration_min_secs : typing.Optional[int] + Minimum call duration in seconds. + + call_duration_max_secs : typing.Optional[int] + Maximum call duration in seconds. + + rating_max : typing.Optional[int] + Maximum overall rating (1-5). + + rating_min : typing.Optional[int] + Minimum overall rating (1-5). + + has_feedback_comment : typing.Optional[bool] + Filter conversations with user feedback comments. + + user_id : typing.Optional[str] + Filter conversations by the user ID who initiated them. + + evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + + data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + + dynamic_variable_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + + data_collection_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection field IDs to include in each conversation summary. Repeat param. When omitted, data_collection_results is not returned. + + evaluation_criteria_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation criteria IDs to include in each conversation summary. Repeat param. When omitted, evaluation_criteria_results is not returned. + + tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names used during the call. + + tool_names_successful : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had successful calls. + + tool_names_errored : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had errored calls. + + include_invalid_tool_calls : typing.Optional[bool] + Also match tool calls that never ran. + + main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by detected main language (language code). + + page_size : typing.Optional[int] + How many conversations to return at maximum. Can not exceed 100, defaults to 30. + + summary_mode : typing.Optional[ConversationsListRequestSummaryMode] + Whether to include transcript summaries in the response. + + search : typing.Optional[str] + Full-text or fuzzy search over transcript messages + + conversation_initiation_source : typing.Optional[ConversationInitiationSource] + + text_only : typing.Optional[bool] + + conversation_product_type : typing.Optional[ConversationProduct] + Restrict results to a single conversation product surface. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + version_id : typing.Optional[str] + Filter conversations by version ID. + + parent_conversation_id : typing.Optional[str] + Filter conversations by parent conversation ID for subagent conversations. + + topic_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by topic IDs assigned during topic discovery. + + exclude_statuses : typing.Optional[typing.Union[ConversationsListRequestExcludeStatusesItem, typing.Sequence[ConversationsListRequestExcludeStatusesItem]]] + Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + + tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by conversation tag IDs assigned via the conversation-tags endpoints. + + workflow_node_entered_id : typing.Optional[str] + Filter conversations to only those that entered the given node. + + termination_reasons : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + + guardrail_types : typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]] + Filter to conversations where a guardrail of any of these types triggered (metadata.triggered_guardrails.guardrail_type). Repeat param to match any of several. + + custom_guardrail_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter to conversations where a custom guardrail with any of these names triggered (metadata.triggered_guardrails.guardrail_name). Only custom guardrails carry a name. Repeat param to match any of several. + + sort_direction : typing.Optional[SortDirection] + The direction to sort conversations by call start time. Defaults to descending (newest first). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationsPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.list( + cursor="cursor", + agent_id="agent_id", + visited_agent_ids=["visited_agent_ids"], + visited_agent_branch_ids=["visited_agent_branch_ids"], + triggered_procedure_ids=["triggered_procedure_ids"], + call_successful="success", + call_start_before_unix=1, + call_start_after_unix=1, + call_duration_min_secs=1, + call_duration_max_secs=1, + rating_max=1, + rating_min=1, + has_feedback_comment=True, + user_id="user_id", + evaluation_params=["evaluation_params"], + data_collection_params=["data_collection_params"], + dynamic_variable_params=["dynamic_variable_params"], + data_collection_ids=["data_collection_ids"], + evaluation_criteria_ids=["evaluation_criteria_ids"], + tool_names=["tool_names"], + tool_names_successful=["tool_names_successful"], + tool_names_errored=["tool_names_errored"], + include_invalid_tool_calls=True, + main_languages=["main_languages"], + page_size=1, + summary_mode="exclude", + search="search", + conversation_initiation_source="unknown", + text_only=True, + conversation_product_type="agents", + branch_id="branch_id", + version_id="version_id", + parent_conversation_id="parent_conversation_id", + topic_ids=["topic_ids"], + exclude_statuses=["initiated"], + tag_ids=["tag_ids"], + workflow_node_entered_id="workflow_node_entered_id", + termination_reasons=["termination_reasons"], + guardrail_types=["custom"], + custom_guardrail_names=["custom_guardrail_names"], + sort_direction="asc", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, + agent_id=agent_id, + visited_agent_ids=visited_agent_ids, + visited_agent_branch_ids=visited_agent_branch_ids, + triggered_procedure_ids=triggered_procedure_ids, + call_successful=call_successful, + call_start_before_unix=call_start_before_unix, + call_start_after_unix=call_start_after_unix, + call_duration_min_secs=call_duration_min_secs, + call_duration_max_secs=call_duration_max_secs, + rating_max=rating_max, + rating_min=rating_min, + has_feedback_comment=has_feedback_comment, + user_id=user_id, + evaluation_params=evaluation_params, + data_collection_params=data_collection_params, + dynamic_variable_params=dynamic_variable_params, + data_collection_ids=data_collection_ids, + evaluation_criteria_ids=evaluation_criteria_ids, + tool_names=tool_names, + tool_names_successful=tool_names_successful, + tool_names_errored=tool_names_errored, + include_invalid_tool_calls=include_invalid_tool_calls, + main_languages=main_languages, + page_size=page_size, + summary_mode=summary_mode, + search=search, + conversation_initiation_source=conversation_initiation_source, + text_only=text_only, + conversation_product_type=conversation_product_type, + branch_id=branch_id, + version_id=version_id, + parent_conversation_id=parent_conversation_id, + topic_ids=topic_ids, + exclude_statuses=exclude_statuses, + tag_ids=tag_ids, + workflow_node_entered_id=workflow_node_entered_id, + termination_reasons=termination_reasons, + guardrail_types=guardrail_types, + custom_guardrail_names=custom_guardrail_names, + sort_direction=sort_direction, + request_options=request_options, + ) + return _response.data + + async def resolve( + self, *, agent_id: str, reference: str, request_options: typing.Optional[RequestOptions] = None + ) -> GetConversationResponseModel: + """ + Resolve a conversation URL (a Slack message URL or a Zendesk ticket URL) to the deterministic conversation ID for the given agent, then confirm the conversation exists. + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + reference : str + A Slack message URL or a Zendesk ticket URL. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.resolve( + agent_id="agent_3701k3ttaq12ewp8b7qv5rfyszkz", + reference="https://your-domain.zendesk.com/agent/tickets/12345", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.resolve( + agent_id=agent_id, reference=reference, request_options=request_options + ) + return _response.data + + async def get( + self, + conversation_id: str, + *, + format: typing.Optional[ConversationsGetRequestFormat] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationResponseModel: + """ + Get the details of a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + format : typing.Optional[ConversationsGetRequestFormat] + Response format. Defaults to 'json'. Set to 'opentelemetry' for an OTLP-compatible trace payload using the same structure as the post-call webhook. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.get( + conversation_id="21m00Tcm4TlvDq8ikWAM", + format="json", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(conversation_id, format=format, request_options=request_options) + return _response.data + + async def delete( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.delete( + conversation_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(conversation_id, request_options=request_options) + return _response.data + + async def get_summary( + self, + conversation_id: str, + *, + max_messages: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationSummaryResponseModel: + """ + Get a lightweight summary of a conversation: its title, the generated transcript summary, whether the call was successful, and — only when the conversation is short — the plain chat messages. Tool calls, tool results, and contextual updates are omitted so the response stays small. Use this instead of the full conversation endpoint when you only need the gist (e.g. an agent reading many conversations); use GET /v1/convai/conversations/{conversation_id} when you need the full transcript with tool calls and contextual updates. + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + max_messages : typing.Optional[int] + Maximum number of chat message turns to include inline. When the conversation has more than this, the messages are omitted and messages_omitted is set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationSummaryResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.get_summary( + conversation_id="21m00Tcm4TlvDq8ikWAM", + max_messages=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_summary( + conversation_id, max_messages=max_messages, request_options=request_options + ) + return _response.data + + async def get_sip_messages( + self, + conversation_id: str, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetSipLogMessagesResponse: + """ + Get SIP messages associated with a conversation's phone call + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + page_size : typing.Optional[int] + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetSipLogMessagesResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.get_sip_messages( + conversation_id="21m00Tcm4TlvDq8ikWAM", + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_sip_messages( + conversation_id, page_size=page_size, cursor=cursor, request_options=request_options + ) + return _response.data + + @property + def audio(self): + if self._audio is None: + from .audio.client import AsyncAudioClient # noqa: E402 + + self._audio = AsyncAudioClient(client_wrapper=self._client_wrapper) + return self._audio + + @property + def feedback(self): + if self._feedback is None: + from .feedback.client import AsyncFeedbackClient # noqa: E402 + + self._feedback = AsyncFeedbackClient(client_wrapper=self._client_wrapper) + return self._feedback + + @property + def messages(self): + if self._messages is None: + from .messages.client import AsyncMessagesClient # noqa: E402 + + self._messages = AsyncMessagesClient(client_wrapper=self._client_wrapper) + return self._messages + + @property + def tags(self): + if self._tags is None: + from .tags.client import AsyncTagsClient # noqa: E402 + + self._tags = AsyncTagsClient(client_wrapper=self._client_wrapper) + return self._tags + + @property + def files(self): + if self._files is None: + from .files.client import AsyncFilesClient # noqa: E402 + + self._files = AsyncFilesClient(client_wrapper=self._client_wrapper) + return self._files + + @property + def topics(self): + if self._topics is None: + from .topics.client import AsyncTopicsClient # noqa: E402 + + self._topics = AsyncTopicsClient(client_wrapper=self._client_wrapper) + return self._topics + + @property + def analysis(self): + if self._analysis is None: + from .analysis.client import AsyncAnalysisClient # noqa: E402 + + self._analysis = AsyncAnalysisClient(client_wrapper=self._client_wrapper) + return self._analysis diff --git a/data/src/elevenlabs/conversational_ai/conversations/feedback/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/feedback/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/feedback/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/conversations/feedback/client.py b/data/src/elevenlabs/conversational_ai/conversations/feedback/client.py new file mode 100644 index 0000000000000000000000000000000000000000..63648960a56e75fe8d93244856001b2b9d7b5573 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/feedback/client.py @@ -0,0 +1,133 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.user_feedback_score import UserFeedbackScore +from .raw_client import AsyncRawFeedbackClient, RawFeedbackClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class FeedbackClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawFeedbackClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawFeedbackClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawFeedbackClient + """ + return self._raw_client + + def create( + self, + conversation_id: str, + *, + feedback: typing.Optional[UserFeedbackScore] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Send the feedback for the given conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + feedback : typing.Optional[UserFeedbackScore] + Either 'like' or 'dislike' to indicate the feedback for the conversation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.feedback.create( + conversation_id="21m00Tcm4TlvDq8ikWAM", + feedback="like", + ) + """ + _response = self._raw_client.create(conversation_id, feedback=feedback, request_options=request_options) + return _response.data + + +class AsyncFeedbackClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawFeedbackClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawFeedbackClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawFeedbackClient + """ + return self._raw_client + + async def create( + self, + conversation_id: str, + *, + feedback: typing.Optional[UserFeedbackScore] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Send the feedback for the given conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + feedback : typing.Optional[UserFeedbackScore] + Either 'like' or 'dislike' to indicate the feedback for the conversation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.feedback.create( + conversation_id="21m00Tcm4TlvDq8ikWAM", + feedback="like", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(conversation_id, feedback=feedback, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/conversations/feedback/raw_client.py b/data/src/elevenlabs/conversational_ai/conversations/feedback/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..21530a1b6beae39831f1eab8ad7136c178b7e3fd --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/feedback/raw_client.py @@ -0,0 +1,168 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.user_feedback_score import UserFeedbackScore +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawFeedbackClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + conversation_id: str, + *, + feedback: typing.Optional[UserFeedbackScore] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Send the feedback for the given conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + feedback : typing.Optional[UserFeedbackScore] + Either 'like' or 'dislike' to indicate the feedback for the conversation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/feedback", + method="POST", + json={ + "feedback": feedback, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawFeedbackClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + conversation_id: str, + *, + feedback: typing.Optional[UserFeedbackScore] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Send the feedback for the given conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + feedback : typing.Optional[UserFeedbackScore] + Either 'like' or 'dislike' to indicate the feedback for the conversation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/feedback", + method="POST", + json={ + "feedback": feedback, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/conversations/files/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/files/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/files/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/conversations/files/client.py b/data/src/elevenlabs/conversational_ai/conversations/files/client.py new file mode 100644 index 0000000000000000000000000000000000000000..952ba3172f79b99bb3935526fa19476b10f6eabb --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/files/client.py @@ -0,0 +1,200 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .... import core +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.conv_ai_file_upload_response_model import ConvAiFileUploadResponseModel +from .raw_client import AsyncRawFilesClient, RawFilesClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class FilesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawFilesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawFilesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawFilesClient + """ + return self._raw_client + + def create( + self, conversation_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> ConvAiFileUploadResponseModel: + """ + Upload an image, PDF, or text file for a conversation. Returns a unique file ID that can be used to reference the file in the conversation. + + Parameters + ---------- + conversation_id : str + + file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvAiFileUploadResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.files.create( + conversation_id="conversation_id", + ) + """ + _response = self._raw_client.create(conversation_id, file=file, request_options=request_options) + return _response.data + + def delete( + self, conversation_id: str, file_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConvAiFileUploadResponseModel: + """ + Remove a file upload from a conversation. Only possible if the file hasn't already been used in the conversation. + + Parameters + ---------- + conversation_id : str + + file_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvAiFileUploadResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.files.delete( + conversation_id="conversation_id", + file_id="file_id", + ) + """ + _response = self._raw_client.delete(conversation_id, file_id, request_options=request_options) + return _response.data + + +class AsyncFilesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawFilesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawFilesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawFilesClient + """ + return self._raw_client + + async def create( + self, conversation_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> ConvAiFileUploadResponseModel: + """ + Upload an image, PDF, or text file for a conversation. Returns a unique file ID that can be used to reference the file in the conversation. + + Parameters + ---------- + conversation_id : str + + file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvAiFileUploadResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.files.create( + conversation_id="conversation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(conversation_id, file=file, request_options=request_options) + return _response.data + + async def delete( + self, conversation_id: str, file_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConvAiFileUploadResponseModel: + """ + Remove a file upload from a conversation. Only possible if the file hasn't already been used in the conversation. + + Parameters + ---------- + conversation_id : str + + file_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvAiFileUploadResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.files.delete( + conversation_id="conversation_id", + file_id="file_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(conversation_id, file_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/conversations/files/raw_client.py b/data/src/elevenlabs/conversational_ai/conversations/files/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8c53c6fb9dd3d70cacd0fe0a8e5278c060d4e15f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/files/raw_client.py @@ -0,0 +1,263 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .... import core +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.conv_ai_file_upload_response_model import ConvAiFileUploadResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawFilesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, conversation_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ConvAiFileUploadResponseModel]: + """ + Upload an image, PDF, or text file for a conversation. Returns a unique file ID that can be used to reference the file in the conversation. + + Parameters + ---------- + conversation_id : str + + file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConvAiFileUploadResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/files", + method="POST", + data={}, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvAiFileUploadResponseModel, + construct_type( + type_=ConvAiFileUploadResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, conversation_id: str, file_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ConvAiFileUploadResponseModel]: + """ + Remove a file upload from a conversation. Only possible if the file hasn't already been used in the conversation. + + Parameters + ---------- + conversation_id : str + + file_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConvAiFileUploadResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/files/{jsonable_encoder(file_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvAiFileUploadResponseModel, + construct_type( + type_=ConvAiFileUploadResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawFilesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, conversation_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ConvAiFileUploadResponseModel]: + """ + Upload an image, PDF, or text file for a conversation. Returns a unique file ID that can be used to reference the file in the conversation. + + Parameters + ---------- + conversation_id : str + + file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConvAiFileUploadResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/files", + method="POST", + data={}, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvAiFileUploadResponseModel, + construct_type( + type_=ConvAiFileUploadResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, conversation_id: str, file_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ConvAiFileUploadResponseModel]: + """ + Remove a file upload from a conversation. Only possible if the file hasn't already been used in the conversation. + + Parameters + ---------- + conversation_id : str + + file_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConvAiFileUploadResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/files/{jsonable_encoder(file_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvAiFileUploadResponseModel, + construct_type( + type_=ConvAiFileUploadResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/conversations/messages/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/messages/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f0d3b7cb4dd9f463b30169fcb5ca9ee0e48c71fd --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/messages/__init__.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import MessagesTextSearchRequestExcludeStatusesItem, MessagesTextSearchRequestSummaryMode +_dynamic_imports: typing.Dict[str, str] = { + "MessagesTextSearchRequestExcludeStatusesItem": ".types", + "MessagesTextSearchRequestSummaryMode": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["MessagesTextSearchRequestExcludeStatusesItem", "MessagesTextSearchRequestSummaryMode"] diff --git a/data/src/elevenlabs/conversational_ai/conversations/messages/client.py b/data/src/elevenlabs/conversational_ai/conversations/messages/client.py new file mode 100644 index 0000000000000000000000000000000000000000..57fcd98cd0ca97e4ab9686b675062f8c83f2d16c --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/messages/client.py @@ -0,0 +1,668 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.conversation_initiation_source import ConversationInitiationSource +from ....types.conversation_product import ConversationProduct +from ....types.evaluation_result_filter import EvaluationResultFilter +from ....types.message_search_sort_by import MessageSearchSortBy +from ....types.messages_search_response import MessagesSearchResponse +from .raw_client import AsyncRawMessagesClient, RawMessagesClient +from .types.messages_text_search_request_exclude_statuses_item import MessagesTextSearchRequestExcludeStatusesItem +from .types.messages_text_search_request_summary_mode import MessagesTextSearchRequestSummaryMode + + +class MessagesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawMessagesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawMessagesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawMessagesClient + """ + return self._raw_client + + def text_search( + self, + *, + text_query: str, + agent_id: typing.Optional[str] = None, + visited_agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + visited_agent_branch_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + triggered_procedure_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + call_successful: typing.Optional[EvaluationResultFilter] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + call_duration_min_secs: typing.Optional[int] = None, + call_duration_max_secs: typing.Optional[int] = None, + rating_max: typing.Optional[int] = None, + rating_min: typing.Optional[int] = None, + has_feedback_comment: typing.Optional[bool] = None, + user_id: typing.Optional[str] = None, + evaluation_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + dynamic_variable_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_successful: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_errored: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_invalid_tool_calls: typing.Optional[bool] = None, + main_languages: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + exclude_statuses: typing.Optional[ + typing.Union[ + MessagesTextSearchRequestExcludeStatusesItem, + typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem], + ] + ] = None, + termination_reasons: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + summary_mode: typing.Optional[MessagesTextSearchRequestSummaryMode] = None, + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None, + text_only: typing.Optional[bool] = None, + conversation_product_type: typing.Optional[ConversationProduct] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + topic_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_by: typing.Optional[MessageSearchSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MessagesSearchResponse: + """ + Search through conversation transcript messages by full-text and fuzzy search + + Parameters + ---------- + text_query : str + The search query text for full-text and fuzzy matching + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + visited_agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agents participated. Can not exceed 50 values. + + visited_agent_branch_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agent branches participated. Can not exceed 50 values. + + triggered_procedure_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + + call_successful : typing.Optional[EvaluationResultFilter] + The result of the success evaluation + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + call_duration_min_secs : typing.Optional[int] + Minimum call duration in seconds. + + call_duration_max_secs : typing.Optional[int] + Maximum call duration in seconds. + + rating_max : typing.Optional[int] + Maximum overall rating (1-5). + + rating_min : typing.Optional[int] + Minimum overall rating (1-5). + + has_feedback_comment : typing.Optional[bool] + Filter conversations with user feedback comments. + + user_id : typing.Optional[str] + Filter conversations by the user ID who initiated them. + + evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + + data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + + dynamic_variable_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + + tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names used during the call. + + tool_names_successful : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had successful calls. + + tool_names_errored : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had errored calls. + + include_invalid_tool_calls : typing.Optional[bool] + Also match tool calls that never ran. + + main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by detected main language (language code). + + exclude_statuses : typing.Optional[typing.Union[MessagesTextSearchRequestExcludeStatusesItem, typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem]]] + Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + + termination_reasons : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + + page_size : typing.Optional[int] + Number of results per page. Max 50. + + summary_mode : typing.Optional[MessagesTextSearchRequestSummaryMode] + Whether to include transcript summaries in the response. + + conversation_initiation_source : typing.Optional[ConversationInitiationSource] + + text_only : typing.Optional[bool] + + conversation_product_type : typing.Optional[ConversationProduct] + Restrict results to a single conversation product surface. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + version_id : typing.Optional[str] + Filter conversations by version ID. + + topic_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by topic IDs assigned during topic discovery. + + sort_by : typing.Optional[MessageSearchSortBy] + Sort order for search results. 'search_score' sorts by search score, 'created_at' sorts by conversation start time. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MessagesSearchResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.messages.text_search( + text_query="refund policy", + agent_id="agent_id", + visited_agent_ids=["visited_agent_ids"], + visited_agent_branch_ids=["visited_agent_branch_ids"], + triggered_procedure_ids=["triggered_procedure_ids"], + call_successful="success", + call_start_before_unix=1, + call_start_after_unix=1, + call_duration_min_secs=1, + call_duration_max_secs=1, + rating_max=1, + rating_min=1, + has_feedback_comment=True, + user_id="user_id", + evaluation_params=["evaluation_params"], + data_collection_params=["data_collection_params"], + dynamic_variable_params=["dynamic_variable_params"], + tool_names=["tool_names"], + tool_names_successful=["tool_names_successful"], + tool_names_errored=["tool_names_errored"], + include_invalid_tool_calls=True, + main_languages=["main_languages"], + exclude_statuses=["initiated"], + termination_reasons=["termination_reasons"], + page_size=1, + summary_mode="exclude", + conversation_initiation_source="unknown", + text_only=True, + conversation_product_type="agents", + branch_id="branch_id", + version_id="version_id", + topic_ids=["topic_ids"], + sort_by="search_score", + cursor="cursor", + ) + """ + _response = self._raw_client.text_search( + text_query=text_query, + agent_id=agent_id, + visited_agent_ids=visited_agent_ids, + visited_agent_branch_ids=visited_agent_branch_ids, + triggered_procedure_ids=triggered_procedure_ids, + call_successful=call_successful, + call_start_before_unix=call_start_before_unix, + call_start_after_unix=call_start_after_unix, + call_duration_min_secs=call_duration_min_secs, + call_duration_max_secs=call_duration_max_secs, + rating_max=rating_max, + rating_min=rating_min, + has_feedback_comment=has_feedback_comment, + user_id=user_id, + evaluation_params=evaluation_params, + data_collection_params=data_collection_params, + dynamic_variable_params=dynamic_variable_params, + tool_names=tool_names, + tool_names_successful=tool_names_successful, + tool_names_errored=tool_names_errored, + include_invalid_tool_calls=include_invalid_tool_calls, + main_languages=main_languages, + exclude_statuses=exclude_statuses, + termination_reasons=termination_reasons, + page_size=page_size, + summary_mode=summary_mode, + conversation_initiation_source=conversation_initiation_source, + text_only=text_only, + conversation_product_type=conversation_product_type, + branch_id=branch_id, + version_id=version_id, + topic_ids=topic_ids, + sort_by=sort_by, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def search( + self, + *, + text_query: str, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MessagesSearchResponse: + """ + Search conversation transcripts by semantic similarity to surface relevant messages based on meaning and intent, rather than exact keyword matches + + Parameters + ---------- + text_query : str + The search query text for semantic similarity matching + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + page_size : typing.Optional[int] + Number of results per page. Max 50. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MessagesSearchResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.messages.search( + text_query="Customer asking to cancel and get money back", + agent_id="agent_id", + branch_id="branch_id", + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.search( + text_query=text_query, + agent_id=agent_id, + branch_id=branch_id, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + +class AsyncMessagesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawMessagesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawMessagesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawMessagesClient + """ + return self._raw_client + + async def text_search( + self, + *, + text_query: str, + agent_id: typing.Optional[str] = None, + visited_agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + visited_agent_branch_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + triggered_procedure_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + call_successful: typing.Optional[EvaluationResultFilter] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + call_duration_min_secs: typing.Optional[int] = None, + call_duration_max_secs: typing.Optional[int] = None, + rating_max: typing.Optional[int] = None, + rating_min: typing.Optional[int] = None, + has_feedback_comment: typing.Optional[bool] = None, + user_id: typing.Optional[str] = None, + evaluation_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + dynamic_variable_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_successful: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_errored: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_invalid_tool_calls: typing.Optional[bool] = None, + main_languages: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + exclude_statuses: typing.Optional[ + typing.Union[ + MessagesTextSearchRequestExcludeStatusesItem, + typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem], + ] + ] = None, + termination_reasons: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + summary_mode: typing.Optional[MessagesTextSearchRequestSummaryMode] = None, + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None, + text_only: typing.Optional[bool] = None, + conversation_product_type: typing.Optional[ConversationProduct] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + topic_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_by: typing.Optional[MessageSearchSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MessagesSearchResponse: + """ + Search through conversation transcript messages by full-text and fuzzy search + + Parameters + ---------- + text_query : str + The search query text for full-text and fuzzy matching + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + visited_agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agents participated. Can not exceed 50 values. + + visited_agent_branch_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agent branches participated. Can not exceed 50 values. + + triggered_procedure_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + + call_successful : typing.Optional[EvaluationResultFilter] + The result of the success evaluation + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + call_duration_min_secs : typing.Optional[int] + Minimum call duration in seconds. + + call_duration_max_secs : typing.Optional[int] + Maximum call duration in seconds. + + rating_max : typing.Optional[int] + Maximum overall rating (1-5). + + rating_min : typing.Optional[int] + Minimum overall rating (1-5). + + has_feedback_comment : typing.Optional[bool] + Filter conversations with user feedback comments. + + user_id : typing.Optional[str] + Filter conversations by the user ID who initiated them. + + evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + + data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + + dynamic_variable_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + + tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names used during the call. + + tool_names_successful : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had successful calls. + + tool_names_errored : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had errored calls. + + include_invalid_tool_calls : typing.Optional[bool] + Also match tool calls that never ran. + + main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by detected main language (language code). + + exclude_statuses : typing.Optional[typing.Union[MessagesTextSearchRequestExcludeStatusesItem, typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem]]] + Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + + termination_reasons : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + + page_size : typing.Optional[int] + Number of results per page. Max 50. + + summary_mode : typing.Optional[MessagesTextSearchRequestSummaryMode] + Whether to include transcript summaries in the response. + + conversation_initiation_source : typing.Optional[ConversationInitiationSource] + + text_only : typing.Optional[bool] + + conversation_product_type : typing.Optional[ConversationProduct] + Restrict results to a single conversation product surface. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + version_id : typing.Optional[str] + Filter conversations by version ID. + + topic_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by topic IDs assigned during topic discovery. + + sort_by : typing.Optional[MessageSearchSortBy] + Sort order for search results. 'search_score' sorts by search score, 'created_at' sorts by conversation start time. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MessagesSearchResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.messages.text_search( + text_query="refund policy", + agent_id="agent_id", + visited_agent_ids=["visited_agent_ids"], + visited_agent_branch_ids=["visited_agent_branch_ids"], + triggered_procedure_ids=["triggered_procedure_ids"], + call_successful="success", + call_start_before_unix=1, + call_start_after_unix=1, + call_duration_min_secs=1, + call_duration_max_secs=1, + rating_max=1, + rating_min=1, + has_feedback_comment=True, + user_id="user_id", + evaluation_params=["evaluation_params"], + data_collection_params=["data_collection_params"], + dynamic_variable_params=["dynamic_variable_params"], + tool_names=["tool_names"], + tool_names_successful=["tool_names_successful"], + tool_names_errored=["tool_names_errored"], + include_invalid_tool_calls=True, + main_languages=["main_languages"], + exclude_statuses=["initiated"], + termination_reasons=["termination_reasons"], + page_size=1, + summary_mode="exclude", + conversation_initiation_source="unknown", + text_only=True, + conversation_product_type="agents", + branch_id="branch_id", + version_id="version_id", + topic_ids=["topic_ids"], + sort_by="search_score", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.text_search( + text_query=text_query, + agent_id=agent_id, + visited_agent_ids=visited_agent_ids, + visited_agent_branch_ids=visited_agent_branch_ids, + triggered_procedure_ids=triggered_procedure_ids, + call_successful=call_successful, + call_start_before_unix=call_start_before_unix, + call_start_after_unix=call_start_after_unix, + call_duration_min_secs=call_duration_min_secs, + call_duration_max_secs=call_duration_max_secs, + rating_max=rating_max, + rating_min=rating_min, + has_feedback_comment=has_feedback_comment, + user_id=user_id, + evaluation_params=evaluation_params, + data_collection_params=data_collection_params, + dynamic_variable_params=dynamic_variable_params, + tool_names=tool_names, + tool_names_successful=tool_names_successful, + tool_names_errored=tool_names_errored, + include_invalid_tool_calls=include_invalid_tool_calls, + main_languages=main_languages, + exclude_statuses=exclude_statuses, + termination_reasons=termination_reasons, + page_size=page_size, + summary_mode=summary_mode, + conversation_initiation_source=conversation_initiation_source, + text_only=text_only, + conversation_product_type=conversation_product_type, + branch_id=branch_id, + version_id=version_id, + topic_ids=topic_ids, + sort_by=sort_by, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def search( + self, + *, + text_query: str, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MessagesSearchResponse: + """ + Search conversation transcripts by semantic similarity to surface relevant messages based on meaning and intent, rather than exact keyword matches + + Parameters + ---------- + text_query : str + The search query text for semantic similarity matching + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + page_size : typing.Optional[int] + Number of results per page. Max 50. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MessagesSearchResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.messages.search( + text_query="Customer asking to cancel and get money back", + agent_id="agent_id", + branch_id="branch_id", + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.search( + text_query=text_query, + agent_id=agent_id, + branch_id=branch_id, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/conversations/messages/raw_client.py b/data/src/elevenlabs/conversational_ai/conversations/messages/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..cea99f906b82c2e74c48c2a6d3d4548f69784977 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/messages/raw_client.py @@ -0,0 +1,646 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.conversation_initiation_source import ConversationInitiationSource +from ....types.conversation_product import ConversationProduct +from ....types.evaluation_result_filter import EvaluationResultFilter +from ....types.message_search_sort_by import MessageSearchSortBy +from ....types.messages_search_response import MessagesSearchResponse +from .types.messages_text_search_request_exclude_statuses_item import MessagesTextSearchRequestExcludeStatusesItem +from .types.messages_text_search_request_summary_mode import MessagesTextSearchRequestSummaryMode +from pydantic import ValidationError + + +class RawMessagesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def text_search( + self, + *, + text_query: str, + agent_id: typing.Optional[str] = None, + visited_agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + visited_agent_branch_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + triggered_procedure_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + call_successful: typing.Optional[EvaluationResultFilter] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + call_duration_min_secs: typing.Optional[int] = None, + call_duration_max_secs: typing.Optional[int] = None, + rating_max: typing.Optional[int] = None, + rating_min: typing.Optional[int] = None, + has_feedback_comment: typing.Optional[bool] = None, + user_id: typing.Optional[str] = None, + evaluation_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + dynamic_variable_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_successful: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_errored: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_invalid_tool_calls: typing.Optional[bool] = None, + main_languages: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + exclude_statuses: typing.Optional[ + typing.Union[ + MessagesTextSearchRequestExcludeStatusesItem, + typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem], + ] + ] = None, + termination_reasons: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + summary_mode: typing.Optional[MessagesTextSearchRequestSummaryMode] = None, + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None, + text_only: typing.Optional[bool] = None, + conversation_product_type: typing.Optional[ConversationProduct] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + topic_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_by: typing.Optional[MessageSearchSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MessagesSearchResponse]: + """ + Search through conversation transcript messages by full-text and fuzzy search + + Parameters + ---------- + text_query : str + The search query text for full-text and fuzzy matching + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + visited_agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agents participated. Can not exceed 50 values. + + visited_agent_branch_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agent branches participated. Can not exceed 50 values. + + triggered_procedure_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + + call_successful : typing.Optional[EvaluationResultFilter] + The result of the success evaluation + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + call_duration_min_secs : typing.Optional[int] + Minimum call duration in seconds. + + call_duration_max_secs : typing.Optional[int] + Maximum call duration in seconds. + + rating_max : typing.Optional[int] + Maximum overall rating (1-5). + + rating_min : typing.Optional[int] + Minimum overall rating (1-5). + + has_feedback_comment : typing.Optional[bool] + Filter conversations with user feedback comments. + + user_id : typing.Optional[str] + Filter conversations by the user ID who initiated them. + + evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + + data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + + dynamic_variable_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + + tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names used during the call. + + tool_names_successful : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had successful calls. + + tool_names_errored : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had errored calls. + + include_invalid_tool_calls : typing.Optional[bool] + Also match tool calls that never ran. + + main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by detected main language (language code). + + exclude_statuses : typing.Optional[typing.Union[MessagesTextSearchRequestExcludeStatusesItem, typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem]]] + Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + + termination_reasons : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + + page_size : typing.Optional[int] + Number of results per page. Max 50. + + summary_mode : typing.Optional[MessagesTextSearchRequestSummaryMode] + Whether to include transcript summaries in the response. + + conversation_initiation_source : typing.Optional[ConversationInitiationSource] + + text_only : typing.Optional[bool] + + conversation_product_type : typing.Optional[ConversationProduct] + Restrict results to a single conversation product surface. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + version_id : typing.Optional[str] + Filter conversations by version ID. + + topic_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by topic IDs assigned during topic discovery. + + sort_by : typing.Optional[MessageSearchSortBy] + Sort order for search results. 'search_score' sorts by search score, 'created_at' sorts by conversation start time. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MessagesSearchResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/conversations/messages/text-search", + method="GET", + params={ + "text_query": text_query, + "agent_id": agent_id, + "visited_agent_ids": visited_agent_ids, + "visited_agent_branch_ids": visited_agent_branch_ids, + "triggered_procedure_ids": triggered_procedure_ids, + "call_successful": call_successful, + "call_start_before_unix": call_start_before_unix, + "call_start_after_unix": call_start_after_unix, + "call_duration_min_secs": call_duration_min_secs, + "call_duration_max_secs": call_duration_max_secs, + "rating_max": rating_max, + "rating_min": rating_min, + "has_feedback_comment": has_feedback_comment, + "user_id": user_id, + "evaluation_params": evaluation_params, + "data_collection_params": data_collection_params, + "dynamic_variable_params": dynamic_variable_params, + "tool_names": tool_names, + "tool_names_successful": tool_names_successful, + "tool_names_errored": tool_names_errored, + "include_invalid_tool_calls": include_invalid_tool_calls, + "main_languages": main_languages, + "exclude_statuses": exclude_statuses, + "termination_reasons": termination_reasons, + "page_size": page_size, + "summary_mode": summary_mode, + "conversation_initiation_source": conversation_initiation_source, + "text_only": text_only, + "conversation_product_type": conversation_product_type, + "branch_id": branch_id, + "version_id": version_id, + "topic_ids": topic_ids, + "sort_by": sort_by, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MessagesSearchResponse, + construct_type( + type_=MessagesSearchResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def search( + self, + *, + text_query: str, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MessagesSearchResponse]: + """ + Search conversation transcripts by semantic similarity to surface relevant messages based on meaning and intent, rather than exact keyword matches + + Parameters + ---------- + text_query : str + The search query text for semantic similarity matching + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + page_size : typing.Optional[int] + Number of results per page. Max 50. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MessagesSearchResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/conversations/messages/smart-search", + method="GET", + params={ + "text_query": text_query, + "agent_id": agent_id, + "branch_id": branch_id, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MessagesSearchResponse, + construct_type( + type_=MessagesSearchResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawMessagesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def text_search( + self, + *, + text_query: str, + agent_id: typing.Optional[str] = None, + visited_agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + visited_agent_branch_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + triggered_procedure_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + call_successful: typing.Optional[EvaluationResultFilter] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + call_duration_min_secs: typing.Optional[int] = None, + call_duration_max_secs: typing.Optional[int] = None, + rating_max: typing.Optional[int] = None, + rating_min: typing.Optional[int] = None, + has_feedback_comment: typing.Optional[bool] = None, + user_id: typing.Optional[str] = None, + evaluation_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + dynamic_variable_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_successful: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_errored: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_invalid_tool_calls: typing.Optional[bool] = None, + main_languages: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + exclude_statuses: typing.Optional[ + typing.Union[ + MessagesTextSearchRequestExcludeStatusesItem, + typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem], + ] + ] = None, + termination_reasons: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + summary_mode: typing.Optional[MessagesTextSearchRequestSummaryMode] = None, + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None, + text_only: typing.Optional[bool] = None, + conversation_product_type: typing.Optional[ConversationProduct] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + topic_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_by: typing.Optional[MessageSearchSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MessagesSearchResponse]: + """ + Search through conversation transcript messages by full-text and fuzzy search + + Parameters + ---------- + text_query : str + The search query text for full-text and fuzzy matching + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + visited_agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agents participated. Can not exceed 50 values. + + visited_agent_branch_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agent branches participated. Can not exceed 50 values. + + triggered_procedure_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + + call_successful : typing.Optional[EvaluationResultFilter] + The result of the success evaluation + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + call_duration_min_secs : typing.Optional[int] + Minimum call duration in seconds. + + call_duration_max_secs : typing.Optional[int] + Maximum call duration in seconds. + + rating_max : typing.Optional[int] + Maximum overall rating (1-5). + + rating_min : typing.Optional[int] + Minimum overall rating (1-5). + + has_feedback_comment : typing.Optional[bool] + Filter conversations with user feedback comments. + + user_id : typing.Optional[str] + Filter conversations by the user ID who initiated them. + + evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + + data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + + dynamic_variable_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + + tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names used during the call. + + tool_names_successful : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had successful calls. + + tool_names_errored : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had errored calls. + + include_invalid_tool_calls : typing.Optional[bool] + Also match tool calls that never ran. + + main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by detected main language (language code). + + exclude_statuses : typing.Optional[typing.Union[MessagesTextSearchRequestExcludeStatusesItem, typing.Sequence[MessagesTextSearchRequestExcludeStatusesItem]]] + Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + + termination_reasons : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + + page_size : typing.Optional[int] + Number of results per page. Max 50. + + summary_mode : typing.Optional[MessagesTextSearchRequestSummaryMode] + Whether to include transcript summaries in the response. + + conversation_initiation_source : typing.Optional[ConversationInitiationSource] + + text_only : typing.Optional[bool] + + conversation_product_type : typing.Optional[ConversationProduct] + Restrict results to a single conversation product surface. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + version_id : typing.Optional[str] + Filter conversations by version ID. + + topic_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by topic IDs assigned during topic discovery. + + sort_by : typing.Optional[MessageSearchSortBy] + Sort order for search results. 'search_score' sorts by search score, 'created_at' sorts by conversation start time. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MessagesSearchResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/conversations/messages/text-search", + method="GET", + params={ + "text_query": text_query, + "agent_id": agent_id, + "visited_agent_ids": visited_agent_ids, + "visited_agent_branch_ids": visited_agent_branch_ids, + "triggered_procedure_ids": triggered_procedure_ids, + "call_successful": call_successful, + "call_start_before_unix": call_start_before_unix, + "call_start_after_unix": call_start_after_unix, + "call_duration_min_secs": call_duration_min_secs, + "call_duration_max_secs": call_duration_max_secs, + "rating_max": rating_max, + "rating_min": rating_min, + "has_feedback_comment": has_feedback_comment, + "user_id": user_id, + "evaluation_params": evaluation_params, + "data_collection_params": data_collection_params, + "dynamic_variable_params": dynamic_variable_params, + "tool_names": tool_names, + "tool_names_successful": tool_names_successful, + "tool_names_errored": tool_names_errored, + "include_invalid_tool_calls": include_invalid_tool_calls, + "main_languages": main_languages, + "exclude_statuses": exclude_statuses, + "termination_reasons": termination_reasons, + "page_size": page_size, + "summary_mode": summary_mode, + "conversation_initiation_source": conversation_initiation_source, + "text_only": text_only, + "conversation_product_type": conversation_product_type, + "branch_id": branch_id, + "version_id": version_id, + "topic_ids": topic_ids, + "sort_by": sort_by, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MessagesSearchResponse, + construct_type( + type_=MessagesSearchResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def search( + self, + *, + text_query: str, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MessagesSearchResponse]: + """ + Search conversation transcripts by semantic similarity to surface relevant messages based on meaning and intent, rather than exact keyword matches + + Parameters + ---------- + text_query : str + The search query text for semantic similarity matching + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + page_size : typing.Optional[int] + Number of results per page. Max 50. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MessagesSearchResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/conversations/messages/smart-search", + method="GET", + params={ + "text_query": text_query, + "agent_id": agent_id, + "branch_id": branch_id, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MessagesSearchResponse, + construct_type( + type_=MessagesSearchResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/conversations/messages/types/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/messages/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4e45ed161e881e2597ba71414c93e6ccbba2a425 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/messages/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .messages_text_search_request_exclude_statuses_item import MessagesTextSearchRequestExcludeStatusesItem + from .messages_text_search_request_summary_mode import MessagesTextSearchRequestSummaryMode +_dynamic_imports: typing.Dict[str, str] = { + "MessagesTextSearchRequestExcludeStatusesItem": ".messages_text_search_request_exclude_statuses_item", + "MessagesTextSearchRequestSummaryMode": ".messages_text_search_request_summary_mode", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["MessagesTextSearchRequestExcludeStatusesItem", "MessagesTextSearchRequestSummaryMode"] diff --git a/data/src/elevenlabs/conversational_ai/conversations/messages/types/messages_text_search_request_exclude_statuses_item.py b/data/src/elevenlabs/conversational_ai/conversations/messages/types/messages_text_search_request_exclude_statuses_item.py new file mode 100644 index 0000000000000000000000000000000000000000..48f157f71fe9204ae2dfc51ce87caa4c337ba3ef --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/messages/types/messages_text_search_request_exclude_statuses_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MessagesTextSearchRequestExcludeStatusesItem = typing.Union[ + typing.Literal["initiated", "in-progress", "processing", "done", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/conversational_ai/conversations/messages/types/messages_text_search_request_summary_mode.py b/data/src/elevenlabs/conversational_ai/conversations/messages/types/messages_text_search_request_summary_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..a17fc8a53d08da957fd9701e73d47b5dbb26194b --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/messages/types/messages_text_search_request_summary_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MessagesTextSearchRequestSummaryMode = typing.Union[typing.Literal["exclude", "include"], typing.Any] diff --git a/data/src/elevenlabs/conversational_ai/conversations/raw_client.py b/data/src/elevenlabs/conversational_ai/conversations/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..7010e5be16968352e2ca88d1b6b667e60417e01b --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/raw_client.py @@ -0,0 +1,1530 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.conversation_initiation_source import ConversationInitiationSource +from ...types.conversation_product import ConversationProduct +from ...types.conversation_signed_url_response_model import ConversationSignedUrlResponseModel +from ...types.evaluation_result_filter import EvaluationResultFilter +from ...types.get_conversation_response_model import GetConversationResponseModel +from ...types.get_conversation_summary_response_model import GetConversationSummaryResponseModel +from ...types.get_conversations_page_response_model import GetConversationsPageResponseModel +from ...types.get_sip_log_messages_response import GetSipLogMessagesResponse +from ...types.guardrail_type import GuardrailType +from ...types.sort_direction import SortDirection +from ...types.token_response_model import TokenResponseModel +from .types.conversations_get_request_format import ConversationsGetRequestFormat +from .types.conversations_list_request_exclude_statuses_item import ConversationsListRequestExcludeStatusesItem +from .types.conversations_list_request_summary_mode import ConversationsListRequestSummaryMode +from pydantic import ValidationError + + +class RawConversationsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_signed_url( + self, + *, + agent_id: str, + include_conversation_id: typing.Optional[bool] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + debug_events_request: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ConversationSignedUrlResponseModel]: + """ + Get a signed url to start a conversation with an agent with an agent that requires authorization + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + include_conversation_id : typing.Optional[bool] + Whether to include a conversation_id with the response. If included, the conversation_signature cannot be used again. + + branch_id : typing.Optional[str] + The ID of the branch to use + + version_id : typing.Optional[str] + The ID of the version to use + + environment : typing.Optional[str] + The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + + debug_events_request : typing.Optional[bool] + Whether to enable debug events. Only available for users with editor access to the agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConversationSignedUrlResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/conversation/get-signed-url", + method="GET", + params={ + "agent_id": agent_id, + "include_conversation_id": include_conversation_id, + "branch_id": branch_id, + "version_id": version_id, + "environment": environment, + "debug_events_request": debug_events_request, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConversationSignedUrlResponseModel, + construct_type( + type_=ConversationSignedUrlResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_webrtc_token( + self, + *, + agent_id: str, + participant_name: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + debug_events_request: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TokenResponseModel]: + """ + Get a WebRTC session token for real-time communication. + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + participant_name : typing.Optional[str] + Optional custom participant name. If not provided, user ID will be used + + branch_id : typing.Optional[str] + The ID of the branch to use + + version_id : typing.Optional[str] + The ID of the version to use + + environment : typing.Optional[str] + The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + + debug_events_request : typing.Optional[bool] + Whether to enable debug events. Only available for users with editor access to the agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TokenResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/conversation/token", + method="GET", + params={ + "agent_id": agent_id, + "participant_name": participant_name, + "branch_id": branch_id, + "version_id": version_id, + "environment": environment, + "debug_events_request": debug_events_request, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TokenResponseModel, + construct_type( + type_=TokenResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list( + self, + *, + cursor: typing.Optional[str] = None, + agent_id: typing.Optional[str] = None, + visited_agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + visited_agent_branch_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + triggered_procedure_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + call_successful: typing.Optional[EvaluationResultFilter] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + call_duration_min_secs: typing.Optional[int] = None, + call_duration_max_secs: typing.Optional[int] = None, + rating_max: typing.Optional[int] = None, + rating_min: typing.Optional[int] = None, + has_feedback_comment: typing.Optional[bool] = None, + user_id: typing.Optional[str] = None, + evaluation_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + dynamic_variable_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + evaluation_criteria_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_successful: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_errored: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_invalid_tool_calls: typing.Optional[bool] = None, + main_languages: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + summary_mode: typing.Optional[ConversationsListRequestSummaryMode] = None, + search: typing.Optional[str] = None, + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None, + text_only: typing.Optional[bool] = None, + conversation_product_type: typing.Optional[ConversationProduct] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + parent_conversation_id: typing.Optional[str] = None, + topic_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + exclude_statuses: typing.Optional[ + typing.Union[ + ConversationsListRequestExcludeStatusesItem, + typing.Sequence[ConversationsListRequestExcludeStatusesItem], + ] + ] = None, + tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + workflow_node_entered_id: typing.Optional[str] = None, + termination_reasons: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + guardrail_types: typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]] = None, + custom_guardrail_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetConversationsPageResponseModel]: + """ + Get all conversations of agents that user owns. With option to restrict to a specific agent. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + visited_agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agents participated. Can not exceed 50 values. + + visited_agent_branch_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agent branches participated. Can not exceed 50 values. + + triggered_procedure_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + + call_successful : typing.Optional[EvaluationResultFilter] + The result of the success evaluation + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + call_duration_min_secs : typing.Optional[int] + Minimum call duration in seconds. + + call_duration_max_secs : typing.Optional[int] + Maximum call duration in seconds. + + rating_max : typing.Optional[int] + Maximum overall rating (1-5). + + rating_min : typing.Optional[int] + Minimum overall rating (1-5). + + has_feedback_comment : typing.Optional[bool] + Filter conversations with user feedback comments. + + user_id : typing.Optional[str] + Filter conversations by the user ID who initiated them. + + evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + + data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + + dynamic_variable_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + + data_collection_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection field IDs to include in each conversation summary. Repeat param. When omitted, data_collection_results is not returned. + + evaluation_criteria_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation criteria IDs to include in each conversation summary. Repeat param. When omitted, evaluation_criteria_results is not returned. + + tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names used during the call. + + tool_names_successful : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had successful calls. + + tool_names_errored : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had errored calls. + + include_invalid_tool_calls : typing.Optional[bool] + Also match tool calls that never ran. + + main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by detected main language (language code). + + page_size : typing.Optional[int] + How many conversations to return at maximum. Can not exceed 100, defaults to 30. + + summary_mode : typing.Optional[ConversationsListRequestSummaryMode] + Whether to include transcript summaries in the response. + + search : typing.Optional[str] + Full-text or fuzzy search over transcript messages + + conversation_initiation_source : typing.Optional[ConversationInitiationSource] + + text_only : typing.Optional[bool] + + conversation_product_type : typing.Optional[ConversationProduct] + Restrict results to a single conversation product surface. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + version_id : typing.Optional[str] + Filter conversations by version ID. + + parent_conversation_id : typing.Optional[str] + Filter conversations by parent conversation ID for subagent conversations. + + topic_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by topic IDs assigned during topic discovery. + + exclude_statuses : typing.Optional[typing.Union[ConversationsListRequestExcludeStatusesItem, typing.Sequence[ConversationsListRequestExcludeStatusesItem]]] + Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + + tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by conversation tag IDs assigned via the conversation-tags endpoints. + + workflow_node_entered_id : typing.Optional[str] + Filter conversations to only those that entered the given node. + + termination_reasons : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + + guardrail_types : typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]] + Filter to conversations where a guardrail of any of these types triggered (metadata.triggered_guardrails.guardrail_type). Repeat param to match any of several. + + custom_guardrail_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter to conversations where a custom guardrail with any of these names triggered (metadata.triggered_guardrails.guardrail_name). Only custom guardrails carry a name. Repeat param to match any of several. + + sort_direction : typing.Optional[SortDirection] + The direction to sort conversations by call start time. Defaults to descending (newest first). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConversationsPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/conversations", + method="GET", + params={ + "cursor": cursor, + "agent_id": agent_id, + "visited_agent_ids": visited_agent_ids, + "visited_agent_branch_ids": visited_agent_branch_ids, + "triggered_procedure_ids": triggered_procedure_ids, + "call_successful": call_successful, + "call_start_before_unix": call_start_before_unix, + "call_start_after_unix": call_start_after_unix, + "call_duration_min_secs": call_duration_min_secs, + "call_duration_max_secs": call_duration_max_secs, + "rating_max": rating_max, + "rating_min": rating_min, + "has_feedback_comment": has_feedback_comment, + "user_id": user_id, + "evaluation_params": evaluation_params, + "data_collection_params": data_collection_params, + "dynamic_variable_params": dynamic_variable_params, + "data_collection_ids": data_collection_ids, + "evaluation_criteria_ids": evaluation_criteria_ids, + "tool_names": tool_names, + "tool_names_successful": tool_names_successful, + "tool_names_errored": tool_names_errored, + "include_invalid_tool_calls": include_invalid_tool_calls, + "main_languages": main_languages, + "page_size": page_size, + "summary_mode": summary_mode, + "search": search, + "conversation_initiation_source": conversation_initiation_source, + "text_only": text_only, + "conversation_product_type": conversation_product_type, + "branch_id": branch_id, + "version_id": version_id, + "parent_conversation_id": parent_conversation_id, + "topic_ids": topic_ids, + "exclude_statuses": exclude_statuses, + "tag_ids": tag_ids, + "workflow_node_entered_id": workflow_node_entered_id, + "termination_reasons": termination_reasons, + "guardrail_types": guardrail_types, + "custom_guardrail_names": custom_guardrail_names, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationsPageResponseModel, + construct_type( + type_=GetConversationsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def resolve( + self, *, agent_id: str, reference: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetConversationResponseModel]: + """ + Resolve a conversation URL (a Slack message URL or a Zendesk ticket URL) to the deterministic conversation ID for the given agent, then confirm the conversation exists. + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + reference : str + A Slack message URL or a Zendesk ticket URL. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConversationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/conversations/resolve", + method="GET", + params={ + "agent_id": agent_id, + "reference": reference, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationResponseModel, + construct_type( + type_=GetConversationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + conversation_id: str, + *, + format: typing.Optional[ConversationsGetRequestFormat] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetConversationResponseModel]: + """ + Get the details of a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + format : typing.Optional[ConversationsGetRequestFormat] + Response format. Defaults to 'json'. Set to 'opentelemetry' for an OTLP-compatible trace payload using the same structure as the post-call webhook. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConversationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}", + method="GET", + params={ + "format": format, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationResponseModel, + construct_type( + type_=GetConversationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Delete a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_summary( + self, + conversation_id: str, + *, + max_messages: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetConversationSummaryResponseModel]: + """ + Get a lightweight summary of a conversation: its title, the generated transcript summary, whether the call was successful, and — only when the conversation is short — the plain chat messages. Tool calls, tool results, and contextual updates are omitted so the response stays small. Use this instead of the full conversation endpoint when you only need the gist (e.g. an agent reading many conversations); use GET /v1/convai/conversations/{conversation_id} when you need the full transcript with tool calls and contextual updates. + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + max_messages : typing.Optional[int] + Maximum number of chat message turns to include inline. When the conversation has more than this, the messages are omitted and messages_omitted is set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConversationSummaryResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/summary", + method="GET", + params={ + "max_messages": max_messages, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationSummaryResponseModel, + construct_type( + type_=GetConversationSummaryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_sip_messages( + self, + conversation_id: str, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetSipLogMessagesResponse]: + """ + Get SIP messages associated with a conversation's phone call + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + page_size : typing.Optional[int] + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetSipLogMessagesResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/sip-messages", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetSipLogMessagesResponse, + construct_type( + type_=GetSipLogMessagesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawConversationsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_signed_url( + self, + *, + agent_id: str, + include_conversation_id: typing.Optional[bool] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + debug_events_request: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ConversationSignedUrlResponseModel]: + """ + Get a signed url to start a conversation with an agent with an agent that requires authorization + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + include_conversation_id : typing.Optional[bool] + Whether to include a conversation_id with the response. If included, the conversation_signature cannot be used again. + + branch_id : typing.Optional[str] + The ID of the branch to use + + version_id : typing.Optional[str] + The ID of the version to use + + environment : typing.Optional[str] + The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + + debug_events_request : typing.Optional[bool] + Whether to enable debug events. Only available for users with editor access to the agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConversationSignedUrlResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/conversation/get-signed-url", + method="GET", + params={ + "agent_id": agent_id, + "include_conversation_id": include_conversation_id, + "branch_id": branch_id, + "version_id": version_id, + "environment": environment, + "debug_events_request": debug_events_request, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConversationSignedUrlResponseModel, + construct_type( + type_=ConversationSignedUrlResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_webrtc_token( + self, + *, + agent_id: str, + participant_name: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + debug_events_request: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TokenResponseModel]: + """ + Get a WebRTC session token for real-time communication. + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + participant_name : typing.Optional[str] + Optional custom participant name. If not provided, user ID will be used + + branch_id : typing.Optional[str] + The ID of the branch to use + + version_id : typing.Optional[str] + The ID of the version to use + + environment : typing.Optional[str] + The environment to use for resolving environment variables (e.g. 'production', 'staging'). Defaults to 'production'. + + debug_events_request : typing.Optional[bool] + Whether to enable debug events. Only available for users with editor access to the agent. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TokenResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/conversation/token", + method="GET", + params={ + "agent_id": agent_id, + "participant_name": participant_name, + "branch_id": branch_id, + "version_id": version_id, + "environment": environment, + "debug_events_request": debug_events_request, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TokenResponseModel, + construct_type( + type_=TokenResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + agent_id: typing.Optional[str] = None, + visited_agent_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + visited_agent_branch_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + triggered_procedure_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + call_successful: typing.Optional[EvaluationResultFilter] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + call_duration_min_secs: typing.Optional[int] = None, + call_duration_max_secs: typing.Optional[int] = None, + rating_max: typing.Optional[int] = None, + rating_min: typing.Optional[int] = None, + has_feedback_comment: typing.Optional[bool] = None, + user_id: typing.Optional[str] = None, + evaluation_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + dynamic_variable_params: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + data_collection_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + evaluation_criteria_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_successful: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + tool_names_errored: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + include_invalid_tool_calls: typing.Optional[bool] = None, + main_languages: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + summary_mode: typing.Optional[ConversationsListRequestSummaryMode] = None, + search: typing.Optional[str] = None, + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None, + text_only: typing.Optional[bool] = None, + conversation_product_type: typing.Optional[ConversationProduct] = None, + branch_id: typing.Optional[str] = None, + version_id: typing.Optional[str] = None, + parent_conversation_id: typing.Optional[str] = None, + topic_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + exclude_statuses: typing.Optional[ + typing.Union[ + ConversationsListRequestExcludeStatusesItem, + typing.Sequence[ConversationsListRequestExcludeStatusesItem], + ] + ] = None, + tag_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + workflow_node_entered_id: typing.Optional[str] = None, + termination_reasons: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + guardrail_types: typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]] = None, + custom_guardrail_names: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetConversationsPageResponseModel]: + """ + Get all conversations of agents that user owns. With option to restrict to a specific agent. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + visited_agent_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agents participated. Can not exceed 50 values. + + visited_agent_branch_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these agent branches participated. Can not exceed 50 values. + + triggered_procedure_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations where any of these procedures were triggered. Can not exceed 50 values. + + call_successful : typing.Optional[EvaluationResultFilter] + The result of the success evaluation + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + call_duration_min_secs : typing.Optional[int] + Minimum call duration in seconds. + + call_duration_max_secs : typing.Optional[int] + Maximum call duration in seconds. + + rating_max : typing.Optional[int] + Maximum overall rating (1-5). + + rating_min : typing.Optional[int] + Minimum overall rating (1-5). + + has_feedback_comment : typing.Optional[bool] + Filter conversations with user feedback comments. + + user_id : typing.Optional[str] + Filter conversations by the user ID who initiated them. + + evaluation_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation filters. Repeat param. Format: criteria_id:result where result is one of success|failure|unknown. Example: eval=value_framing:success + + data_collection_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection filters. Repeat param. Format: id:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the field was not collected (id:eq:), and neq with an empty value matches where it was (id:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. + + dynamic_variable_params : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Dynamic variable filters. Repeat param. Format: name:op:value where op is one of eq|neq|gt|gte|lt|lte|in. For in, pipe-delimit values. An empty value matches conversations where the variable was not set (name:eq:), and neq with an empty value matches where it was (name:neq:). eq is exact equality. gt|gte|lt|lte require a numeric value. Names containing ':' cannot be expressed. + + data_collection_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Data collection field IDs to include in each conversation summary. Repeat param. When omitted, data_collection_results is not returned. + + evaluation_criteria_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Evaluation criteria IDs to include in each conversation summary. Repeat param. When omitted, evaluation_criteria_results is not returned. + + tool_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names used during the call. + + tool_names_successful : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had successful calls. + + tool_names_errored : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by tool names that had errored calls. + + include_invalid_tool_calls : typing.Optional[bool] + Also match tool calls that never ran. + + main_languages : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by detected main language (language code). + + page_size : typing.Optional[int] + How many conversations to return at maximum. Can not exceed 100, defaults to 30. + + summary_mode : typing.Optional[ConversationsListRequestSummaryMode] + Whether to include transcript summaries in the response. + + search : typing.Optional[str] + Full-text or fuzzy search over transcript messages + + conversation_initiation_source : typing.Optional[ConversationInitiationSource] + + text_only : typing.Optional[bool] + + conversation_product_type : typing.Optional[ConversationProduct] + Restrict results to a single conversation product surface. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + version_id : typing.Optional[str] + Filter conversations by version ID. + + parent_conversation_id : typing.Optional[str] + Filter conversations by parent conversation ID for subagent conversations. + + topic_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by topic IDs assigned during topic discovery. + + exclude_statuses : typing.Optional[typing.Union[ConversationsListRequestExcludeStatusesItem, typing.Sequence[ConversationsListRequestExcludeStatusesItem]]] + Exclude conversations with the given statuses. Useful for hiding in-progress / processing conversations from list views. + + tag_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by conversation tag IDs assigned via the conversation-tags endpoints. + + workflow_node_entered_id : typing.Optional[str] + Filter conversations to only those that entered the given node. + + termination_reasons : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter conversations by their stored termination_reason (metadata.termination_reason). Repeat param to match any of several. + + guardrail_types : typing.Optional[typing.Union[GuardrailType, typing.Sequence[GuardrailType]]] + Filter to conversations where a guardrail of any of these types triggered (metadata.triggered_guardrails.guardrail_type). Repeat param to match any of several. + + custom_guardrail_names : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter to conversations where a custom guardrail with any of these names triggered (metadata.triggered_guardrails.guardrail_name). Only custom guardrails carry a name. Repeat param to match any of several. + + sort_direction : typing.Optional[SortDirection] + The direction to sort conversations by call start time. Defaults to descending (newest first). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConversationsPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/conversations", + method="GET", + params={ + "cursor": cursor, + "agent_id": agent_id, + "visited_agent_ids": visited_agent_ids, + "visited_agent_branch_ids": visited_agent_branch_ids, + "triggered_procedure_ids": triggered_procedure_ids, + "call_successful": call_successful, + "call_start_before_unix": call_start_before_unix, + "call_start_after_unix": call_start_after_unix, + "call_duration_min_secs": call_duration_min_secs, + "call_duration_max_secs": call_duration_max_secs, + "rating_max": rating_max, + "rating_min": rating_min, + "has_feedback_comment": has_feedback_comment, + "user_id": user_id, + "evaluation_params": evaluation_params, + "data_collection_params": data_collection_params, + "dynamic_variable_params": dynamic_variable_params, + "data_collection_ids": data_collection_ids, + "evaluation_criteria_ids": evaluation_criteria_ids, + "tool_names": tool_names, + "tool_names_successful": tool_names_successful, + "tool_names_errored": tool_names_errored, + "include_invalid_tool_calls": include_invalid_tool_calls, + "main_languages": main_languages, + "page_size": page_size, + "summary_mode": summary_mode, + "search": search, + "conversation_initiation_source": conversation_initiation_source, + "text_only": text_only, + "conversation_product_type": conversation_product_type, + "branch_id": branch_id, + "version_id": version_id, + "parent_conversation_id": parent_conversation_id, + "topic_ids": topic_ids, + "exclude_statuses": exclude_statuses, + "tag_ids": tag_ids, + "workflow_node_entered_id": workflow_node_entered_id, + "termination_reasons": termination_reasons, + "guardrail_types": guardrail_types, + "custom_guardrail_names": custom_guardrail_names, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationsPageResponseModel, + construct_type( + type_=GetConversationsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def resolve( + self, *, agent_id: str, reference: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetConversationResponseModel]: + """ + Resolve a conversation URL (a Slack message URL or a Zendesk ticket URL) to the deterministic conversation ID for the given agent, then confirm the conversation exists. + + Parameters + ---------- + agent_id : str + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + reference : str + A Slack message URL or a Zendesk ticket URL. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConversationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/conversations/resolve", + method="GET", + params={ + "agent_id": agent_id, + "reference": reference, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationResponseModel, + construct_type( + type_=GetConversationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + conversation_id: str, + *, + format: typing.Optional[ConversationsGetRequestFormat] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetConversationResponseModel]: + """ + Get the details of a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + format : typing.Optional[ConversationsGetRequestFormat] + Response format. Defaults to 'json'. Set to 'opentelemetry' for an OTLP-compatible trace payload using the same structure as the post-call webhook. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConversationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}", + method="GET", + params={ + "format": format, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationResponseModel, + construct_type( + type_=GetConversationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, conversation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete a particular conversation + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_summary( + self, + conversation_id: str, + *, + max_messages: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetConversationSummaryResponseModel]: + """ + Get a lightweight summary of a conversation: its title, the generated transcript summary, whether the call was successful, and — only when the conversation is short — the plain chat messages. Tool calls, tool results, and contextual updates are omitted so the response stays small. Use this instead of the full conversation endpoint when you only need the gist (e.g. an agent reading many conversations); use GET /v1/convai/conversations/{conversation_id} when you need the full transcript with tool calls and contextual updates. + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + max_messages : typing.Optional[int] + Maximum number of chat message turns to include inline. When the conversation has more than this, the messages are omitted and messages_omitted is set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConversationSummaryResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/summary", + method="GET", + params={ + "max_messages": max_messages, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationSummaryResponseModel, + construct_type( + type_=GetConversationSummaryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_sip_messages( + self, + conversation_id: str, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetSipLogMessagesResponse]: + """ + Get SIP messages associated with a conversation's phone call + + Parameters + ---------- + conversation_id : str + The id of the conversation you're taking the action on. + + page_size : typing.Optional[int] + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetSipLogMessagesResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/sip-messages", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetSipLogMessagesResponse, + construct_type( + type_=GetSipLogMessagesResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/conversations/tags/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/tags/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/tags/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/conversations/tags/client.py b/data/src/elevenlabs/conversational_ai/conversations/tags/client.py new file mode 100644 index 0000000000000000000000000000000000000000..ae1b01627b122bcf2a4728d57491f59b3e9be353 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/tags/client.py @@ -0,0 +1,620 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.conversation_tag_response_model import ConversationTagResponseModel +from ....types.get_conversation_tags_page_response_model import GetConversationTagsPageResponseModel +from .raw_client import AsyncRawTagsClient, RawTagsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TagsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTagsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTagsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTagsClient + """ + return self._raw_client + + def assign( + self, + conversation_id: str, + *, + tag_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Assign one or more conversation tags to a conversation. Tags that are already assigned are ignored. Tags must belong to the same workspace. + + Parameters + ---------- + conversation_id : str + + tag_ids : typing.Sequence[str] + Tag IDs to add to the conversation. Re-assigning an existing tag is a no-op. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.tags.assign( + conversation_id="conversation_id", + tag_ids=["tag_ids"], + ) + """ + _response = self._raw_client.assign(conversation_id, tag_ids=tag_ids, request_options=request_options) + return _response.data + + def unassign( + self, conversation_id: str, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Remove a single conversation tag from a conversation. + + Parameters + ---------- + conversation_id : str + + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.tags.unassign( + conversation_id="conversation_id", + tag_id="tag_id", + ) + """ + _response = self._raw_client.unassign(conversation_id, tag_id, request_options=request_options) + return _response.data + + def list( + self, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationTagsPageResponseModel: + """ + List conversation tags for the workspace, ordered by most recently created first. + + Parameters + ---------- + page_size : typing.Optional[int] + How many conversation tags to return. Can not exceed 100. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationTagsPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.tags.list( + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.list(page_size=page_size, cursor=cursor, request_options=request_options) + return _response.data + + def create( + self, + *, + title: str, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ConversationTagResponseModel: + """ + Create a new conversation tag for the workspace. + + Parameters + ---------- + title : str + Display title of the tag. + + description : typing.Optional[str] + Optional free-text description. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConversationTagResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.tags.create( + title="title", + ) + """ + _response = self._raw_client.create(title=title, description=description, request_options=request_options) + return _response.data + + def get( + self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConversationTagResponseModel: + """ + Get a conversation tag by ID. + + Parameters + ---------- + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConversationTagResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.tags.get( + tag_id="tag_id", + ) + """ + _response = self._raw_client.get(tag_id, request_options=request_options) + return _response.data + + def delete(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a conversation tag. Restricted to the tag owner or a workspace admin. + + Parameters + ---------- + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.tags.delete( + tag_id="tag_id", + ) + """ + _response = self._raw_client.delete(tag_id, request_options=request_options) + return _response.data + + def update( + self, + tag_id: str, + *, + title: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ConversationTagResponseModel: + """ + Update a conversation tag's title and/or description. Restricted to the tag owner or a workspace admin. + + Parameters + ---------- + tag_id : str + + title : typing.Optional[str] + If provided, replaces the tag title. Omit to leave unchanged. + + description : typing.Optional[str] + If provided, replaces the tag description. Omit to leave unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConversationTagResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.tags.update( + tag_id="tag_id", + ) + """ + _response = self._raw_client.update( + tag_id, title=title, description=description, request_options=request_options + ) + return _response.data + + +class AsyncTagsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTagsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTagsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTagsClient + """ + return self._raw_client + + async def assign( + self, + conversation_id: str, + *, + tag_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Assign one or more conversation tags to a conversation. Tags that are already assigned are ignored. Tags must belong to the same workspace. + + Parameters + ---------- + conversation_id : str + + tag_ids : typing.Sequence[str] + Tag IDs to add to the conversation. Re-assigning an existing tag is a no-op. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.tags.assign( + conversation_id="conversation_id", + tag_ids=["tag_ids"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.assign(conversation_id, tag_ids=tag_ids, request_options=request_options) + return _response.data + + async def unassign( + self, conversation_id: str, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Remove a single conversation tag from a conversation. + + Parameters + ---------- + conversation_id : str + + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.tags.unassign( + conversation_id="conversation_id", + tag_id="tag_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.unassign(conversation_id, tag_id, request_options=request_options) + return _response.data + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationTagsPageResponseModel: + """ + List conversation tags for the workspace, ordered by most recently created first. + + Parameters + ---------- + page_size : typing.Optional[int] + How many conversation tags to return. Can not exceed 100. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationTagsPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.tags.list( + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(page_size=page_size, cursor=cursor, request_options=request_options) + return _response.data + + async def create( + self, + *, + title: str, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ConversationTagResponseModel: + """ + Create a new conversation tag for the workspace. + + Parameters + ---------- + title : str + Display title of the tag. + + description : typing.Optional[str] + Optional free-text description. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConversationTagResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.tags.create( + title="title", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(title=title, description=description, request_options=request_options) + return _response.data + + async def get( + self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConversationTagResponseModel: + """ + Get a conversation tag by ID. + + Parameters + ---------- + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConversationTagResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.tags.get( + tag_id="tag_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(tag_id, request_options=request_options) + return _response.data + + async def delete(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a conversation tag. Restricted to the tag owner or a workspace admin. + + Parameters + ---------- + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.tags.delete( + tag_id="tag_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(tag_id, request_options=request_options) + return _response.data + + async def update( + self, + tag_id: str, + *, + title: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ConversationTagResponseModel: + """ + Update a conversation tag's title and/or description. Restricted to the tag owner or a workspace admin. + + Parameters + ---------- + tag_id : str + + title : typing.Optional[str] + If provided, replaces the tag title. Omit to leave unchanged. + + description : typing.Optional[str] + If provided, replaces the tag description. Omit to leave unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConversationTagResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.tags.update( + tag_id="tag_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + tag_id, title=title, description=description, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/conversations/tags/raw_client.py b/data/src/elevenlabs/conversational_ai/conversations/tags/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c86f5aa7809f99a08c53106635efc11c56a603b9 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/tags/raw_client.py @@ -0,0 +1,847 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.conversation_tag_response_model import ConversationTagResponseModel +from ....types.get_conversation_tags_page_response_model import GetConversationTagsPageResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTagsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def assign( + self, + conversation_id: str, + *, + tag_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[None]: + """ + Assign one or more conversation tags to a conversation. Tags that are already assigned are ignored. Tags must belong to the same workspace. + + Parameters + ---------- + conversation_id : str + + tag_ids : typing.Sequence[str] + Tag IDs to add to the conversation. Re-assigning an existing tag is a no-op. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/tags", + method="POST", + json={ + "tag_ids": tag_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def unassign( + self, conversation_id: str, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Remove a single conversation tag from a conversation. + + Parameters + ---------- + conversation_id : str + + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list( + self, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetConversationTagsPageResponseModel]: + """ + List conversation tags for the workspace, ordered by most recently created first. + + Parameters + ---------- + page_size : typing.Optional[int] + How many conversation tags to return. Can not exceed 100. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConversationTagsPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/tags", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationTagsPageResponseModel, + construct_type( + type_=GetConversationTagsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + title: str, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ConversationTagResponseModel]: + """ + Create a new conversation tag for the workspace. + + Parameters + ---------- + title : str + Display title of the tag. + + description : typing.Optional[str] + Optional free-text description. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConversationTagResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/tags", + method="POST", + json={ + "title": title, + "description": description, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConversationTagResponseModel, + construct_type( + type_=ConversationTagResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ConversationTagResponseModel]: + """ + Get a conversation tag by ID. + + Parameters + ---------- + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConversationTagResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/tags/{jsonable_encoder(tag_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConversationTagResponseModel, + construct_type( + type_=ConversationTagResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete(self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Delete a conversation tag. Restricted to the tag owner or a workspace admin. + + Parameters + ---------- + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + tag_id: str, + *, + title: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ConversationTagResponseModel]: + """ + Update a conversation tag's title and/or description. Restricted to the tag owner or a workspace admin. + + Parameters + ---------- + tag_id : str + + title : typing.Optional[str] + If provided, replaces the tag title. Omit to leave unchanged. + + description : typing.Optional[str] + If provided, replaces the tag description. Omit to leave unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConversationTagResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/tags/{jsonable_encoder(tag_id)}", + method="PATCH", + json={ + "title": title, + "description": description, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConversationTagResponseModel, + construct_type( + type_=ConversationTagResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTagsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def assign( + self, + conversation_id: str, + *, + tag_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[None]: + """ + Assign one or more conversation tags to a conversation. Tags that are already assigned are ignored. Tags must belong to the same workspace. + + Parameters + ---------- + conversation_id : str + + tag_ids : typing.Sequence[str] + Tag IDs to add to the conversation. Re-assigning an existing tag is a no-op. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/tags", + method="POST", + json={ + "tag_ids": tag_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def unassign( + self, conversation_id: str, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Remove a single conversation tag from a conversation. + + Parameters + ---------- + conversation_id : str + + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/conversations/{jsonable_encoder(conversation_id)}/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetConversationTagsPageResponseModel]: + """ + List conversation tags for the workspace, ordered by most recently created first. + + Parameters + ---------- + page_size : typing.Optional[int] + How many conversation tags to return. Can not exceed 100. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConversationTagsPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/tags", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationTagsPageResponseModel, + construct_type( + type_=GetConversationTagsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + title: str, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ConversationTagResponseModel]: + """ + Create a new conversation tag for the workspace. + + Parameters + ---------- + title : str + Display title of the tag. + + description : typing.Optional[str] + Optional free-text description. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConversationTagResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/tags", + method="POST", + json={ + "title": title, + "description": description, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConversationTagResponseModel, + construct_type( + type_=ConversationTagResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ConversationTagResponseModel]: + """ + Get a conversation tag by ID. + + Parameters + ---------- + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConversationTagResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/tags/{jsonable_encoder(tag_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConversationTagResponseModel, + construct_type( + type_=ConversationTagResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, tag_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete a conversation tag. Restricted to the tag owner or a workspace admin. + + Parameters + ---------- + tag_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/tags/{jsonable_encoder(tag_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + tag_id: str, + *, + title: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ConversationTagResponseModel]: + """ + Update a conversation tag's title and/or description. Restricted to the tag owner or a workspace admin. + + Parameters + ---------- + tag_id : str + + title : typing.Optional[str] + If provided, replaces the tag title. Omit to leave unchanged. + + description : typing.Optional[str] + If provided, replaces the tag description. Omit to leave unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConversationTagResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/tags/{jsonable_encoder(tag_id)}", + method="PATCH", + json={ + "title": title, + "description": description, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConversationTagResponseModel, + construct_type( + type_=ConversationTagResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/conversations/topics/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/topics/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/topics/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/conversations/topics/client.py b/data/src/elevenlabs/conversational_ai/conversations/topics/client.py new file mode 100644 index 0000000000000000000000000000000000000000..74e3df398f5866a556e51800430a4bcabbec36dd --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/topics/client.py @@ -0,0 +1,212 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.get_agent_topics_response_model import GetAgentTopicsResponseModel +from ....types.sort_direction import SortDirection +from ....types.topic_sort_by import TopicSortBy +from .raw_client import AsyncRawTopicsClient, RawTopicsClient + + +class TopicsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTopicsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTopicsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTopicsClient + """ + return self._raw_client + + def get( + self, + agent_id: str, + *, + page_size: typing.Optional[int] = None, + sort_by: typing.Optional[TopicSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + from_unix_secs: typing.Optional[int] = None, + to_unix_secs: typing.Optional[int] = None, + include_evaluation_criteria: typing.Optional[bool] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentTopicsResponseModel: + """ + Returns the latest topic discovery run results for a given agent. + + Parameters + ---------- + agent_id : str + ID of the agent + + page_size : typing.Optional[int] + Number of top-level topic groups to return. + + sort_by : typing.Optional[TopicSortBy] + Column to rank topics by. Use conversations for volume, sentiment with sort_direction=asc for the most negative topics, and frustration with sort_direction=desc for the most frustrated ones. Topics with no score are always ranked last. + + sort_direction : typing.Optional[SortDirection] + Direction to sort topics. + + from_unix_secs : typing.Optional[int] + Start of the window to view topics for. When set with to_unix_secs, the completed daily topic-discovery runs in the range are aggregated together, so the window scopes the metrics as well as the topic set. Floored to the start of its UTC day because runs cover whole UTC days; aggregated_run_count reports how many runs were summed. Omit both bounds to get the single latest run. + + to_unix_secs : typing.Optional[int] + End of the window to view topics for. + + include_evaluation_criteria : typing.Optional[bool] + Include the per-criteria evaluation breakdown on each topic's metrics. Pass false to drop it: it dominates the payload and the weighted success_rate is returned either way. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentTopicsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.conversations.topics.get( + agent_id="agent_id", + page_size=1, + sort_by="conversations", + sort_direction="asc", + from_unix_secs=1, + to_unix_secs=1, + include_evaluation_criteria=True, + cursor="cursor", + ) + """ + _response = self._raw_client.get( + agent_id, + page_size=page_size, + sort_by=sort_by, + sort_direction=sort_direction, + from_unix_secs=from_unix_secs, + to_unix_secs=to_unix_secs, + include_evaluation_criteria=include_evaluation_criteria, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + +class AsyncTopicsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTopicsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTopicsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTopicsClient + """ + return self._raw_client + + async def get( + self, + agent_id: str, + *, + page_size: typing.Optional[int] = None, + sort_by: typing.Optional[TopicSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + from_unix_secs: typing.Optional[int] = None, + to_unix_secs: typing.Optional[int] = None, + include_evaluation_criteria: typing.Optional[bool] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentTopicsResponseModel: + """ + Returns the latest topic discovery run results for a given agent. + + Parameters + ---------- + agent_id : str + ID of the agent + + page_size : typing.Optional[int] + Number of top-level topic groups to return. + + sort_by : typing.Optional[TopicSortBy] + Column to rank topics by. Use conversations for volume, sentiment with sort_direction=asc for the most negative topics, and frustration with sort_direction=desc for the most frustrated ones. Topics with no score are always ranked last. + + sort_direction : typing.Optional[SortDirection] + Direction to sort topics. + + from_unix_secs : typing.Optional[int] + Start of the window to view topics for. When set with to_unix_secs, the completed daily topic-discovery runs in the range are aggregated together, so the window scopes the metrics as well as the topic set. Floored to the start of its UTC day because runs cover whole UTC days; aggregated_run_count reports how many runs were summed. Omit both bounds to get the single latest run. + + to_unix_secs : typing.Optional[int] + End of the window to view topics for. + + include_evaluation_criteria : typing.Optional[bool] + Include the per-criteria evaluation breakdown on each topic's metrics. Pass false to drop it: it dominates the payload and the weighted success_rate is returned either way. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentTopicsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.conversations.topics.get( + agent_id="agent_id", + page_size=1, + sort_by="conversations", + sort_direction="asc", + from_unix_secs=1, + to_unix_secs=1, + include_evaluation_criteria=True, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + agent_id, + page_size=page_size, + sort_by=sort_by, + sort_direction=sort_direction, + from_unix_secs=from_unix_secs, + to_unix_secs=to_unix_secs, + include_evaluation_criteria=include_evaluation_criteria, + cursor=cursor, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/conversations/topics/raw_client.py b/data/src/elevenlabs/conversational_ai/conversations/topics/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..ac744cc0e8a897ccedcce5599476fcca86525b4a --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/topics/raw_client.py @@ -0,0 +1,215 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.get_agent_topics_response_model import GetAgentTopicsResponseModel +from ....types.sort_direction import SortDirection +from ....types.topic_sort_by import TopicSortBy +from pydantic import ValidationError + + +class RawTopicsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + agent_id: str, + *, + page_size: typing.Optional[int] = None, + sort_by: typing.Optional[TopicSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + from_unix_secs: typing.Optional[int] = None, + to_unix_secs: typing.Optional[int] = None, + include_evaluation_criteria: typing.Optional[bool] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetAgentTopicsResponseModel]: + """ + Returns the latest topic discovery run results for a given agent. + + Parameters + ---------- + agent_id : str + ID of the agent + + page_size : typing.Optional[int] + Number of top-level topic groups to return. + + sort_by : typing.Optional[TopicSortBy] + Column to rank topics by. Use conversations for volume, sentiment with sort_direction=asc for the most negative topics, and frustration with sort_direction=desc for the most frustrated ones. Topics with no score are always ranked last. + + sort_direction : typing.Optional[SortDirection] + Direction to sort topics. + + from_unix_secs : typing.Optional[int] + Start of the window to view topics for. When set with to_unix_secs, the completed daily topic-discovery runs in the range are aggregated together, so the window scopes the metrics as well as the topic set. Floored to the start of its UTC day because runs cover whole UTC days; aggregated_run_count reports how many runs were summed. Omit both bounds to get the single latest run. + + to_unix_secs : typing.Optional[int] + End of the window to view topics for. + + include_evaluation_criteria : typing.Optional[bool] + Include the per-criteria evaluation breakdown on each topic's metrics. Pass false to drop it: it dominates the payload and the weighted success_rate is returned either way. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentTopicsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/topics", + method="GET", + params={ + "page_size": page_size, + "sort_by": sort_by, + "sort_direction": sort_direction, + "from_unix_secs": from_unix_secs, + "to_unix_secs": to_unix_secs, + "include_evaluation_criteria": include_evaluation_criteria, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentTopicsResponseModel, + construct_type( + type_=GetAgentTopicsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTopicsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + agent_id: str, + *, + page_size: typing.Optional[int] = None, + sort_by: typing.Optional[TopicSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + from_unix_secs: typing.Optional[int] = None, + to_unix_secs: typing.Optional[int] = None, + include_evaluation_criteria: typing.Optional[bool] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetAgentTopicsResponseModel]: + """ + Returns the latest topic discovery run results for a given agent. + + Parameters + ---------- + agent_id : str + ID of the agent + + page_size : typing.Optional[int] + Number of top-level topic groups to return. + + sort_by : typing.Optional[TopicSortBy] + Column to rank topics by. Use conversations for volume, sentiment with sort_direction=asc for the most negative topics, and frustration with sort_direction=desc for the most frustrated ones. Topics with no score are always ranked last. + + sort_direction : typing.Optional[SortDirection] + Direction to sort topics. + + from_unix_secs : typing.Optional[int] + Start of the window to view topics for. When set with to_unix_secs, the completed daily topic-discovery runs in the range are aggregated together, so the window scopes the metrics as well as the topic set. Floored to the start of its UTC day because runs cover whole UTC days; aggregated_run_count reports how many runs were summed. Omit both bounds to get the single latest run. + + to_unix_secs : typing.Optional[int] + End of the window to view topics for. + + include_evaluation_criteria : typing.Optional[bool] + Include the per-criteria evaluation breakdown on each topic's metrics. Pass false to drop it: it dominates the payload and the weighted success_rate is returned either way. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentTopicsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/topics", + method="GET", + params={ + "page_size": page_size, + "sort_by": sort_by, + "sort_direction": sort_direction, + "from_unix_secs": from_unix_secs, + "to_unix_secs": to_unix_secs, + "include_evaluation_criteria": include_evaluation_criteria, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentTopicsResponseModel, + construct_type( + type_=GetAgentTopicsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/conversations/types/__init__.py b/data/src/elevenlabs/conversational_ai/conversations/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..724948fcec5b88e1ae8e48843f9569cd262e9d55 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/types/__init__.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .conversations_get_request_format import ConversationsGetRequestFormat + from .conversations_list_request_exclude_statuses_item import ConversationsListRequestExcludeStatusesItem + from .conversations_list_request_summary_mode import ConversationsListRequestSummaryMode +_dynamic_imports: typing.Dict[str, str] = { + "ConversationsGetRequestFormat": ".conversations_get_request_format", + "ConversationsListRequestExcludeStatusesItem": ".conversations_list_request_exclude_statuses_item", + "ConversationsListRequestSummaryMode": ".conversations_list_request_summary_mode", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ConversationsGetRequestFormat", + "ConversationsListRequestExcludeStatusesItem", + "ConversationsListRequestSummaryMode", +] diff --git a/data/src/elevenlabs/conversational_ai/conversations/types/conversations_get_request_format.py b/data/src/elevenlabs/conversational_ai/conversations/types/conversations_get_request_format.py new file mode 100644 index 0000000000000000000000000000000000000000..093d0bf8b254403093911f417b0955e054c83e36 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/types/conversations_get_request_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationsGetRequestFormat = typing.Union[typing.Literal["json", "opentelemetry"], typing.Any] diff --git a/data/src/elevenlabs/conversational_ai/conversations/types/conversations_list_request_exclude_statuses_item.py b/data/src/elevenlabs/conversational_ai/conversations/types/conversations_list_request_exclude_statuses_item.py new file mode 100644 index 0000000000000000000000000000000000000000..f6edfd87d544b47fbcb4774f53f5d321de2eb0b6 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/types/conversations_list_request_exclude_statuses_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationsListRequestExcludeStatusesItem = typing.Union[ + typing.Literal["initiated", "in-progress", "processing", "done", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/conversational_ai/conversations/types/conversations_list_request_summary_mode.py b/data/src/elevenlabs/conversational_ai/conversations/types/conversations_list_request_summary_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..f4dcc5d5b55906acb9ff039f957d3797b7267270 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/conversations/types/conversations_list_request_summary_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationsListRequestSummaryMode = typing.Union[typing.Literal["exclude", "include"], typing.Any] diff --git a/data/src/elevenlabs/conversational_ai/dashboard/__init__.py b/data/src/elevenlabs/conversational_ai/dashboard/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..68478233fcec6cf25e80a1615165d84569bde36f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/dashboard/__init__.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import settings + from .settings import ( + PatchConvAiDashboardSettingsRequestChartsItem, + PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess, + PatchConvAiDashboardSettingsRequestChartsItem_Criteria, + PatchConvAiDashboardSettingsRequestChartsItem_DataCollection, + ) +_dynamic_imports: typing.Dict[str, str] = { + "PatchConvAiDashboardSettingsRequestChartsItem": ".settings", + "PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess": ".settings", + "PatchConvAiDashboardSettingsRequestChartsItem_Criteria": ".settings", + "PatchConvAiDashboardSettingsRequestChartsItem_DataCollection": ".settings", + "settings": ".settings", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "PatchConvAiDashboardSettingsRequestChartsItem", + "PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess", + "PatchConvAiDashboardSettingsRequestChartsItem_Criteria", + "PatchConvAiDashboardSettingsRequestChartsItem_DataCollection", + "settings", +] diff --git a/data/src/elevenlabs/conversational_ai/dashboard/client.py b/data/src/elevenlabs/conversational_ai/dashboard/client.py new file mode 100644 index 0000000000000000000000000000000000000000..55ea128e4d6af7a6838f468ca74196b7395900c5 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/dashboard/client.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .raw_client import AsyncRawDashboardClient, RawDashboardClient + +if typing.TYPE_CHECKING: + from .settings.client import AsyncSettingsClient, SettingsClient + + +class DashboardClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawDashboardClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._settings: typing.Optional[SettingsClient] = None + + @property + def with_raw_response(self) -> RawDashboardClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawDashboardClient + """ + return self._raw_client + + @property + def settings(self): + if self._settings is None: + from .settings.client import SettingsClient # noqa: E402 + + self._settings = SettingsClient(client_wrapper=self._client_wrapper) + return self._settings + + +class AsyncDashboardClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawDashboardClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._settings: typing.Optional[AsyncSettingsClient] = None + + @property + def with_raw_response(self) -> AsyncRawDashboardClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawDashboardClient + """ + return self._raw_client + + @property + def settings(self): + if self._settings is None: + from .settings.client import AsyncSettingsClient # noqa: E402 + + self._settings = AsyncSettingsClient(client_wrapper=self._client_wrapper) + return self._settings diff --git a/data/src/elevenlabs/conversational_ai/dashboard/raw_client.py b/data/src/elevenlabs/conversational_ai/dashboard/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..2dc83b3d129517a6b2bb846af32f851e890062bf --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/dashboard/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawDashboardClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawDashboardClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/data/src/elevenlabs/conversational_ai/dashboard/settings/__init__.py b/data/src/elevenlabs/conversational_ai/dashboard/settings/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5c51a886ec8854e88172c6dab79b6f32ad50f6bf --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/dashboard/settings/__init__.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + PatchConvAiDashboardSettingsRequestChartsItem, + PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess, + PatchConvAiDashboardSettingsRequestChartsItem_Criteria, + PatchConvAiDashboardSettingsRequestChartsItem_DataCollection, + ) +_dynamic_imports: typing.Dict[str, str] = { + "PatchConvAiDashboardSettingsRequestChartsItem": ".types", + "PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess": ".types", + "PatchConvAiDashboardSettingsRequestChartsItem_Criteria": ".types", + "PatchConvAiDashboardSettingsRequestChartsItem_DataCollection": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "PatchConvAiDashboardSettingsRequestChartsItem", + "PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess", + "PatchConvAiDashboardSettingsRequestChartsItem_Criteria", + "PatchConvAiDashboardSettingsRequestChartsItem_DataCollection", +] diff --git a/data/src/elevenlabs/conversational_ai/dashboard/settings/client.py b/data/src/elevenlabs/conversational_ai/dashboard/settings/client.py new file mode 100644 index 0000000000000000000000000000000000000000..2a71c5de768016db5375598aaa0edafb282b1cd4 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/dashboard/settings/client.py @@ -0,0 +1,182 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.get_conv_ai_dashboard_settings_response_model import GetConvAiDashboardSettingsResponseModel +from .raw_client import AsyncRawSettingsClient, RawSettingsClient +from .types.patch_conv_ai_dashboard_settings_request_charts_item import PatchConvAiDashboardSettingsRequestChartsItem + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SettingsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSettingsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSettingsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSettingsClient + """ + return self._raw_client + + def get( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetConvAiDashboardSettingsResponseModel: + """ + Retrieve Convai dashboard settings for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConvAiDashboardSettingsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.dashboard.settings.get() + """ + _response = self._raw_client.get(request_options=request_options) + return _response.data + + def update( + self, + *, + charts: typing.Optional[typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConvAiDashboardSettingsResponseModel: + """ + Update Convai dashboard settings for the workspace + + Parameters + ---------- + charts : typing.Optional[typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConvAiDashboardSettingsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.dashboard.settings.update() + """ + _response = self._raw_client.update(charts=charts, request_options=request_options) + return _response.data + + +class AsyncSettingsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSettingsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSettingsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSettingsClient + """ + return self._raw_client + + async def get( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetConvAiDashboardSettingsResponseModel: + """ + Retrieve Convai dashboard settings for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConvAiDashboardSettingsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.dashboard.settings.get() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(request_options=request_options) + return _response.data + + async def update( + self, + *, + charts: typing.Optional[typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConvAiDashboardSettingsResponseModel: + """ + Update Convai dashboard settings for the workspace + + Parameters + ---------- + charts : typing.Optional[typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConvAiDashboardSettingsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.dashboard.settings.update() + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(charts=charts, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/dashboard/settings/raw_client.py b/data/src/elevenlabs/conversational_ai/dashboard/settings/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..517a95d7c0aa15e8008af911db4cdc6fb6eddf4d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/dashboard/settings/raw_client.py @@ -0,0 +1,265 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.get_conv_ai_dashboard_settings_response_model import GetConvAiDashboardSettingsResponseModel +from .types.patch_conv_ai_dashboard_settings_request_charts_item import PatchConvAiDashboardSettingsRequestChartsItem +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSettingsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetConvAiDashboardSettingsResponseModel]: + """ + Retrieve Convai dashboard settings for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConvAiDashboardSettingsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/settings/dashboard", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConvAiDashboardSettingsResponseModel, + construct_type( + type_=GetConvAiDashboardSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + *, + charts: typing.Optional[typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetConvAiDashboardSettingsResponseModel]: + """ + Update Convai dashboard settings for the workspace + + Parameters + ---------- + charts : typing.Optional[typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConvAiDashboardSettingsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/settings/dashboard", + method="PATCH", + json={ + "charts": convert_and_respect_annotation_metadata( + object_=charts, + annotation=typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConvAiDashboardSettingsResponseModel, + construct_type( + type_=GetConvAiDashboardSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSettingsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetConvAiDashboardSettingsResponseModel]: + """ + Retrieve Convai dashboard settings for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConvAiDashboardSettingsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/settings/dashboard", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConvAiDashboardSettingsResponseModel, + construct_type( + type_=GetConvAiDashboardSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + *, + charts: typing.Optional[typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetConvAiDashboardSettingsResponseModel]: + """ + Update Convai dashboard settings for the workspace + + Parameters + ---------- + charts : typing.Optional[typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConvAiDashboardSettingsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/settings/dashboard", + method="PATCH", + json={ + "charts": convert_and_respect_annotation_metadata( + object_=charts, + annotation=typing.Sequence[PatchConvAiDashboardSettingsRequestChartsItem], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConvAiDashboardSettingsResponseModel, + construct_type( + type_=GetConvAiDashboardSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/dashboard/settings/types/__init__.py b/data/src/elevenlabs/conversational_ai/dashboard/settings/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e55a3e82f853cd45718fb90abda4afe58206c3f2 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/dashboard/settings/types/__init__.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .patch_conv_ai_dashboard_settings_request_charts_item import ( + PatchConvAiDashboardSettingsRequestChartsItem, + PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess, + PatchConvAiDashboardSettingsRequestChartsItem_Criteria, + PatchConvAiDashboardSettingsRequestChartsItem_DataCollection, + ) +_dynamic_imports: typing.Dict[str, str] = { + "PatchConvAiDashboardSettingsRequestChartsItem": ".patch_conv_ai_dashboard_settings_request_charts_item", + "PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess": ".patch_conv_ai_dashboard_settings_request_charts_item", + "PatchConvAiDashboardSettingsRequestChartsItem_Criteria": ".patch_conv_ai_dashboard_settings_request_charts_item", + "PatchConvAiDashboardSettingsRequestChartsItem_DataCollection": ".patch_conv_ai_dashboard_settings_request_charts_item", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "PatchConvAiDashboardSettingsRequestChartsItem", + "PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess", + "PatchConvAiDashboardSettingsRequestChartsItem_Criteria", + "PatchConvAiDashboardSettingsRequestChartsItem_DataCollection", +] diff --git a/data/src/elevenlabs/conversational_ai/dashboard/settings/types/patch_conv_ai_dashboard_settings_request_charts_item.py b/data/src/elevenlabs/conversational_ai/dashboard/settings/types/patch_conv_ai_dashboard_settings_request_charts_item.py new file mode 100644 index 0000000000000000000000000000000000000000..faf19ea57aa6ee4057141a25d3de6df926bd494a --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/dashboard/settings/types/patch_conv_ai_dashboard_settings_request_charts_item.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess(UncheckedBaseModel): + type: typing.Literal["call_success"] = "call_success" + 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 + + +class PatchConvAiDashboardSettingsRequestChartsItem_Criteria(UncheckedBaseModel): + type: typing.Literal["criteria"] = "criteria" + name: str + criteria_id: 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 + + +class PatchConvAiDashboardSettingsRequestChartsItem_DataCollection(UncheckedBaseModel): + type: typing.Literal["data_collection"] = "data_collection" + name: str + data_collection_id: 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 + + +PatchConvAiDashboardSettingsRequestChartsItem = typing_extensions.Annotated[ + typing.Union[ + PatchConvAiDashboardSettingsRequestChartsItem_CallSuccess, + PatchConvAiDashboardSettingsRequestChartsItem_Criteria, + PatchConvAiDashboardSettingsRequestChartsItem_DataCollection, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/conversational_ai/default_audio_interface.py b/data/src/elevenlabs/conversational_ai/default_audio_interface.py new file mode 100644 index 0000000000000000000000000000000000000000..e3bd9ad80b991bd315e8111b1d1896c4f09b67c3 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/default_audio_interface.py @@ -0,0 +1,173 @@ +from typing import Callable, Awaitable +import queue +import threading +import asyncio + +from .conversation import AudioInterface, AsyncAudioInterface + + +class DefaultAudioInterface(AudioInterface): + INPUT_FRAMES_PER_BUFFER = 4000 # 250ms @ 16kHz + OUTPUT_FRAMES_PER_BUFFER = 1000 # 62.5ms @ 16kHz + + def __init__(self): + try: + import pyaudio + except ImportError: + raise ImportError("To use DefaultAudioInterface you must install pyaudio.") + self.pyaudio = pyaudio + + def start(self, input_callback: Callable[[bytes], None]): + # Audio input is using callbacks from pyaudio which we simply pass through. + self.input_callback = input_callback + + # Audio output is buffered so we can handle interruptions. + # Start a separate thread to handle writing to the output stream. + self.output_queue: queue.Queue[bytes] = queue.Queue() + self.should_stop = threading.Event() + self.output_thread = threading.Thread(target=self._output_thread) + + self.p = self.pyaudio.PyAudio() + self.in_stream = self.p.open( + format=self.pyaudio.paInt16, + channels=1, + rate=16000, + input=True, + stream_callback=self._in_callback, + frames_per_buffer=self.INPUT_FRAMES_PER_BUFFER, + start=True, + ) + self.out_stream = self.p.open( + format=self.pyaudio.paInt16, + channels=1, + rate=16000, + output=True, + frames_per_buffer=self.OUTPUT_FRAMES_PER_BUFFER, + start=True, + ) + + self.output_thread.start() + + def stop(self): + self.should_stop.set() + self.output_thread.join() + self.in_stream.stop_stream() + self.in_stream.close() + self.out_stream.close() + self.p.terminate() + + def output(self, audio: bytes): + self.output_queue.put(audio) + + def interrupt(self): + # Clear the output queue to stop any audio that is currently playing. + # Note: We can't atomically clear the whole queue, but we are doing + # it from the message handling thread so no new audio will be added + # while we are clearing. + try: + while True: + _ = self.output_queue.get(block=False) + except queue.Empty: + pass + + def _output_thread(self): + while not self.should_stop.is_set(): + try: + audio = self.output_queue.get(timeout=0.25) + self.out_stream.write(audio) + except queue.Empty: + pass + + def _in_callback(self, in_data, frame_count, time_info, status): + if self.input_callback: + self.input_callback(in_data) + return (None, self.pyaudio.paContinue) + + +class AsyncDefaultAudioInterface(AsyncAudioInterface): + INPUT_FRAMES_PER_BUFFER = 4000 # 250ms @ 16kHz + OUTPUT_FRAMES_PER_BUFFER = 1000 # 62.5ms @ 16kHz + + def __init__(self): + try: + import pyaudio + except ImportError: + raise ImportError("To use AsyncDefaultAudioInterface you must install pyaudio.") + self.pyaudio = pyaudio + + async def start(self, input_callback: Callable[[bytes], Awaitable[None]]): + # Audio input is using callbacks from pyaudio which we adapt to async + self.input_callback = input_callback + + # Audio output is buffered so we can handle interruptions. + # Start a separate task to handle writing to the output stream. + self.output_queue: asyncio.Queue[bytes] = asyncio.Queue() + self.should_stop = asyncio.Event() + + self.p = self.pyaudio.PyAudio() + self.in_stream = self.p.open( + format=self.pyaudio.paInt16, + channels=1, + rate=16000, + input=True, + stream_callback=self._in_callback, + frames_per_buffer=self.INPUT_FRAMES_PER_BUFFER, + start=True, + ) + self.out_stream = self.p.open( + format=self.pyaudio.paInt16, + channels=1, + rate=16000, + output=True, + frames_per_buffer=self.OUTPUT_FRAMES_PER_BUFFER, + start=True, + ) + + # Start the output task + self.output_task = asyncio.create_task(self._output_task()) + + async def stop(self): + self.should_stop.set() + await self.output_task + self.in_stream.stop_stream() + self.in_stream.close() + self.out_stream.close() + self.p.terminate() + + async def output(self, audio: bytes): + await self.output_queue.put(audio) + + async def interrupt(self): + # Clear the output queue to stop any audio that is currently playing. + try: + while True: + try: + _ = self.output_queue.get_nowait() + except asyncio.QueueEmpty: + break + except AttributeError: + # In Python 3.8, it's asyncio.QueueEmpty, in 3.10+ it's asyncio.QueueEmpty + while not self.output_queue.empty(): + try: + _ = self.output_queue.get_nowait() + except: + break + + async def _output_task(self): + while not self.should_stop.is_set(): + try: + audio = await asyncio.wait_for(self.output_queue.get(), timeout=0.25) + self.out_stream.write(audio) + except asyncio.TimeoutError: + pass + + def _in_callback(self, in_data, frame_count, time_info, status): + if self.input_callback: + # Schedule the async callback to run in the event loop + try: + loop = asyncio.get_event_loop() + asyncio.run_coroutine_threadsafe(self.input_callback(in_data), loop) + except RuntimeError: + # No event loop running, ignore + pass + return (None, self.pyaudio.paContinue) diff --git a/data/src/elevenlabs/conversational_ai/exotel/__init__.py b/data/src/elevenlabs/conversational_ai/exotel/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/exotel/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/exotel/client.py b/data/src/elevenlabs/conversational_ai/exotel/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a88fa80a5d30b37371a0f19f052cb083aba45d9f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/exotel/client.py @@ -0,0 +1,165 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput +from ...types.exotel_outbound_call_response import ExotelOutboundCallResponse +from ...types.telephony_call_config_input import TelephonyCallConfigInput +from .raw_client import AsyncRawExotelClient, RawExotelClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ExotelClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawExotelClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawExotelClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawExotelClient + """ + return self._raw_client + + def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ExotelOutboundCallResponse: + """ + Handle an outbound call via Exotel Connect API + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ExotelOutboundCallResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.exotel.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", + ) + """ + _response = self._raw_client.outbound_call( + agent_id=agent_id, + agent_phone_number_id=agent_phone_number_id, + to_number=to_number, + conversation_initiation_client_data=conversation_initiation_client_data, + telephony_call_config=telephony_call_config, + request_options=request_options, + ) + return _response.data + + +class AsyncExotelClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawExotelClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawExotelClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawExotelClient + """ + return self._raw_client + + async def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ExotelOutboundCallResponse: + """ + Handle an outbound call via Exotel Connect API + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ExotelOutboundCallResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.exotel.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.outbound_call( + agent_id=agent_id, + agent_phone_number_id=agent_phone_number_id, + to_number=to_number, + conversation_initiation_client_data=conversation_initiation_client_data, + telephony_call_config=telephony_call_config, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/exotel/raw_client.py b/data/src/elevenlabs/conversational_ai/exotel/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d346f527f0640bf163c2bf012cda8563c7e14eaa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/exotel/raw_client.py @@ -0,0 +1,200 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput +from ...types.exotel_outbound_call_response import ExotelOutboundCallResponse +from ...types.telephony_call_config_input import TelephonyCallConfigInput +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawExotelClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ExotelOutboundCallResponse]: + """ + Handle an outbound call via Exotel Connect API + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ExotelOutboundCallResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/exotel/outbound-call", + method="POST", + json={ + "agent_id": agent_id, + "agent_phone_number_id": agent_phone_number_id, + "to_number": to_number, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + "telephony_call_config": convert_and_respect_annotation_metadata( + object_=telephony_call_config, annotation=TelephonyCallConfigInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ExotelOutboundCallResponse, + construct_type( + type_=ExotelOutboundCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawExotelClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ExotelOutboundCallResponse]: + """ + Handle an outbound call via Exotel Connect API + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ExotelOutboundCallResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/exotel/outbound-call", + method="POST", + json={ + "agent_id": agent_id, + "agent_phone_number_id": agent_phone_number_id, + "to_number": to_number, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + "telephony_call_config": convert_and_respect_annotation_metadata( + object_=telephony_call_config, annotation=TelephonyCallConfigInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ExotelOutboundCallResponse, + construct_type( + type_=ExotelOutboundCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..92f85b2062b9b6a76c7e891fb3576beb12aae85d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/__init__.py @@ -0,0 +1,126 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + KnowledgeBaseGetOrCreateRagIndexesResponseValue, + KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure, + KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success, + ) + from . import crawl_jobs, document, documents + from .document import ( + DocumentRefreshResponse, + DocumentRefreshResponse_File, + DocumentRefreshResponse_Folder, + DocumentRefreshResponse_Text, + DocumentRefreshResponse_Url, + DocumentUpdateFileResponse, + DocumentUpdateFileResponse_File, + DocumentUpdateFileResponse_Folder, + DocumentUpdateFileResponse_Text, + DocumentUpdateFileResponse_Url, + ) + from .documents import ( + DocumentsBulkDeleteResponseValue, + DocumentsBulkDeleteResponseValue_Failure, + DocumentsBulkDeleteResponseValue_Success, + DocumentsGetResponse, + DocumentsGetResponse_File, + DocumentsGetResponse_Folder, + DocumentsGetResponse_Text, + DocumentsGetResponse_Url, + DocumentsUpdateResponse, + DocumentsUpdateResponse_File, + DocumentsUpdateResponse_Folder, + DocumentsUpdateResponse_Text, + DocumentsUpdateResponse_Url, + ) +_dynamic_imports: typing.Dict[str, str] = { + "DocumentRefreshResponse": ".document", + "DocumentRefreshResponse_File": ".document", + "DocumentRefreshResponse_Folder": ".document", + "DocumentRefreshResponse_Text": ".document", + "DocumentRefreshResponse_Url": ".document", + "DocumentUpdateFileResponse": ".document", + "DocumentUpdateFileResponse_File": ".document", + "DocumentUpdateFileResponse_Folder": ".document", + "DocumentUpdateFileResponse_Text": ".document", + "DocumentUpdateFileResponse_Url": ".document", + "DocumentsBulkDeleteResponseValue": ".documents", + "DocumentsBulkDeleteResponseValue_Failure": ".documents", + "DocumentsBulkDeleteResponseValue_Success": ".documents", + "DocumentsGetResponse": ".documents", + "DocumentsGetResponse_File": ".documents", + "DocumentsGetResponse_Folder": ".documents", + "DocumentsGetResponse_Text": ".documents", + "DocumentsGetResponse_Url": ".documents", + "DocumentsUpdateResponse": ".documents", + "DocumentsUpdateResponse_File": ".documents", + "DocumentsUpdateResponse_Folder": ".documents", + "DocumentsUpdateResponse_Text": ".documents", + "DocumentsUpdateResponse_Url": ".documents", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue": ".types", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure": ".types", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success": ".types", + "crawl_jobs": ".crawl_jobs", + "document": ".document", + "documents": ".documents", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "DocumentRefreshResponse", + "DocumentRefreshResponse_File", + "DocumentRefreshResponse_Folder", + "DocumentRefreshResponse_Text", + "DocumentRefreshResponse_Url", + "DocumentUpdateFileResponse", + "DocumentUpdateFileResponse_File", + "DocumentUpdateFileResponse_Folder", + "DocumentUpdateFileResponse_Text", + "DocumentUpdateFileResponse_Url", + "DocumentsBulkDeleteResponseValue", + "DocumentsBulkDeleteResponseValue_Failure", + "DocumentsBulkDeleteResponseValue_Success", + "DocumentsGetResponse", + "DocumentsGetResponse_File", + "DocumentsGetResponse_Folder", + "DocumentsGetResponse_Text", + "DocumentsGetResponse_Url", + "DocumentsUpdateResponse", + "DocumentsUpdateResponse_File", + "DocumentsUpdateResponse_Folder", + "DocumentsUpdateResponse_Text", + "DocumentsUpdateResponse_Url", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success", + "crawl_jobs", + "document", + "documents", +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/client.py new file mode 100644 index 0000000000000000000000000000000000000000..f0d9aabe020ad3d950f88ecc46691dcc0e6ab7c3 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/client.py @@ -0,0 +1,533 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.get_knowledge_base_list_response_model import GetKnowledgeBaseListResponseModel +from ...types.get_or_create_rag_index_request_model import GetOrCreateRagIndexRequestModel +from ...types.knowledge_base_content_search_response_model import KnowledgeBaseContentSearchResponseModel +from ...types.knowledge_base_document_type import KnowledgeBaseDocumentType +from ...types.knowledge_base_sort_by import KnowledgeBaseSortBy +from ...types.sort_direction import SortDirection +from .raw_client import AsyncRawKnowledgeBaseClient, RawKnowledgeBaseClient +from .types.knowledge_base_get_or_create_rag_indexes_response_value import ( + KnowledgeBaseGetOrCreateRagIndexesResponseValue, +) + +if typing.TYPE_CHECKING: + from .crawl_jobs.client import AsyncCrawlJobsClient, CrawlJobsClient + from .document.client import AsyncDocumentClient, DocumentClient + from .documents.client import AsyncDocumentsClient, DocumentsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class KnowledgeBaseClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawKnowledgeBaseClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._documents: typing.Optional[DocumentsClient] = None + self._crawl_jobs: typing.Optional[CrawlJobsClient] = None + self._document: typing.Optional[DocumentClient] = None + + @property + def with_raw_response(self) -> RawKnowledgeBaseClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawKnowledgeBaseClient + """ + return self._raw_client + + def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + show_only_owned_documents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + types: typing.Optional[ + typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]] + ] = None, + parent_folder_id: typing.Optional[str] = None, + ancestor_folder_id: typing.Optional[str] = None, + folders_first: typing.Optional[bool] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[KnowledgeBaseSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetKnowledgeBaseListResponseModel: + """ + Get a list of available knowledge base documents + + Parameters + ---------- + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + If specified, the endpoint returns only such knowledge base documents whose names start with this string. + + show_only_owned_documents : typing.Optional[bool] + If set to true, the endpoint will return only documents owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter documents by creator user ID. When set, only documents created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + + types : typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]] + If present, the endpoint will return only documents of the given types. + + parent_folder_id : typing.Optional[str] + If set, the endpoint will return only documents that are direct children of the given folder. + + ancestor_folder_id : typing.Optional[str] + If set, the endpoint will return only documents that are descendants of the given folder. + + folders_first : typing.Optional[bool] + Whether folders should be returned first in the list of documents. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[KnowledgeBaseSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetKnowledgeBaseListResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.list( + page_size=1, + search="search", + show_only_owned_documents=True, + created_by_user_id="created_by_user_id", + types=["file"], + parent_folder_id="parent_folder_id", + ancestor_folder_id="ancestor_folder_id", + folders_first=True, + sort_direction="asc", + sort_by="name", + cursor="cursor", + ) + """ + _response = self._raw_client.list( + page_size=page_size, + search=search, + show_only_owned_documents=show_only_owned_documents, + created_by_user_id=created_by_user_id, + types=types, + parent_folder_id=parent_folder_id, + ancestor_folder_id=ancestor_folder_id, + folders_first=folders_first, + sort_direction=sort_direction, + sort_by=sort_by, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def get_or_create_rag_indexes( + self, + *, + items: typing.Sequence[GetOrCreateRagIndexRequestModel], + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue]: + """ + Retrieves and/or creates RAG indexes for multiple knowledge base documents in a single request. Maximum 100 items per request. + + Parameters + ---------- + items : typing.Sequence[GetOrCreateRagIndexRequestModel] + List of requested RAG indexes. Minimum 1, maximum 100 items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, GetOrCreateRagIndexRequestModel + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.get_or_create_rag_indexes( + items=[ + GetOrCreateRagIndexRequestModel( + document_id="document_id", + create_if_missing=True, + model="e5_mistral_7b_instruct", + ) + ], + ) + """ + _response = self._raw_client.get_or_create_rag_indexes(items=items, request_options=request_options) + return _response.data + + def search( + self, + *, + query: str, + page_size: typing.Optional[int] = None, + types: typing.Optional[ + typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]] + ] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> KnowledgeBaseContentSearchResponseModel: + """ + Fuzzy text search over knowledge base document content + + Parameters + ---------- + query : str + The search query text + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + types : typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]] + If present, the endpoint will return only documents of the given types. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + KnowledgeBaseContentSearchResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.search( + query="query", + page_size=1, + types=["file"], + cursor="cursor", + ) + """ + _response = self._raw_client.search( + query=query, page_size=page_size, types=types, cursor=cursor, request_options=request_options + ) + return _response.data + + @property + def documents(self): + if self._documents is None: + from .documents.client import DocumentsClient # noqa: E402 + + self._documents = DocumentsClient(client_wrapper=self._client_wrapper) + return self._documents + + @property + def crawl_jobs(self): + if self._crawl_jobs is None: + from .crawl_jobs.client import CrawlJobsClient # noqa: E402 + + self._crawl_jobs = CrawlJobsClient(client_wrapper=self._client_wrapper) + return self._crawl_jobs + + @property + def document(self): + if self._document is None: + from .document.client import DocumentClient # noqa: E402 + + self._document = DocumentClient(client_wrapper=self._client_wrapper) + return self._document + + +class AsyncKnowledgeBaseClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawKnowledgeBaseClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._documents: typing.Optional[AsyncDocumentsClient] = None + self._crawl_jobs: typing.Optional[AsyncCrawlJobsClient] = None + self._document: typing.Optional[AsyncDocumentClient] = None + + @property + def with_raw_response(self) -> AsyncRawKnowledgeBaseClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawKnowledgeBaseClient + """ + return self._raw_client + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + show_only_owned_documents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + types: typing.Optional[ + typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]] + ] = None, + parent_folder_id: typing.Optional[str] = None, + ancestor_folder_id: typing.Optional[str] = None, + folders_first: typing.Optional[bool] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[KnowledgeBaseSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetKnowledgeBaseListResponseModel: + """ + Get a list of available knowledge base documents + + Parameters + ---------- + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + If specified, the endpoint returns only such knowledge base documents whose names start with this string. + + show_only_owned_documents : typing.Optional[bool] + If set to true, the endpoint will return only documents owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter documents by creator user ID. When set, only documents created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + + types : typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]] + If present, the endpoint will return only documents of the given types. + + parent_folder_id : typing.Optional[str] + If set, the endpoint will return only documents that are direct children of the given folder. + + ancestor_folder_id : typing.Optional[str] + If set, the endpoint will return only documents that are descendants of the given folder. + + folders_first : typing.Optional[bool] + Whether folders should be returned first in the list of documents. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[KnowledgeBaseSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetKnowledgeBaseListResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.list( + page_size=1, + search="search", + show_only_owned_documents=True, + created_by_user_id="created_by_user_id", + types=["file"], + parent_folder_id="parent_folder_id", + ancestor_folder_id="ancestor_folder_id", + folders_first=True, + sort_direction="asc", + sort_by="name", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + page_size=page_size, + search=search, + show_only_owned_documents=show_only_owned_documents, + created_by_user_id=created_by_user_id, + types=types, + parent_folder_id=parent_folder_id, + ancestor_folder_id=ancestor_folder_id, + folders_first=folders_first, + sort_direction=sort_direction, + sort_by=sort_by, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def get_or_create_rag_indexes( + self, + *, + items: typing.Sequence[GetOrCreateRagIndexRequestModel], + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue]: + """ + Retrieves and/or creates RAG indexes for multiple knowledge base documents in a single request. Maximum 100 items per request. + + Parameters + ---------- + items : typing.Sequence[GetOrCreateRagIndexRequestModel] + List of requested RAG indexes. Minimum 1, maximum 100 items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, GetOrCreateRagIndexRequestModel + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.get_or_create_rag_indexes( + items=[ + GetOrCreateRagIndexRequestModel( + document_id="document_id", + create_if_missing=True, + model="e5_mistral_7b_instruct", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_or_create_rag_indexes(items=items, request_options=request_options) + return _response.data + + async def search( + self, + *, + query: str, + page_size: typing.Optional[int] = None, + types: typing.Optional[ + typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]] + ] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> KnowledgeBaseContentSearchResponseModel: + """ + Fuzzy text search over knowledge base document content + + Parameters + ---------- + query : str + The search query text + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + types : typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]] + If present, the endpoint will return only documents of the given types. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + KnowledgeBaseContentSearchResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.search( + query="query", + page_size=1, + types=["file"], + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.search( + query=query, page_size=page_size, types=types, cursor=cursor, request_options=request_options + ) + return _response.data + + @property + def documents(self): + if self._documents is None: + from .documents.client import AsyncDocumentsClient # noqa: E402 + + self._documents = AsyncDocumentsClient(client_wrapper=self._client_wrapper) + return self._documents + + @property + def crawl_jobs(self): + if self._crawl_jobs is None: + from .crawl_jobs.client import AsyncCrawlJobsClient # noqa: E402 + + self._crawl_jobs = AsyncCrawlJobsClient(client_wrapper=self._client_wrapper) + return self._crawl_jobs + + @property + def document(self): + if self._document is None: + from .document.client import AsyncDocumentClient # noqa: E402 + + self._document = AsyncDocumentClient(client_wrapper=self._client_wrapper) + return self._document diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7f61397949028642b7bbc46fcc8b2426832a52ef --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/client.py @@ -0,0 +1,469 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.create_crawl_job_response_model import CreateCrawlJobResponseModel +from ....types.get_crawl_job_response_model import GetCrawlJobResponseModel +from ....types.list_crawl_jobs_response_model import ListCrawlJobsResponseModel +from .raw_client import AsyncRawCrawlJobsClient, RawCrawlJobsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class CrawlJobsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawCrawlJobsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawCrawlJobsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawCrawlJobsClient + """ + return self._raw_client + + def list( + self, + *, + include_job_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListCrawlJobsResponseModel: + """ + Get a list of ongoing and recent crawl jobs for the user. + + Parameters + ---------- + include_job_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Ids of additional crawl jobs to retrieve + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListCrawlJobsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.crawl_jobs.list( + include_job_ids=["include_job_ids"], + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.list( + include_job_ids=include_job_ids, page_size=page_size, cursor=cursor, request_options=request_options + ) + return _response.data + + def create( + self, + *, + url: str, + max_depth: typing.Optional[int] = OMIT, + max_pages: typing.Optional[int] = OMIT, + pattern: typing.Optional[str] = OMIT, + sitemap_urls: typing.Optional[typing.Sequence[str]] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + auto_discover: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateCrawlJobResponseModel: + """ + Create a crawl job to crawl the given URL with specified depth and page limits. + + Parameters + ---------- + url : str + URL to a page of documentation that the agent will have access to in order to interact with users. + + max_depth : typing.Optional[int] + Deprecated - this field is a no-op and will be removed in a future version. + + max_pages : typing.Optional[int] + Maximum number of pages to crawl (1-10,000), defaults to 1000. + + pattern : typing.Optional[str] + If set, only URLs that match this pattern are included. + + sitemap_urls : typing.Optional[typing.Sequence[str]] + List of URLs to crawl from sitemap (optional, overrides automatic URL discovery). + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + auto_discover : typing.Optional[bool] + Automatically discover and add new pages linked from already-crawled pages during auto-sync. Requires enable_auto_sync=true. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateCrawlJobResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.crawl_jobs.create( + url="url", + ) + """ + _response = self._raw_client.create( + url=url, + max_depth=max_depth, + max_pages=max_pages, + pattern=pattern, + sitemap_urls=sitemap_urls, + parent_folder_id=parent_folder_id, + enable_auto_sync=enable_auto_sync, + auto_remove=auto_remove, + auto_discover=auto_discover, + minimum_frequency_days=minimum_frequency_days, + request_options=request_options, + ) + return _response.data + + def get( + self, crawl_job_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetCrawlJobResponseModel: + """ + Get details about a specific crawl job including status and progress. + + Parameters + ---------- + crawl_job_id : str + The id of the crawl job to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetCrawlJobResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.crawl_jobs.get( + crawl_job_id="crawl_job_id", + ) + """ + _response = self._raw_client.get(crawl_job_id, request_options=request_options) + return _response.data + + def cancel(self, crawl_job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Cancel a crawl job and delete all associated documents and folders. + + Parameters + ---------- + crawl_job_id : str + The id of the crawl job to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.crawl_jobs.cancel( + crawl_job_id="crawl_job_id", + ) + """ + _response = self._raw_client.cancel(crawl_job_id, request_options=request_options) + return _response.data + + +class AsyncCrawlJobsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawCrawlJobsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawCrawlJobsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawCrawlJobsClient + """ + return self._raw_client + + async def list( + self, + *, + include_job_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListCrawlJobsResponseModel: + """ + Get a list of ongoing and recent crawl jobs for the user. + + Parameters + ---------- + include_job_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Ids of additional crawl jobs to retrieve + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListCrawlJobsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.crawl_jobs.list( + include_job_ids=["include_job_ids"], + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + include_job_ids=include_job_ids, page_size=page_size, cursor=cursor, request_options=request_options + ) + return _response.data + + async def create( + self, + *, + url: str, + max_depth: typing.Optional[int] = OMIT, + max_pages: typing.Optional[int] = OMIT, + pattern: typing.Optional[str] = OMIT, + sitemap_urls: typing.Optional[typing.Sequence[str]] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + auto_discover: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateCrawlJobResponseModel: + """ + Create a crawl job to crawl the given URL with specified depth and page limits. + + Parameters + ---------- + url : str + URL to a page of documentation that the agent will have access to in order to interact with users. + + max_depth : typing.Optional[int] + Deprecated - this field is a no-op and will be removed in a future version. + + max_pages : typing.Optional[int] + Maximum number of pages to crawl (1-10,000), defaults to 1000. + + pattern : typing.Optional[str] + If set, only URLs that match this pattern are included. + + sitemap_urls : typing.Optional[typing.Sequence[str]] + List of URLs to crawl from sitemap (optional, overrides automatic URL discovery). + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + auto_discover : typing.Optional[bool] + Automatically discover and add new pages linked from already-crawled pages during auto-sync. Requires enable_auto_sync=true. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateCrawlJobResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.crawl_jobs.create( + url="url", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + url=url, + max_depth=max_depth, + max_pages=max_pages, + pattern=pattern, + sitemap_urls=sitemap_urls, + parent_folder_id=parent_folder_id, + enable_auto_sync=enable_auto_sync, + auto_remove=auto_remove, + auto_discover=auto_discover, + minimum_frequency_days=minimum_frequency_days, + request_options=request_options, + ) + return _response.data + + async def get( + self, crawl_job_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetCrawlJobResponseModel: + """ + Get details about a specific crawl job including status and progress. + + Parameters + ---------- + crawl_job_id : str + The id of the crawl job to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetCrawlJobResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.crawl_jobs.get( + crawl_job_id="crawl_job_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(crawl_job_id, request_options=request_options) + return _response.data + + async def cancel(self, crawl_job_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Cancel a crawl job and delete all associated documents and folders. + + Parameters + ---------- + crawl_job_id : str + The id of the crawl job to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.crawl_jobs.cancel( + crawl_job_id="crawl_job_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.cancel(crawl_job_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/raw_client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..e1abcca085fb02f96facb70e913ff4e053d82a4f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/crawl_jobs/raw_client.py @@ -0,0 +1,608 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.create_crawl_job_response_model import CreateCrawlJobResponseModel +from ....types.get_crawl_job_response_model import GetCrawlJobResponseModel +from ....types.list_crawl_jobs_response_model import ListCrawlJobsResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawCrawlJobsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + include_job_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListCrawlJobsResponseModel]: + """ + Get a list of ongoing and recent crawl jobs for the user. + + Parameters + ---------- + include_job_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Ids of additional crawl jobs to retrieve + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListCrawlJobsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/crawl", + method="GET", + params={ + "include_job_ids": include_job_ids, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListCrawlJobsResponseModel, + construct_type( + type_=ListCrawlJobsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + url: str, + max_depth: typing.Optional[int] = OMIT, + max_pages: typing.Optional[int] = OMIT, + pattern: typing.Optional[str] = OMIT, + sitemap_urls: typing.Optional[typing.Sequence[str]] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + auto_discover: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateCrawlJobResponseModel]: + """ + Create a crawl job to crawl the given URL with specified depth and page limits. + + Parameters + ---------- + url : str + URL to a page of documentation that the agent will have access to in order to interact with users. + + max_depth : typing.Optional[int] + Deprecated - this field is a no-op and will be removed in a future version. + + max_pages : typing.Optional[int] + Maximum number of pages to crawl (1-10,000), defaults to 1000. + + pattern : typing.Optional[str] + If set, only URLs that match this pattern are included. + + sitemap_urls : typing.Optional[typing.Sequence[str]] + List of URLs to crawl from sitemap (optional, overrides automatic URL discovery). + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + auto_discover : typing.Optional[bool] + Automatically discover and add new pages linked from already-crawled pages during auto-sync. Requires enable_auto_sync=true. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateCrawlJobResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/crawl", + method="POST", + json={ + "url": url, + "max_depth": max_depth, + "max_pages": max_pages, + "pattern": pattern, + "sitemap_urls": sitemap_urls, + "parent_folder_id": parent_folder_id, + "enable_auto_sync": enable_auto_sync, + "auto_remove": auto_remove, + "auto_discover": auto_discover, + "minimum_frequency_days": minimum_frequency_days, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateCrawlJobResponseModel, + construct_type( + type_=CreateCrawlJobResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, crawl_job_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetCrawlJobResponseModel]: + """ + Get details about a specific crawl job including status and progress. + + Parameters + ---------- + crawl_job_id : str + The id of the crawl job to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetCrawlJobResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/crawl/{jsonable_encoder(crawl_job_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetCrawlJobResponseModel, + construct_type( + type_=GetCrawlJobResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def cancel( + self, crawl_job_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Cancel a crawl job and delete all associated documents and folders. + + Parameters + ---------- + crawl_job_id : str + The id of the crawl job to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/crawl/{jsonable_encoder(crawl_job_id)}/cancel", + method="POST", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawCrawlJobsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + include_job_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListCrawlJobsResponseModel]: + """ + Get a list of ongoing and recent crawl jobs for the user. + + Parameters + ---------- + include_job_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Ids of additional crawl jobs to retrieve + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListCrawlJobsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/crawl", + method="GET", + params={ + "include_job_ids": include_job_ids, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListCrawlJobsResponseModel, + construct_type( + type_=ListCrawlJobsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + url: str, + max_depth: typing.Optional[int] = OMIT, + max_pages: typing.Optional[int] = OMIT, + pattern: typing.Optional[str] = OMIT, + sitemap_urls: typing.Optional[typing.Sequence[str]] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + auto_discover: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateCrawlJobResponseModel]: + """ + Create a crawl job to crawl the given URL with specified depth and page limits. + + Parameters + ---------- + url : str + URL to a page of documentation that the agent will have access to in order to interact with users. + + max_depth : typing.Optional[int] + Deprecated - this field is a no-op and will be removed in a future version. + + max_pages : typing.Optional[int] + Maximum number of pages to crawl (1-10,000), defaults to 1000. + + pattern : typing.Optional[str] + If set, only URLs that match this pattern are included. + + sitemap_urls : typing.Optional[typing.Sequence[str]] + List of URLs to crawl from sitemap (optional, overrides automatic URL discovery). + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + auto_discover : typing.Optional[bool] + Automatically discover and add new pages linked from already-crawled pages during auto-sync. Requires enable_auto_sync=true. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateCrawlJobResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/crawl", + method="POST", + json={ + "url": url, + "max_depth": max_depth, + "max_pages": max_pages, + "pattern": pattern, + "sitemap_urls": sitemap_urls, + "parent_folder_id": parent_folder_id, + "enable_auto_sync": enable_auto_sync, + "auto_remove": auto_remove, + "auto_discover": auto_discover, + "minimum_frequency_days": minimum_frequency_days, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateCrawlJobResponseModel, + construct_type( + type_=CreateCrawlJobResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, crawl_job_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetCrawlJobResponseModel]: + """ + Get details about a specific crawl job including status and progress. + + Parameters + ---------- + crawl_job_id : str + The id of the crawl job to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetCrawlJobResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/crawl/{jsonable_encoder(crawl_job_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetCrawlJobResponseModel, + construct_type( + type_=GetCrawlJobResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def cancel( + self, crawl_job_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Cancel a crawl job and delete all associated documents and folders. + + Parameters + ---------- + crawl_job_id : str + The id of the crawl job to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/crawl/{jsonable_encoder(crawl_job_id)}/cancel", + method="POST", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/document/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/document/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4235d78848ad12543285700ee6ab047fcd9b6884 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/document/__init__.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + DocumentRefreshResponse, + DocumentRefreshResponse_File, + DocumentRefreshResponse_Folder, + DocumentRefreshResponse_Text, + DocumentRefreshResponse_Url, + DocumentUpdateFileResponse, + DocumentUpdateFileResponse_File, + DocumentUpdateFileResponse_Folder, + DocumentUpdateFileResponse_Text, + DocumentUpdateFileResponse_Url, + ) +_dynamic_imports: typing.Dict[str, str] = { + "DocumentRefreshResponse": ".types", + "DocumentRefreshResponse_File": ".types", + "DocumentRefreshResponse_Folder": ".types", + "DocumentRefreshResponse_Text": ".types", + "DocumentRefreshResponse_Url": ".types", + "DocumentUpdateFileResponse": ".types", + "DocumentUpdateFileResponse_File": ".types", + "DocumentUpdateFileResponse_Folder": ".types", + "DocumentUpdateFileResponse_Text": ".types", + "DocumentUpdateFileResponse_Url": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "DocumentRefreshResponse", + "DocumentRefreshResponse_File", + "DocumentRefreshResponse_Folder", + "DocumentRefreshResponse_Text", + "DocumentRefreshResponse_Url", + "DocumentUpdateFileResponse", + "DocumentUpdateFileResponse_File", + "DocumentUpdateFileResponse_Folder", + "DocumentUpdateFileResponse_Text", + "DocumentUpdateFileResponse_Url", +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/document/client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/document/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a3b14121dde3ca0ca823044d5e2cad7cfc656849 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/document/client.py @@ -0,0 +1,291 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .... import core +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.embedding_model_enum import EmbeddingModelEnum +from ....types.rag_document_index_response_model import RagDocumentIndexResponseModel +from .raw_client import AsyncRawDocumentClient, RawDocumentClient +from .types.document_refresh_response import DocumentRefreshResponse +from .types.document_update_file_response import DocumentUpdateFileResponse + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class DocumentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawDocumentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawDocumentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawDocumentClient + """ + return self._raw_client + + def update_file( + self, documentation_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> DocumentUpdateFileResponse: + """ + Update the source file of a file document. The document name, content, and metadata are updated to reflect the new file. Any manual content edits will be overwritten. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentUpdateFileResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.document.update_file( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.update_file(documentation_id, file=file, request_options=request_options) + return _response.data + + def refresh( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DocumentRefreshResponse: + """ + Manually refresh a URL document by re-fetching its content from the source URL. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentRefreshResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.document.refresh( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.refresh(documentation_id, request_options=request_options) + return _response.data + + def compute_rag_index( + self, + documentation_id: str, + *, + model: EmbeddingModelEnum, + request_options: typing.Optional[RequestOptions] = None, + ) -> RagDocumentIndexResponseModel: + """ + In case the document is not RAG indexed, it triggers rag indexing task, otherwise it just returns the current status. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + model : EmbeddingModelEnum + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RagDocumentIndexResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.document.compute_rag_index( + documentation_id="21m00Tcm4TlvDq8ikWAM", + model="e5_mistral_7b_instruct", + ) + """ + _response = self._raw_client.compute_rag_index(documentation_id, model=model, request_options=request_options) + return _response.data + + +class AsyncDocumentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawDocumentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawDocumentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawDocumentClient + """ + return self._raw_client + + async def update_file( + self, documentation_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> DocumentUpdateFileResponse: + """ + Update the source file of a file document. The document name, content, and metadata are updated to reflect the new file. Any manual content edits will be overwritten. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentUpdateFileResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.document.update_file( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_file(documentation_id, file=file, request_options=request_options) + return _response.data + + async def refresh( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DocumentRefreshResponse: + """ + Manually refresh a URL document by re-fetching its content from the source URL. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentRefreshResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.document.refresh( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.refresh(documentation_id, request_options=request_options) + return _response.data + + async def compute_rag_index( + self, + documentation_id: str, + *, + model: EmbeddingModelEnum, + request_options: typing.Optional[RequestOptions] = None, + ) -> RagDocumentIndexResponseModel: + """ + In case the document is not RAG indexed, it triggers rag indexing task, otherwise it just returns the current status. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + model : EmbeddingModelEnum + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RagDocumentIndexResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.document.compute_rag_index( + documentation_id="21m00Tcm4TlvDq8ikWAM", + model="e5_mistral_7b_instruct", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.compute_rag_index( + documentation_id, model=model, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/document/raw_client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/document/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..f6d33909113d1285bff528774a67904e5378810a --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/document/raw_client.py @@ -0,0 +1,400 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .... import core +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.embedding_model_enum import EmbeddingModelEnum +from ....types.rag_document_index_response_model import RagDocumentIndexResponseModel +from .types.document_refresh_response import DocumentRefreshResponse +from .types.document_update_file_response import DocumentUpdateFileResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawDocumentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def update_file( + self, documentation_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DocumentUpdateFileResponse]: + """ + Update the source file of a file document. The document name, content, and metadata are updated to reflect the new file. Any manual content edits will be overwritten. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DocumentUpdateFileResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/update-file", + method="PATCH", + data={}, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentUpdateFileResponse, + construct_type( + type_=DocumentUpdateFileResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def refresh( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DocumentRefreshResponse]: + """ + Manually refresh a URL document by re-fetching its content from the source URL. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DocumentRefreshResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/refresh", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentRefreshResponse, + construct_type( + type_=DocumentRefreshResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def compute_rag_index( + self, + documentation_id: str, + *, + model: EmbeddingModelEnum, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[RagDocumentIndexResponseModel]: + """ + In case the document is not RAG indexed, it triggers rag indexing task, otherwise it just returns the current status. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + model : EmbeddingModelEnum + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[RagDocumentIndexResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/rag-index", + method="POST", + json={ + "model": model, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RagDocumentIndexResponseModel, + construct_type( + type_=RagDocumentIndexResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawDocumentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def update_file( + self, documentation_id: str, *, file: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DocumentUpdateFileResponse]: + """ + Update the source file of a file document. The document name, content, and metadata are updated to reflect the new file. Any manual content edits will be overwritten. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + file : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DocumentUpdateFileResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/update-file", + method="PATCH", + data={}, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentUpdateFileResponse, + construct_type( + type_=DocumentUpdateFileResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def refresh( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DocumentRefreshResponse]: + """ + Manually refresh a URL document by re-fetching its content from the source URL. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DocumentRefreshResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/refresh", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentRefreshResponse, + construct_type( + type_=DocumentRefreshResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def compute_rag_index( + self, + documentation_id: str, + *, + model: EmbeddingModelEnum, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[RagDocumentIndexResponseModel]: + """ + In case the document is not RAG indexed, it triggers rag indexing task, otherwise it just returns the current status. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + model : EmbeddingModelEnum + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RagDocumentIndexResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/rag-index", + method="POST", + json={ + "model": model, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RagDocumentIndexResponseModel, + construct_type( + type_=RagDocumentIndexResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1d3ca63f3463c9f1a4cd115fb982775e817e6be8 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/__init__.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .document_refresh_response import ( + DocumentRefreshResponse, + DocumentRefreshResponse_File, + DocumentRefreshResponse_Folder, + DocumentRefreshResponse_Text, + DocumentRefreshResponse_Url, + ) + from .document_update_file_response import ( + DocumentUpdateFileResponse, + DocumentUpdateFileResponse_File, + DocumentUpdateFileResponse_Folder, + DocumentUpdateFileResponse_Text, + DocumentUpdateFileResponse_Url, + ) +_dynamic_imports: typing.Dict[str, str] = { + "DocumentRefreshResponse": ".document_refresh_response", + "DocumentRefreshResponse_File": ".document_refresh_response", + "DocumentRefreshResponse_Folder": ".document_refresh_response", + "DocumentRefreshResponse_Text": ".document_refresh_response", + "DocumentRefreshResponse_Url": ".document_refresh_response", + "DocumentUpdateFileResponse": ".document_update_file_response", + "DocumentUpdateFileResponse_File": ".document_update_file_response", + "DocumentUpdateFileResponse_Folder": ".document_update_file_response", + "DocumentUpdateFileResponse_Text": ".document_update_file_response", + "DocumentUpdateFileResponse_Url": ".document_update_file_response", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "DocumentRefreshResponse", + "DocumentRefreshResponse_File", + "DocumentRefreshResponse_Folder", + "DocumentRefreshResponse_Text", + "DocumentRefreshResponse_Url", + "DocumentUpdateFileResponse", + "DocumentUpdateFileResponse_File", + "DocumentUpdateFileResponse_Folder", + "DocumentUpdateFileResponse_Text", + "DocumentUpdateFileResponse_Url", +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/document_refresh_response.py b/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/document_refresh_response.py new file mode 100644 index 0000000000000000000000000000000000000000..40db016089ff643b20606fa2239bf6df7c395791 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/document_refresh_response.py @@ -0,0 +1,130 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .....types.auto_sync_info import AutoSyncInfo +from .....types.content_format import ContentFormat +from .....types.document_usage_mode_enum import DocumentUsageModeEnum +from .....types.external_file_sync_info import ExternalFileSyncInfo +from .....types.external_folder_sync_info import ExternalFolderSyncInfo +from .....types.file_refresh_status import FileRefreshStatus +from .....types.kb_external_sync_job import KbExternalSyncJob +from .....types.knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .....types.knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel +from .....types.resource_access_info import ResourceAccessInfo + + +class DocumentRefreshResponse_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + url: str + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = 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 + + +class DocumentRefreshResponse_File(UncheckedBaseModel): + type: typing.Literal["file"] = "file" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + filename: str + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = None + is_frozen: 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 + + +class DocumentRefreshResponse_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = 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 + + +class DocumentRefreshResponse_Folder(UncheckedBaseModel): + type: typing.Literal["folder"] = "folder" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + children_count: int + document_count: int + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: typing.Optional[bool] = None + active_sync_job: typing.Optional[KbExternalSyncJob] = 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 + + +DocumentRefreshResponse = typing_extensions.Annotated[ + typing.Union[ + DocumentRefreshResponse_Url, + DocumentRefreshResponse_File, + DocumentRefreshResponse_Text, + DocumentRefreshResponse_Folder, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/document_update_file_response.py b/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/document_update_file_response.py new file mode 100644 index 0000000000000000000000000000000000000000..2fae78daa1fa31b3fdfbb19f3c46b0125fe1e3dd --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/document/types/document_update_file_response.py @@ -0,0 +1,130 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .....types.auto_sync_info import AutoSyncInfo +from .....types.content_format import ContentFormat +from .....types.document_usage_mode_enum import DocumentUsageModeEnum +from .....types.external_file_sync_info import ExternalFileSyncInfo +from .....types.external_folder_sync_info import ExternalFolderSyncInfo +from .....types.file_refresh_status import FileRefreshStatus +from .....types.kb_external_sync_job import KbExternalSyncJob +from .....types.knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .....types.knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel +from .....types.resource_access_info import ResourceAccessInfo + + +class DocumentUpdateFileResponse_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + url: str + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = 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 + + +class DocumentUpdateFileResponse_File(UncheckedBaseModel): + type: typing.Literal["file"] = "file" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + filename: str + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = None + is_frozen: 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 + + +class DocumentUpdateFileResponse_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = 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 + + +class DocumentUpdateFileResponse_Folder(UncheckedBaseModel): + type: typing.Literal["folder"] = "folder" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + children_count: int + document_count: int + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: typing.Optional[bool] = None + active_sync_job: typing.Optional[KbExternalSyncJob] = 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 + + +DocumentUpdateFileResponse = typing_extensions.Annotated[ + typing.Union[ + DocumentUpdateFileResponse_Url, + DocumentUpdateFileResponse_File, + DocumentUpdateFileResponse_Text, + DocumentUpdateFileResponse_Folder, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6d80f0b7b0c97787ed2d634e08c0870d75f15dde --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/__init__.py @@ -0,0 +1,94 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + DocumentsBulkDeleteResponseValue, + DocumentsBulkDeleteResponseValue_Failure, + DocumentsBulkDeleteResponseValue_Success, + DocumentsGetResponse, + DocumentsGetResponse_File, + DocumentsGetResponse_Folder, + DocumentsGetResponse_Text, + DocumentsGetResponse_Url, + DocumentsUpdateResponse, + DocumentsUpdateResponse_File, + DocumentsUpdateResponse_Folder, + DocumentsUpdateResponse_Text, + DocumentsUpdateResponse_Url, + ) + from . import chunk, chunks, summaries + from .summaries import ( + SummariesGetResponseValue, + SummariesGetResponseValue_Failure, + SummariesGetResponseValue_Success, + ) +_dynamic_imports: typing.Dict[str, str] = { + "DocumentsBulkDeleteResponseValue": ".types", + "DocumentsBulkDeleteResponseValue_Failure": ".types", + "DocumentsBulkDeleteResponseValue_Success": ".types", + "DocumentsGetResponse": ".types", + "DocumentsGetResponse_File": ".types", + "DocumentsGetResponse_Folder": ".types", + "DocumentsGetResponse_Text": ".types", + "DocumentsGetResponse_Url": ".types", + "DocumentsUpdateResponse": ".types", + "DocumentsUpdateResponse_File": ".types", + "DocumentsUpdateResponse_Folder": ".types", + "DocumentsUpdateResponse_Text": ".types", + "DocumentsUpdateResponse_Url": ".types", + "SummariesGetResponseValue": ".summaries", + "SummariesGetResponseValue_Failure": ".summaries", + "SummariesGetResponseValue_Success": ".summaries", + "chunk": ".chunk", + "chunks": ".chunks", + "summaries": ".summaries", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "DocumentsBulkDeleteResponseValue", + "DocumentsBulkDeleteResponseValue_Failure", + "DocumentsBulkDeleteResponseValue_Success", + "DocumentsGetResponse", + "DocumentsGetResponse_File", + "DocumentsGetResponse_Folder", + "DocumentsGetResponse_Text", + "DocumentsGetResponse_Url", + "DocumentsUpdateResponse", + "DocumentsUpdateResponse_File", + "DocumentsUpdateResponse_Folder", + "DocumentsUpdateResponse_Text", + "DocumentsUpdateResponse_Url", + "SummariesGetResponseValue", + "SummariesGetResponseValue_Failure", + "SummariesGetResponseValue_Success", + "chunk", + "chunks", + "summaries", +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/client.py new file mode 100644 index 0000000000000000000000000000000000000000..12a9b3181ad7f88e5d6d0e00ee2b55c0d1fb6eee --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/client.py @@ -0,0 +1,145 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.embedding_model_enum import EmbeddingModelEnum +from .....types.knowledge_base_document_chunk_response_model import KnowledgeBaseDocumentChunkResponseModel +from .raw_client import AsyncRawChunkClient, RawChunkClient + + +class ChunkClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawChunkClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawChunkClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawChunkClient + """ + return self._raw_client + + def get( + self, + documentation_id: str, + chunk_id: str, + *, + embedding_model: typing.Optional[EmbeddingModelEnum] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> KnowledgeBaseDocumentChunkResponseModel: + """ + Get details about a specific documentation part used by RAG. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + chunk_id : str + The id of a document RAG chunk from the knowledge base. + + embedding_model : typing.Optional[EmbeddingModelEnum] + The embedding model used to retrieve the chunk. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + KnowledgeBaseDocumentChunkResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.chunk.get( + documentation_id="21m00Tcm4TlvDq8ikWAM", + chunk_id="chunk_id", + embedding_model="e5_mistral_7b_instruct", + ) + """ + _response = self._raw_client.get( + documentation_id, chunk_id, embedding_model=embedding_model, request_options=request_options + ) + return _response.data + + +class AsyncChunkClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawChunkClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawChunkClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawChunkClient + """ + return self._raw_client + + async def get( + self, + documentation_id: str, + chunk_id: str, + *, + embedding_model: typing.Optional[EmbeddingModelEnum] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> KnowledgeBaseDocumentChunkResponseModel: + """ + Get details about a specific documentation part used by RAG. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + chunk_id : str + The id of a document RAG chunk from the knowledge base. + + embedding_model : typing.Optional[EmbeddingModelEnum] + The embedding model used to retrieve the chunk. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + KnowledgeBaseDocumentChunkResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.chunk.get( + documentation_id="21m00Tcm4TlvDq8ikWAM", + chunk_id="chunk_id", + embedding_model="e5_mistral_7b_instruct", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + documentation_id, chunk_id, embedding_model=embedding_model, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/raw_client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..e01a9a69ec9c7434e99e809e338fd1e53f51142f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunk/raw_client.py @@ -0,0 +1,162 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.embedding_model_enum import EmbeddingModelEnum +from .....types.knowledge_base_document_chunk_response_model import KnowledgeBaseDocumentChunkResponseModel +from pydantic import ValidationError + + +class RawChunkClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + documentation_id: str, + chunk_id: str, + *, + embedding_model: typing.Optional[EmbeddingModelEnum] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[KnowledgeBaseDocumentChunkResponseModel]: + """ + Get details about a specific documentation part used by RAG. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + chunk_id : str + The id of a document RAG chunk from the knowledge base. + + embedding_model : typing.Optional[EmbeddingModelEnum] + The embedding model used to retrieve the chunk. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[KnowledgeBaseDocumentChunkResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/chunk/{jsonable_encoder(chunk_id)}", + method="GET", + params={ + "embedding_model": embedding_model, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + KnowledgeBaseDocumentChunkResponseModel, + construct_type( + type_=KnowledgeBaseDocumentChunkResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawChunkClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + documentation_id: str, + chunk_id: str, + *, + embedding_model: typing.Optional[EmbeddingModelEnum] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[KnowledgeBaseDocumentChunkResponseModel]: + """ + Get details about a specific documentation part used by RAG. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + chunk_id : str + The id of a document RAG chunk from the knowledge base. + + embedding_model : typing.Optional[EmbeddingModelEnum] + The embedding model used to retrieve the chunk. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[KnowledgeBaseDocumentChunkResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/chunk/{jsonable_encoder(chunk_id)}", + method="GET", + params={ + "embedding_model": embedding_model, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + KnowledgeBaseDocumentChunkResponseModel, + construct_type( + type_=KnowledgeBaseDocumentChunkResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/client.py new file mode 100644 index 0000000000000000000000000000000000000000..fdb2d07c0cec386046ebced5584b54a2ea6ac32c --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/client.py @@ -0,0 +1,163 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.embedding_model_enum import EmbeddingModelEnum +from .....types.knowledge_base_document_chunks_response_model import KnowledgeBaseDocumentChunksResponseModel +from .raw_client import AsyncRawChunksClient, RawChunksClient + + +class ChunksClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawChunksClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawChunksClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawChunksClient + """ + return self._raw_client + + def list( + self, + documentation_id: str, + *, + embedding_model: EmbeddingModelEnum, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> KnowledgeBaseDocumentChunksResponseModel: + """ + Get all RAG chunks for a specific knowledge base document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + embedding_model : EmbeddingModelEnum + The embedding model used to retrieve the chunk. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + KnowledgeBaseDocumentChunksResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.chunks.list( + documentation_id="21m00Tcm4TlvDq8ikWAM", + embedding_model="e5_mistral_7b_instruct", + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.list( + documentation_id, + embedding_model=embedding_model, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + +class AsyncChunksClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawChunksClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawChunksClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawChunksClient + """ + return self._raw_client + + async def list( + self, + documentation_id: str, + *, + embedding_model: EmbeddingModelEnum, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> KnowledgeBaseDocumentChunksResponseModel: + """ + Get all RAG chunks for a specific knowledge base document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + embedding_model : EmbeddingModelEnum + The embedding model used to retrieve the chunk. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + KnowledgeBaseDocumentChunksResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.chunks.list( + documentation_id="21m00Tcm4TlvDq8ikWAM", + embedding_model="e5_mistral_7b_instruct", + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + documentation_id, + embedding_model=embedding_model, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/raw_client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c96622fe4167600ee8e55c398c656741e74b4324 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/chunks/raw_client.py @@ -0,0 +1,174 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.embedding_model_enum import EmbeddingModelEnum +from .....types.knowledge_base_document_chunks_response_model import KnowledgeBaseDocumentChunksResponseModel +from pydantic import ValidationError + + +class RawChunksClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + documentation_id: str, + *, + embedding_model: EmbeddingModelEnum, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[KnowledgeBaseDocumentChunksResponseModel]: + """ + Get all RAG chunks for a specific knowledge base document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + embedding_model : EmbeddingModelEnum + The embedding model used to retrieve the chunk. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[KnowledgeBaseDocumentChunksResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/chunks", + method="GET", + params={ + "embedding_model": embedding_model, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + KnowledgeBaseDocumentChunksResponseModel, + construct_type( + type_=KnowledgeBaseDocumentChunksResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawChunksClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + documentation_id: str, + *, + embedding_model: EmbeddingModelEnum, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[KnowledgeBaseDocumentChunksResponseModel]: + """ + Get all RAG chunks for a specific knowledge base document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + embedding_model : EmbeddingModelEnum + The embedding model used to retrieve the chunk. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[KnowledgeBaseDocumentChunksResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/chunks", + method="GET", + params={ + "embedding_model": embedding_model, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + KnowledgeBaseDocumentChunksResponseModel, + construct_type( + type_=KnowledgeBaseDocumentChunksResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/client.py new file mode 100644 index 0000000000000000000000000000000000000000..348d3002edd92185ee608cf2490d0c12f8ad4bb0 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/client.py @@ -0,0 +1,1506 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .... import core +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.add_knowledge_base_response_model import AddKnowledgeBaseResponseModel +from ....types.get_knowledge_base_dependent_agents_response_model import GetKnowledgeBaseDependentAgentsResponseModel +from ....types.knowledge_base_dependent_type import KnowledgeBaseDependentType +from ....types.knowledge_base_source_file_url_response_model import KnowledgeBaseSourceFileUrlResponseModel +from .raw_client import AsyncRawDocumentsClient, RawDocumentsClient +from .types.documents_bulk_delete_response_value import DocumentsBulkDeleteResponseValue +from .types.documents_get_response import DocumentsGetResponse +from .types.documents_update_response import DocumentsUpdateResponse + +if typing.TYPE_CHECKING: + from .chunk.client import AsyncChunkClient, ChunkClient + from .chunks.client import AsyncChunksClient, ChunksClient + from .summaries.client import AsyncSummariesClient, SummariesClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class DocumentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawDocumentsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._summaries: typing.Optional[SummariesClient] = None + self._chunk: typing.Optional[ChunkClient] = None + self._chunks: typing.Optional[ChunksClient] = None + + @property + def with_raw_response(self) -> RawDocumentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawDocumentsClient + """ + return self._raw_client + + def create_from_url( + self, + *, + url: str, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Create a knowledge base document generated by scraping the given webpage. + + Parameters + ---------- + url : str + URL to a page of documentation that the agent will have access to in order to interact with users. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the document is refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.create_from_url( + url="url", + ) + """ + _response = self._raw_client.create_from_url( + url=url, + name=name, + parent_folder_id=parent_folder_id, + enable_auto_sync=enable_auto_sync, + auto_remove=auto_remove, + minimum_frequency_days=minimum_frequency_days, + request_options=request_options, + ) + return _response.data + + def create_from_file( + self, + *, + file: core.File, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Create a knowledge base document generated form the uploaded file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.create_from_file() + """ + _response = self._raw_client.create_from_file( + file=file, name=name, parent_folder_id=parent_folder_id, request_options=request_options + ) + return _response.data + + def create_from_text( + self, + *, + text: str, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Create a knowledge base document containing the provided text. + + Parameters + ---------- + text : str + Text content to be added to the knowledge base. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.create_from_text( + text="text", + ) + """ + _response = self._raw_client.create_from_text( + text=text, name=name, parent_folder_id=parent_folder_id, request_options=request_options + ) + return _response.data + + def create_folder( + self, + *, + name: str, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Create a folder used for grouping documents together. + + Parameters + ---------- + name : str + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.create_folder( + name="name", + ) + """ + _response = self._raw_client.create_folder( + name=name, + parent_folder_id=parent_folder_id, + enable_auto_sync=enable_auto_sync, + auto_remove=auto_remove, + minimum_frequency_days=minimum_frequency_days, + request_options=request_options, + ) + return _response.data + + def get( + self, + documentation_id: str, + *, + agent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DocumentsGetResponse: + """ + Get details about a specific documentation making up the agent's knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + agent_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentsGetResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.get( + documentation_id="21m00Tcm4TlvDq8ikWAM", + agent_id="agent_id", + ) + """ + _response = self._raw_client.get(documentation_id, agent_id=agent_id, request_options=request_options) + return _response.data + + def delete( + self, + documentation_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Delete a document or folder from the knowledge base. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + force : typing.Optional[bool] + If set to true, the document or folder will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.delete( + documentation_id="21m00Tcm4TlvDq8ikWAM", + force=True, + ) + """ + _response = self._raw_client.delete(documentation_id, force=force, request_options=request_options) + return _response.data + + def update( + self, + documentation_id: str, + *, + name: typing.Optional[str] = OMIT, + content: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DocumentsUpdateResponse: + """ + Update the name and/or content of a document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + content : typing.Optional[str] + Updated content for the document. Only supported for text documents, URL documents with auto-sync disabled, and file documents that are not synced from an external source. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentsUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.update( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.update( + documentation_id, name=name, content=content, request_options=request_options + ) + return _response.data + + def get_agents( + self, + documentation_id: str, + *, + dependent_type: typing.Optional[KnowledgeBaseDependentType] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetKnowledgeBaseDependentAgentsResponseModel: + """ + Get a list of agents depending on this knowledge base document + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + dependent_type : typing.Optional[KnowledgeBaseDependentType] + Type of dependent agents to return. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetKnowledgeBaseDependentAgentsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.get_agents( + documentation_id="21m00Tcm4TlvDq8ikWAM", + dependent_type="direct", + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.get_agents( + documentation_id, + dependent_type=dependent_type, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def get_bulk_agents( + self, + *, + document_ids: typing.Sequence[str], + dependent_type: typing.Optional[KnowledgeBaseDependentType] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetKnowledgeBaseDependentAgentsResponseModel: + """ + Get a list of agents depending on any of the given knowledge base documents. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + dependent_type : typing.Optional[KnowledgeBaseDependentType] + Type of dependent agents to return. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetKnowledgeBaseDependentAgentsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.get_bulk_agents( + dependent_type="direct", + page_size=1, + cursor="cursor", + document_ids=["21m00Tcm4TlvDq8ikWAM", "31m00Tcm4TlvDq8ikWBM"], + ) + """ + _response = self._raw_client.get_bulk_agents( + document_ids=document_ids, + dependent_type=dependent_type, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def get_content(self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + Get the entire content of a document from the knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + Streaming document content + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.get_content( + documentation_id="documentation_id", + ) + """ + _response = self._raw_client.get_content(documentation_id, request_options=request_options) + return _response.data + + def get_source_file_url( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> KnowledgeBaseSourceFileUrlResponseModel: + """ + Get a signed URL to download the original source file of a file-type document from the knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + KnowledgeBaseSourceFileUrlResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.get_source_file_url( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get_source_file_url(documentation_id, request_options=request_options) + return _response.data + + def move( + self, + document_id: str, + *, + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Moves the entity from one folder to another. + + Parameters + ---------- + document_id : str + The id of a document from the knowledge base. This is returned on document addition. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.move( + document_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.move(document_id, move_to=move_to, request_options=request_options) + return _response.data + + def bulk_move( + self, + *, + document_ids: typing.Sequence[str], + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Moves multiple entities from one folder to another. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.bulk_move( + document_ids=["21m00Tcm4TlvDq8ikWAM", "31m00Tcm4TlvDq8ikWBM"], + ) + """ + _response = self._raw_client.bulk_move( + document_ids=document_ids, move_to=move_to, request_options=request_options + ) + return _response.data + + def bulk_delete( + self, + *, + document_ids: typing.Sequence[str], + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Dict[str, DocumentsBulkDeleteResponseValue]: + """ + Delete multiple documents or folders from the knowledge base. Each id succeeds or fails independently. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + force : typing.Optional[bool] + If set to true, documents or folders will be deleted regardless of whether they are used by any agents and will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, DocumentsBulkDeleteResponseValue] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.bulk_delete( + document_ids=["21m00Tcm4TlvDq8ikWAM", "31m00Tcm4TlvDq8ikWBM"], + ) + """ + _response = self._raw_client.bulk_delete( + document_ids=document_ids, force=force, request_options=request_options + ) + return _response.data + + @property + def summaries(self): + if self._summaries is None: + from .summaries.client import SummariesClient # noqa: E402 + + self._summaries = SummariesClient(client_wrapper=self._client_wrapper) + return self._summaries + + @property + def chunk(self): + if self._chunk is None: + from .chunk.client import ChunkClient # noqa: E402 + + self._chunk = ChunkClient(client_wrapper=self._client_wrapper) + return self._chunk + + @property + def chunks(self): + if self._chunks is None: + from .chunks.client import ChunksClient # noqa: E402 + + self._chunks = ChunksClient(client_wrapper=self._client_wrapper) + return self._chunks + + +class AsyncDocumentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawDocumentsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._summaries: typing.Optional[AsyncSummariesClient] = None + self._chunk: typing.Optional[AsyncChunkClient] = None + self._chunks: typing.Optional[AsyncChunksClient] = None + + @property + def with_raw_response(self) -> AsyncRawDocumentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawDocumentsClient + """ + return self._raw_client + + async def create_from_url( + self, + *, + url: str, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Create a knowledge base document generated by scraping the given webpage. + + Parameters + ---------- + url : str + URL to a page of documentation that the agent will have access to in order to interact with users. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the document is refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.create_from_url( + url="url", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_from_url( + url=url, + name=name, + parent_folder_id=parent_folder_id, + enable_auto_sync=enable_auto_sync, + auto_remove=auto_remove, + minimum_frequency_days=minimum_frequency_days, + request_options=request_options, + ) + return _response.data + + async def create_from_file( + self, + *, + file: core.File, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Create a knowledge base document generated form the uploaded file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.create_from_file() + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_from_file( + file=file, name=name, parent_folder_id=parent_folder_id, request_options=request_options + ) + return _response.data + + async def create_from_text( + self, + *, + text: str, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Create a knowledge base document containing the provided text. + + Parameters + ---------- + text : str + Text content to be added to the knowledge base. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.create_from_text( + text="text", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_from_text( + text=text, name=name, parent_folder_id=parent_folder_id, request_options=request_options + ) + return _response.data + + async def create_folder( + self, + *, + name: str, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddKnowledgeBaseResponseModel: + """ + Create a folder used for grouping documents together. + + Parameters + ---------- + name : str + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddKnowledgeBaseResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.create_folder( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_folder( + name=name, + parent_folder_id=parent_folder_id, + enable_auto_sync=enable_auto_sync, + auto_remove=auto_remove, + minimum_frequency_days=minimum_frequency_days, + request_options=request_options, + ) + return _response.data + + async def get( + self, + documentation_id: str, + *, + agent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DocumentsGetResponse: + """ + Get details about a specific documentation making up the agent's knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + agent_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentsGetResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.get( + documentation_id="21m00Tcm4TlvDq8ikWAM", + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(documentation_id, agent_id=agent_id, request_options=request_options) + return _response.data + + async def delete( + self, + documentation_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Delete a document or folder from the knowledge base. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + force : typing.Optional[bool] + If set to true, the document or folder will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.delete( + documentation_id="21m00Tcm4TlvDq8ikWAM", + force=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(documentation_id, force=force, request_options=request_options) + return _response.data + + async def update( + self, + documentation_id: str, + *, + name: typing.Optional[str] = OMIT, + content: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DocumentsUpdateResponse: + """ + Update the name and/or content of a document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + content : typing.Optional[str] + Updated content for the document. Only supported for text documents, URL documents with auto-sync disabled, and file documents that are not synced from an external source. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DocumentsUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.update( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + documentation_id, name=name, content=content, request_options=request_options + ) + return _response.data + + async def get_agents( + self, + documentation_id: str, + *, + dependent_type: typing.Optional[KnowledgeBaseDependentType] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetKnowledgeBaseDependentAgentsResponseModel: + """ + Get a list of agents depending on this knowledge base document + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + dependent_type : typing.Optional[KnowledgeBaseDependentType] + Type of dependent agents to return. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetKnowledgeBaseDependentAgentsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.get_agents( + documentation_id="21m00Tcm4TlvDq8ikWAM", + dependent_type="direct", + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_agents( + documentation_id, + dependent_type=dependent_type, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def get_bulk_agents( + self, + *, + document_ids: typing.Sequence[str], + dependent_type: typing.Optional[KnowledgeBaseDependentType] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetKnowledgeBaseDependentAgentsResponseModel: + """ + Get a list of agents depending on any of the given knowledge base documents. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + dependent_type : typing.Optional[KnowledgeBaseDependentType] + Type of dependent agents to return. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetKnowledgeBaseDependentAgentsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.get_bulk_agents( + dependent_type="direct", + page_size=1, + cursor="cursor", + document_ids=["21m00Tcm4TlvDq8ikWAM", "31m00Tcm4TlvDq8ikWBM"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_bulk_agents( + document_ids=document_ids, + dependent_type=dependent_type, + page_size=page_size, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def get_content( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> str: + """ + Get the entire content of a document from the knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + Streaming document content + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.get_content( + documentation_id="documentation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_content(documentation_id, request_options=request_options) + return _response.data + + async def get_source_file_url( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> KnowledgeBaseSourceFileUrlResponseModel: + """ + Get a signed URL to download the original source file of a file-type document from the knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + KnowledgeBaseSourceFileUrlResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.get_source_file_url( + documentation_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_source_file_url(documentation_id, request_options=request_options) + return _response.data + + async def move( + self, + document_id: str, + *, + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Moves the entity from one folder to another. + + Parameters + ---------- + document_id : str + The id of a document from the knowledge base. This is returned on document addition. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.move( + document_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.move(document_id, move_to=move_to, request_options=request_options) + return _response.data + + async def bulk_move( + self, + *, + document_ids: typing.Sequence[str], + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Moves multiple entities from one folder to another. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.bulk_move( + document_ids=["21m00Tcm4TlvDq8ikWAM", "31m00Tcm4TlvDq8ikWBM"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.bulk_move( + document_ids=document_ids, move_to=move_to, request_options=request_options + ) + return _response.data + + async def bulk_delete( + self, + *, + document_ids: typing.Sequence[str], + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Dict[str, DocumentsBulkDeleteResponseValue]: + """ + Delete multiple documents or folders from the knowledge base. Each id succeeds or fails independently. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + force : typing.Optional[bool] + If set to true, documents or folders will be deleted regardless of whether they are used by any agents and will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, DocumentsBulkDeleteResponseValue] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.bulk_delete( + document_ids=["21m00Tcm4TlvDq8ikWAM", "31m00Tcm4TlvDq8ikWBM"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.bulk_delete( + document_ids=document_ids, force=force, request_options=request_options + ) + return _response.data + + @property + def summaries(self): + if self._summaries is None: + from .summaries.client import AsyncSummariesClient # noqa: E402 + + self._summaries = AsyncSummariesClient(client_wrapper=self._client_wrapper) + return self._summaries + + @property + def chunk(self): + if self._chunk is None: + from .chunk.client import AsyncChunkClient # noqa: E402 + + self._chunk = AsyncChunkClient(client_wrapper=self._client_wrapper) + return self._chunk + + @property + def chunks(self): + if self._chunks is None: + from .chunks.client import AsyncChunksClient # noqa: E402 + + self._chunks = AsyncChunksClient(client_wrapper=self._client_wrapper) + return self._chunks diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/raw_client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..dc13142db5feac5d56cd70866235fef1ccca2ec6 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/raw_client.py @@ -0,0 +1,1973 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .... import core +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.add_knowledge_base_response_model import AddKnowledgeBaseResponseModel +from ....types.get_knowledge_base_dependent_agents_response_model import GetKnowledgeBaseDependentAgentsResponseModel +from ....types.knowledge_base_dependent_type import KnowledgeBaseDependentType +from ....types.knowledge_base_source_file_url_response_model import KnowledgeBaseSourceFileUrlResponseModel +from .types.documents_bulk_delete_response_value import DocumentsBulkDeleteResponseValue +from .types.documents_get_response import DocumentsGetResponse +from .types.documents_update_response import DocumentsUpdateResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawDocumentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create_from_url( + self, + *, + url: str, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddKnowledgeBaseResponseModel]: + """ + Create a knowledge base document generated by scraping the given webpage. + + Parameters + ---------- + url : str + URL to a page of documentation that the agent will have access to in order to interact with users. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the document is refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/url", + method="POST", + json={ + "url": url, + "name": name, + "parent_folder_id": parent_folder_id, + "enable_auto_sync": enable_auto_sync, + "auto_remove": auto_remove, + "minimum_frequency_days": minimum_frequency_days, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_from_file( + self, + *, + file: core.File, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddKnowledgeBaseResponseModel]: + """ + Create a knowledge base document generated form the uploaded file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/file", + method="POST", + data={ + "name": name, + "parent_folder_id": parent_folder_id, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_from_text( + self, + *, + text: str, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddKnowledgeBaseResponseModel]: + """ + Create a knowledge base document containing the provided text. + + Parameters + ---------- + text : str + Text content to be added to the knowledge base. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/text", + method="POST", + json={ + "text": text, + "name": name, + "parent_folder_id": parent_folder_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_folder( + self, + *, + name: str, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddKnowledgeBaseResponseModel]: + """ + Create a folder used for grouping documents together. + + Parameters + ---------- + name : str + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/folder", + method="POST", + json={ + "name": name, + "parent_folder_id": parent_folder_id, + "enable_auto_sync": enable_auto_sync, + "auto_remove": auto_remove, + "minimum_frequency_days": minimum_frequency_days, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + documentation_id: str, + *, + agent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DocumentsGetResponse]: + """ + Get details about a specific documentation making up the agent's knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + agent_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DocumentsGetResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}", + method="GET", + params={ + "agent_id": agent_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentsGetResponse, + construct_type( + type_=DocumentsGetResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, + documentation_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Delete a document or folder from the knowledge base. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + force : typing.Optional[bool] + If set to true, the document or folder will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}", + method="DELETE", + params={ + "force": force, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + documentation_id: str, + *, + name: typing.Optional[str] = OMIT, + content: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DocumentsUpdateResponse]: + """ + Update the name and/or content of a document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + content : typing.Optional[str] + Updated content for the document. Only supported for text documents, URL documents with auto-sync disabled, and file documents that are not synced from an external source. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DocumentsUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}", + method="PATCH", + json={ + "name": name, + "content": content, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentsUpdateResponse, + construct_type( + type_=DocumentsUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_agents( + self, + documentation_id: str, + *, + dependent_type: typing.Optional[KnowledgeBaseDependentType] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetKnowledgeBaseDependentAgentsResponseModel]: + """ + Get a list of agents depending on this knowledge base document + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + dependent_type : typing.Optional[KnowledgeBaseDependentType] + Type of dependent agents to return. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetKnowledgeBaseDependentAgentsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/dependent-agents", + method="GET", + params={ + "dependent_type": dependent_type, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetKnowledgeBaseDependentAgentsResponseModel, + construct_type( + type_=GetKnowledgeBaseDependentAgentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_bulk_agents( + self, + *, + document_ids: typing.Sequence[str], + dependent_type: typing.Optional[KnowledgeBaseDependentType] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetKnowledgeBaseDependentAgentsResponseModel]: + """ + Get a list of agents depending on any of the given knowledge base documents. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + dependent_type : typing.Optional[KnowledgeBaseDependentType] + Type of dependent agents to return. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetKnowledgeBaseDependentAgentsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/dependent-agents", + method="POST", + params={ + "dependent_type": dependent_type, + "page_size": page_size, + "cursor": cursor, + }, + json={ + "document_ids": document_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetKnowledgeBaseDependentAgentsResponseModel, + construct_type( + type_=GetKnowledgeBaseDependentAgentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_content( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[str]: + """ + Get the entire content of a document from the knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[str] + Streaming document content + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/content", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=_response.text) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_source_file_url( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[KnowledgeBaseSourceFileUrlResponseModel]: + """ + Get a signed URL to download the original source file of a file-type document from the knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[KnowledgeBaseSourceFileUrlResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/source-file-url", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + KnowledgeBaseSourceFileUrlResponseModel, + construct_type( + type_=KnowledgeBaseSourceFileUrlResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def move( + self, + document_id: str, + *, + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[None]: + """ + Moves the entity from one folder to another. + + Parameters + ---------- + document_id : str + The id of a document from the knowledge base. This is returned on document addition. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(document_id)}/move", + method="POST", + json={ + "move_to": move_to, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def bulk_move( + self, + *, + document_ids: typing.Sequence[str], + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[None]: + """ + Moves multiple entities from one folder to another. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/bulk-move", + method="POST", + json={ + "document_ids": document_ids, + "move_to": move_to, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def bulk_delete( + self, + *, + document_ids: typing.Sequence[str], + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Dict[str, DocumentsBulkDeleteResponseValue]]: + """ + Delete multiple documents or folders from the knowledge base. Each id succeeds or fails independently. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + force : typing.Optional[bool] + If set to true, documents or folders will be deleted regardless of whether they are used by any agents and will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Dict[str, DocumentsBulkDeleteResponseValue]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/bulk-delete", + method="POST", + json={ + "document_ids": document_ids, + "force": force, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, DocumentsBulkDeleteResponseValue], + construct_type( + type_=typing.Dict[str, DocumentsBulkDeleteResponseValue], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawDocumentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create_from_url( + self, + *, + url: str, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddKnowledgeBaseResponseModel]: + """ + Create a knowledge base document generated by scraping the given webpage. + + Parameters + ---------- + url : str + URL to a page of documentation that the agent will have access to in order to interact with users. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the document is refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/url", + method="POST", + json={ + "url": url, + "name": name, + "parent_folder_id": parent_folder_id, + "enable_auto_sync": enable_auto_sync, + "auto_remove": auto_remove, + "minimum_frequency_days": minimum_frequency_days, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_from_file( + self, + *, + file: core.File, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddKnowledgeBaseResponseModel]: + """ + Create a knowledge base document generated form the uploaded file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/file", + method="POST", + data={ + "name": name, + "parent_folder_id": parent_folder_id, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_from_text( + self, + *, + text: str, + name: typing.Optional[str] = OMIT, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddKnowledgeBaseResponseModel]: + """ + Create a knowledge base document containing the provided text. + + Parameters + ---------- + text : str + Text content to be added to the knowledge base. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/text", + method="POST", + json={ + "text": text, + "name": name, + "parent_folder_id": parent_folder_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_folder( + self, + *, + name: str, + parent_folder_id: typing.Optional[str] = OMIT, + enable_auto_sync: typing.Optional[bool] = OMIT, + auto_remove: typing.Optional[bool] = OMIT, + minimum_frequency_days: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddKnowledgeBaseResponseModel]: + """ + Create a folder used for grouping documents together. + + Parameters + ---------- + name : str + A custom, human-readable name for the document. + + parent_folder_id : typing.Optional[str] + If set, the created document or folder will be placed inside the given folder. + + enable_auto_sync : typing.Optional[bool] + Whether to enable auto-sync for this URL document. + + auto_remove : typing.Optional[bool] + Whether to automatically remove the document if the URL becomes unavailable. Only applicable when auto-sync is enabled. + + minimum_frequency_days : typing.Optional[int] + Minimum frequency (in days) at which the underlying eligible documents are refreshed. The actual interval may be shorter, never longer. Defaults to 7, tightened to the parent folder's frequency if that is stricter. Only applicable when auto-sync is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/folder", + method="POST", + json={ + "name": name, + "parent_folder_id": parent_folder_id, + "enable_auto_sync": enable_auto_sync, + "auto_remove": auto_remove, + "minimum_frequency_days": minimum_frequency_days, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + documentation_id: str, + *, + agent_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DocumentsGetResponse]: + """ + Get details about a specific documentation making up the agent's knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + agent_id : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DocumentsGetResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}", + method="GET", + params={ + "agent_id": agent_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentsGetResponse, + construct_type( + type_=DocumentsGetResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, + documentation_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete a document or folder from the knowledge base. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + force : typing.Optional[bool] + If set to true, the document or folder will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}", + method="DELETE", + params={ + "force": force, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + documentation_id: str, + *, + name: typing.Optional[str] = OMIT, + content: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DocumentsUpdateResponse]: + """ + Update the name and/or content of a document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + name : typing.Optional[str] + A custom, human-readable name for the document. + + content : typing.Optional[str] + Updated content for the document. Only supported for text documents, URL documents with auto-sync disabled, and file documents that are not synced from an external source. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DocumentsUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}", + method="PATCH", + json={ + "name": name, + "content": content, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DocumentsUpdateResponse, + construct_type( + type_=DocumentsUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_agents( + self, + documentation_id: str, + *, + dependent_type: typing.Optional[KnowledgeBaseDependentType] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetKnowledgeBaseDependentAgentsResponseModel]: + """ + Get a list of agents depending on this knowledge base document + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + dependent_type : typing.Optional[KnowledgeBaseDependentType] + Type of dependent agents to return. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetKnowledgeBaseDependentAgentsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/dependent-agents", + method="GET", + params={ + "dependent_type": dependent_type, + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetKnowledgeBaseDependentAgentsResponseModel, + construct_type( + type_=GetKnowledgeBaseDependentAgentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_bulk_agents( + self, + *, + document_ids: typing.Sequence[str], + dependent_type: typing.Optional[KnowledgeBaseDependentType] = None, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetKnowledgeBaseDependentAgentsResponseModel]: + """ + Get a list of agents depending on any of the given knowledge base documents. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + dependent_type : typing.Optional[KnowledgeBaseDependentType] + Type of dependent agents to return. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetKnowledgeBaseDependentAgentsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/dependent-agents", + method="POST", + params={ + "dependent_type": dependent_type, + "page_size": page_size, + "cursor": cursor, + }, + json={ + "document_ids": document_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetKnowledgeBaseDependentAgentsResponseModel, + construct_type( + type_=GetKnowledgeBaseDependentAgentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_content( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[str]: + """ + Get the entire content of a document from the knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[str] + Streaming document content + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/content", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=_response.text) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_source_file_url( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[KnowledgeBaseSourceFileUrlResponseModel]: + """ + Get a signed URL to download the original source file of a file-type document from the knowledge base + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[KnowledgeBaseSourceFileUrlResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/source-file-url", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + KnowledgeBaseSourceFileUrlResponseModel, + construct_type( + type_=KnowledgeBaseSourceFileUrlResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def move( + self, + document_id: str, + *, + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[None]: + """ + Moves the entity from one folder to another. + + Parameters + ---------- + document_id : str + The id of a document from the knowledge base. This is returned on document addition. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(document_id)}/move", + method="POST", + json={ + "move_to": move_to, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def bulk_move( + self, + *, + document_ids: typing.Sequence[str], + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[None]: + """ + Moves multiple entities from one folder to another. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/bulk-move", + method="POST", + json={ + "document_ids": document_ids, + "move_to": move_to, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def bulk_delete( + self, + *, + document_ids: typing.Sequence[str], + force: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Dict[str, DocumentsBulkDeleteResponseValue]]: + """ + Delete multiple documents or folders from the knowledge base. Each id succeeds or fails independently. + + Parameters + ---------- + document_ids : typing.Sequence[str] + The ids of documents or folders from the knowledge base. + + force : typing.Optional[bool] + If set to true, documents or folders will be deleted regardless of whether they are used by any agents and will be removed from the dependent agents. For non-empty folders, this will also delete all child documents and folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Dict[str, DocumentsBulkDeleteResponseValue]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/bulk-delete", + method="POST", + json={ + "document_ids": document_ids, + "force": force, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, DocumentsBulkDeleteResponseValue], + construct_type( + type_=typing.Dict[str, DocumentsBulkDeleteResponseValue], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a644d928b732fc3a0e6c208f991f2d5225a0f291 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import SummariesGetResponseValue, SummariesGetResponseValue_Failure, SummariesGetResponseValue_Success +_dynamic_imports: typing.Dict[str, str] = { + "SummariesGetResponseValue": ".types", + "SummariesGetResponseValue_Failure": ".types", + "SummariesGetResponseValue_Success": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["SummariesGetResponseValue", "SummariesGetResponseValue_Failure", "SummariesGetResponseValue_Success"] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/client.py new file mode 100644 index 0000000000000000000000000000000000000000..166d906914adc9f6b4e7c22360fccdb50f9b36b6 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/client.py @@ -0,0 +1,120 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .raw_client import AsyncRawSummariesClient, RawSummariesClient +from .types.summaries_get_response_value import SummariesGetResponseValue + + +class SummariesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSummariesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSummariesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSummariesClient + """ + return self._raw_client + + def get( + self, + *, + document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Dict[str, SummariesGetResponseValue]: + """ + Gets multiple knowledge base document summaries by their IDs. + + Parameters + ---------- + document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + The ids of knowledge base documents. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, SummariesGetResponseValue] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.knowledge_base.documents.summaries.get( + document_ids=["21m00Tcm4TlvDq8ikWAM", "31n11Udm5UmwEr9jkXBN"], + ) + """ + _response = self._raw_client.get(document_ids=document_ids, request_options=request_options) + return _response.data + + +class AsyncSummariesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSummariesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSummariesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSummariesClient + """ + return self._raw_client + + async def get( + self, + *, + document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Dict[str, SummariesGetResponseValue]: + """ + Gets multiple knowledge base document summaries by their IDs. + + Parameters + ---------- + document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + The ids of knowledge base documents. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, SummariesGetResponseValue] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.knowledge_base.documents.summaries.get( + document_ids=["21m00Tcm4TlvDq8ikWAM", "31n11Udm5UmwEr9jkXBN"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(document_ids=document_ids, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/raw_client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..972041cf3b4d80a72c81f2e2d20c23e222741697 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/raw_client.py @@ -0,0 +1,144 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .types.summaries_get_response_value import SummariesGetResponseValue +from pydantic import ValidationError + + +class RawSummariesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + *, + document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Dict[str, SummariesGetResponseValue]]: + """ + Gets multiple knowledge base document summaries by their IDs. + + Parameters + ---------- + document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + The ids of knowledge base documents. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Dict[str, SummariesGetResponseValue]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/summaries", + method="GET", + params={ + "document_ids": document_ids, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, SummariesGetResponseValue], + construct_type( + type_=typing.Dict[str, SummariesGetResponseValue], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSummariesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + *, + document_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Dict[str, SummariesGetResponseValue]]: + """ + Gets multiple knowledge base document summaries by their IDs. + + Parameters + ---------- + document_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + The ids of knowledge base documents. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Dict[str, SummariesGetResponseValue]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/summaries", + method="GET", + params={ + "document_ids": document_ids, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, SummariesGetResponseValue], + construct_type( + type_=typing.Dict[str, SummariesGetResponseValue], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/types/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..61ec6579434518cc7cfaeaf5bdeba9017e6f3a56 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/types/__init__.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .summaries_get_response_value import ( + SummariesGetResponseValue, + SummariesGetResponseValue_Failure, + SummariesGetResponseValue_Success, + ) +_dynamic_imports: typing.Dict[str, str] = { + "SummariesGetResponseValue": ".summaries_get_response_value", + "SummariesGetResponseValue_Failure": ".summaries_get_response_value", + "SummariesGetResponseValue_Success": ".summaries_get_response_value", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["SummariesGetResponseValue", "SummariesGetResponseValue_Failure", "SummariesGetResponseValue_Success"] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/types/summaries_get_response_value.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/types/summaries_get_response_value.py new file mode 100644 index 0000000000000000000000000000000000000000..ffbafbfce4fe25c43876a37ba03ccd6a587c884e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/summaries/types/summaries_get_response_value.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ......core.pydantic_utilities import IS_PYDANTIC_V2 +from ......core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ......types.knowledge_base_summary_batch_successful_response_model_data import ( + KnowledgeBaseSummaryBatchSuccessfulResponseModelData, +) + + +class SummariesGetResponseValue_Success(UncheckedBaseModel): + status: typing.Literal["success"] = "success" + data: KnowledgeBaseSummaryBatchSuccessfulResponseModelData + + 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 + + +class SummariesGetResponseValue_Failure(UncheckedBaseModel): + status: typing.Literal["failure"] = "failure" + error_code: int + error_status: str + error_message: 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 + + +SummariesGetResponseValue = typing_extensions.Annotated[ + typing.Union[SummariesGetResponseValue_Success, SummariesGetResponseValue_Failure], + UnionMetadata(discriminant="status"), +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b73750427e4fadd7d58b91a02a5ae49b38355a08 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/__init__.py @@ -0,0 +1,80 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .documents_bulk_delete_response_value import ( + DocumentsBulkDeleteResponseValue, + DocumentsBulkDeleteResponseValue_Failure, + DocumentsBulkDeleteResponseValue_Success, + ) + from .documents_get_response import ( + DocumentsGetResponse, + DocumentsGetResponse_File, + DocumentsGetResponse_Folder, + DocumentsGetResponse_Text, + DocumentsGetResponse_Url, + ) + from .documents_update_response import ( + DocumentsUpdateResponse, + DocumentsUpdateResponse_File, + DocumentsUpdateResponse_Folder, + DocumentsUpdateResponse_Text, + DocumentsUpdateResponse_Url, + ) +_dynamic_imports: typing.Dict[str, str] = { + "DocumentsBulkDeleteResponseValue": ".documents_bulk_delete_response_value", + "DocumentsBulkDeleteResponseValue_Failure": ".documents_bulk_delete_response_value", + "DocumentsBulkDeleteResponseValue_Success": ".documents_bulk_delete_response_value", + "DocumentsGetResponse": ".documents_get_response", + "DocumentsGetResponse_File": ".documents_get_response", + "DocumentsGetResponse_Folder": ".documents_get_response", + "DocumentsGetResponse_Text": ".documents_get_response", + "DocumentsGetResponse_Url": ".documents_get_response", + "DocumentsUpdateResponse": ".documents_update_response", + "DocumentsUpdateResponse_File": ".documents_update_response", + "DocumentsUpdateResponse_Folder": ".documents_update_response", + "DocumentsUpdateResponse_Text": ".documents_update_response", + "DocumentsUpdateResponse_Url": ".documents_update_response", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "DocumentsBulkDeleteResponseValue", + "DocumentsBulkDeleteResponseValue_Failure", + "DocumentsBulkDeleteResponseValue_Success", + "DocumentsGetResponse", + "DocumentsGetResponse_File", + "DocumentsGetResponse_Folder", + "DocumentsGetResponse_Text", + "DocumentsGetResponse_Url", + "DocumentsUpdateResponse", + "DocumentsUpdateResponse_File", + "DocumentsUpdateResponse_Folder", + "DocumentsUpdateResponse_Text", + "DocumentsUpdateResponse_Url", +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_bulk_delete_response_value.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_bulk_delete_response_value.py new file mode 100644 index 0000000000000000000000000000000000000000..c9b5acaebe03cb2724b711103340bca113d48b47 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_bulk_delete_response_value.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .....types.knowledge_base_deleted_response_model import KnowledgeBaseDeletedResponseModel + + +class DocumentsBulkDeleteResponseValue_Success(UncheckedBaseModel): + status: typing.Literal["success"] = "success" + data: KnowledgeBaseDeletedResponseModel + + 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 + + +class DocumentsBulkDeleteResponseValue_Failure(UncheckedBaseModel): + status: typing.Literal["failure"] = "failure" + error_code: int + error_status: str + error_message: 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 + + +DocumentsBulkDeleteResponseValue = typing_extensions.Annotated[ + typing.Union[DocumentsBulkDeleteResponseValue_Success, DocumentsBulkDeleteResponseValue_Failure], + UnionMetadata(discriminant="status"), +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_get_response.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_get_response.py new file mode 100644 index 0000000000000000000000000000000000000000..e342108d553fad429c0b01a8398681fc063a7fa1 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_get_response.py @@ -0,0 +1,127 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .....types.auto_sync_info import AutoSyncInfo +from .....types.content_format import ContentFormat +from .....types.document_usage_mode_enum import DocumentUsageModeEnum +from .....types.external_file_sync_info import ExternalFileSyncInfo +from .....types.external_folder_sync_info import ExternalFolderSyncInfo +from .....types.file_refresh_status import FileRefreshStatus +from .....types.kb_external_sync_job import KbExternalSyncJob +from .....types.knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .....types.knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel +from .....types.resource_access_info import ResourceAccessInfo + + +class DocumentsGetResponse_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + url: str + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = 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 + + +class DocumentsGetResponse_File(UncheckedBaseModel): + type: typing.Literal["file"] = "file" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + filename: str + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = None + is_frozen: 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 + + +class DocumentsGetResponse_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = 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 + + +class DocumentsGetResponse_Folder(UncheckedBaseModel): + type: typing.Literal["folder"] = "folder" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + children_count: int + document_count: int + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: typing.Optional[bool] = None + active_sync_job: typing.Optional[KbExternalSyncJob] = 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 + + +DocumentsGetResponse = typing_extensions.Annotated[ + typing.Union[ + DocumentsGetResponse_Url, DocumentsGetResponse_File, DocumentsGetResponse_Text, DocumentsGetResponse_Folder + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_update_response.py b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..e5b6468e4ca5eb573525755f224fe335bf94c2a4 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/documents/types/documents_update_response.py @@ -0,0 +1,130 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .....types.auto_sync_info import AutoSyncInfo +from .....types.content_format import ContentFormat +from .....types.document_usage_mode_enum import DocumentUsageModeEnum +from .....types.external_file_sync_info import ExternalFileSyncInfo +from .....types.external_folder_sync_info import ExternalFolderSyncInfo +from .....types.file_refresh_status import FileRefreshStatus +from .....types.kb_external_sync_job import KbExternalSyncJob +from .....types.knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .....types.knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel +from .....types.resource_access_info import ResourceAccessInfo + + +class DocumentsUpdateResponse_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + url: str + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = 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 + + +class DocumentsUpdateResponse_File(UncheckedBaseModel): + type: typing.Literal["file"] = "file" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + filename: str + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = None + is_frozen: 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 + + +class DocumentsUpdateResponse_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = 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 + + +class DocumentsUpdateResponse_Folder(UncheckedBaseModel): + type: typing.Literal["folder"] = "folder" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = None + children_count: int + document_count: int + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: typing.Optional[bool] = None + active_sync_job: typing.Optional[KbExternalSyncJob] = 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 + + +DocumentsUpdateResponse = typing_extensions.Annotated[ + typing.Union[ + DocumentsUpdateResponse_Url, + DocumentsUpdateResponse_File, + DocumentsUpdateResponse_Text, + DocumentsUpdateResponse_Folder, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/raw_client.py b/data/src/elevenlabs/conversational_ai/knowledge_base/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..0bc5c00fa81cc6dc5c7c901467a8914f2198508d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/raw_client.py @@ -0,0 +1,546 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.get_knowledge_base_list_response_model import GetKnowledgeBaseListResponseModel +from ...types.get_or_create_rag_index_request_model import GetOrCreateRagIndexRequestModel +from ...types.knowledge_base_content_search_response_model import KnowledgeBaseContentSearchResponseModel +from ...types.knowledge_base_document_type import KnowledgeBaseDocumentType +from ...types.knowledge_base_sort_by import KnowledgeBaseSortBy +from ...types.sort_direction import SortDirection +from .types.knowledge_base_get_or_create_rag_indexes_response_value import ( + KnowledgeBaseGetOrCreateRagIndexesResponseValue, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawKnowledgeBaseClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + show_only_owned_documents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + types: typing.Optional[ + typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]] + ] = None, + parent_folder_id: typing.Optional[str] = None, + ancestor_folder_id: typing.Optional[str] = None, + folders_first: typing.Optional[bool] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[KnowledgeBaseSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetKnowledgeBaseListResponseModel]: + """ + Get a list of available knowledge base documents + + Parameters + ---------- + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + If specified, the endpoint returns only such knowledge base documents whose names start with this string. + + show_only_owned_documents : typing.Optional[bool] + If set to true, the endpoint will return only documents owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter documents by creator user ID. When set, only documents created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + + types : typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]] + If present, the endpoint will return only documents of the given types. + + parent_folder_id : typing.Optional[str] + If set, the endpoint will return only documents that are direct children of the given folder. + + ancestor_folder_id : typing.Optional[str] + If set, the endpoint will return only documents that are descendants of the given folder. + + folders_first : typing.Optional[bool] + Whether folders should be returned first in the list of documents. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[KnowledgeBaseSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetKnowledgeBaseListResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base", + method="GET", + params={ + "page_size": page_size, + "search": search, + "show_only_owned_documents": show_only_owned_documents, + "created_by_user_id": created_by_user_id, + "types": types, + "parent_folder_id": parent_folder_id, + "ancestor_folder_id": ancestor_folder_id, + "folders_first": folders_first, + "sort_direction": sort_direction, + "sort_by": sort_by, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetKnowledgeBaseListResponseModel, + construct_type( + type_=GetKnowledgeBaseListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_or_create_rag_indexes( + self, + *, + items: typing.Sequence[GetOrCreateRagIndexRequestModel], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue]]: + """ + Retrieves and/or creates RAG indexes for multiple knowledge base documents in a single request. Maximum 100 items per request. + + Parameters + ---------- + items : typing.Sequence[GetOrCreateRagIndexRequestModel] + List of requested RAG indexes. Minimum 1, maximum 100 items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/rag-index", + method="POST", + json={ + "items": convert_and_respect_annotation_metadata( + object_=items, annotation=typing.Sequence[GetOrCreateRagIndexRequestModel], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue], + construct_type( + type_=typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def search( + self, + *, + query: str, + page_size: typing.Optional[int] = None, + types: typing.Optional[ + typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]] + ] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[KnowledgeBaseContentSearchResponseModel]: + """ + Fuzzy text search over knowledge base document content + + Parameters + ---------- + query : str + The search query text + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + types : typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]] + If present, the endpoint will return only documents of the given types. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[KnowledgeBaseContentSearchResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/search", + method="GET", + params={ + "query": query, + "page_size": page_size, + "types": types, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + KnowledgeBaseContentSearchResponseModel, + construct_type( + type_=KnowledgeBaseContentSearchResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawKnowledgeBaseClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + show_only_owned_documents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + types: typing.Optional[ + typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]] + ] = None, + parent_folder_id: typing.Optional[str] = None, + ancestor_folder_id: typing.Optional[str] = None, + folders_first: typing.Optional[bool] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[KnowledgeBaseSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetKnowledgeBaseListResponseModel]: + """ + Get a list of available knowledge base documents + + Parameters + ---------- + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + If specified, the endpoint returns only such knowledge base documents whose names start with this string. + + show_only_owned_documents : typing.Optional[bool] + If set to true, the endpoint will return only documents owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter documents by creator user ID. When set, only documents created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + + types : typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]] + If present, the endpoint will return only documents of the given types. + + parent_folder_id : typing.Optional[str] + If set, the endpoint will return only documents that are direct children of the given folder. + + ancestor_folder_id : typing.Optional[str] + If set, the endpoint will return only documents that are descendants of the given folder. + + folders_first : typing.Optional[bool] + Whether folders should be returned first in the list of documents. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[KnowledgeBaseSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetKnowledgeBaseListResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base", + method="GET", + params={ + "page_size": page_size, + "search": search, + "show_only_owned_documents": show_only_owned_documents, + "created_by_user_id": created_by_user_id, + "types": types, + "parent_folder_id": parent_folder_id, + "ancestor_folder_id": ancestor_folder_id, + "folders_first": folders_first, + "sort_direction": sort_direction, + "sort_by": sort_by, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetKnowledgeBaseListResponseModel, + construct_type( + type_=GetKnowledgeBaseListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_or_create_rag_indexes( + self, + *, + items: typing.Sequence[GetOrCreateRagIndexRequestModel], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue]]: + """ + Retrieves and/or creates RAG indexes for multiple knowledge base documents in a single request. Maximum 100 items per request. + + Parameters + ---------- + items : typing.Sequence[GetOrCreateRagIndexRequestModel] + List of requested RAG indexes. Minimum 1, maximum 100 items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/rag-index", + method="POST", + json={ + "items": convert_and_respect_annotation_metadata( + object_=items, annotation=typing.Sequence[GetOrCreateRagIndexRequestModel], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue], + construct_type( + type_=typing.Dict[str, KnowledgeBaseGetOrCreateRagIndexesResponseValue], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def search( + self, + *, + query: str, + page_size: typing.Optional[int] = None, + types: typing.Optional[ + typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]] + ] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[KnowledgeBaseContentSearchResponseModel]: + """ + Fuzzy text search over knowledge base document content + + Parameters + ---------- + query : str + The search query text + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + types : typing.Optional[typing.Union[KnowledgeBaseDocumentType, typing.Sequence[KnowledgeBaseDocumentType]]] + If present, the endpoint will return only documents of the given types. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[KnowledgeBaseContentSearchResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/search", + method="GET", + params={ + "query": query, + "page_size": page_size, + "types": types, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + KnowledgeBaseContentSearchResponseModel, + construct_type( + type_=KnowledgeBaseContentSearchResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/types/__init__.py b/data/src/elevenlabs/conversational_ai/knowledge_base/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..17a5cc3923ac3099fd2634941875270ee33600f1 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/types/__init__.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .knowledge_base_get_or_create_rag_indexes_response_value import ( + KnowledgeBaseGetOrCreateRagIndexesResponseValue, + KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure, + KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success, + ) +_dynamic_imports: typing.Dict[str, str] = { + "KnowledgeBaseGetOrCreateRagIndexesResponseValue": ".knowledge_base_get_or_create_rag_indexes_response_value", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure": ".knowledge_base_get_or_create_rag_indexes_response_value", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success": ".knowledge_base_get_or_create_rag_indexes_response_value", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "KnowledgeBaseGetOrCreateRagIndexesResponseValue", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure", + "KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success", +] diff --git a/data/src/elevenlabs/conversational_ai/knowledge_base/types/knowledge_base_get_or_create_rag_indexes_response_value.py b/data/src/elevenlabs/conversational_ai/knowledge_base/types/knowledge_base_get_or_create_rag_indexes_response_value.py new file mode 100644 index 0000000000000000000000000000000000000000..2e384b3b7808697ee086d78d9b01e55e9ab66cd0 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/knowledge_base/types/knowledge_base_get_or_create_rag_indexes_response_value.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.rag_document_index_response_model import RagDocumentIndexResponseModel + + +class KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success(UncheckedBaseModel): + status: typing.Literal["success"] = "success" + data: RagDocumentIndexResponseModel + + 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 + + +class KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure(UncheckedBaseModel): + status: typing.Literal["failure"] = "failure" + error_code: int + error_status: str + error_message: 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 + + +KnowledgeBaseGetOrCreateRagIndexesResponseValue = typing_extensions.Annotated[ + typing.Union[ + KnowledgeBaseGetOrCreateRagIndexesResponseValue_Success, KnowledgeBaseGetOrCreateRagIndexesResponseValue_Failure + ], + UnionMetadata(discriminant="status"), +] diff --git a/data/src/elevenlabs/conversational_ai/llm/__init__.py b/data/src/elevenlabs/conversational_ai/llm/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/llm/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/llm/client.py b/data/src/elevenlabs/conversational_ai/llm/client.py new file mode 100644 index 0000000000000000000000000000000000000000..134b0a602cb2dfc1be3348acf087d928b1190f78 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/llm/client.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.llm_list_response_model import LlmListResponseModel +from .raw_client import AsyncRawLlmClient, RawLlmClient + + +class LlmClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLlmClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLlmClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLlmClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> LlmListResponseModel: + """ + Returns a list of available LLM models that can be used with agents, including their capabilities and any deprecation status. The response is filtered based on the data residency of the deployment and any compliance requirements (e.g. HIPAA) of the workspace subscription. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmListResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.llm.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + +class AsyncLlmClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLlmClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLlmClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLlmClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> LlmListResponseModel: + """ + Returns a list of available LLM models that can be used with agents, including their capabilities and any deprecation status. The response is filtered based on the data residency of the deployment and any compliance requirements (e.g. HIPAA) of the workspace subscription. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmListResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.llm.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/llm/raw_client.py b/data/src/elevenlabs/conversational_ai/llm/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..bc142475b73c40a18821094b1fa9abeee401f86b --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/llm/raw_client.py @@ -0,0 +1,124 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.llm_list_response_model import LlmListResponseModel +from pydantic import ValidationError + + +class RawLlmClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[LlmListResponseModel]: + """ + Returns a list of available LLM models that can be used with agents, including their capabilities and any deprecation status. The response is filtered based on the data residency of the deployment and any compliance requirements (e.g. HIPAA) of the workspace subscription. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[LlmListResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/llm/list", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmListResponseModel, + construct_type( + type_=LlmListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLlmClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[LlmListResponseModel]: + """ + Returns a list of available LLM models that can be used with agents, including their capabilities and any deprecation status. The response is filtered based on the data residency of the deployment and any compliance requirements (e.g. HIPAA) of the workspace subscription. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[LlmListResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/llm/list", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmListResponseModel, + construct_type( + type_=LlmListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/llm_usage/__init__.py b/data/src/elevenlabs/conversational_ai/llm_usage/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/llm_usage/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/llm_usage/client.py b/data/src/elevenlabs/conversational_ai/llm_usage/client.py new file mode 100644 index 0000000000000000000000000000000000000000..674d98471bb9a5b6bb9dbbfafed620d61d70c314 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/llm_usage/client.py @@ -0,0 +1,153 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel +from .raw_client import AsyncRawLlmUsageClient, RawLlmUsageClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class LlmUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLlmUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLlmUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLlmUsageClient + """ + return self._raw_client + + def calculate( + self, + *, + prompt_length: int, + number_of_pages: int, + rag_enabled: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> LlmUsageCalculatorResponseModel: + """ + Returns a list of LLM models and the expected cost for using them based on the provided values. + + Parameters + ---------- + prompt_length : int + Length of the prompt in characters. + + number_of_pages : int + Pages of content in PDF documents or URLs in the agent's knowledge base. + + rag_enabled : bool + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmUsageCalculatorResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.llm_usage.calculate( + prompt_length=1, + number_of_pages=1, + rag_enabled=True, + ) + """ + _response = self._raw_client.calculate( + prompt_length=prompt_length, + number_of_pages=number_of_pages, + rag_enabled=rag_enabled, + request_options=request_options, + ) + return _response.data + + +class AsyncLlmUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLlmUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLlmUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLlmUsageClient + """ + return self._raw_client + + async def calculate( + self, + *, + prompt_length: int, + number_of_pages: int, + rag_enabled: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> LlmUsageCalculatorResponseModel: + """ + Returns a list of LLM models and the expected cost for using them based on the provided values. + + Parameters + ---------- + prompt_length : int + Length of the prompt in characters. + + number_of_pages : int + Pages of content in PDF documents or URLs in the agent's knowledge base. + + rag_enabled : bool + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LlmUsageCalculatorResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.llm_usage.calculate( + prompt_length=1, + number_of_pages=1, + rag_enabled=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.calculate( + prompt_length=prompt_length, + number_of_pages=number_of_pages, + rag_enabled=rag_enabled, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/llm_usage/raw_client.py b/data/src/elevenlabs/conversational_ai/llm_usage/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..ecca783589edcf50eb59051e839ba11db7c22af5 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/llm_usage/raw_client.py @@ -0,0 +1,175 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawLlmUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def calculate( + self, + *, + prompt_length: int, + number_of_pages: int, + rag_enabled: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[LlmUsageCalculatorResponseModel]: + """ + Returns a list of LLM models and the expected cost for using them based on the provided values. + + Parameters + ---------- + prompt_length : int + Length of the prompt in characters. + + number_of_pages : int + Pages of content in PDF documents or URLs in the agent's knowledge base. + + rag_enabled : bool + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[LlmUsageCalculatorResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/llm-usage/calculate", + method="POST", + json={ + "prompt_length": prompt_length, + "number_of_pages": number_of_pages, + "rag_enabled": rag_enabled, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmUsageCalculatorResponseModel, + construct_type( + type_=LlmUsageCalculatorResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLlmUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def calculate( + self, + *, + prompt_length: int, + number_of_pages: int, + rag_enabled: bool, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[LlmUsageCalculatorResponseModel]: + """ + Returns a list of LLM models and the expected cost for using them based on the provided values. + + Parameters + ---------- + prompt_length : int + Length of the prompt in characters. + + number_of_pages : int + Pages of content in PDF documents or URLs in the agent's knowledge base. + + rag_enabled : bool + Whether RAG is enabled. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[LlmUsageCalculatorResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/llm-usage/calculate", + method="POST", + json={ + "prompt_length": prompt_length, + "number_of_pages": number_of_pages, + "rag_enabled": rag_enabled, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LlmUsageCalculatorResponseModel, + construct_type( + type_=LlmUsageCalculatorResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/__init__.py b/data/src/elevenlabs/conversational_ai/mcp_servers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1b3fadd9068ba09b9528efc30a5563a71336df04 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/__init__.py @@ -0,0 +1,93 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + McpServerConfigUpdateRequestModelAuthConnection, + McpServerConfigUpdateRequestModelRequestHeadersValue, + McpServerConfigUpdateRequestModelRequestMetaValue, + ) + from . import approval_policy, tool_approvals, tool_configs, tools + from .tool_configs import ( + McpToolConfigOverrideCreateRequestModelInputOverridesValue, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit, + McpToolConfigOverrideCreateRequestModelToolCallSound, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit, + McpToolConfigOverrideUpdateRequestModelToolCallSound, + ) +_dynamic_imports: typing.Dict[str, str] = { + "McpServerConfigUpdateRequestModelAuthConnection": ".types", + "McpServerConfigUpdateRequestModelRequestHeadersValue": ".types", + "McpServerConfigUpdateRequestModelRequestMetaValue": ".types", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue": ".tool_configs", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant": ".tool_configs", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable": ".tool_configs", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm": ".tool_configs", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit": ".tool_configs", + "McpToolConfigOverrideCreateRequestModelToolCallSound": ".tool_configs", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue": ".tool_configs", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant": ".tool_configs", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable": ".tool_configs", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm": ".tool_configs", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit": ".tool_configs", + "McpToolConfigOverrideUpdateRequestModelToolCallSound": ".tool_configs", + "approval_policy": ".approval_policy", + "tool_approvals": ".tool_approvals", + "tool_configs": ".tool_configs", + "tools": ".tools", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "McpServerConfigUpdateRequestModelAuthConnection", + "McpServerConfigUpdateRequestModelRequestHeadersValue", + "McpServerConfigUpdateRequestModelRequestMetaValue", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit", + "McpToolConfigOverrideCreateRequestModelToolCallSound", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit", + "McpToolConfigOverrideUpdateRequestModelToolCallSound", + "approval_policy", + "tool_approvals", + "tool_configs", + "tools", +] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/__init__.py b/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/client.py new file mode 100644 index 0000000000000000000000000000000000000000..85ec9765503a6a95f16fbb8c9a4c6a885458896d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/client.py @@ -0,0 +1,138 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.mcp_approval_policy import McpApprovalPolicy +from ....types.mcp_server_response_model import McpServerResponseModel +from .raw_client import AsyncRawApprovalPolicyClient, RawApprovalPolicyClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ApprovalPolicyClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawApprovalPolicyClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawApprovalPolicyClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawApprovalPolicyClient + """ + return self._raw_client + + def update( + self, + mcp_server_id: str, + *, + approval_policy: McpApprovalPolicy, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Update the approval policy configuration for an MCP server. DEPRECATED: Use PATCH /mcp-servers/{id} endpoint instead. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + approval_policy : McpApprovalPolicy + The approval mode to set for the MCP server + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.approval_policy.update( + mcp_server_id="mcp_server_id", + approval_policy="auto_approve_all", + ) + """ + _response = self._raw_client.update( + mcp_server_id, approval_policy=approval_policy, request_options=request_options + ) + return _response.data + + +class AsyncApprovalPolicyClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawApprovalPolicyClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawApprovalPolicyClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawApprovalPolicyClient + """ + return self._raw_client + + async def update( + self, + mcp_server_id: str, + *, + approval_policy: McpApprovalPolicy, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Update the approval policy configuration for an MCP server. DEPRECATED: Use PATCH /mcp-servers/{id} endpoint instead. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + approval_policy : McpApprovalPolicy + The approval mode to set for the MCP server + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.approval_policy.update( + mcp_server_id="mcp_server_id", + approval_policy="auto_approve_all", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + mcp_server_id, approval_policy=approval_policy, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/raw_client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..9556548b871723d98fbe4f6af8ea1073814d4018 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/approval_policy/raw_client.py @@ -0,0 +1,165 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.mcp_approval_policy import McpApprovalPolicy +from ....types.mcp_server_response_model import McpServerResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawApprovalPolicyClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def update( + self, + mcp_server_id: str, + *, + approval_policy: McpApprovalPolicy, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[McpServerResponseModel]: + """ + Update the approval policy configuration for an MCP server. DEPRECATED: Use PATCH /mcp-servers/{id} endpoint instead. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + approval_policy : McpApprovalPolicy + The approval mode to set for the MCP server + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/approval-policy", + method="PATCH", + json={ + "approval_policy": approval_policy, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawApprovalPolicyClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def update( + self, + mcp_server_id: str, + *, + approval_policy: McpApprovalPolicy, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Update the approval policy configuration for an MCP server. DEPRECATED: Use PATCH /mcp-servers/{id} endpoint instead. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + approval_policy : McpApprovalPolicy + The approval mode to set for the MCP server + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/approval-policy", + method="PATCH", + json={ + "approval_policy": approval_policy, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/client.py new file mode 100644 index 0000000000000000000000000000000000000000..f313ba7f71abc1e2b6e69d6d341b6f38541c72f0 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/client.py @@ -0,0 +1,662 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.conv_ai_secret_locator import ConvAiSecretLocator +from ...types.mcp_approval_policy import McpApprovalPolicy +from ...types.mcp_server_config_input import McpServerConfigInput +from ...types.mcp_server_response_model import McpServerResponseModel +from ...types.mcp_servers_response_model import McpServersResponseModel +from ...types.pre_tool_speech_mode import PreToolSpeechMode +from ...types.tool_call_sound_behavior import ToolCallSoundBehavior +from ...types.tool_call_sound_type import ToolCallSoundType +from ...types.tool_execution_mode import ToolExecutionMode +from ...types.tool_interruption_mode import ToolInterruptionMode +from .raw_client import AsyncRawMcpServersClient, RawMcpServersClient +from .types.mcp_server_config_update_request_model_auth_connection import ( + McpServerConfigUpdateRequestModelAuthConnection, +) +from .types.mcp_server_config_update_request_model_request_headers_value import ( + McpServerConfigUpdateRequestModelRequestHeadersValue, +) +from .types.mcp_server_config_update_request_model_request_meta_value import ( + McpServerConfigUpdateRequestModelRequestMetaValue, +) + +if typing.TYPE_CHECKING: + from .approval_policy.client import ApprovalPolicyClient, AsyncApprovalPolicyClient + from .tool_approvals.client import AsyncToolApprovalsClient, ToolApprovalsClient + from .tool_configs.client import AsyncToolConfigsClient, ToolConfigsClient + from .tools.client import AsyncToolsClient, ToolsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class McpServersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawMcpServersClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._tools: typing.Optional[ToolsClient] = None + self._approval_policy: typing.Optional[ApprovalPolicyClient] = None + self._tool_approvals: typing.Optional[ToolApprovalsClient] = None + self._tool_configs: typing.Optional[ToolConfigsClient] = None + + @property + def with_raw_response(self) -> RawMcpServersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawMcpServersClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> McpServersResponseModel: + """ + Retrieve all MCP server configurations available in the workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServersResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def create( + self, *, config: McpServerConfigInput, request_options: typing.Optional[RequestOptions] = None + ) -> McpServerResponseModel: + """ + Create a new MCP server configuration in the workspace. + + Parameters + ---------- + config : McpServerConfigInput + Configuration details for the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, McpServerConfigInput + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.create( + config=McpServerConfigInput( + url="url", + name="name", + ), + ) + """ + _response = self._raw_client.create(config=config, request_options=request_options) + return _response.data + + def get( + self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> McpServerResponseModel: + """ + Retrieve a specific MCP server configuration from the workspace. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.get( + mcp_server_id="mcp_server_id", + ) + """ + _response = self._raw_client.get(mcp_server_id, request_options=request_options) + return _response.data + + def delete(self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete a specific MCP server configuration from the workspace. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.delete( + mcp_server_id="mcp_server_id", + ) + """ + _response = self._raw_client.delete(mcp_server_id, request_options=request_options) + return _response.data + + def update( + self, + mcp_server_id: str, + *, + approval_policy: typing.Optional[McpApprovalPolicy] = OMIT, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[ToolCallSoundType] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + request_headers: typing.Optional[ + typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]] + ] = OMIT, + request_meta: typing.Optional[ + typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]] + ] = OMIT, + disable_compression: typing.Optional[bool] = OMIT, + secret_token: typing.Optional[ConvAiSecretLocator] = OMIT, + auth_connection: typing.Optional[McpServerConfigUpdateRequestModelAuthConnection] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Update the configuration settings for an MCP server. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + approval_policy : typing.Optional[McpApprovalPolicy] + The approval mode to set for the MCP server + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[ToolCallSoundType] + Predefined tool call sound type to play during tool execution for all tools from this MCP server + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + Determines when the tool call sound should play for all tools from this MCP server + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + The maximum time in seconds to wait for each MCP tool call to complete. + + request_headers : typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]]] + The headers to include in requests to the MCP server + + request_meta : typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]]] + Entries sent in the MCP `_meta` field of tools/call requests. Values may be JSON scalars, or references to a workspace secret, dynamic variable, or environment variable resolved per call. + + disable_compression : typing.Optional[bool] + Whether to disable HTTP compression for this MCP server + + secret_token : typing.Optional[ConvAiSecretLocator] + Optional secret token for authentication with this MCP server + + auth_connection : typing.Optional[McpServerConfigUpdateRequestModelAuthConnection] + Optional auth connection to use for authentication with this MCP server + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.update( + mcp_server_id="mcp_server_id", + ) + """ + _response = self._raw_client.update( + mcp_server_id, + approval_policy=approval_policy, + force_pre_tool_speech=force_pre_tool_speech, + pre_tool_speech=pre_tool_speech, + disable_interruptions=disable_interruptions, + interruption_mode=interruption_mode, + tool_call_sound=tool_call_sound, + tool_call_sound_behavior=tool_call_sound_behavior, + execution_mode=execution_mode, + response_timeout_secs=response_timeout_secs, + request_headers=request_headers, + request_meta=request_meta, + disable_compression=disable_compression, + secret_token=secret_token, + auth_connection=auth_connection, + request_options=request_options, + ) + return _response.data + + @property + def tools(self): + if self._tools is None: + from .tools.client import ToolsClient # noqa: E402 + + self._tools = ToolsClient(client_wrapper=self._client_wrapper) + return self._tools + + @property + def approval_policy(self): + if self._approval_policy is None: + from .approval_policy.client import ApprovalPolicyClient # noqa: E402 + + self._approval_policy = ApprovalPolicyClient(client_wrapper=self._client_wrapper) + return self._approval_policy + + @property + def tool_approvals(self): + if self._tool_approvals is None: + from .tool_approvals.client import ToolApprovalsClient # noqa: E402 + + self._tool_approvals = ToolApprovalsClient(client_wrapper=self._client_wrapper) + return self._tool_approvals + + @property + def tool_configs(self): + if self._tool_configs is None: + from .tool_configs.client import ToolConfigsClient # noqa: E402 + + self._tool_configs = ToolConfigsClient(client_wrapper=self._client_wrapper) + return self._tool_configs + + +class AsyncMcpServersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawMcpServersClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._tools: typing.Optional[AsyncToolsClient] = None + self._approval_policy: typing.Optional[AsyncApprovalPolicyClient] = None + self._tool_approvals: typing.Optional[AsyncToolApprovalsClient] = None + self._tool_configs: typing.Optional[AsyncToolConfigsClient] = None + + @property + def with_raw_response(self) -> AsyncRawMcpServersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawMcpServersClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> McpServersResponseModel: + """ + Retrieve all MCP server configurations available in the workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServersResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, *, config: McpServerConfigInput, request_options: typing.Optional[RequestOptions] = None + ) -> McpServerResponseModel: + """ + Create a new MCP server configuration in the workspace. + + Parameters + ---------- + config : McpServerConfigInput + Configuration details for the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, McpServerConfigInput + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.create( + config=McpServerConfigInput( + url="url", + name="name", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(config=config, request_options=request_options) + return _response.data + + async def get( + self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> McpServerResponseModel: + """ + Retrieve a specific MCP server configuration from the workspace. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.get( + mcp_server_id="mcp_server_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(mcp_server_id, request_options=request_options) + return _response.data + + async def delete( + self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a specific MCP server configuration from the workspace. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.delete( + mcp_server_id="mcp_server_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(mcp_server_id, request_options=request_options) + return _response.data + + async def update( + self, + mcp_server_id: str, + *, + approval_policy: typing.Optional[McpApprovalPolicy] = OMIT, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[ToolCallSoundType] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + request_headers: typing.Optional[ + typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]] + ] = OMIT, + request_meta: typing.Optional[ + typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]] + ] = OMIT, + disable_compression: typing.Optional[bool] = OMIT, + secret_token: typing.Optional[ConvAiSecretLocator] = OMIT, + auth_connection: typing.Optional[McpServerConfigUpdateRequestModelAuthConnection] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Update the configuration settings for an MCP server. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + approval_policy : typing.Optional[McpApprovalPolicy] + The approval mode to set for the MCP server + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[ToolCallSoundType] + Predefined tool call sound type to play during tool execution for all tools from this MCP server + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + Determines when the tool call sound should play for all tools from this MCP server + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + The maximum time in seconds to wait for each MCP tool call to complete. + + request_headers : typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]]] + The headers to include in requests to the MCP server + + request_meta : typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]]] + Entries sent in the MCP `_meta` field of tools/call requests. Values may be JSON scalars, or references to a workspace secret, dynamic variable, or environment variable resolved per call. + + disable_compression : typing.Optional[bool] + Whether to disable HTTP compression for this MCP server + + secret_token : typing.Optional[ConvAiSecretLocator] + Optional secret token for authentication with this MCP server + + auth_connection : typing.Optional[McpServerConfigUpdateRequestModelAuthConnection] + Optional auth connection to use for authentication with this MCP server + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.update( + mcp_server_id="mcp_server_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + mcp_server_id, + approval_policy=approval_policy, + force_pre_tool_speech=force_pre_tool_speech, + pre_tool_speech=pre_tool_speech, + disable_interruptions=disable_interruptions, + interruption_mode=interruption_mode, + tool_call_sound=tool_call_sound, + tool_call_sound_behavior=tool_call_sound_behavior, + execution_mode=execution_mode, + response_timeout_secs=response_timeout_secs, + request_headers=request_headers, + request_meta=request_meta, + disable_compression=disable_compression, + secret_token=secret_token, + auth_connection=auth_connection, + request_options=request_options, + ) + return _response.data + + @property + def tools(self): + if self._tools is None: + from .tools.client import AsyncToolsClient # noqa: E402 + + self._tools = AsyncToolsClient(client_wrapper=self._client_wrapper) + return self._tools + + @property + def approval_policy(self): + if self._approval_policy is None: + from .approval_policy.client import AsyncApprovalPolicyClient # noqa: E402 + + self._approval_policy = AsyncApprovalPolicyClient(client_wrapper=self._client_wrapper) + return self._approval_policy + + @property + def tool_approvals(self): + if self._tool_approvals is None: + from .tool_approvals.client import AsyncToolApprovalsClient # noqa: E402 + + self._tool_approvals = AsyncToolApprovalsClient(client_wrapper=self._client_wrapper) + return self._tool_approvals + + @property + def tool_configs(self): + if self._tool_configs is None: + from .tool_configs.client import AsyncToolConfigsClient # noqa: E402 + + self._tool_configs = AsyncToolConfigsClient(client_wrapper=self._client_wrapper) + return self._tool_configs diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/raw_client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..0c947107eb6e38b534f5b5fd17147726685968e1 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/raw_client.py @@ -0,0 +1,795 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.conv_ai_secret_locator import ConvAiSecretLocator +from ...types.mcp_approval_policy import McpApprovalPolicy +from ...types.mcp_server_config_input import McpServerConfigInput +from ...types.mcp_server_response_model import McpServerResponseModel +from ...types.mcp_servers_response_model import McpServersResponseModel +from ...types.pre_tool_speech_mode import PreToolSpeechMode +from ...types.tool_call_sound_behavior import ToolCallSoundBehavior +from ...types.tool_call_sound_type import ToolCallSoundType +from ...types.tool_execution_mode import ToolExecutionMode +from ...types.tool_interruption_mode import ToolInterruptionMode +from .types.mcp_server_config_update_request_model_auth_connection import ( + McpServerConfigUpdateRequestModelAuthConnection, +) +from .types.mcp_server_config_update_request_model_request_headers_value import ( + McpServerConfigUpdateRequestModelRequestHeadersValue, +) +from .types.mcp_server_config_update_request_model_request_meta_value import ( + McpServerConfigUpdateRequestModelRequestMetaValue, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawMcpServersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[McpServersResponseModel]: + """ + Retrieve all MCP server configurations available in the workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServersResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/mcp-servers", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServersResponseModel, + construct_type( + type_=McpServersResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, config: McpServerConfigInput, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[McpServerResponseModel]: + """ + Create a new MCP server configuration in the workspace. + + Parameters + ---------- + config : McpServerConfigInput + Configuration details for the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/mcp-servers", + method="POST", + json={ + "config": convert_and_respect_annotation_metadata( + object_=config, annotation=McpServerConfigInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[McpServerResponseModel]: + """ + Retrieve a specific MCP server configuration from the workspace. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Delete a specific MCP server configuration from the workspace. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + mcp_server_id: str, + *, + approval_policy: typing.Optional[McpApprovalPolicy] = OMIT, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[ToolCallSoundType] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + request_headers: typing.Optional[ + typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]] + ] = OMIT, + request_meta: typing.Optional[ + typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]] + ] = OMIT, + disable_compression: typing.Optional[bool] = OMIT, + secret_token: typing.Optional[ConvAiSecretLocator] = OMIT, + auth_connection: typing.Optional[McpServerConfigUpdateRequestModelAuthConnection] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[McpServerResponseModel]: + """ + Update the configuration settings for an MCP server. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + approval_policy : typing.Optional[McpApprovalPolicy] + The approval mode to set for the MCP server + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[ToolCallSoundType] + Predefined tool call sound type to play during tool execution for all tools from this MCP server + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + Determines when the tool call sound should play for all tools from this MCP server + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + The maximum time in seconds to wait for each MCP tool call to complete. + + request_headers : typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]]] + The headers to include in requests to the MCP server + + request_meta : typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]]] + Entries sent in the MCP `_meta` field of tools/call requests. Values may be JSON scalars, or references to a workspace secret, dynamic variable, or environment variable resolved per call. + + disable_compression : typing.Optional[bool] + Whether to disable HTTP compression for this MCP server + + secret_token : typing.Optional[ConvAiSecretLocator] + Optional secret token for authentication with this MCP server + + auth_connection : typing.Optional[McpServerConfigUpdateRequestModelAuthConnection] + Optional auth connection to use for authentication with this MCP server + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}", + method="PATCH", + json={ + "approval_policy": approval_policy, + "force_pre_tool_speech": force_pre_tool_speech, + "pre_tool_speech": pre_tool_speech, + "disable_interruptions": disable_interruptions, + "interruption_mode": interruption_mode, + "tool_call_sound": tool_call_sound, + "tool_call_sound_behavior": tool_call_sound_behavior, + "execution_mode": execution_mode, + "response_timeout_secs": response_timeout_secs, + "request_headers": convert_and_respect_annotation_metadata( + object_=request_headers, + annotation=typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]], + direction="write", + ), + "request_meta": convert_and_respect_annotation_metadata( + object_=request_meta, + annotation=typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]], + direction="write", + ), + "disable_compression": disable_compression, + "secret_token": convert_and_respect_annotation_metadata( + object_=secret_token, annotation=ConvAiSecretLocator, direction="write" + ), + "auth_connection": convert_and_respect_annotation_metadata( + object_=auth_connection, + annotation=McpServerConfigUpdateRequestModelAuthConnection, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawMcpServersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[McpServersResponseModel]: + """ + Retrieve all MCP server configurations available in the workspace. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServersResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/mcp-servers", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServersResponseModel, + construct_type( + type_=McpServersResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, config: McpServerConfigInput, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Create a new MCP server configuration in the workspace. + + Parameters + ---------- + config : McpServerConfigInput + Configuration details for the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/mcp-servers", + method="POST", + json={ + "config": convert_and_respect_annotation_metadata( + object_=config, annotation=McpServerConfigInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Retrieve a specific MCP server configuration from the workspace. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, mcp_server_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete a specific MCP server configuration from the workspace. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + mcp_server_id: str, + *, + approval_policy: typing.Optional[McpApprovalPolicy] = OMIT, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[ToolCallSoundType] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + request_headers: typing.Optional[ + typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]] + ] = OMIT, + request_meta: typing.Optional[ + typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]] + ] = OMIT, + disable_compression: typing.Optional[bool] = OMIT, + secret_token: typing.Optional[ConvAiSecretLocator] = OMIT, + auth_connection: typing.Optional[McpServerConfigUpdateRequestModelAuthConnection] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Update the configuration settings for an MCP server. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + approval_policy : typing.Optional[McpApprovalPolicy] + The approval mode to set for the MCP server + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[ToolCallSoundType] + Predefined tool call sound type to play during tool execution for all tools from this MCP server + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + Determines when the tool call sound should play for all tools from this MCP server + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + The maximum time in seconds to wait for each MCP tool call to complete. + + request_headers : typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]]] + The headers to include in requests to the MCP server + + request_meta : typing.Optional[typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]]] + Entries sent in the MCP `_meta` field of tools/call requests. Values may be JSON scalars, or references to a workspace secret, dynamic variable, or environment variable resolved per call. + + disable_compression : typing.Optional[bool] + Whether to disable HTTP compression for this MCP server + + secret_token : typing.Optional[ConvAiSecretLocator] + Optional secret token for authentication with this MCP server + + auth_connection : typing.Optional[McpServerConfigUpdateRequestModelAuthConnection] + Optional auth connection to use for authentication with this MCP server + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}", + method="PATCH", + json={ + "approval_policy": approval_policy, + "force_pre_tool_speech": force_pre_tool_speech, + "pre_tool_speech": pre_tool_speech, + "disable_interruptions": disable_interruptions, + "interruption_mode": interruption_mode, + "tool_call_sound": tool_call_sound, + "tool_call_sound_behavior": tool_call_sound_behavior, + "execution_mode": execution_mode, + "response_timeout_secs": response_timeout_secs, + "request_headers": convert_and_respect_annotation_metadata( + object_=request_headers, + annotation=typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestHeadersValue]], + direction="write", + ), + "request_meta": convert_and_respect_annotation_metadata( + object_=request_meta, + annotation=typing.Dict[str, typing.Optional[McpServerConfigUpdateRequestModelRequestMetaValue]], + direction="write", + ), + "disable_compression": disable_compression, + "secret_token": convert_and_respect_annotation_metadata( + object_=secret_token, annotation=ConvAiSecretLocator, direction="write" + ), + "auth_connection": convert_and_respect_annotation_metadata( + object_=auth_connection, + annotation=McpServerConfigUpdateRequestModelAuthConnection, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/__init__.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7c1428451bdc9e1ec0f1377f1ea911a90ea3de96 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/client.py @@ -0,0 +1,256 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.mcp_server_response_model import McpServerResponseModel +from ....types.mcp_tool_approval_policy import McpToolApprovalPolicy +from .raw_client import AsyncRawToolApprovalsClient, RawToolApprovalsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ToolApprovalsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawToolApprovalsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawToolApprovalsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawToolApprovalsClient + """ + return self._raw_client + + def create( + self, + mcp_server_id: str, + *, + tool_name: str, + tool_description: str, + input_schema: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + approval_policy: typing.Optional[McpToolApprovalPolicy] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Add approval for a specific MCP tool when using per-tool approval mode. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + The name of the MCP tool + + tool_description : str + The description of the MCP tool + + input_schema : typing.Optional[typing.Dict[str, typing.Any]] + The input schema of the MCP tool (the schema defined on the MCP server before ElevenLabs does any extra processing) + + approval_policy : typing.Optional[McpToolApprovalPolicy] + The tool-level approval policy + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.tool_approvals.create( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + tool_description="tool_description", + ) + """ + _response = self._raw_client.create( + mcp_server_id, + tool_name=tool_name, + tool_description=tool_description, + input_schema=input_schema, + approval_policy=approval_policy, + request_options=request_options, + ) + return _response.data + + def delete( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> McpServerResponseModel: + """ + Remove approval for a specific MCP tool when using per-tool approval mode. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to remove approval for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.tool_approvals.delete( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + ) + """ + _response = self._raw_client.delete(mcp_server_id, tool_name, request_options=request_options) + return _response.data + + +class AsyncToolApprovalsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawToolApprovalsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawToolApprovalsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawToolApprovalsClient + """ + return self._raw_client + + async def create( + self, + mcp_server_id: str, + *, + tool_name: str, + tool_description: str, + input_schema: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + approval_policy: typing.Optional[McpToolApprovalPolicy] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Add approval for a specific MCP tool when using per-tool approval mode. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + The name of the MCP tool + + tool_description : str + The description of the MCP tool + + input_schema : typing.Optional[typing.Dict[str, typing.Any]] + The input schema of the MCP tool (the schema defined on the MCP server before ElevenLabs does any extra processing) + + approval_policy : typing.Optional[McpToolApprovalPolicy] + The tool-level approval policy + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.tool_approvals.create( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + tool_description="tool_description", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + mcp_server_id, + tool_name=tool_name, + tool_description=tool_description, + input_schema=input_schema, + approval_policy=approval_policy, + request_options=request_options, + ) + return _response.data + + async def delete( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> McpServerResponseModel: + """ + Remove approval for a specific MCP tool when using per-tool approval mode. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to remove approval for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.tool_approvals.delete( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(mcp_server_id, tool_name, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/raw_client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..307b55fd1b5a044e5b4d81cb65d1d09a60af5657 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_approvals/raw_client.py @@ -0,0 +1,309 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.mcp_server_response_model import McpServerResponseModel +from ....types.mcp_tool_approval_policy import McpToolApprovalPolicy +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawToolApprovalsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + mcp_server_id: str, + *, + tool_name: str, + tool_description: str, + input_schema: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + approval_policy: typing.Optional[McpToolApprovalPolicy] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[McpServerResponseModel]: + """ + Add approval for a specific MCP tool when using per-tool approval mode. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + The name of the MCP tool + + tool_description : str + The description of the MCP tool + + input_schema : typing.Optional[typing.Dict[str, typing.Any]] + The input schema of the MCP tool (the schema defined on the MCP server before ElevenLabs does any extra processing) + + approval_policy : typing.Optional[McpToolApprovalPolicy] + The tool-level approval policy + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-approvals", + method="POST", + json={ + "tool_name": tool_name, + "tool_description": tool_description, + "input_schema": input_schema, + "approval_policy": approval_policy, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[McpServerResponseModel]: + """ + Remove approval for a specific MCP tool when using per-tool approval mode. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to remove approval for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-approvals/{jsonable_encoder(tool_name)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawToolApprovalsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + mcp_server_id: str, + *, + tool_name: str, + tool_description: str, + input_schema: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, + approval_policy: typing.Optional[McpToolApprovalPolicy] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Add approval for a specific MCP tool when using per-tool approval mode. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + The name of the MCP tool + + tool_description : str + The description of the MCP tool + + input_schema : typing.Optional[typing.Dict[str, typing.Any]] + The input schema of the MCP tool (the schema defined on the MCP server before ElevenLabs does any extra processing) + + approval_policy : typing.Optional[McpToolApprovalPolicy] + The tool-level approval policy + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-approvals", + method="POST", + json={ + "tool_name": tool_name, + "tool_description": tool_description, + "input_schema": input_schema, + "approval_policy": approval_policy, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Remove approval for a specific MCP tool when using per-tool approval mode. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to remove approval for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-approvals/{jsonable_encoder(tool_name)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/__init__.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3d76609de8cb9c2319159863edd52de3bdd328a7 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/__init__.py @@ -0,0 +1,73 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + McpToolConfigOverrideCreateRequestModelInputOverridesValue, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit, + McpToolConfigOverrideCreateRequestModelToolCallSound, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit, + McpToolConfigOverrideUpdateRequestModelToolCallSound, + ) +_dynamic_imports: typing.Dict[str, str] = { + "McpToolConfigOverrideCreateRequestModelInputOverridesValue": ".types", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant": ".types", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable": ".types", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm": ".types", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit": ".types", + "McpToolConfigOverrideCreateRequestModelToolCallSound": ".types", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue": ".types", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant": ".types", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable": ".types", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm": ".types", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit": ".types", + "McpToolConfigOverrideUpdateRequestModelToolCallSound": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "McpToolConfigOverrideCreateRequestModelInputOverridesValue", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit", + "McpToolConfigOverrideCreateRequestModelToolCallSound", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit", + "McpToolConfigOverrideUpdateRequestModelToolCallSound", +] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a207372debb29ab63ddaed3d115f28ba7f2e76d5 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/client.py @@ -0,0 +1,674 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.dynamic_variable_assignment import DynamicVariableAssignment +from ....types.mcp_server_response_model import McpServerResponseModel +from ....types.mcp_tool_config_override_output import McpToolConfigOverrideOutput +from ....types.pre_tool_speech_mode import PreToolSpeechMode +from ....types.tool_call_sound_behavior import ToolCallSoundBehavior +from ....types.tool_execution_mode import ToolExecutionMode +from ....types.tool_interruption_mode import ToolInterruptionMode +from ....types.tool_response_mock_config_input import ToolResponseMockConfigInput +from .raw_client import AsyncRawToolConfigsClient, RawToolConfigsClient +from .types.mcp_tool_config_override_create_request_model_input_overrides_value import ( + McpToolConfigOverrideCreateRequestModelInputOverridesValue, +) +from .types.mcp_tool_config_override_create_request_model_tool_call_sound import ( + McpToolConfigOverrideCreateRequestModelToolCallSound, +) +from .types.mcp_tool_config_override_update_request_model_input_overrides_value import ( + McpToolConfigOverrideUpdateRequestModelInputOverridesValue, +) +from .types.mcp_tool_config_override_update_request_model_tool_call_sound import ( + McpToolConfigOverrideUpdateRequestModelToolCallSound, +) + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ToolConfigsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawToolConfigsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawToolConfigsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawToolConfigsClient + """ + return self._raw_client + + def create( + self, + mcp_server_id: str, + *, + tool_name: str, + environment: typing.Optional[str] = None, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT, + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]] + ] = OMIT, + response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Create configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + The name of the MCP tool + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound] + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + If set, overrides the server's tool_call_sound_behavior setting for this tool + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + If set, overrides the server's response timeout for this MCP tool. + + assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]] + Dynamic variable assignments for this MCP tool + + input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]] + Mapping of json path to input override configuration + + response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.tool_configs.create( + mcp_server_id="mcp_server_id", + environment="environment", + tool_name="tool_name", + ) + """ + _response = self._raw_client.create( + mcp_server_id, + tool_name=tool_name, + environment=environment, + force_pre_tool_speech=force_pre_tool_speech, + pre_tool_speech=pre_tool_speech, + disable_interruptions=disable_interruptions, + interruption_mode=interruption_mode, + tool_call_sound=tool_call_sound, + tool_call_sound_behavior=tool_call_sound_behavior, + execution_mode=execution_mode, + response_timeout_secs=response_timeout_secs, + assignments=assignments, + input_overrides=input_overrides, + response_mocks=response_mocks, + request_options=request_options, + ) + return _response.data + + def get( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> McpToolConfigOverrideOutput: + """ + Retrieve configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to retrieve config overrides for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpToolConfigOverrideOutput + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.tool_configs.get( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + ) + """ + _response = self._raw_client.get(mcp_server_id, tool_name, request_options=request_options) + return _response.data + + def delete( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> McpServerResponseModel: + """ + Remove configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to remove config overrides for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.tool_configs.delete( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + ) + """ + _response = self._raw_client.delete(mcp_server_id, tool_name, request_options=request_options) + return _response.data + + def update( + self, + mcp_server_id: str, + tool_name: str, + *, + environment: typing.Optional[str] = None, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT, + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]] + ] = OMIT, + response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Update configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to update config overrides for. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound] + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + If set, overrides the server's tool_call_sound_behavior setting for this tool + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + If set, overrides the server's response timeout for this MCP tool. + + assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]] + Dynamic variable assignments for this MCP tool + + input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]] + Mapping of json path to input override configuration + + response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.tool_configs.update( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + environment="environment", + ) + """ + _response = self._raw_client.update( + mcp_server_id, + tool_name, + environment=environment, + force_pre_tool_speech=force_pre_tool_speech, + pre_tool_speech=pre_tool_speech, + disable_interruptions=disable_interruptions, + interruption_mode=interruption_mode, + tool_call_sound=tool_call_sound, + tool_call_sound_behavior=tool_call_sound_behavior, + execution_mode=execution_mode, + response_timeout_secs=response_timeout_secs, + assignments=assignments, + input_overrides=input_overrides, + response_mocks=response_mocks, + request_options=request_options, + ) + return _response.data + + +class AsyncToolConfigsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawToolConfigsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawToolConfigsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawToolConfigsClient + """ + return self._raw_client + + async def create( + self, + mcp_server_id: str, + *, + tool_name: str, + environment: typing.Optional[str] = None, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT, + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]] + ] = OMIT, + response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Create configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + The name of the MCP tool + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound] + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + If set, overrides the server's tool_call_sound_behavior setting for this tool + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + If set, overrides the server's response timeout for this MCP tool. + + assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]] + Dynamic variable assignments for this MCP tool + + input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]] + Mapping of json path to input override configuration + + response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.tool_configs.create( + mcp_server_id="mcp_server_id", + environment="environment", + tool_name="tool_name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + mcp_server_id, + tool_name=tool_name, + environment=environment, + force_pre_tool_speech=force_pre_tool_speech, + pre_tool_speech=pre_tool_speech, + disable_interruptions=disable_interruptions, + interruption_mode=interruption_mode, + tool_call_sound=tool_call_sound, + tool_call_sound_behavior=tool_call_sound_behavior, + execution_mode=execution_mode, + response_timeout_secs=response_timeout_secs, + assignments=assignments, + input_overrides=input_overrides, + response_mocks=response_mocks, + request_options=request_options, + ) + return _response.data + + async def get( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> McpToolConfigOverrideOutput: + """ + Retrieve configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to retrieve config overrides for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpToolConfigOverrideOutput + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.tool_configs.get( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(mcp_server_id, tool_name, request_options=request_options) + return _response.data + + async def delete( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> McpServerResponseModel: + """ + Remove configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to remove config overrides for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.tool_configs.delete( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(mcp_server_id, tool_name, request_options=request_options) + return _response.data + + async def update( + self, + mcp_server_id: str, + tool_name: str, + *, + environment: typing.Optional[str] = None, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT, + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]] + ] = OMIT, + response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> McpServerResponseModel: + """ + Update configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to update config overrides for. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound] + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + If set, overrides the server's tool_call_sound_behavior setting for this tool + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + If set, overrides the server's response timeout for this MCP tool. + + assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]] + Dynamic variable assignments for this MCP tool + + input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]] + Mapping of json path to input override configuration + + response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + McpServerResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.tool_configs.update( + mcp_server_id="mcp_server_id", + tool_name="tool_name", + environment="environment", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + mcp_server_id, + tool_name, + environment=environment, + force_pre_tool_speech=force_pre_tool_speech, + pre_tool_speech=pre_tool_speech, + disable_interruptions=disable_interruptions, + interruption_mode=interruption_mode, + tool_call_sound=tool_call_sound, + tool_call_sound_behavior=tool_call_sound_behavior, + execution_mode=execution_mode, + response_timeout_secs=response_timeout_secs, + assignments=assignments, + input_overrides=input_overrides, + response_mocks=response_mocks, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/raw_client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..2f846a06e524a158ee5ba088d6a804b093fc65c1 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/raw_client.py @@ -0,0 +1,926 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.conflict_error import ConflictError +from ....errors.not_found_error import NotFoundError +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.dynamic_variable_assignment import DynamicVariableAssignment +from ....types.mcp_server_response_model import McpServerResponseModel +from ....types.mcp_tool_config_override_output import McpToolConfigOverrideOutput +from ....types.pre_tool_speech_mode import PreToolSpeechMode +from ....types.tool_call_sound_behavior import ToolCallSoundBehavior +from ....types.tool_execution_mode import ToolExecutionMode +from ....types.tool_interruption_mode import ToolInterruptionMode +from ....types.tool_response_mock_config_input import ToolResponseMockConfigInput +from .types.mcp_tool_config_override_create_request_model_input_overrides_value import ( + McpToolConfigOverrideCreateRequestModelInputOverridesValue, +) +from .types.mcp_tool_config_override_create_request_model_tool_call_sound import ( + McpToolConfigOverrideCreateRequestModelToolCallSound, +) +from .types.mcp_tool_config_override_update_request_model_input_overrides_value import ( + McpToolConfigOverrideUpdateRequestModelInputOverridesValue, +) +from .types.mcp_tool_config_override_update_request_model_tool_call_sound import ( + McpToolConfigOverrideUpdateRequestModelToolCallSound, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawToolConfigsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + mcp_server_id: str, + *, + tool_name: str, + environment: typing.Optional[str] = None, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT, + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]] + ] = OMIT, + response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[McpServerResponseModel]: + """ + Create configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + The name of the MCP tool + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound] + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + If set, overrides the server's tool_call_sound_behavior setting for this tool + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + If set, overrides the server's response timeout for this MCP tool. + + assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]] + Dynamic variable assignments for this MCP tool + + input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]] + Mapping of json path to input override configuration + + response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs", + method="POST", + params={ + "environment": environment, + }, + json={ + "force_pre_tool_speech": force_pre_tool_speech, + "pre_tool_speech": pre_tool_speech, + "disable_interruptions": disable_interruptions, + "interruption_mode": interruption_mode, + "tool_call_sound": convert_and_respect_annotation_metadata( + object_=tool_call_sound, + annotation=McpToolConfigOverrideCreateRequestModelToolCallSound, + direction="write", + ), + "tool_call_sound_behavior": tool_call_sound_behavior, + "execution_mode": execution_mode, + "response_timeout_secs": response_timeout_secs, + "assignments": convert_and_respect_annotation_metadata( + object_=assignments, annotation=typing.Sequence[DynamicVariableAssignment], direction="write" + ), + "input_overrides": convert_and_respect_annotation_metadata( + object_=input_overrides, + annotation=typing.Dict[ + str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue] + ], + direction="write", + ), + "response_mocks": convert_and_respect_annotation_metadata( + object_=response_mocks, annotation=typing.Sequence[ToolResponseMockConfigInput], direction="write" + ), + "tool_name": tool_name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[McpToolConfigOverrideOutput]: + """ + Retrieve configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to retrieve config overrides for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpToolConfigOverrideOutput] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpToolConfigOverrideOutput, + construct_type( + type_=McpToolConfigOverrideOutput, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[McpServerResponseModel]: + """ + Remove configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to remove config overrides for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + mcp_server_id: str, + tool_name: str, + *, + environment: typing.Optional[str] = None, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT, + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]] + ] = OMIT, + response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[McpServerResponseModel]: + """ + Update configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to update config overrides for. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound] + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + If set, overrides the server's tool_call_sound_behavior setting for this tool + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + If set, overrides the server's response timeout for this MCP tool. + + assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]] + Dynamic variable assignments for this MCP tool + + input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]] + Mapping of json path to input override configuration + + response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[McpServerResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}", + method="PATCH", + params={ + "environment": environment, + }, + json={ + "force_pre_tool_speech": force_pre_tool_speech, + "pre_tool_speech": pre_tool_speech, + "disable_interruptions": disable_interruptions, + "interruption_mode": interruption_mode, + "tool_call_sound": convert_and_respect_annotation_metadata( + object_=tool_call_sound, + annotation=McpToolConfigOverrideUpdateRequestModelToolCallSound, + direction="write", + ), + "tool_call_sound_behavior": tool_call_sound_behavior, + "execution_mode": execution_mode, + "response_timeout_secs": response_timeout_secs, + "assignments": convert_and_respect_annotation_metadata( + object_=assignments, annotation=typing.Sequence[DynamicVariableAssignment], direction="write" + ), + "input_overrides": convert_and_respect_annotation_metadata( + object_=input_overrides, + annotation=typing.Dict[ + str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue] + ], + direction="write", + ), + "response_mocks": convert_and_respect_annotation_metadata( + object_=response_mocks, annotation=typing.Sequence[ToolResponseMockConfigInput], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawToolConfigsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + mcp_server_id: str, + *, + tool_name: str, + environment: typing.Optional[str] = None, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT, + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]] + ] = OMIT, + response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Create configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + The name of the MCP tool + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[McpToolConfigOverrideCreateRequestModelToolCallSound] + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + If set, overrides the server's tool_call_sound_behavior setting for this tool + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + If set, overrides the server's response timeout for this MCP tool. + + assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]] + Dynamic variable assignments for this MCP tool + + input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]] + Mapping of json path to input override configuration + + response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs", + method="POST", + params={ + "environment": environment, + }, + json={ + "force_pre_tool_speech": force_pre_tool_speech, + "pre_tool_speech": pre_tool_speech, + "disable_interruptions": disable_interruptions, + "interruption_mode": interruption_mode, + "tool_call_sound": convert_and_respect_annotation_metadata( + object_=tool_call_sound, + annotation=McpToolConfigOverrideCreateRequestModelToolCallSound, + direction="write", + ), + "tool_call_sound_behavior": tool_call_sound_behavior, + "execution_mode": execution_mode, + "response_timeout_secs": response_timeout_secs, + "assignments": convert_and_respect_annotation_metadata( + object_=assignments, annotation=typing.Sequence[DynamicVariableAssignment], direction="write" + ), + "input_overrides": convert_and_respect_annotation_metadata( + object_=input_overrides, + annotation=typing.Dict[ + str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue] + ], + direction="write", + ), + "response_mocks": convert_and_respect_annotation_metadata( + object_=response_mocks, annotation=typing.Sequence[ToolResponseMockConfigInput], direction="write" + ), + "tool_name": tool_name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[McpToolConfigOverrideOutput]: + """ + Retrieve configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to retrieve config overrides for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpToolConfigOverrideOutput] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpToolConfigOverrideOutput, + construct_type( + type_=McpToolConfigOverrideOutput, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Remove configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to remove config overrides for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + mcp_server_id: str, + tool_name: str, + *, + environment: typing.Optional[str] = None, + force_pre_tool_speech: typing.Optional[bool] = OMIT, + pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT, + disable_interruptions: typing.Optional[bool] = OMIT, + interruption_mode: typing.Optional[ToolInterruptionMode] = OMIT, + tool_call_sound: typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound] = OMIT, + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT, + execution_mode: typing.Optional[ToolExecutionMode] = OMIT, + response_timeout_secs: typing.Optional[int] = OMIT, + assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT, + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]] + ] = OMIT, + response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[McpServerResponseModel]: + """ + Update configuration overrides for a specific MCP tool. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + tool_name : str + Name of the MCP tool to update config overrides for. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + force_pre_tool_speech : typing.Optional[bool] + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + + pre_tool_speech : typing.Optional[PreToolSpeechMode] + If set, overrides the server's pre_tool_speech setting for this tool. + + disable_interruptions : typing.Optional[bool] + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + + interruption_mode : typing.Optional[ToolInterruptionMode] + If set, overrides the server's interruption_mode setting for this tool. + + tool_call_sound : typing.Optional[McpToolConfigOverrideUpdateRequestModelToolCallSound] + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + + tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior] + If set, overrides the server's tool_call_sound_behavior setting for this tool + + execution_mode : typing.Optional[ToolExecutionMode] + If set, overrides the server's execution_mode setting for this tool + + response_timeout_secs : typing.Optional[int] + If set, overrides the server's response timeout for this MCP tool. + + assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]] + Dynamic variable assignments for this MCP tool + + input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]] + Mapping of json path to input override configuration + + response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[McpServerResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}", + method="PATCH", + params={ + "environment": environment, + }, + json={ + "force_pre_tool_speech": force_pre_tool_speech, + "pre_tool_speech": pre_tool_speech, + "disable_interruptions": disable_interruptions, + "interruption_mode": interruption_mode, + "tool_call_sound": convert_and_respect_annotation_metadata( + object_=tool_call_sound, + annotation=McpToolConfigOverrideUpdateRequestModelToolCallSound, + direction="write", + ), + "tool_call_sound_behavior": tool_call_sound_behavior, + "execution_mode": execution_mode, + "response_timeout_secs": response_timeout_secs, + "assignments": convert_and_respect_annotation_metadata( + object_=assignments, annotation=typing.Sequence[DynamicVariableAssignment], direction="write" + ), + "input_overrides": convert_and_respect_annotation_metadata( + object_=input_overrides, + annotation=typing.Dict[ + str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue] + ], + direction="write", + ), + "response_mocks": convert_and_respect_annotation_metadata( + object_=response_mocks, annotation=typing.Sequence[ToolResponseMockConfigInput], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + McpServerResponseModel, + construct_type( + type_=McpServerResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/__init__.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..753878d8230ea62e45c6d9beee5f976167d9df4b --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/__init__.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .mcp_tool_config_override_create_request_model_input_overrides_value import ( + McpToolConfigOverrideCreateRequestModelInputOverridesValue, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit, + ) + from .mcp_tool_config_override_create_request_model_tool_call_sound import ( + McpToolConfigOverrideCreateRequestModelToolCallSound, + ) + from .mcp_tool_config_override_update_request_model_input_overrides_value import ( + McpToolConfigOverrideUpdateRequestModelInputOverridesValue, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit, + ) + from .mcp_tool_config_override_update_request_model_tool_call_sound import ( + McpToolConfigOverrideUpdateRequestModelToolCallSound, + ) +_dynamic_imports: typing.Dict[str, str] = { + "McpToolConfigOverrideCreateRequestModelInputOverridesValue": ".mcp_tool_config_override_create_request_model_input_overrides_value", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant": ".mcp_tool_config_override_create_request_model_input_overrides_value", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable": ".mcp_tool_config_override_create_request_model_input_overrides_value", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm": ".mcp_tool_config_override_create_request_model_input_overrides_value", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit": ".mcp_tool_config_override_create_request_model_input_overrides_value", + "McpToolConfigOverrideCreateRequestModelToolCallSound": ".mcp_tool_config_override_create_request_model_tool_call_sound", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue": ".mcp_tool_config_override_update_request_model_input_overrides_value", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant": ".mcp_tool_config_override_update_request_model_input_overrides_value", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable": ".mcp_tool_config_override_update_request_model_input_overrides_value", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm": ".mcp_tool_config_override_update_request_model_input_overrides_value", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit": ".mcp_tool_config_override_update_request_model_input_overrides_value", + "McpToolConfigOverrideUpdateRequestModelToolCallSound": ".mcp_tool_config_override_update_request_model_tool_call_sound", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "McpToolConfigOverrideCreateRequestModelInputOverridesValue", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm", + "McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit", + "McpToolConfigOverrideCreateRequestModelToolCallSound", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm", + "McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit", + "McpToolConfigOverrideUpdateRequestModelToolCallSound", +] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_create_request_model_input_overrides_value.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_create_request_model_input_overrides_value.py new file mode 100644 index 0000000000000000000000000000000000000000..adf5a141a90d52a591ffb1a0c795ba4d7ef36a1e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_create_request_model_input_overrides_value.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .....types.constant_schema_override_constant_value import ConstantSchemaOverrideConstantValue + + +class McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant(UncheckedBaseModel): + source: typing.Literal["constant"] = "constant" + constant_value: typing.Optional[ConstantSchemaOverrideConstantValue] = 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 + + +class McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable(UncheckedBaseModel): + source: typing.Literal["dynamic_variable"] = "dynamic_variable" + dynamic_variable: 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 + + +class McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm(UncheckedBaseModel): + source: typing.Literal["llm"] = "llm" + prompt: 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 + + +class McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit(UncheckedBaseModel): + source: typing.Literal["omit"] = "omit" + + 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 + + +McpToolConfigOverrideCreateRequestModelInputOverridesValue = typing_extensions.Annotated[ + typing.Union[ + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Constant, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_DynamicVariable, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Llm, + McpToolConfigOverrideCreateRequestModelInputOverridesValue_Omit, + ], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_create_request_model_tool_call_sound.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_create_request_model_tool_call_sound.py new file mode 100644 index 0000000000000000000000000000000000000000..82fef98c08b7a7420f8154acdd53e079e677c6f6 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_create_request_model_tool_call_sound.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....types.tool_call_sound_type import ToolCallSoundType + +McpToolConfigOverrideCreateRequestModelToolCallSound = typing.Union[ToolCallSoundType, typing.Literal["off"]] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_update_request_model_input_overrides_value.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_update_request_model_input_overrides_value.py new file mode 100644 index 0000000000000000000000000000000000000000..9e2900a37b04845dd5b93b3cabe920093750483d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_update_request_model_input_overrides_value.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from .....core.pydantic_utilities import IS_PYDANTIC_V2 +from .....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .....types.constant_schema_override_constant_value import ConstantSchemaOverrideConstantValue + + +class McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant(UncheckedBaseModel): + source: typing.Literal["constant"] = "constant" + constant_value: typing.Optional[ConstantSchemaOverrideConstantValue] = 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 + + +class McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable(UncheckedBaseModel): + source: typing.Literal["dynamic_variable"] = "dynamic_variable" + dynamic_variable: 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 + + +class McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm(UncheckedBaseModel): + source: typing.Literal["llm"] = "llm" + prompt: 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 + + +class McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit(UncheckedBaseModel): + source: typing.Literal["omit"] = "omit" + + 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 + + +McpToolConfigOverrideUpdateRequestModelInputOverridesValue = typing_extensions.Annotated[ + typing.Union[ + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Constant, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_DynamicVariable, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Llm, + McpToolConfigOverrideUpdateRequestModelInputOverridesValue_Omit, + ], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_update_request_model_tool_call_sound.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_update_request_model_tool_call_sound.py new file mode 100644 index 0000000000000000000000000000000000000000..711654f2ac9dcf2e11fd9432d53c9bc59952ceb9 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tool_configs/types/mcp_tool_config_override_update_request_model_tool_call_sound.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....types.tool_call_sound_type import ToolCallSoundType + +McpToolConfigOverrideUpdateRequestModelToolCallSound = typing.Union[ToolCallSoundType, typing.Literal["off"]] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tools/__init__.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tools/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tools/client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tools/client.py new file mode 100644 index 0000000000000000000000000000000000000000..5f225f1e8c4645bb9dde7df838bb93822680764b --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tools/client.py @@ -0,0 +1,130 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.list_mcp_tools_response_model import ListMcpToolsResponseModel +from .raw_client import AsyncRawToolsClient, RawToolsClient + + +class ToolsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawToolsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawToolsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawToolsClient + """ + return self._raw_client + + def list( + self, + mcp_server_id: str, + *, + environment: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListMcpToolsResponseModel: + """ + Retrieve all tools available for a specific MCP server configuration. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListMcpToolsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.mcp_servers.tools.list( + mcp_server_id="mcp_server_id", + environment="environment", + ) + """ + _response = self._raw_client.list(mcp_server_id, environment=environment, request_options=request_options) + return _response.data + + +class AsyncToolsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawToolsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawToolsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawToolsClient + """ + return self._raw_client + + async def list( + self, + mcp_server_id: str, + *, + environment: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListMcpToolsResponseModel: + """ + Retrieve all tools available for a specific MCP server configuration. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListMcpToolsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.mcp_servers.tools.list( + mcp_server_id="mcp_server_id", + environment="environment", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(mcp_server_id, environment=environment, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/tools/raw_client.py b/data/src/elevenlabs/conversational_ai/mcp_servers/tools/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b007213bc818520a6e490ca64423d68762c8974e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/tools/raw_client.py @@ -0,0 +1,153 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.list_mcp_tools_response_model import ListMcpToolsResponseModel +from pydantic import ValidationError + + +class RawToolsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + mcp_server_id: str, + *, + environment: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListMcpToolsResponseModel]: + """ + Retrieve all tools available for a specific MCP server configuration. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListMcpToolsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tools", + method="GET", + params={ + "environment": environment, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListMcpToolsResponseModel, + construct_type( + type_=ListMcpToolsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawToolsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + mcp_server_id: str, + *, + environment: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListMcpToolsResponseModel]: + """ + Retrieve all tools available for a specific MCP server configuration. + + Parameters + ---------- + mcp_server_id : str + ID of the MCP Server. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListMcpToolsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tools", + method="GET", + params={ + "environment": environment, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListMcpToolsResponseModel, + construct_type( + type_=ListMcpToolsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/types/__init__.py b/data/src/elevenlabs/conversational_ai/mcp_servers/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7d545957abf70a6b92ae0c6ca83cecad5233116f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/types/__init__.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .mcp_server_config_update_request_model_auth_connection import McpServerConfigUpdateRequestModelAuthConnection + from .mcp_server_config_update_request_model_request_headers_value import ( + McpServerConfigUpdateRequestModelRequestHeadersValue, + ) + from .mcp_server_config_update_request_model_request_meta_value import ( + McpServerConfigUpdateRequestModelRequestMetaValue, + ) +_dynamic_imports: typing.Dict[str, str] = { + "McpServerConfigUpdateRequestModelAuthConnection": ".mcp_server_config_update_request_model_auth_connection", + "McpServerConfigUpdateRequestModelRequestHeadersValue": ".mcp_server_config_update_request_model_request_headers_value", + "McpServerConfigUpdateRequestModelRequestMetaValue": ".mcp_server_config_update_request_model_request_meta_value", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "McpServerConfigUpdateRequestModelAuthConnection", + "McpServerConfigUpdateRequestModelRequestHeadersValue", + "McpServerConfigUpdateRequestModelRequestMetaValue", +] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_auth_connection.py b/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_auth_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..1056bd54796c34c5ae38aca2c1894bfc7c3390c5 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_auth_connection.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.auth_connection_locator import AuthConnectionLocator +from ....types.environment_auth_connection_locator import EnvironmentAuthConnectionLocator + +McpServerConfigUpdateRequestModelAuthConnection = typing.Union[AuthConnectionLocator, EnvironmentAuthConnectionLocator] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_request_headers_value.py b/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..e81dde7231a4e55aadd328c4cdc1ab8b09a4c573 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_request_headers_value.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.conv_ai_dynamic_variable import ConvAiDynamicVariable +from ....types.conv_ai_env_var_locator import ConvAiEnvVarLocator +from ....types.conv_ai_secret_locator import ConvAiSecretLocator + +McpServerConfigUpdateRequestModelRequestHeadersValue = typing.Union[ + str, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator +] diff --git a/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_request_meta_value.py b/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_request_meta_value.py new file mode 100644 index 0000000000000000000000000000000000000000..6943ee468be7c970ad1765653940e3d112d3a292 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/mcp_servers/types/mcp_server_config_update_request_model_request_meta_value.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.conv_ai_dynamic_variable import ConvAiDynamicVariable +from ....types.conv_ai_env_var_locator import ConvAiEnvVarLocator +from ....types.conv_ai_secret_locator import ConvAiSecretLocator + +McpServerConfigUpdateRequestModelRequestMetaValue = typing.Union[ + str, int, float, bool, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator +] diff --git a/data/src/elevenlabs/conversational_ai/phone_numbers/__init__.py b/data/src/elevenlabs/conversational_ai/phone_numbers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..955efde03ea62bf438593f9d1b57c95c862e9651 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/phone_numbers/__init__.py @@ -0,0 +1,85 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + PhoneNumbersCreateRequestBody, + PhoneNumbersCreateRequestBody_Exotel, + PhoneNumbersCreateRequestBody_SipTrunk, + PhoneNumbersCreateRequestBody_Twilio, + PhoneNumbersGetResponse, + PhoneNumbersGetResponse_Exotel, + PhoneNumbersGetResponse_SipTrunk, + PhoneNumbersGetResponse_Twilio, + PhoneNumbersListResponseItem, + PhoneNumbersListResponseItem_Exotel, + PhoneNumbersListResponseItem_SipTrunk, + PhoneNumbersListResponseItem_Twilio, + PhoneNumbersUpdateResponse, + PhoneNumbersUpdateResponse_Exotel, + PhoneNumbersUpdateResponse_SipTrunk, + PhoneNumbersUpdateResponse_Twilio, + ) +_dynamic_imports: typing.Dict[str, str] = { + "PhoneNumbersCreateRequestBody": ".types", + "PhoneNumbersCreateRequestBody_Exotel": ".types", + "PhoneNumbersCreateRequestBody_SipTrunk": ".types", + "PhoneNumbersCreateRequestBody_Twilio": ".types", + "PhoneNumbersGetResponse": ".types", + "PhoneNumbersGetResponse_Exotel": ".types", + "PhoneNumbersGetResponse_SipTrunk": ".types", + "PhoneNumbersGetResponse_Twilio": ".types", + "PhoneNumbersListResponseItem": ".types", + "PhoneNumbersListResponseItem_Exotel": ".types", + "PhoneNumbersListResponseItem_SipTrunk": ".types", + "PhoneNumbersListResponseItem_Twilio": ".types", + "PhoneNumbersUpdateResponse": ".types", + "PhoneNumbersUpdateResponse_Exotel": ".types", + "PhoneNumbersUpdateResponse_SipTrunk": ".types", + "PhoneNumbersUpdateResponse_Twilio": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "PhoneNumbersCreateRequestBody", + "PhoneNumbersCreateRequestBody_Exotel", + "PhoneNumbersCreateRequestBody_SipTrunk", + "PhoneNumbersCreateRequestBody_Twilio", + "PhoneNumbersGetResponse", + "PhoneNumbersGetResponse_Exotel", + "PhoneNumbersGetResponse_SipTrunk", + "PhoneNumbersGetResponse_Twilio", + "PhoneNumbersListResponseItem", + "PhoneNumbersListResponseItem_Exotel", + "PhoneNumbersListResponseItem_SipTrunk", + "PhoneNumbersListResponseItem_Twilio", + "PhoneNumbersUpdateResponse", + "PhoneNumbersUpdateResponse_Exotel", + "PhoneNumbersUpdateResponse_SipTrunk", + "PhoneNumbersUpdateResponse_Twilio", +] diff --git a/data/src/elevenlabs/conversational_ai/phone_numbers/client.py b/data/src/elevenlabs/conversational_ai/phone_numbers/client.py new file mode 100644 index 0000000000000000000000000000000000000000..db56198e51cab622140a84ca252925549a1b39f3 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/phone_numbers/client.py @@ -0,0 +1,855 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.create_phone_number_response_model import CreatePhoneNumberResponseModel +from ...types.get_phone_numbers_page_response_model import GetPhoneNumbersPageResponseModel +from ...types.get_sip_log_messages_response import GetSipLogMessagesResponse +from ...types.inbound_sip_trunk_config_request_model import InboundSipTrunkConfigRequestModel +from ...types.livekit_stack_type import LivekitStackType +from ...types.outbound_sip_trunk_config_request_model import OutboundSipTrunkConfigRequestModel +from ...types.phone_number_sort_by import PhoneNumberSortBy +from ...types.sort_direction import SortDirection +from ...types.telephony_provider import TelephonyProvider +from .raw_client import AsyncRawPhoneNumbersClient, RawPhoneNumbersClient +from .types.phone_numbers_create_request_body import PhoneNumbersCreateRequestBody +from .types.phone_numbers_get_response import PhoneNumbersGetResponse +from .types.phone_numbers_list_response_item import PhoneNumbersListResponseItem +from .types.phone_numbers_update_response import PhoneNumbersUpdateResponse + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class PhoneNumbersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawPhoneNumbersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawPhoneNumbersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawPhoneNumbersClient + """ + return self._raw_client + + def list( + self, + *, + provider: typing.Optional[TelephonyProvider] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.List[PhoneNumbersListResponseItem]: + """ + Retrieve all Phone Numbers + + Parameters + ---------- + provider : typing.Optional[TelephonyProvider] + Filter by telephony provider + + agent_id : typing.Optional[str] + Filter by assigned agent ID + + branch_id : typing.Optional[str] + Filter by assigned branch ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[PhoneNumbersListResponseItem] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.phone_numbers.list( + provider="twilio", + agent_id="agent_id", + branch_id="branch_id", + ) + """ + _response = self._raw_client.list( + provider=provider, agent_id=agent_id, branch_id=branch_id, request_options=request_options + ) + return _response.data + + def create( + self, *, request: PhoneNumbersCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> CreatePhoneNumberResponseModel: + """ + Import Phone Number from provider configuration (Twilio, Exotel, or SIP trunk) + + Parameters + ---------- + request : PhoneNumbersCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreatePhoneNumberResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.conversational_ai.phone_numbers import ( + PhoneNumbersCreateRequestBody_Twilio, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.phone_numbers.create( + request=PhoneNumbersCreateRequestBody_Twilio( + phone_number="phone_number", + label="label", + sid="sid", + token="token", + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def get( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> PhoneNumbersGetResponse: + """ + Retrieve Phone Number details by ID + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumbersGetResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.phone_numbers.get( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + ) + """ + _response = self._raw_client.get(phone_number_id, request_options=request_options) + return _response.data + + def delete(self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete Phone Number by ID + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.phone_numbers.delete( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + ) + """ + _response = self._raw_client.delete(phone_number_id, request_options=request_options) + return _response.data + + def update( + self, + phone_number_id: str, + *, + agent_id: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + inbound_trunk_config: typing.Optional[InboundSipTrunkConfigRequestModel] = OMIT, + outbound_trunk_config: typing.Optional[OutboundSipTrunkConfigRequestModel] = OMIT, + livekit_stack: typing.Optional[LivekitStackType] = OMIT, + store_sip_messages: typing.Optional[bool] = OMIT, + environment: typing.Optional[str] = OMIT, + branch_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumbersUpdateResponse: + """ + Update assigned agent of a phone number + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + agent_id : typing.Optional[str] + + label : typing.Optional[str] + + inbound_trunk_config : typing.Optional[InboundSipTrunkConfigRequestModel] + + outbound_trunk_config : typing.Optional[OutboundSipTrunkConfigRequestModel] + + livekit_stack : typing.Optional[LivekitStackType] + + store_sip_messages : typing.Optional[bool] + + environment : typing.Optional[str] + Environment to use for resolving environment variables on calls to this number. + + branch_id : typing.Optional[str] + Agent branch to use for calls to this number. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumbersUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.phone_numbers.update( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + ) + """ + _response = self._raw_client.update( + phone_number_id, + agent_id=agent_id, + label=label, + inbound_trunk_config=inbound_trunk_config, + outbound_trunk_config=outbound_trunk_config, + livekit_stack=livekit_stack, + store_sip_messages=store_sip_messages, + environment=environment, + branch_id=branch_id, + request_options=request_options, + ) + return _response.data + + def list_v_2( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + label: typing.Optional[str] = None, + phone_number: typing.Optional[str] = None, + provider: typing.Optional[TelephonyProvider] = None, + supports_outbound: typing.Optional[bool] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + sort_by: typing.Optional[PhoneNumberSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetPhoneNumbersPageResponseModel: + """ + Retrieve a page of Phone Numbers + + Parameters + ---------- + page_size : typing.Optional[int] + Number of phone numbers per page + + search : typing.Optional[str] + Filter by phone number ID, label, or phone number. A phone number ID must match exactly; label and phone number matching is a case-insensitive substring. + + label : typing.Optional[str] + Filter by label. Matching is a case-insensitive substring. + + phone_number : typing.Optional[str] + Filter by phone number + + provider : typing.Optional[TelephonyProvider] + Filter by telephony provider + + supports_outbound : typing.Optional[bool] + Filter by whether the phone number can place outbound calls + + agent_id : typing.Optional[str] + Filter by assigned agent ID + + branch_id : typing.Optional[str] + Filter by assigned branch ID + + sort_by : typing.Optional[PhoneNumberSortBy] + The field to sort the results by + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetPhoneNumbersPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.phone_numbers.list_v_2( + page_size=1, + search="search", + label="label", + phone_number="phone_number", + provider="twilio", + supports_outbound=True, + agent_id="agent_id", + branch_id="branch_id", + sort_by="label", + sort_direction="asc", + cursor="cursor", + ) + """ + _response = self._raw_client.list_v_2( + page_size=page_size, + search=search, + label=label, + phone_number=phone_number, + provider=provider, + supports_outbound=supports_outbound, + agent_id=agent_id, + branch_id=branch_id, + sort_by=sort_by, + sort_direction=sort_direction, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def get_sip_messages( + self, + phone_number_id: str, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetSipLogMessagesResponse: + """ + Get SIP messages for a phone number + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + page_size : typing.Optional[int] + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetSipLogMessagesResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.phone_numbers.get_sip_messages( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.get_sip_messages( + phone_number_id, page_size=page_size, cursor=cursor, request_options=request_options + ) + return _response.data + + +class AsyncPhoneNumbersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawPhoneNumbersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawPhoneNumbersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawPhoneNumbersClient + """ + return self._raw_client + + async def list( + self, + *, + provider: typing.Optional[TelephonyProvider] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.List[PhoneNumbersListResponseItem]: + """ + Retrieve all Phone Numbers + + Parameters + ---------- + provider : typing.Optional[TelephonyProvider] + Filter by telephony provider + + agent_id : typing.Optional[str] + Filter by assigned agent ID + + branch_id : typing.Optional[str] + Filter by assigned branch ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[PhoneNumbersListResponseItem] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.phone_numbers.list( + provider="twilio", + agent_id="agent_id", + branch_id="branch_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + provider=provider, agent_id=agent_id, branch_id=branch_id, request_options=request_options + ) + return _response.data + + async def create( + self, *, request: PhoneNumbersCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> CreatePhoneNumberResponseModel: + """ + Import Phone Number from provider configuration (Twilio, Exotel, or SIP trunk) + + Parameters + ---------- + request : PhoneNumbersCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreatePhoneNumberResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.conversational_ai.phone_numbers import ( + PhoneNumbersCreateRequestBody_Twilio, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.phone_numbers.create( + request=PhoneNumbersCreateRequestBody_Twilio( + phone_number="phone_number", + label="label", + sid="sid", + token="token", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def get( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> PhoneNumbersGetResponse: + """ + Retrieve Phone Number details by ID + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumbersGetResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.phone_numbers.get( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(phone_number_id, request_options=request_options) + return _response.data + + async def delete( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete Phone Number by ID + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.phone_numbers.delete( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(phone_number_id, request_options=request_options) + return _response.data + + async def update( + self, + phone_number_id: str, + *, + agent_id: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + inbound_trunk_config: typing.Optional[InboundSipTrunkConfigRequestModel] = OMIT, + outbound_trunk_config: typing.Optional[OutboundSipTrunkConfigRequestModel] = OMIT, + livekit_stack: typing.Optional[LivekitStackType] = OMIT, + store_sip_messages: typing.Optional[bool] = OMIT, + environment: typing.Optional[str] = OMIT, + branch_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PhoneNumbersUpdateResponse: + """ + Update assigned agent of a phone number + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + agent_id : typing.Optional[str] + + label : typing.Optional[str] + + inbound_trunk_config : typing.Optional[InboundSipTrunkConfigRequestModel] + + outbound_trunk_config : typing.Optional[OutboundSipTrunkConfigRequestModel] + + livekit_stack : typing.Optional[LivekitStackType] + + store_sip_messages : typing.Optional[bool] + + environment : typing.Optional[str] + Environment to use for resolving environment variables on calls to this number. + + branch_id : typing.Optional[str] + Agent branch to use for calls to this number. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PhoneNumbersUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.phone_numbers.update( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + phone_number_id, + agent_id=agent_id, + label=label, + inbound_trunk_config=inbound_trunk_config, + outbound_trunk_config=outbound_trunk_config, + livekit_stack=livekit_stack, + store_sip_messages=store_sip_messages, + environment=environment, + branch_id=branch_id, + request_options=request_options, + ) + return _response.data + + async def list_v_2( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + label: typing.Optional[str] = None, + phone_number: typing.Optional[str] = None, + provider: typing.Optional[TelephonyProvider] = None, + supports_outbound: typing.Optional[bool] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + sort_by: typing.Optional[PhoneNumberSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetPhoneNumbersPageResponseModel: + """ + Retrieve a page of Phone Numbers + + Parameters + ---------- + page_size : typing.Optional[int] + Number of phone numbers per page + + search : typing.Optional[str] + Filter by phone number ID, label, or phone number. A phone number ID must match exactly; label and phone number matching is a case-insensitive substring. + + label : typing.Optional[str] + Filter by label. Matching is a case-insensitive substring. + + phone_number : typing.Optional[str] + Filter by phone number + + provider : typing.Optional[TelephonyProvider] + Filter by telephony provider + + supports_outbound : typing.Optional[bool] + Filter by whether the phone number can place outbound calls + + agent_id : typing.Optional[str] + Filter by assigned agent ID + + branch_id : typing.Optional[str] + Filter by assigned branch ID + + sort_by : typing.Optional[PhoneNumberSortBy] + The field to sort the results by + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetPhoneNumbersPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.phone_numbers.list_v_2( + page_size=1, + search="search", + label="label", + phone_number="phone_number", + provider="twilio", + supports_outbound=True, + agent_id="agent_id", + branch_id="branch_id", + sort_by="label", + sort_direction="asc", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_v_2( + page_size=page_size, + search=search, + label=label, + phone_number=phone_number, + provider=provider, + supports_outbound=supports_outbound, + agent_id=agent_id, + branch_id=branch_id, + sort_by=sort_by, + sort_direction=sort_direction, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def get_sip_messages( + self, + phone_number_id: str, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetSipLogMessagesResponse: + """ + Get SIP messages for a phone number + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + page_size : typing.Optional[int] + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetSipLogMessagesResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.phone_numbers.get_sip_messages( + phone_number_id="TeaqRRdTcIfIu2i7BYfT", + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_sip_messages( + phone_number_id, page_size=page_size, cursor=cursor, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/phone_numbers/raw_client.py b/data/src/elevenlabs/conversational_ai/phone_numbers/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..bfe17a5b681b0aab54448c04a97f2c503a262878 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/phone_numbers/raw_client.py @@ -0,0 +1,1079 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.create_phone_number_response_model import CreatePhoneNumberResponseModel +from ...types.get_phone_numbers_page_response_model import GetPhoneNumbersPageResponseModel +from ...types.get_sip_log_messages_response import GetSipLogMessagesResponse +from ...types.inbound_sip_trunk_config_request_model import InboundSipTrunkConfigRequestModel +from ...types.livekit_stack_type import LivekitStackType +from ...types.outbound_sip_trunk_config_request_model import OutboundSipTrunkConfigRequestModel +from ...types.phone_number_sort_by import PhoneNumberSortBy +from ...types.sort_direction import SortDirection +from ...types.telephony_provider import TelephonyProvider +from .types.phone_numbers_create_request_body import PhoneNumbersCreateRequestBody +from .types.phone_numbers_get_response import PhoneNumbersGetResponse +from .types.phone_numbers_list_response_item import PhoneNumbersListResponseItem +from .types.phone_numbers_update_response import PhoneNumbersUpdateResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawPhoneNumbersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + provider: typing.Optional[TelephonyProvider] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.List[PhoneNumbersListResponseItem]]: + """ + Retrieve all Phone Numbers + + Parameters + ---------- + provider : typing.Optional[TelephonyProvider] + Filter by telephony provider + + agent_id : typing.Optional[str] + Filter by assigned agent ID + + branch_id : typing.Optional[str] + Filter by assigned branch ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.List[PhoneNumbersListResponseItem]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/phone-numbers", + method="GET", + params={ + "provider": provider, + "agent_id": agent_id, + "branch_id": branch_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[PhoneNumbersListResponseItem], + construct_type( + type_=typing.List[PhoneNumbersListResponseItem], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, request: PhoneNumbersCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[CreatePhoneNumberResponseModel]: + """ + Import Phone Number from provider configuration (Twilio, Exotel, or SIP trunk) + + Parameters + ---------- + request : PhoneNumbersCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreatePhoneNumberResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/phone-numbers", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=PhoneNumbersCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreatePhoneNumberResponseModel, + construct_type( + type_=CreatePhoneNumberResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PhoneNumbersGetResponse]: + """ + Retrieve Phone Number details by ID + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PhoneNumbersGetResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/phone-numbers/{jsonable_encoder(phone_number_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PhoneNumbersGetResponse, + construct_type( + type_=PhoneNumbersGetResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Delete Phone Number by ID + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/phone-numbers/{jsonable_encoder(phone_number_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + phone_number_id: str, + *, + agent_id: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + inbound_trunk_config: typing.Optional[InboundSipTrunkConfigRequestModel] = OMIT, + outbound_trunk_config: typing.Optional[OutboundSipTrunkConfigRequestModel] = OMIT, + livekit_stack: typing.Optional[LivekitStackType] = OMIT, + store_sip_messages: typing.Optional[bool] = OMIT, + environment: typing.Optional[str] = OMIT, + branch_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[PhoneNumbersUpdateResponse]: + """ + Update assigned agent of a phone number + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + agent_id : typing.Optional[str] + + label : typing.Optional[str] + + inbound_trunk_config : typing.Optional[InboundSipTrunkConfigRequestModel] + + outbound_trunk_config : typing.Optional[OutboundSipTrunkConfigRequestModel] + + livekit_stack : typing.Optional[LivekitStackType] + + store_sip_messages : typing.Optional[bool] + + environment : typing.Optional[str] + Environment to use for resolving environment variables on calls to this number. + + branch_id : typing.Optional[str] + Agent branch to use for calls to this number. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PhoneNumbersUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/phone-numbers/{jsonable_encoder(phone_number_id)}", + method="PATCH", + json={ + "agent_id": agent_id, + "label": label, + "inbound_trunk_config": convert_and_respect_annotation_metadata( + object_=inbound_trunk_config, annotation=InboundSipTrunkConfigRequestModel, direction="write" + ), + "outbound_trunk_config": convert_and_respect_annotation_metadata( + object_=outbound_trunk_config, annotation=OutboundSipTrunkConfigRequestModel, direction="write" + ), + "livekit_stack": livekit_stack, + "store_sip_messages": store_sip_messages, + "environment": environment, + "branch_id": branch_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PhoneNumbersUpdateResponse, + construct_type( + type_=PhoneNumbersUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_v_2( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + label: typing.Optional[str] = None, + phone_number: typing.Optional[str] = None, + provider: typing.Optional[TelephonyProvider] = None, + supports_outbound: typing.Optional[bool] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + sort_by: typing.Optional[PhoneNumberSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetPhoneNumbersPageResponseModel]: + """ + Retrieve a page of Phone Numbers + + Parameters + ---------- + page_size : typing.Optional[int] + Number of phone numbers per page + + search : typing.Optional[str] + Filter by phone number ID, label, or phone number. A phone number ID must match exactly; label and phone number matching is a case-insensitive substring. + + label : typing.Optional[str] + Filter by label. Matching is a case-insensitive substring. + + phone_number : typing.Optional[str] + Filter by phone number + + provider : typing.Optional[TelephonyProvider] + Filter by telephony provider + + supports_outbound : typing.Optional[bool] + Filter by whether the phone number can place outbound calls + + agent_id : typing.Optional[str] + Filter by assigned agent ID + + branch_id : typing.Optional[str] + Filter by assigned branch ID + + sort_by : typing.Optional[PhoneNumberSortBy] + The field to sort the results by + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetPhoneNumbersPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/v2/phone-numbers", + method="GET", + params={ + "page_size": page_size, + "search": search, + "label": label, + "phone_number": phone_number, + "provider": provider, + "supports_outbound": supports_outbound, + "agent_id": agent_id, + "branch_id": branch_id, + "sort_by": sort_by, + "sort_direction": sort_direction, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetPhoneNumbersPageResponseModel, + construct_type( + type_=GetPhoneNumbersPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_sip_messages( + self, + phone_number_id: str, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetSipLogMessagesResponse]: + """ + Get SIP messages for a phone number + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + page_size : typing.Optional[int] + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetSipLogMessagesResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/phone-numbers/{jsonable_encoder(phone_number_id)}/sip-messages", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetSipLogMessagesResponse, + construct_type( + type_=GetSipLogMessagesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawPhoneNumbersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + provider: typing.Optional[TelephonyProvider] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.List[PhoneNumbersListResponseItem]]: + """ + Retrieve all Phone Numbers + + Parameters + ---------- + provider : typing.Optional[TelephonyProvider] + Filter by telephony provider + + agent_id : typing.Optional[str] + Filter by assigned agent ID + + branch_id : typing.Optional[str] + Filter by assigned branch ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.List[PhoneNumbersListResponseItem]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/phone-numbers", + method="GET", + params={ + "provider": provider, + "agent_id": agent_id, + "branch_id": branch_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[PhoneNumbersListResponseItem], + construct_type( + type_=typing.List[PhoneNumbersListResponseItem], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, request: PhoneNumbersCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[CreatePhoneNumberResponseModel]: + """ + Import Phone Number from provider configuration (Twilio, Exotel, or SIP trunk) + + Parameters + ---------- + request : PhoneNumbersCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreatePhoneNumberResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/phone-numbers", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=PhoneNumbersCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreatePhoneNumberResponseModel, + construct_type( + type_=CreatePhoneNumberResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PhoneNumbersGetResponse]: + """ + Retrieve Phone Number details by ID + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PhoneNumbersGetResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/phone-numbers/{jsonable_encoder(phone_number_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PhoneNumbersGetResponse, + construct_type( + type_=PhoneNumbersGetResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete Phone Number by ID + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/phone-numbers/{jsonable_encoder(phone_number_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + phone_number_id: str, + *, + agent_id: typing.Optional[str] = OMIT, + label: typing.Optional[str] = OMIT, + inbound_trunk_config: typing.Optional[InboundSipTrunkConfigRequestModel] = OMIT, + outbound_trunk_config: typing.Optional[OutboundSipTrunkConfigRequestModel] = OMIT, + livekit_stack: typing.Optional[LivekitStackType] = OMIT, + store_sip_messages: typing.Optional[bool] = OMIT, + environment: typing.Optional[str] = OMIT, + branch_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[PhoneNumbersUpdateResponse]: + """ + Update assigned agent of a phone number + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + agent_id : typing.Optional[str] + + label : typing.Optional[str] + + inbound_trunk_config : typing.Optional[InboundSipTrunkConfigRequestModel] + + outbound_trunk_config : typing.Optional[OutboundSipTrunkConfigRequestModel] + + livekit_stack : typing.Optional[LivekitStackType] + + store_sip_messages : typing.Optional[bool] + + environment : typing.Optional[str] + Environment to use for resolving environment variables on calls to this number. + + branch_id : typing.Optional[str] + Agent branch to use for calls to this number. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PhoneNumbersUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/phone-numbers/{jsonable_encoder(phone_number_id)}", + method="PATCH", + json={ + "agent_id": agent_id, + "label": label, + "inbound_trunk_config": convert_and_respect_annotation_metadata( + object_=inbound_trunk_config, annotation=InboundSipTrunkConfigRequestModel, direction="write" + ), + "outbound_trunk_config": convert_and_respect_annotation_metadata( + object_=outbound_trunk_config, annotation=OutboundSipTrunkConfigRequestModel, direction="write" + ), + "livekit_stack": livekit_stack, + "store_sip_messages": store_sip_messages, + "environment": environment, + "branch_id": branch_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PhoneNumbersUpdateResponse, + construct_type( + type_=PhoneNumbersUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_v_2( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + label: typing.Optional[str] = None, + phone_number: typing.Optional[str] = None, + provider: typing.Optional[TelephonyProvider] = None, + supports_outbound: typing.Optional[bool] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + sort_by: typing.Optional[PhoneNumberSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetPhoneNumbersPageResponseModel]: + """ + Retrieve a page of Phone Numbers + + Parameters + ---------- + page_size : typing.Optional[int] + Number of phone numbers per page + + search : typing.Optional[str] + Filter by phone number ID, label, or phone number. A phone number ID must match exactly; label and phone number matching is a case-insensitive substring. + + label : typing.Optional[str] + Filter by label. Matching is a case-insensitive substring. + + phone_number : typing.Optional[str] + Filter by phone number + + provider : typing.Optional[TelephonyProvider] + Filter by telephony provider + + supports_outbound : typing.Optional[bool] + Filter by whether the phone number can place outbound calls + + agent_id : typing.Optional[str] + Filter by assigned agent ID + + branch_id : typing.Optional[str] + Filter by assigned branch ID + + sort_by : typing.Optional[PhoneNumberSortBy] + The field to sort the results by + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetPhoneNumbersPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/v2/phone-numbers", + method="GET", + params={ + "page_size": page_size, + "search": search, + "label": label, + "phone_number": phone_number, + "provider": provider, + "supports_outbound": supports_outbound, + "agent_id": agent_id, + "branch_id": branch_id, + "sort_by": sort_by, + "sort_direction": sort_direction, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetPhoneNumbersPageResponseModel, + construct_type( + type_=GetPhoneNumbersPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_sip_messages( + self, + phone_number_id: str, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetSipLogMessagesResponse]: + """ + Get SIP messages for a phone number + + Parameters + ---------- + phone_number_id : str + The phone number ID. This is returned when a phone number is imported. + + page_size : typing.Optional[int] + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetSipLogMessagesResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/phone-numbers/{jsonable_encoder(phone_number_id)}/sip-messages", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetSipLogMessagesResponse, + construct_type( + type_=GetSipLogMessagesResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/phone_numbers/types/__init__.py b/data/src/elevenlabs/conversational_ai/phone_numbers/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5fedb5bec45fe7e00afdc94f31b3c00b016e8067 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/phone_numbers/types/__init__.py @@ -0,0 +1,91 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .phone_numbers_create_request_body import ( + PhoneNumbersCreateRequestBody, + PhoneNumbersCreateRequestBody_Exotel, + PhoneNumbersCreateRequestBody_SipTrunk, + PhoneNumbersCreateRequestBody_Twilio, + ) + from .phone_numbers_get_response import ( + PhoneNumbersGetResponse, + PhoneNumbersGetResponse_Exotel, + PhoneNumbersGetResponse_SipTrunk, + PhoneNumbersGetResponse_Twilio, + ) + from .phone_numbers_list_response_item import ( + PhoneNumbersListResponseItem, + PhoneNumbersListResponseItem_Exotel, + PhoneNumbersListResponseItem_SipTrunk, + PhoneNumbersListResponseItem_Twilio, + ) + from .phone_numbers_update_response import ( + PhoneNumbersUpdateResponse, + PhoneNumbersUpdateResponse_Exotel, + PhoneNumbersUpdateResponse_SipTrunk, + PhoneNumbersUpdateResponse_Twilio, + ) +_dynamic_imports: typing.Dict[str, str] = { + "PhoneNumbersCreateRequestBody": ".phone_numbers_create_request_body", + "PhoneNumbersCreateRequestBody_Exotel": ".phone_numbers_create_request_body", + "PhoneNumbersCreateRequestBody_SipTrunk": ".phone_numbers_create_request_body", + "PhoneNumbersCreateRequestBody_Twilio": ".phone_numbers_create_request_body", + "PhoneNumbersGetResponse": ".phone_numbers_get_response", + "PhoneNumbersGetResponse_Exotel": ".phone_numbers_get_response", + "PhoneNumbersGetResponse_SipTrunk": ".phone_numbers_get_response", + "PhoneNumbersGetResponse_Twilio": ".phone_numbers_get_response", + "PhoneNumbersListResponseItem": ".phone_numbers_list_response_item", + "PhoneNumbersListResponseItem_Exotel": ".phone_numbers_list_response_item", + "PhoneNumbersListResponseItem_SipTrunk": ".phone_numbers_list_response_item", + "PhoneNumbersListResponseItem_Twilio": ".phone_numbers_list_response_item", + "PhoneNumbersUpdateResponse": ".phone_numbers_update_response", + "PhoneNumbersUpdateResponse_Exotel": ".phone_numbers_update_response", + "PhoneNumbersUpdateResponse_SipTrunk": ".phone_numbers_update_response", + "PhoneNumbersUpdateResponse_Twilio": ".phone_numbers_update_response", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "PhoneNumbersCreateRequestBody", + "PhoneNumbersCreateRequestBody_Exotel", + "PhoneNumbersCreateRequestBody_SipTrunk", + "PhoneNumbersCreateRequestBody_Twilio", + "PhoneNumbersGetResponse", + "PhoneNumbersGetResponse_Exotel", + "PhoneNumbersGetResponse_SipTrunk", + "PhoneNumbersGetResponse_Twilio", + "PhoneNumbersListResponseItem", + "PhoneNumbersListResponseItem_Exotel", + "PhoneNumbersListResponseItem_SipTrunk", + "PhoneNumbersListResponseItem_Twilio", + "PhoneNumbersUpdateResponse", + "PhoneNumbersUpdateResponse_Exotel", + "PhoneNumbersUpdateResponse_SipTrunk", + "PhoneNumbersUpdateResponse_Twilio", +] diff --git a/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_create_request_body.py b/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_create_request_body.py new file mode 100644 index 0000000000000000000000000000000000000000..a704d4813be33d18fbe39ab9aba6140a09530d8a --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_create_request_body.py @@ -0,0 +1,103 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.exotel_api_subdomain import ExotelApiSubdomain +from ....types.inbound_sip_trunk_config_request_model import InboundSipTrunkConfigRequestModel +from ....types.outbound_sip_trunk_config_request_model import OutboundSipTrunkConfigRequestModel +from ....types.region_config_request import RegionConfigRequest + + +class PhoneNumbersCreateRequestBody_Twilio(UncheckedBaseModel): + """ + Create Phone Request Information + """ + + provider: typing.Literal["twilio"] = "twilio" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + agent_id: typing.Optional[str] = None + sid: str + token: str + account_auth_token: typing.Optional[str] = None + region_config: typing.Optional[RegionConfigRequest] = None + enable_sms: 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 + + +class PhoneNumbersCreateRequestBody_Exotel(UncheckedBaseModel): + """ + Create Phone Request Information + """ + + provider: typing.Literal["exotel"] = "exotel" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + agent_id: typing.Optional[str] = None + account_sid: str + api_key: str + api_token: str + api_subdomain: ExotelApiSubdomain + app_id: str + applet_url: 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 + + +class PhoneNumbersCreateRequestBody_SipTrunk(UncheckedBaseModel): + """ + Create Phone Request Information + """ + + provider: typing.Literal["sip_trunk"] = "sip_trunk" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + agent_id: typing.Optional[str] = None + inbound_trunk_config: typing.Optional[InboundSipTrunkConfigRequestModel] = None + outbound_trunk_config: typing.Optional[OutboundSipTrunkConfigRequestModel] = 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 + + +PhoneNumbersCreateRequestBody = typing_extensions.Annotated[ + typing.Union[ + PhoneNumbersCreateRequestBody_Twilio, + PhoneNumbersCreateRequestBody_Exotel, + PhoneNumbersCreateRequestBody_SipTrunk, + ], + UnionMetadata(discriminant="provider"), +] diff --git a/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_get_response.py b/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_get_response.py new file mode 100644 index 0000000000000000000000000000000000000000..39b657d2c7c930452d381387f7b9a016abc38043 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_get_response.py @@ -0,0 +1,86 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.get_phone_number_inbound_sip_trunk_config_response_model import ( + GetPhoneNumberInboundSipTrunkConfigResponseModel, +) +from ....types.get_phone_number_outbound_sip_trunk_config_response_model import ( + GetPhoneNumberOutboundSipTrunkConfigResponseModel, +) +from ....types.livekit_stack_type import LivekitStackType +from ....types.phone_number_agent_info import PhoneNumberAgentInfo + + +class PhoneNumbersGetResponse_Twilio(UncheckedBaseModel): + provider: typing.Literal["twilio"] = "twilio" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class PhoneNumbersGetResponse_Exotel(UncheckedBaseModel): + provider: typing.Literal["exotel"] = "exotel" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class PhoneNumbersGetResponse_SipTrunk(UncheckedBaseModel): + provider: typing.Literal["sip_trunk"] = "sip_trunk" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = None + provider_config: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + outbound_trunk: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + inbound_trunk: typing.Optional[GetPhoneNumberInboundSipTrunkConfigResponseModel] = None + livekit_stack: LivekitStackType + store_sip_messages: 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 + + +PhoneNumbersGetResponse = typing_extensions.Annotated[ + typing.Union[PhoneNumbersGetResponse_Twilio, PhoneNumbersGetResponse_Exotel, PhoneNumbersGetResponse_SipTrunk], + UnionMetadata(discriminant="provider"), +] diff --git a/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_list_response_item.py b/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_list_response_item.py new file mode 100644 index 0000000000000000000000000000000000000000..f652904d63dd5df1eb20ab344d13c1b2f1dae53f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_list_response_item.py @@ -0,0 +1,88 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.get_phone_number_inbound_sip_trunk_config_response_model import ( + GetPhoneNumberInboundSipTrunkConfigResponseModel, +) +from ....types.get_phone_number_outbound_sip_trunk_config_response_model import ( + GetPhoneNumberOutboundSipTrunkConfigResponseModel, +) +from ....types.livekit_stack_type import LivekitStackType +from ....types.phone_number_agent_info import PhoneNumberAgentInfo + + +class PhoneNumbersListResponseItem_Twilio(UncheckedBaseModel): + provider: typing.Literal["twilio"] = "twilio" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class PhoneNumbersListResponseItem_Exotel(UncheckedBaseModel): + provider: typing.Literal["exotel"] = "exotel" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class PhoneNumbersListResponseItem_SipTrunk(UncheckedBaseModel): + provider: typing.Literal["sip_trunk"] = "sip_trunk" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = None + provider_config: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + outbound_trunk: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + inbound_trunk: typing.Optional[GetPhoneNumberInboundSipTrunkConfigResponseModel] = None + livekit_stack: LivekitStackType + store_sip_messages: 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 + + +PhoneNumbersListResponseItem = typing_extensions.Annotated[ + typing.Union[ + PhoneNumbersListResponseItem_Twilio, PhoneNumbersListResponseItem_Exotel, PhoneNumbersListResponseItem_SipTrunk + ], + UnionMetadata(discriminant="provider"), +] diff --git a/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_update_response.py b/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..30d3105c2bc6c77a48e241c73206e031db88ffc1 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/phone_numbers/types/phone_numbers_update_response.py @@ -0,0 +1,88 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.get_phone_number_inbound_sip_trunk_config_response_model import ( + GetPhoneNumberInboundSipTrunkConfigResponseModel, +) +from ....types.get_phone_number_outbound_sip_trunk_config_response_model import ( + GetPhoneNumberOutboundSipTrunkConfigResponseModel, +) +from ....types.livekit_stack_type import LivekitStackType +from ....types.phone_number_agent_info import PhoneNumberAgentInfo + + +class PhoneNumbersUpdateResponse_Twilio(UncheckedBaseModel): + provider: typing.Literal["twilio"] = "twilio" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class PhoneNumbersUpdateResponse_Exotel(UncheckedBaseModel): + provider: typing.Literal["exotel"] = "exotel" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class PhoneNumbersUpdateResponse_SipTrunk(UncheckedBaseModel): + provider: typing.Literal["sip_trunk"] = "sip_trunk" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = None + provider_config: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + outbound_trunk: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + inbound_trunk: typing.Optional[GetPhoneNumberInboundSipTrunkConfigResponseModel] = None + livekit_stack: LivekitStackType + store_sip_messages: 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 + + +PhoneNumbersUpdateResponse = typing_extensions.Annotated[ + typing.Union[ + PhoneNumbersUpdateResponse_Twilio, PhoneNumbersUpdateResponse_Exotel, PhoneNumbersUpdateResponse_SipTrunk + ], + UnionMetadata(discriminant="provider"), +] diff --git a/data/src/elevenlabs/conversational_ai/raw_client.py b/data/src/elevenlabs/conversational_ai/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..149875238d1158333a93d3bdcb0651fda97a0113 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/raw_client.py @@ -0,0 +1,516 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.add_knowledge_base_response_model import AddKnowledgeBaseResponseModel +from ..types.rag_document_index_response_model import RagDocumentIndexResponseModel +from ..types.rag_document_indexes_response_model import RagDocumentIndexesResponseModel +from ..types.rag_index_overview_response_model import RagIndexOverviewResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawConversationalAiClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def add_to_knowledge_base( + self, + *, + agent_id: typing.Optional[str] = None, + name: typing.Optional[str] = OMIT, + url: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddKnowledgeBaseResponseModel]: + """ + Upload a file or webpage URL to create a knowledge base document.
After creating the document, update the agent's knowledge base by calling [Update agent](/docs/api-reference/agents/update). + + Parameters + ---------- + agent_id : typing.Optional[str] + + name : typing.Optional[str] + A custom, human-readable name for the document. + + url : typing.Optional[str] + URL to a page of documentation that the agent will have access to in order to interact with users. + + file : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base", + method="POST", + params={ + "agent_id": agent_id, + }, + data={ + "name": name, + "url": url, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def rag_index_overview( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[RagIndexOverviewResponseModel]: + """ + Provides total size and other information of RAG indexes used by knowledgebase documents + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[RagIndexOverviewResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/rag-index", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RagIndexOverviewResponseModel, + construct_type( + type_=RagIndexOverviewResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_document_rag_indexes( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[RagDocumentIndexesResponseModel]: + """ + Provides information about all RAG indexes of the specified knowledgebase document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[RagDocumentIndexesResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/rag-index", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RagDocumentIndexesResponseModel, + construct_type( + type_=RagDocumentIndexesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete_document_rag_index( + self, documentation_id: str, rag_index_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[RagDocumentIndexResponseModel]: + """ + Delete RAG index for the knowledgebase document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + rag_index_id : str + The id of RAG index of document from the knowledge base. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[RagDocumentIndexResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/rag-index/{jsonable_encoder(rag_index_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RagDocumentIndexResponseModel, + construct_type( + type_=RagDocumentIndexResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawConversationalAiClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def add_to_knowledge_base( + self, + *, + agent_id: typing.Optional[str] = None, + name: typing.Optional[str] = OMIT, + url: typing.Optional[str] = OMIT, + file: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddKnowledgeBaseResponseModel]: + """ + Upload a file or webpage URL to create a knowledge base document.
After creating the document, update the agent's knowledge base by calling [Update agent](/docs/api-reference/agents/update). + + Parameters + ---------- + agent_id : typing.Optional[str] + + name : typing.Optional[str] + A custom, human-readable name for the document. + + url : typing.Optional[str] + URL to a page of documentation that the agent will have access to in order to interact with users. + + file : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddKnowledgeBaseResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base", + method="POST", + params={ + "agent_id": agent_id, + }, + data={ + "name": name, + "url": url, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddKnowledgeBaseResponseModel, + construct_type( + type_=AddKnowledgeBaseResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def rag_index_overview( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[RagIndexOverviewResponseModel]: + """ + Provides total size and other information of RAG indexes used by knowledgebase documents + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RagIndexOverviewResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/knowledge-base/rag-index", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RagIndexOverviewResponseModel, + construct_type( + type_=RagIndexOverviewResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_document_rag_indexes( + self, documentation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[RagDocumentIndexesResponseModel]: + """ + Provides information about all RAG indexes of the specified knowledgebase document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RagDocumentIndexesResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/rag-index", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RagDocumentIndexesResponseModel, + construct_type( + type_=RagDocumentIndexesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete_document_rag_index( + self, documentation_id: str, rag_index_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[RagDocumentIndexResponseModel]: + """ + Delete RAG index for the knowledgebase document. + + Parameters + ---------- + documentation_id : str + The id of a document from the knowledge base. This is returned on document addition. + + rag_index_id : str + The id of RAG index of document from the knowledge base. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RagDocumentIndexResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/knowledge-base/{jsonable_encoder(documentation_id)}/rag-index/{jsonable_encoder(rag_index_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RagDocumentIndexResponseModel, + construct_type( + type_=RagDocumentIndexResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/realtime/__init__.py b/data/src/elevenlabs/conversational_ai/realtime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/realtime/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/realtime/client.py b/data/src/elevenlabs/conversational_ai/realtime/client.py new file mode 100644 index 0000000000000000000000000000000000000000..f036e78350a33450e045cc1b2b04f390fc906cd9 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/realtime/client.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.client_secret_response import ClientSecretResponse +from ...types.create_client_secret_request import CreateClientSecretRequest +from .raw_client import AsyncRawRealtimeClient, RawRealtimeClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RealtimeClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawRealtimeClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawRealtimeClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawRealtimeClient + """ + return self._raw_client + + def create_client_secret( + self, + *, + request: typing.Optional[CreateClientSecretRequest] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ClientSecretResponse: + """ + Create an ephemeral client secret for authenticating browser-based Realtime API sessions. + + Parameters + ---------- + request : typing.Optional[CreateClientSecretRequest] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ClientSecretResponse + Successful Response + + Examples + -------- + from elevenlabs import CreateClientSecretRequest, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.realtime.create_client_secret( + request=CreateClientSecretRequest(), + ) + """ + _response = self._raw_client.create_client_secret(request=request, request_options=request_options) + return _response.data + + +class AsyncRealtimeClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawRealtimeClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawRealtimeClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawRealtimeClient + """ + return self._raw_client + + async def create_client_secret( + self, + *, + request: typing.Optional[CreateClientSecretRequest] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ClientSecretResponse: + """ + Create an ephemeral client secret for authenticating browser-based Realtime API sessions. + + Parameters + ---------- + request : typing.Optional[CreateClientSecretRequest] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ClientSecretResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, CreateClientSecretRequest + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.realtime.create_client_secret( + request=CreateClientSecretRequest(), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_client_secret(request=request, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/realtime/raw_client.py b/data/src/elevenlabs/conversational_ai/realtime/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..a3d9e2bfc379cfc9267209d1ca57c456e6d79efc --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/realtime/raw_client.py @@ -0,0 +1,149 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.client_secret_response import ClientSecretResponse +from ...types.create_client_secret_request import CreateClientSecretRequest +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawRealtimeClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create_client_secret( + self, + *, + request: typing.Optional[CreateClientSecretRequest] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ClientSecretResponse]: + """ + Create an ephemeral client secret for authenticating browser-based Realtime API sessions. + + Parameters + ---------- + request : typing.Optional[CreateClientSecretRequest] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ClientSecretResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/realtime/client_secrets", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=CreateClientSecretRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ClientSecretResponse, + construct_type( + type_=ClientSecretResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawRealtimeClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create_client_secret( + self, + *, + request: typing.Optional[CreateClientSecretRequest] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ClientSecretResponse]: + """ + Create an ephemeral client secret for authenticating browser-based Realtime API sessions. + + Parameters + ---------- + request : typing.Optional[CreateClientSecretRequest] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ClientSecretResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/realtime/client_secrets", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=CreateClientSecretRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ClientSecretResponse, + construct_type( + type_=ClientSecretResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/secrets/__init__.py b/data/src/elevenlabs/conversational_ai/secrets/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/secrets/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/secrets/client.py b/data/src/elevenlabs/conversational_ai/secrets/client.py new file mode 100644 index 0000000000000000000000000000000000000000..f6db0ccf8b1941861be243bb4152c23f29cd6797 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/secrets/client.py @@ -0,0 +1,579 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.conv_ai_workspace_stored_secret_config import ConvAiWorkspaceStoredSecretConfig +from ...types.get_secret_dependencies_response_model import GetSecretDependenciesResponseModel +from ...types.get_workspace_secrets_response_model import GetWorkspaceSecretsResponseModel +from ...types.post_workspace_secret_response_model import PostWorkspaceSecretResponseModel +from ...types.secret_dependency_resource_type import SecretDependencyResourceType +from .raw_client import AsyncRawSecretsClient, RawSecretsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SecretsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSecretsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSecretsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSecretsClient + """ + return self._raw_client + + def list( + self, + *, + page_size: typing.Optional[int] = None, + dependency_limit: typing.Optional[int] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetWorkspaceSecretsResponseModel: + """ + Get all workspace secrets for the user + + Parameters + ---------- + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100. If not provided, returns all secrets. + + dependency_limit : typing.Optional[int] + Maximum number of dependent resources (tools, agents, phone numbers) to return per secret. Can not exceed 100. + + search : typing.Optional[str] + If specified, returns only secrets whose names start with this string. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWorkspaceSecretsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.secrets.list( + page_size=1, + dependency_limit=1, + search="search", + cursor="cursor", + ) + """ + _response = self._raw_client.list( + page_size=page_size, + dependency_limit=dependency_limit, + search=search, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def create( + self, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None + ) -> PostWorkspaceSecretResponseModel: + """ + Create a new secret for the workspace + + Parameters + ---------- + name : str + + value : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PostWorkspaceSecretResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.secrets.create( + name="name", + value="value", + ) + """ + _response = self._raw_client.create(name=name, value=value, request_options=request_options) + return _response.data + + def get( + self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConvAiWorkspaceStoredSecretConfig: + """ + Get a workspace secret by ID + + Parameters + ---------- + secret_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvAiWorkspaceStoredSecretConfig + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.secrets.get( + secret_id="secret_id", + ) + """ + _response = self._raw_client.get(secret_id, request_options=request_options) + return _response.data + + def delete(self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a workspace secret if it's not in use + + Parameters + ---------- + secret_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.secrets.delete( + secret_id="secret_id", + ) + """ + _response = self._raw_client.delete(secret_id, request_options=request_options) + return _response.data + + def update( + self, secret_id: str, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None + ) -> PostWorkspaceSecretResponseModel: + """ + Update an existing secret for the workspace + + Parameters + ---------- + secret_id : str + + name : str + + value : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PostWorkspaceSecretResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.secrets.update( + secret_id="secret_id", + name="name", + value="value", + ) + """ + _response = self._raw_client.update(secret_id, name=name, value=value, request_options=request_options) + return _response.data + + def get_dependencies( + self, + secret_id: str, + resource_type: SecretDependencyResourceType, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetSecretDependenciesResponseModel: + """ + Get paginated list of resources that depend on a specific secret, filtered by resource type. + + Parameters + ---------- + secret_id : str + + resource_type : SecretDependencyResourceType + + page_size : typing.Optional[int] + How many dependency items to return per page. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetSecretDependenciesResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.secrets.get_dependencies( + secret_id="secret_id", + resource_type="tools", + page_size=1, + cursor="cursor", + ) + """ + _response = self._raw_client.get_dependencies( + secret_id, resource_type, page_size=page_size, cursor=cursor, request_options=request_options + ) + return _response.data + + +class AsyncSecretsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSecretsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSecretsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSecretsClient + """ + return self._raw_client + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + dependency_limit: typing.Optional[int] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetWorkspaceSecretsResponseModel: + """ + Get all workspace secrets for the user + + Parameters + ---------- + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100. If not provided, returns all secrets. + + dependency_limit : typing.Optional[int] + Maximum number of dependent resources (tools, agents, phone numbers) to return per secret. Can not exceed 100. + + search : typing.Optional[str] + If specified, returns only secrets whose names start with this string. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWorkspaceSecretsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.secrets.list( + page_size=1, + dependency_limit=1, + search="search", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + page_size=page_size, + dependency_limit=dependency_limit, + search=search, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def create( + self, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None + ) -> PostWorkspaceSecretResponseModel: + """ + Create a new secret for the workspace + + Parameters + ---------- + name : str + + value : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PostWorkspaceSecretResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.secrets.create( + name="name", + value="value", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(name=name, value=value, request_options=request_options) + return _response.data + + async def get( + self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConvAiWorkspaceStoredSecretConfig: + """ + Get a workspace secret by ID + + Parameters + ---------- + secret_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvAiWorkspaceStoredSecretConfig + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.secrets.get( + secret_id="secret_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(secret_id, request_options=request_options) + return _response.data + + async def delete(self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a workspace secret if it's not in use + + Parameters + ---------- + secret_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.secrets.delete( + secret_id="secret_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(secret_id, request_options=request_options) + return _response.data + + async def update( + self, secret_id: str, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None + ) -> PostWorkspaceSecretResponseModel: + """ + Update an existing secret for the workspace + + Parameters + ---------- + secret_id : str + + name : str + + value : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PostWorkspaceSecretResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.secrets.update( + secret_id="secret_id", + name="name", + value="value", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(secret_id, name=name, value=value, request_options=request_options) + return _response.data + + async def get_dependencies( + self, + secret_id: str, + resource_type: SecretDependencyResourceType, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetSecretDependenciesResponseModel: + """ + Get paginated list of resources that depend on a specific secret, filtered by resource type. + + Parameters + ---------- + secret_id : str + + resource_type : SecretDependencyResourceType + + page_size : typing.Optional[int] + How many dependency items to return per page. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetSecretDependenciesResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.secrets.get_dependencies( + secret_id="secret_id", + resource_type="tools", + page_size=1, + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_dependencies( + secret_id, resource_type, page_size=page_size, cursor=cursor, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/secrets/raw_client.py b/data/src/elevenlabs/conversational_ai/secrets/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..edb04cefe0f306aed502b50aa9b01e485504d8cc --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/secrets/raw_client.py @@ -0,0 +1,778 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.conv_ai_workspace_stored_secret_config import ConvAiWorkspaceStoredSecretConfig +from ...types.get_secret_dependencies_response_model import GetSecretDependenciesResponseModel +from ...types.get_workspace_secrets_response_model import GetWorkspaceSecretsResponseModel +from ...types.post_workspace_secret_response_model import PostWorkspaceSecretResponseModel +from ...types.secret_dependency_resource_type import SecretDependencyResourceType +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSecretsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + page_size: typing.Optional[int] = None, + dependency_limit: typing.Optional[int] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetWorkspaceSecretsResponseModel]: + """ + Get all workspace secrets for the user + + Parameters + ---------- + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100. If not provided, returns all secrets. + + dependency_limit : typing.Optional[int] + Maximum number of dependent resources (tools, agents, phone numbers) to return per secret. Can not exceed 100. + + search : typing.Optional[str] + If specified, returns only secrets whose names start with this string. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetWorkspaceSecretsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/secrets", + method="GET", + params={ + "page_size": page_size, + "dependency_limit": dependency_limit, + "search": search, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWorkspaceSecretsResponseModel, + construct_type( + type_=GetWorkspaceSecretsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PostWorkspaceSecretResponseModel]: + """ + Create a new secret for the workspace + + Parameters + ---------- + name : str + + value : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PostWorkspaceSecretResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/secrets", + method="POST", + json={ + "name": name, + "value": value, + "type": "new", + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PostWorkspaceSecretResponseModel, + construct_type( + type_=PostWorkspaceSecretResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ConvAiWorkspaceStoredSecretConfig]: + """ + Get a workspace secret by ID + + Parameters + ---------- + secret_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConvAiWorkspaceStoredSecretConfig] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/secrets/{jsonable_encoder(secret_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvAiWorkspaceStoredSecretConfig, + construct_type( + type_=ConvAiWorkspaceStoredSecretConfig, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete(self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Delete a workspace secret if it's not in use + + Parameters + ---------- + secret_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/secrets/{jsonable_encoder(secret_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, secret_id: str, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[PostWorkspaceSecretResponseModel]: + """ + Update an existing secret for the workspace + + Parameters + ---------- + secret_id : str + + name : str + + value : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PostWorkspaceSecretResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/secrets/{jsonable_encoder(secret_id)}", + method="PATCH", + json={ + "name": name, + "value": value, + "type": "update", + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PostWorkspaceSecretResponseModel, + construct_type( + type_=PostWorkspaceSecretResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_dependencies( + self, + secret_id: str, + resource_type: SecretDependencyResourceType, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetSecretDependenciesResponseModel]: + """ + Get paginated list of resources that depend on a specific secret, filtered by resource type. + + Parameters + ---------- + secret_id : str + + resource_type : SecretDependencyResourceType + + page_size : typing.Optional[int] + How many dependency items to return per page. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetSecretDependenciesResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/secrets/{jsonable_encoder(secret_id)}/dependencies/{jsonable_encoder(resource_type)}", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetSecretDependenciesResponseModel, + construct_type( + type_=GetSecretDependenciesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSecretsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + dependency_limit: typing.Optional[int] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetWorkspaceSecretsResponseModel]: + """ + Get all workspace secrets for the user + + Parameters + ---------- + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100. If not provided, returns all secrets. + + dependency_limit : typing.Optional[int] + Maximum number of dependent resources (tools, agents, phone numbers) to return per secret. Can not exceed 100. + + search : typing.Optional[str] + If specified, returns only secrets whose names start with this string. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetWorkspaceSecretsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/secrets", + method="GET", + params={ + "page_size": page_size, + "dependency_limit": dependency_limit, + "search": search, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWorkspaceSecretsResponseModel, + construct_type( + type_=GetWorkspaceSecretsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PostWorkspaceSecretResponseModel]: + """ + Create a new secret for the workspace + + Parameters + ---------- + name : str + + value : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PostWorkspaceSecretResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/secrets", + method="POST", + json={ + "name": name, + "value": value, + "type": "new", + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PostWorkspaceSecretResponseModel, + construct_type( + type_=PostWorkspaceSecretResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ConvAiWorkspaceStoredSecretConfig]: + """ + Get a workspace secret by ID + + Parameters + ---------- + secret_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConvAiWorkspaceStoredSecretConfig] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/secrets/{jsonable_encoder(secret_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvAiWorkspaceStoredSecretConfig, + construct_type( + type_=ConvAiWorkspaceStoredSecretConfig, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, secret_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete a workspace secret if it's not in use + + Parameters + ---------- + secret_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/secrets/{jsonable_encoder(secret_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, secret_id: str, *, name: str, value: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[PostWorkspaceSecretResponseModel]: + """ + Update an existing secret for the workspace + + Parameters + ---------- + secret_id : str + + name : str + + value : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PostWorkspaceSecretResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/secrets/{jsonable_encoder(secret_id)}", + method="PATCH", + json={ + "name": name, + "value": value, + "type": "update", + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PostWorkspaceSecretResponseModel, + construct_type( + type_=PostWorkspaceSecretResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_dependencies( + self, + secret_id: str, + resource_type: SecretDependencyResourceType, + *, + page_size: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetSecretDependenciesResponseModel]: + """ + Get paginated list of resources that depend on a specific secret, filtered by resource type. + + Parameters + ---------- + secret_id : str + + resource_type : SecretDependencyResourceType + + page_size : typing.Optional[int] + How many dependency items to return per page. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetSecretDependenciesResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/secrets/{jsonable_encoder(secret_id)}/dependencies/{jsonable_encoder(resource_type)}", + method="GET", + params={ + "page_size": page_size, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetSecretDependenciesResponseModel, + construct_type( + type_=GetSecretDependenciesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/settings/__init__.py b/data/src/elevenlabs/conversational_ai/settings/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/settings/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/settings/client.py b/data/src/elevenlabs/conversational_ai/settings/client.py new file mode 100644 index 0000000000000000000000000000000000000000..cd9c97166df2d82f4bda82352f8065d9d5f7f7ab --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/settings/client.py @@ -0,0 +1,230 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.conv_ai_webhooks import ConvAiWebhooks +from ...types.conversation_initiation_client_data_webhook import ConversationInitiationClientDataWebhook +from ...types.get_conv_ai_settings_response_model import GetConvAiSettingsResponseModel +from ...types.livekit_stack_type import LivekitStackType +from .raw_client import AsyncRawSettingsClient, RawSettingsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SettingsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSettingsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSettingsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSettingsClient + """ + return self._raw_client + + def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetConvAiSettingsResponseModel: + """ + Retrieve Convai settings for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConvAiSettingsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.settings.get() + """ + _response = self._raw_client.get(request_options=request_options) + return _response.data + + def update( + self, + *, + conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = OMIT, + webhooks: typing.Optional[ConvAiWebhooks] = OMIT, + can_use_mcp_servers: typing.Optional[bool] = OMIT, + rag_retention_period_days: typing.Optional[int] = OMIT, + conversation_embedding_retention_days: typing.Optional[int] = OMIT, + default_livekit_stack: typing.Optional[LivekitStackType] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConvAiSettingsResponseModel: + """ + Update Convai settings for the workspace + + Parameters + ---------- + conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] + + webhooks : typing.Optional[ConvAiWebhooks] + + can_use_mcp_servers : typing.Optional[bool] + Whether the workspace can use MCP servers + + rag_retention_period_days : typing.Optional[int] + + conversation_embedding_retention_days : typing.Optional[int] + Days to retain conversation embeddings. None means use the system default (30 days). + + default_livekit_stack : typing.Optional[LivekitStackType] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConvAiSettingsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.settings.update() + """ + _response = self._raw_client.update( + conversation_initiation_client_data_webhook=conversation_initiation_client_data_webhook, + webhooks=webhooks, + can_use_mcp_servers=can_use_mcp_servers, + rag_retention_period_days=rag_retention_period_days, + conversation_embedding_retention_days=conversation_embedding_retention_days, + default_livekit_stack=default_livekit_stack, + request_options=request_options, + ) + return _response.data + + +class AsyncSettingsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSettingsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSettingsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSettingsClient + """ + return self._raw_client + + async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetConvAiSettingsResponseModel: + """ + Retrieve Convai settings for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConvAiSettingsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.settings.get() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(request_options=request_options) + return _response.data + + async def update( + self, + *, + conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = OMIT, + webhooks: typing.Optional[ConvAiWebhooks] = OMIT, + can_use_mcp_servers: typing.Optional[bool] = OMIT, + rag_retention_period_days: typing.Optional[int] = OMIT, + conversation_embedding_retention_days: typing.Optional[int] = OMIT, + default_livekit_stack: typing.Optional[LivekitStackType] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConvAiSettingsResponseModel: + """ + Update Convai settings for the workspace + + Parameters + ---------- + conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] + + webhooks : typing.Optional[ConvAiWebhooks] + + can_use_mcp_servers : typing.Optional[bool] + Whether the workspace can use MCP servers + + rag_retention_period_days : typing.Optional[int] + + conversation_embedding_retention_days : typing.Optional[int] + Days to retain conversation embeddings. None means use the system default (30 days). + + default_livekit_stack : typing.Optional[LivekitStackType] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConvAiSettingsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.settings.update() + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + conversation_initiation_client_data_webhook=conversation_initiation_client_data_webhook, + webhooks=webhooks, + can_use_mcp_servers=can_use_mcp_servers, + rag_retention_period_days=rag_retention_period_days, + conversation_embedding_retention_days=conversation_embedding_retention_days, + default_livekit_stack=default_livekit_stack, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/settings/raw_client.py b/data/src/elevenlabs/conversational_ai/settings/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..a78a53241c5c8f702e339c9d79b0734c3a64a9a1 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/settings/raw_client.py @@ -0,0 +1,315 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.conv_ai_webhooks import ConvAiWebhooks +from ...types.conversation_initiation_client_data_webhook import ConversationInitiationClientDataWebhook +from ...types.get_conv_ai_settings_response_model import GetConvAiSettingsResponseModel +from ...types.livekit_stack_type import LivekitStackType +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSettingsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetConvAiSettingsResponseModel]: + """ + Retrieve Convai settings for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConvAiSettingsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConvAiSettingsResponseModel, + construct_type( + type_=GetConvAiSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + *, + conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = OMIT, + webhooks: typing.Optional[ConvAiWebhooks] = OMIT, + can_use_mcp_servers: typing.Optional[bool] = OMIT, + rag_retention_period_days: typing.Optional[int] = OMIT, + conversation_embedding_retention_days: typing.Optional[int] = OMIT, + default_livekit_stack: typing.Optional[LivekitStackType] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetConvAiSettingsResponseModel]: + """ + Update Convai settings for the workspace + + Parameters + ---------- + conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] + + webhooks : typing.Optional[ConvAiWebhooks] + + can_use_mcp_servers : typing.Optional[bool] + Whether the workspace can use MCP servers + + rag_retention_period_days : typing.Optional[int] + + conversation_embedding_retention_days : typing.Optional[int] + Days to retain conversation embeddings. None means use the system default (30 days). + + default_livekit_stack : typing.Optional[LivekitStackType] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConvAiSettingsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/settings", + method="PATCH", + json={ + "conversation_initiation_client_data_webhook": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data_webhook, + annotation=ConversationInitiationClientDataWebhook, + direction="write", + ), + "webhooks": convert_and_respect_annotation_metadata( + object_=webhooks, annotation=ConvAiWebhooks, direction="write" + ), + "can_use_mcp_servers": can_use_mcp_servers, + "rag_retention_period_days": rag_retention_period_days, + "conversation_embedding_retention_days": conversation_embedding_retention_days, + "default_livekit_stack": default_livekit_stack, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConvAiSettingsResponseModel, + construct_type( + type_=GetConvAiSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSettingsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetConvAiSettingsResponseModel]: + """ + Retrieve Convai settings for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConvAiSettingsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConvAiSettingsResponseModel, + construct_type( + type_=GetConvAiSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + *, + conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = OMIT, + webhooks: typing.Optional[ConvAiWebhooks] = OMIT, + can_use_mcp_servers: typing.Optional[bool] = OMIT, + rag_retention_period_days: typing.Optional[int] = OMIT, + conversation_embedding_retention_days: typing.Optional[int] = OMIT, + default_livekit_stack: typing.Optional[LivekitStackType] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetConvAiSettingsResponseModel]: + """ + Update Convai settings for the workspace + + Parameters + ---------- + conversation_initiation_client_data_webhook : typing.Optional[ConversationInitiationClientDataWebhook] + + webhooks : typing.Optional[ConvAiWebhooks] + + can_use_mcp_servers : typing.Optional[bool] + Whether the workspace can use MCP servers + + rag_retention_period_days : typing.Optional[int] + + conversation_embedding_retention_days : typing.Optional[int] + Days to retain conversation embeddings. None means use the system default (30 days). + + default_livekit_stack : typing.Optional[LivekitStackType] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConvAiSettingsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/settings", + method="PATCH", + json={ + "conversation_initiation_client_data_webhook": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data_webhook, + annotation=ConversationInitiationClientDataWebhook, + direction="write", + ), + "webhooks": convert_and_respect_annotation_metadata( + object_=webhooks, annotation=ConvAiWebhooks, direction="write" + ), + "can_use_mcp_servers": can_use_mcp_servers, + "rag_retention_period_days": rag_retention_period_days, + "conversation_embedding_retention_days": conversation_embedding_retention_days, + "default_livekit_stack": default_livekit_stack, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConvAiSettingsResponseModel, + construct_type( + type_=GetConvAiSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/sip_trunk/__init__.py b/data/src/elevenlabs/conversational_ai/sip_trunk/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/sip_trunk/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/sip_trunk/client.py b/data/src/elevenlabs/conversational_ai/sip_trunk/client.py new file mode 100644 index 0000000000000000000000000000000000000000..741ab1f67fe4fa23ad041fe584bf168589eb9f98 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/sip_trunk/client.py @@ -0,0 +1,165 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput +from ...types.sip_trunk_outbound_call_response import SipTrunkOutboundCallResponse +from ...types.telephony_call_config_input import TelephonyCallConfigInput +from .raw_client import AsyncRawSipTrunkClient, RawSipTrunkClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SipTrunkClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSipTrunkClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSipTrunkClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSipTrunkClient + """ + return self._raw_client + + def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SipTrunkOutboundCallResponse: + """ + Handle an outbound call via SIP trunk + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SipTrunkOutboundCallResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.sip_trunk.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", + ) + """ + _response = self._raw_client.outbound_call( + agent_id=agent_id, + agent_phone_number_id=agent_phone_number_id, + to_number=to_number, + conversation_initiation_client_data=conversation_initiation_client_data, + telephony_call_config=telephony_call_config, + request_options=request_options, + ) + return _response.data + + +class AsyncSipTrunkClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSipTrunkClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSipTrunkClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSipTrunkClient + """ + return self._raw_client + + async def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SipTrunkOutboundCallResponse: + """ + Handle an outbound call via SIP trunk + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SipTrunkOutboundCallResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.sip_trunk.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.outbound_call( + agent_id=agent_id, + agent_phone_number_id=agent_phone_number_id, + to_number=to_number, + conversation_initiation_client_data=conversation_initiation_client_data, + telephony_call_config=telephony_call_config, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/sip_trunk/raw_client.py b/data/src/elevenlabs/conversational_ai/sip_trunk/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..168143bf62a6f9ddd80830f3956355d694ed5cf5 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/sip_trunk/raw_client.py @@ -0,0 +1,200 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput +from ...types.sip_trunk_outbound_call_response import SipTrunkOutboundCallResponse +from ...types.telephony_call_config_input import TelephonyCallConfigInput +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSipTrunkClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SipTrunkOutboundCallResponse]: + """ + Handle an outbound call via SIP trunk + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SipTrunkOutboundCallResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/sip-trunk/outbound-call", + method="POST", + json={ + "agent_id": agent_id, + "agent_phone_number_id": agent_phone_number_id, + "to_number": to_number, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + "telephony_call_config": convert_and_respect_annotation_metadata( + object_=telephony_call_config, annotation=TelephonyCallConfigInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SipTrunkOutboundCallResponse, + construct_type( + type_=SipTrunkOutboundCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSipTrunkClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SipTrunkOutboundCallResponse]: + """ + Handle an outbound call via SIP trunk + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SipTrunkOutboundCallResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/sip-trunk/outbound-call", + method="POST", + json={ + "agent_id": agent_id, + "agent_phone_number_id": agent_phone_number_id, + "to_number": to_number, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + "telephony_call_config": convert_and_respect_annotation_metadata( + object_=telephony_call_config, annotation=TelephonyCallConfigInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SipTrunkOutboundCallResponse, + construct_type( + type_=SipTrunkOutboundCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/tests/__init__.py b/data/src/elevenlabs/conversational_ai/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ae0f77a63b2d20de33eb1b14bfc0bb915eab031c --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/__init__.py @@ -0,0 +1,93 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + TestsCreateRequestBody, + TestsCreateRequestBody_Llm, + TestsCreateRequestBody_Simulation, + TestsCreateRequestBody_Tool, + TestsGetResponse, + TestsGetResponse_Llm, + TestsGetResponse_Simulation, + TestsGetResponse_Tool, + TestsListRequestSortMode, + TestsUpdateRequestBody, + TestsUpdateRequestBody_Llm, + TestsUpdateRequestBody_Simulation, + TestsUpdateRequestBody_Tool, + TestsUpdateResponse, + TestsUpdateResponse_Llm, + TestsUpdateResponse_Simulation, + TestsUpdateResponse_Tool, + ) + from . import folders, invocations +_dynamic_imports: typing.Dict[str, str] = { + "TestsCreateRequestBody": ".types", + "TestsCreateRequestBody_Llm": ".types", + "TestsCreateRequestBody_Simulation": ".types", + "TestsCreateRequestBody_Tool": ".types", + "TestsGetResponse": ".types", + "TestsGetResponse_Llm": ".types", + "TestsGetResponse_Simulation": ".types", + "TestsGetResponse_Tool": ".types", + "TestsListRequestSortMode": ".types", + "TestsUpdateRequestBody": ".types", + "TestsUpdateRequestBody_Llm": ".types", + "TestsUpdateRequestBody_Simulation": ".types", + "TestsUpdateRequestBody_Tool": ".types", + "TestsUpdateResponse": ".types", + "TestsUpdateResponse_Llm": ".types", + "TestsUpdateResponse_Simulation": ".types", + "TestsUpdateResponse_Tool": ".types", + "folders": ".folders", + "invocations": ".invocations", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "TestsCreateRequestBody", + "TestsCreateRequestBody_Llm", + "TestsCreateRequestBody_Simulation", + "TestsCreateRequestBody_Tool", + "TestsGetResponse", + "TestsGetResponse_Llm", + "TestsGetResponse_Simulation", + "TestsGetResponse_Tool", + "TestsListRequestSortMode", + "TestsUpdateRequestBody", + "TestsUpdateRequestBody_Llm", + "TestsUpdateRequestBody_Simulation", + "TestsUpdateRequestBody_Tool", + "TestsUpdateResponse", + "TestsUpdateResponse_Llm", + "TestsUpdateResponse_Simulation", + "TestsUpdateResponse_Tool", + "folders", + "invocations", +] diff --git a/data/src/elevenlabs/conversational_ai/tests/client.py b/data/src/elevenlabs/conversational_ai/tests/client.py new file mode 100644 index 0000000000000000000000000000000000000000..6f2c7116fd4ce8f918889ae08cda6fbb286085b6 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/client.py @@ -0,0 +1,743 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.create_agent_test_response_model import CreateAgentTestResponseModel +from ...types.get_tests_page_response_model import GetTestsPageResponseModel +from ...types.get_tests_summaries_by_ids_response_model import GetTestsSummariesByIdsResponseModel +from ...types.test_sharing_mode import TestSharingMode +from ...types.test_type import TestType +from .raw_client import AsyncRawTestsClient, RawTestsClient +from .types.tests_create_request_body import TestsCreateRequestBody +from .types.tests_get_response import TestsGetResponse +from .types.tests_list_request_sort_mode import TestsListRequestSortMode +from .types.tests_update_request_body import TestsUpdateRequestBody +from .types.tests_update_response import TestsUpdateResponse + +if typing.TYPE_CHECKING: + from .folders.client import AsyncFoldersClient, FoldersClient + from .invocations.client import AsyncInvocationsClient, InvocationsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TestsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTestsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._folders: typing.Optional[FoldersClient] = None + self._invocations: typing.Optional[InvocationsClient] = None + + @property + def with_raw_response(self) -> RawTestsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTestsClient + """ + return self._raw_client + + def create( + self, *, request: TestsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> CreateAgentTestResponseModel: + """ + Creates a new agent response test. + + Parameters + ---------- + request : TestsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentTestResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.conversational_ai.tests import TestsCreateRequestBody_Llm + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.create( + request=TestsCreateRequestBody_Llm( + name="name", + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def move( + self, + *, + entity_ids: typing.Sequence[str], + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Moves multiple tests or folders from one folder to another. + + Parameters + ---------- + entity_ids : typing.Sequence[str] + The IDs of tests or folders to move. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Tests or folders successfully moved to another folder + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.move( + entity_ids=["entity_ids"], + ) + """ + _response = self._raw_client.move(entity_ids=entity_ids, move_to=move_to, request_options=request_options) + return _response.data + + def get(self, test_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> TestsGetResponse: + """ + Gets an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TestsGetResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.get( + test_id="TeaqRRdTcIfIu2i7BYfT", + ) + """ + _response = self._raw_client.get(test_id, request_options=request_options) + return _response.data + + def update( + self, test_id: str, *, request: TestsUpdateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> TestsUpdateResponse: + """ + Updates an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request : TestsUpdateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TestsUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.conversational_ai.tests import TestsUpdateRequestBody_Llm + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.update( + test_id="TeaqRRdTcIfIu2i7BYfT", + request=TestsUpdateRequestBody_Llm( + name="name", + ), + ) + """ + _response = self._raw_client.update(test_id, request=request, request_options=request_options) + return _response.data + + def delete(self, test_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Deletes an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.delete( + test_id="TeaqRRdTcIfIu2i7BYfT", + ) + """ + _response = self._raw_client.delete(test_id, request_options=request_options) + return _response.data + + def summaries( + self, *, test_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None + ) -> GetTestsSummariesByIdsResponseModel: + """ + Gets agent response test summaries for the requested test IDs. + + Parameters + ---------- + test_ids : typing.Sequence[str] + List of test IDs to fetch. No duplicates allowed. Prefer at most 1000 IDs per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestsSummariesByIdsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.summaries( + test_ids=["test_id_1", "test_id_2"], + ) + """ + _response = self._raw_client.summaries(test_ids=test_ids, request_options=request_options) + return _response.data + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + parent_folder_id: typing.Optional[str] = None, + types: typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]] = None, + include_folders: typing.Optional[bool] = None, + sort_mode: typing.Optional[TestsListRequestSortMode] = None, + sharing_mode: typing.Optional[TestSharingMode] = None, + created_by_user_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetTestsPageResponseModel: + """ + Lists all agent response tests with pagination support and optional search filtering. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many Tests to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search query to filter tests and folders by name. + + parent_folder_id : typing.Optional[str] + Filter by parent folder ID. Use 'root' to get items in the root folder. + + types : typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]] + If present, the endpoint will return only tests/folders of the given types. + + include_folders : typing.Optional[bool] + Deprecated. Use the `types` query param and include `folder` instead. + + sort_mode : typing.Optional[TestsListRequestSortMode] + Sort mode for listing tests. Use 'folders_first' to place folders before tests. + + sharing_mode : typing.Optional[TestSharingMode] + Filter test visibility. Use `shared_with_me` to return only tests/folders shared with the current user that they did not create. + + created_by_user_id : typing.Optional[str] + Filter tests and folders by creator user ID. Use '@me' to refer to the authenticated user. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestsPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.list( + cursor="cursor", + page_size=1, + search="search", + parent_folder_id="parent_folder_id", + types=["llm"], + include_folders=True, + sort_mode="default", + sharing_mode="all", + created_by_user_id="created_by_user_id", + ) + """ + _response = self._raw_client.list( + cursor=cursor, + page_size=page_size, + search=search, + parent_folder_id=parent_folder_id, + types=types, + include_folders=include_folders, + sort_mode=sort_mode, + sharing_mode=sharing_mode, + created_by_user_id=created_by_user_id, + request_options=request_options, + ) + return _response.data + + @property + def folders(self): + if self._folders is None: + from .folders.client import FoldersClient # noqa: E402 + + self._folders = FoldersClient(client_wrapper=self._client_wrapper) + return self._folders + + @property + def invocations(self): + if self._invocations is None: + from .invocations.client import InvocationsClient # noqa: E402 + + self._invocations = InvocationsClient(client_wrapper=self._client_wrapper) + return self._invocations + + +class AsyncTestsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTestsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._folders: typing.Optional[AsyncFoldersClient] = None + self._invocations: typing.Optional[AsyncInvocationsClient] = None + + @property + def with_raw_response(self) -> AsyncRawTestsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTestsClient + """ + return self._raw_client + + async def create( + self, *, request: TestsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> CreateAgentTestResponseModel: + """ + Creates a new agent response test. + + Parameters + ---------- + request : TestsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentTestResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.conversational_ai.tests import TestsCreateRequestBody_Llm + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.create( + request=TestsCreateRequestBody_Llm( + name="name", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def move( + self, + *, + entity_ids: typing.Sequence[str], + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Moves multiple tests or folders from one folder to another. + + Parameters + ---------- + entity_ids : typing.Sequence[str] + The IDs of tests or folders to move. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Tests or folders successfully moved to another folder + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.move( + entity_ids=["entity_ids"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.move(entity_ids=entity_ids, move_to=move_to, request_options=request_options) + return _response.data + + async def get(self, test_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> TestsGetResponse: + """ + Gets an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TestsGetResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.get( + test_id="TeaqRRdTcIfIu2i7BYfT", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(test_id, request_options=request_options) + return _response.data + + async def update( + self, test_id: str, *, request: TestsUpdateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> TestsUpdateResponse: + """ + Updates an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request : TestsUpdateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TestsUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.conversational_ai.tests import TestsUpdateRequestBody_Llm + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.update( + test_id="TeaqRRdTcIfIu2i7BYfT", + request=TestsUpdateRequestBody_Llm( + name="name", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(test_id, request=request, request_options=request_options) + return _response.data + + async def delete(self, test_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Deletes an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.delete( + test_id="TeaqRRdTcIfIu2i7BYfT", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(test_id, request_options=request_options) + return _response.data + + async def summaries( + self, *, test_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None + ) -> GetTestsSummariesByIdsResponseModel: + """ + Gets agent response test summaries for the requested test IDs. + + Parameters + ---------- + test_ids : typing.Sequence[str] + List of test IDs to fetch. No duplicates allowed. Prefer at most 1000 IDs per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestsSummariesByIdsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.summaries( + test_ids=["test_id_1", "test_id_2"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.summaries(test_ids=test_ids, request_options=request_options) + return _response.data + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + parent_folder_id: typing.Optional[str] = None, + types: typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]] = None, + include_folders: typing.Optional[bool] = None, + sort_mode: typing.Optional[TestsListRequestSortMode] = None, + sharing_mode: typing.Optional[TestSharingMode] = None, + created_by_user_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetTestsPageResponseModel: + """ + Lists all agent response tests with pagination support and optional search filtering. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many Tests to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search query to filter tests and folders by name. + + parent_folder_id : typing.Optional[str] + Filter by parent folder ID. Use 'root' to get items in the root folder. + + types : typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]] + If present, the endpoint will return only tests/folders of the given types. + + include_folders : typing.Optional[bool] + Deprecated. Use the `types` query param and include `folder` instead. + + sort_mode : typing.Optional[TestsListRequestSortMode] + Sort mode for listing tests. Use 'folders_first' to place folders before tests. + + sharing_mode : typing.Optional[TestSharingMode] + Filter test visibility. Use `shared_with_me` to return only tests/folders shared with the current user that they did not create. + + created_by_user_id : typing.Optional[str] + Filter tests and folders by creator user ID. Use '@me' to refer to the authenticated user. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestsPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.list( + cursor="cursor", + page_size=1, + search="search", + parent_folder_id="parent_folder_id", + types=["llm"], + include_folders=True, + sort_mode="default", + sharing_mode="all", + created_by_user_id="created_by_user_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, + page_size=page_size, + search=search, + parent_folder_id=parent_folder_id, + types=types, + include_folders=include_folders, + sort_mode=sort_mode, + sharing_mode=sharing_mode, + created_by_user_id=created_by_user_id, + request_options=request_options, + ) + return _response.data + + @property + def folders(self): + if self._folders is None: + from .folders.client import AsyncFoldersClient # noqa: E402 + + self._folders = AsyncFoldersClient(client_wrapper=self._client_wrapper) + return self._folders + + @property + def invocations(self): + if self._invocations is None: + from .invocations.client import AsyncInvocationsClient # noqa: E402 + + self._invocations = AsyncInvocationsClient(client_wrapper=self._client_wrapper) + return self._invocations diff --git a/data/src/elevenlabs/conversational_ai/tests/folders/__init__.py b/data/src/elevenlabs/conversational_ai/tests/folders/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/folders/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/tests/folders/client.py b/data/src/elevenlabs/conversational_ai/tests/folders/client.py new file mode 100644 index 0000000000000000000000000000000000000000..c8892607056d507ff65baebaef488c9c26017f71 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/folders/client.py @@ -0,0 +1,380 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.create_agent_test_folder_response_model import CreateAgentTestFolderResponseModel +from ....types.get_agent_test_folder_response_model import GetAgentTestFolderResponseModel +from .raw_client import AsyncRawFoldersClient, RawFoldersClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class FoldersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawFoldersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawFoldersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawFoldersClient + """ + return self._raw_client + + def create( + self, + *, + name: str, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentTestFolderResponseModel: + """ + Creates a folder for organizing agent tests. + + Parameters + ---------- + name : str + The name of the folder to create + + parent_folder_id : typing.Optional[str] + The ID of the parent folder. If not provided, the folder will be created at the root level. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentTestFolderResponseModel + Folder successfully created + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.folders.create( + name="name", + ) + """ + _response = self._raw_client.create( + name=name, parent_folder_id=parent_folder_id, request_options=request_options + ) + return _response.data + + def get( + self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentTestFolderResponseModel: + """ + Gets an agent test folder by ID, including its folder path. + + Parameters + ---------- + folder_id : str + The folder ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentTestFolderResponseModel + Folder details retrieved successfully + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.folders.get( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", + ) + """ + _response = self._raw_client.get(folder_id, request_options=request_options) + return _response.data + + def delete( + self, + folder_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Deletes an agent test folder by ID. Use force=true to delete a non-empty folder and all its contents. + + Parameters + ---------- + folder_id : str + The folder ID. + + force : typing.Optional[bool] + Force delete. Required for deleting non-empty folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.folders.delete( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", + force=True, + ) + """ + _response = self._raw_client.delete(folder_id, force=force, request_options=request_options) + return _response.data + + def update( + self, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentTestFolderResponseModel: + """ + Updates an agent test folder. Currently only supports updating the folder name. + + Parameters + ---------- + folder_id : str + The folder ID. + + name : str + The new name for the folder + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentTestFolderResponseModel + Folder successfully updated + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.folders.update( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", + name="name", + ) + """ + _response = self._raw_client.update(folder_id, name=name, request_options=request_options) + return _response.data + + +class AsyncFoldersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawFoldersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawFoldersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawFoldersClient + """ + return self._raw_client + + async def create( + self, + *, + name: str, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateAgentTestFolderResponseModel: + """ + Creates a folder for organizing agent tests. + + Parameters + ---------- + name : str + The name of the folder to create + + parent_folder_id : typing.Optional[str] + The ID of the parent folder. If not provided, the folder will be created at the root level. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateAgentTestFolderResponseModel + Folder successfully created + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.folders.create( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + name=name, parent_folder_id=parent_folder_id, request_options=request_options + ) + return _response.data + + async def get( + self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentTestFolderResponseModel: + """ + Gets an agent test folder by ID, including its folder path. + + Parameters + ---------- + folder_id : str + The folder ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentTestFolderResponseModel + Folder details retrieved successfully + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.folders.get( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(folder_id, request_options=request_options) + return _response.data + + async def delete( + self, + folder_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + Deletes an agent test folder by ID. Use force=true to delete a non-empty folder and all its contents. + + Parameters + ---------- + folder_id : str + The folder ID. + + force : typing.Optional[bool] + Force delete. Required for deleting non-empty folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.folders.delete( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", + force=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(folder_id, force=force, request_options=request_options) + return _response.data + + async def update( + self, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> GetAgentTestFolderResponseModel: + """ + Updates an agent test folder. Currently only supports updating the folder name. + + Parameters + ---------- + folder_id : str + The folder ID. + + name : str + The new name for the folder + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentTestFolderResponseModel + Folder successfully updated + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.folders.update( + folder_id="tfld_7301khxdkycse5f88fzjdtrterzm", + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(folder_id, name=name, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/tests/folders/raw_client.py b/data/src/elevenlabs/conversational_ai/tests/folders/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..76e82473d1d37c72702aa007f2300fe9817d6db5 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/folders/raw_client.py @@ -0,0 +1,515 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.create_agent_test_folder_response_model import CreateAgentTestFolderResponseModel +from ....types.get_agent_test_folder_response_model import GetAgentTestFolderResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawFoldersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + name: str, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateAgentTestFolderResponseModel]: + """ + Creates a folder for organizing agent tests. + + Parameters + ---------- + name : str + The name of the folder to create + + parent_folder_id : typing.Optional[str] + The ID of the parent folder. If not provided, the folder will be created at the root level. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateAgentTestFolderResponseModel] + Folder successfully created + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing/folders", + method="POST", + json={ + "name": name, + "parent_folder_id": parent_folder_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentTestFolderResponseModel, + construct_type( + type_=CreateAgentTestFolderResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetAgentTestFolderResponseModel]: + """ + Gets an agent test folder by ID, including its folder path. + + Parameters + ---------- + folder_id : str + The folder ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentTestFolderResponseModel] + Folder details retrieved successfully + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/folders/{jsonable_encoder(folder_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentTestFolderResponseModel, + construct_type( + type_=GetAgentTestFolderResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, + folder_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[None]: + """ + Deletes an agent test folder by ID. Use force=true to delete a non-empty folder and all its contents. + + Parameters + ---------- + folder_id : str + The folder ID. + + force : typing.Optional[bool] + Force delete. Required for deleting non-empty folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/folders/{jsonable_encoder(folder_id)}", + method="DELETE", + params={ + "force": force, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetAgentTestFolderResponseModel]: + """ + Updates an agent test folder. Currently only supports updating the folder name. + + Parameters + ---------- + folder_id : str + The folder ID. + + name : str + The new name for the folder + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentTestFolderResponseModel] + Folder successfully updated + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/folders/{jsonable_encoder(folder_id)}", + method="PATCH", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentTestFolderResponseModel, + construct_type( + type_=GetAgentTestFolderResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawFoldersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + name: str, + parent_folder_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateAgentTestFolderResponseModel]: + """ + Creates a folder for organizing agent tests. + + Parameters + ---------- + name : str + The name of the folder to create + + parent_folder_id : typing.Optional[str] + The ID of the parent folder. If not provided, the folder will be created at the root level. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateAgentTestFolderResponseModel] + Folder successfully created + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing/folders", + method="POST", + json={ + "name": name, + "parent_folder_id": parent_folder_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentTestFolderResponseModel, + construct_type( + type_=CreateAgentTestFolderResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetAgentTestFolderResponseModel]: + """ + Gets an agent test folder by ID, including its folder path. + + Parameters + ---------- + folder_id : str + The folder ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentTestFolderResponseModel] + Folder details retrieved successfully + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/folders/{jsonable_encoder(folder_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentTestFolderResponseModel, + construct_type( + type_=GetAgentTestFolderResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, + folder_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[None]: + """ + Deletes an agent test folder by ID. Use force=true to delete a non-empty folder and all its contents. + + Parameters + ---------- + folder_id : str + The folder ID. + + force : typing.Optional[bool] + Force delete. Required for deleting non-empty folders. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/folders/{jsonable_encoder(folder_id)}", + method="DELETE", + params={ + "force": force, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, folder_id: str, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetAgentTestFolderResponseModel]: + """ + Updates an agent test folder. Currently only supports updating the folder name. + + Parameters + ---------- + folder_id : str + The folder ID. + + name : str + The new name for the folder + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentTestFolderResponseModel] + Folder successfully updated + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/folders/{jsonable_encoder(folder_id)}", + method="PATCH", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentTestFolderResponseModel, + construct_type( + type_=GetAgentTestFolderResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/tests/invocations/__init__.py b/data/src/elevenlabs/conversational_ai/tests/invocations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/invocations/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/tests/invocations/client.py b/data/src/elevenlabs/conversational_ai/tests/invocations/client.py new file mode 100644 index 0000000000000000000000000000000000000000..ae79cbaef5737f3cde6afc305d672bee22b2945f --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/invocations/client.py @@ -0,0 +1,499 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.adhoc_agent_config_override_for_test_request_model import AdhocAgentConfigOverrideForTestRequestModel +from ....types.get_test_invocations_page_response_model import GetTestInvocationsPageResponseModel +from ....types.get_test_suite_invocation_response_model import GetTestSuiteInvocationResponseModel +from .raw_client import AsyncRawInvocationsClient, RawInvocationsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class InvocationsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawInvocationsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawInvocationsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawInvocationsClient + """ + return self._raw_client + + def list( + self, + *, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + test_id: typing.Optional[str] = None, + start_time: typing.Optional[int] = None, + end_time: typing.Optional[int] = None, + version_id: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetTestInvocationsPageResponseModel: + """ + Lists all test invocations with pagination support and optional search filtering. + + Parameters + ---------- + agent_id : typing.Optional[str] + Filter by agent ID + + branch_id : typing.Optional[str] + Filter by branch ID + + test_id : typing.Optional[str] + Filter to invocations that include a run of this test id + + start_time : typing.Optional[int] + Inclusive lower bound on created_at, in unix seconds + + end_time : typing.Optional[int] + Inclusive upper bound on created_at, in unix seconds + + version_id : typing.Optional[str] + Filter by the agent version the tests ran against + + page_size : typing.Optional[int] + How many Tests to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search query to filter tests and folders by name. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestInvocationsPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.invocations.list( + agent_id="agent_id", + branch_id="branch_id", + test_id="test_id", + start_time=1, + end_time=1, + version_id="version_id", + page_size=1, + search="search", + cursor="cursor", + ) + """ + _response = self._raw_client.list( + agent_id=agent_id, + branch_id=branch_id, + test_id=test_id, + start_time=start_time, + end_time=end_time, + version_id=version_id, + page_size=page_size, + search=search, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def get( + self, test_invocation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetTestSuiteInvocationResponseModel: + """ + Gets a test invocation by ID. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestSuiteInvocationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.invocations.get( + test_invocation_id="test_invocation_id", + ) + """ + _response = self._raw_client.get(test_invocation_id, request_options=request_options) + return _response.data + + def cancel(self, test_invocation_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Cancels all pending runs in a test invocation. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.invocations.cancel( + test_invocation_id="test_invocation_id", + ) + """ + _response = self._raw_client.cancel(test_invocation_id, request_options=request_options) + return _response.data + + def resubmit( + self, + test_invocation_id: str, + *, + test_run_ids: typing.Sequence[str], + agent_id: str, + agent_config_override: typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] = OMIT, + branch_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Resubmits specific test runs from a test invocation. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + test_run_ids : typing.Sequence[str] + List of test run IDs to resubmit + + agent_id : str + Agent ID to resubmit tests for + + agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] + Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + + branch_id : typing.Optional[str] + ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tests.invocations.resubmit( + test_invocation_id="test_invocation_id", + test_run_ids=["test_run_ids"], + agent_id="agent_id", + ) + """ + _response = self._raw_client.resubmit( + test_invocation_id, + test_run_ids=test_run_ids, + agent_id=agent_id, + agent_config_override=agent_config_override, + branch_id=branch_id, + request_options=request_options, + ) + return _response.data + + +class AsyncInvocationsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawInvocationsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawInvocationsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawInvocationsClient + """ + return self._raw_client + + async def list( + self, + *, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + test_id: typing.Optional[str] = None, + start_time: typing.Optional[int] = None, + end_time: typing.Optional[int] = None, + version_id: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetTestInvocationsPageResponseModel: + """ + Lists all test invocations with pagination support and optional search filtering. + + Parameters + ---------- + agent_id : typing.Optional[str] + Filter by agent ID + + branch_id : typing.Optional[str] + Filter by branch ID + + test_id : typing.Optional[str] + Filter to invocations that include a run of this test id + + start_time : typing.Optional[int] + Inclusive lower bound on created_at, in unix seconds + + end_time : typing.Optional[int] + Inclusive upper bound on created_at, in unix seconds + + version_id : typing.Optional[str] + Filter by the agent version the tests ran against + + page_size : typing.Optional[int] + How many Tests to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search query to filter tests and folders by name. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestInvocationsPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.invocations.list( + agent_id="agent_id", + branch_id="branch_id", + test_id="test_id", + start_time=1, + end_time=1, + version_id="version_id", + page_size=1, + search="search", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + agent_id=agent_id, + branch_id=branch_id, + test_id=test_id, + start_time=start_time, + end_time=end_time, + version_id=version_id, + page_size=page_size, + search=search, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def get( + self, test_invocation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetTestSuiteInvocationResponseModel: + """ + Gets a test invocation by ID. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetTestSuiteInvocationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.invocations.get( + test_invocation_id="test_invocation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(test_invocation_id, request_options=request_options) + return _response.data + + async def cancel(self, test_invocation_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Cancels all pending runs in a test invocation. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.invocations.cancel( + test_invocation_id="test_invocation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.cancel(test_invocation_id, request_options=request_options) + return _response.data + + async def resubmit( + self, + test_invocation_id: str, + *, + test_run_ids: typing.Sequence[str], + agent_id: str, + agent_config_override: typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] = OMIT, + branch_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Resubmits specific test runs from a test invocation. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + test_run_ids : typing.Sequence[str] + List of test run IDs to resubmit + + agent_id : str + Agent ID to resubmit tests for + + agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] + Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + + branch_id : typing.Optional[str] + ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tests.invocations.resubmit( + test_invocation_id="test_invocation_id", + test_run_ids=["test_run_ids"], + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.resubmit( + test_invocation_id, + test_run_ids=test_run_ids, + agent_id=agent_id, + agent_config_override=agent_config_override, + branch_id=branch_id, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/tests/invocations/raw_client.py b/data/src/elevenlabs/conversational_ai/tests/invocations/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..da805daf52e09e0cfc4a6f4d97243c0f3d43f400 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/invocations/raw_client.py @@ -0,0 +1,609 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.adhoc_agent_config_override_for_test_request_model import AdhocAgentConfigOverrideForTestRequestModel +from ....types.get_test_invocations_page_response_model import GetTestInvocationsPageResponseModel +from ....types.get_test_suite_invocation_response_model import GetTestSuiteInvocationResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawInvocationsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + test_id: typing.Optional[str] = None, + start_time: typing.Optional[int] = None, + end_time: typing.Optional[int] = None, + version_id: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetTestInvocationsPageResponseModel]: + """ + Lists all test invocations with pagination support and optional search filtering. + + Parameters + ---------- + agent_id : typing.Optional[str] + Filter by agent ID + + branch_id : typing.Optional[str] + Filter by branch ID + + test_id : typing.Optional[str] + Filter to invocations that include a run of this test id + + start_time : typing.Optional[int] + Inclusive lower bound on created_at, in unix seconds + + end_time : typing.Optional[int] + Inclusive upper bound on created_at, in unix seconds + + version_id : typing.Optional[str] + Filter by the agent version the tests ran against + + page_size : typing.Optional[int] + How many Tests to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search query to filter tests and folders by name. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetTestInvocationsPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/test-invocations", + method="GET", + params={ + "agent_id": agent_id, + "branch_id": branch_id, + "test_id": test_id, + "start_time": start_time, + "end_time": end_time, + "version_id": version_id, + "page_size": page_size, + "search": search, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestInvocationsPageResponseModel, + construct_type( + type_=GetTestInvocationsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, test_invocation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetTestSuiteInvocationResponseModel]: + """ + Gets a test invocation by ID. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetTestSuiteInvocationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/test-invocations/{jsonable_encoder(test_invocation_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestSuiteInvocationResponseModel, + construct_type( + type_=GetTestSuiteInvocationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def cancel( + self, test_invocation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Cancels all pending runs in a test invocation. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/test-invocations/{jsonable_encoder(test_invocation_id)}/cancel", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def resubmit( + self, + test_invocation_id: str, + *, + test_run_ids: typing.Sequence[str], + agent_id: str, + agent_config_override: typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] = OMIT, + branch_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Resubmits specific test runs from a test invocation. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + test_run_ids : typing.Sequence[str] + List of test run IDs to resubmit + + agent_id : str + Agent ID to resubmit tests for + + agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] + Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + + branch_id : typing.Optional[str] + ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/test-invocations/{jsonable_encoder(test_invocation_id)}/resubmit", + method="POST", + json={ + "test_run_ids": test_run_ids, + "agent_config_override": convert_and_respect_annotation_metadata( + object_=agent_config_override, + annotation=AdhocAgentConfigOverrideForTestRequestModel, + direction="write", + ), + "agent_id": agent_id, + "branch_id": branch_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawInvocationsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + test_id: typing.Optional[str] = None, + start_time: typing.Optional[int] = None, + end_time: typing.Optional[int] = None, + version_id: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetTestInvocationsPageResponseModel]: + """ + Lists all test invocations with pagination support and optional search filtering. + + Parameters + ---------- + agent_id : typing.Optional[str] + Filter by agent ID + + branch_id : typing.Optional[str] + Filter by branch ID + + test_id : typing.Optional[str] + Filter to invocations that include a run of this test id + + start_time : typing.Optional[int] + Inclusive lower bound on created_at, in unix seconds + + end_time : typing.Optional[int] + Inclusive upper bound on created_at, in unix seconds + + version_id : typing.Optional[str] + Filter by the agent version the tests ran against + + page_size : typing.Optional[int] + How many Tests to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search query to filter tests and folders by name. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetTestInvocationsPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/test-invocations", + method="GET", + params={ + "agent_id": agent_id, + "branch_id": branch_id, + "test_id": test_id, + "start_time": start_time, + "end_time": end_time, + "version_id": version_id, + "page_size": page_size, + "search": search, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestInvocationsPageResponseModel, + construct_type( + type_=GetTestInvocationsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, test_invocation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetTestSuiteInvocationResponseModel]: + """ + Gets a test invocation by ID. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetTestSuiteInvocationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/test-invocations/{jsonable_encoder(test_invocation_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestSuiteInvocationResponseModel, + construct_type( + type_=GetTestSuiteInvocationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def cancel( + self, test_invocation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Cancels all pending runs in a test invocation. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/test-invocations/{jsonable_encoder(test_invocation_id)}/cancel", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def resubmit( + self, + test_invocation_id: str, + *, + test_run_ids: typing.Sequence[str], + agent_id: str, + agent_config_override: typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] = OMIT, + branch_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Resubmits specific test runs from a test invocation. + + Parameters + ---------- + test_invocation_id : str + The id of a test invocation. This is returned when tests are run. + + test_run_ids : typing.Sequence[str] + List of test run IDs to resubmit + + agent_id : str + Agent ID to resubmit tests for + + agent_config_override : typing.Optional[AdhocAgentConfigOverrideForTestRequestModel] + Configuration overrides to use for testing. If not provided, the agent's default configuration will be used. + + branch_id : typing.Optional[str] + ID of the branch to run the tests on. If not provided, the tests will be run on the agent's main branch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/test-invocations/{jsonable_encoder(test_invocation_id)}/resubmit", + method="POST", + json={ + "test_run_ids": test_run_ids, + "agent_config_override": convert_and_respect_annotation_metadata( + object_=agent_config_override, + annotation=AdhocAgentConfigOverrideForTestRequestModel, + direction="write", + ), + "agent_id": agent_id, + "branch_id": branch_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/tests/raw_client.py b/data/src/elevenlabs/conversational_ai/tests/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d4d392260725e18845622d873ff6f49d17fe5be5 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/raw_client.py @@ -0,0 +1,968 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.create_agent_test_response_model import CreateAgentTestResponseModel +from ...types.get_tests_page_response_model import GetTestsPageResponseModel +from ...types.get_tests_summaries_by_ids_response_model import GetTestsSummariesByIdsResponseModel +from ...types.test_sharing_mode import TestSharingMode +from ...types.test_type import TestType +from .types.tests_create_request_body import TestsCreateRequestBody +from .types.tests_get_response import TestsGetResponse +from .types.tests_list_request_sort_mode import TestsListRequestSortMode +from .types.tests_update_request_body import TestsUpdateRequestBody +from .types.tests_update_response import TestsUpdateResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTestsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, *, request: TestsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[CreateAgentTestResponseModel]: + """ + Creates a new agent response test. + + Parameters + ---------- + request : TestsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateAgentTestResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing/create", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TestsCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentTestResponseModel, + construct_type( + type_=CreateAgentTestResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def move( + self, + *, + entity_ids: typing.Sequence[str], + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Moves multiple tests or folders from one folder to another. + + Parameters + ---------- + entity_ids : typing.Sequence[str] + The IDs of tests or folders to move. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Tests or folders successfully moved to another folder + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing/bulk-move", + method="POST", + json={ + "entity_ids": entity_ids, + "move_to": move_to, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, test_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[TestsGetResponse]: + """ + Gets an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TestsGetResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/{jsonable_encoder(test_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TestsGetResponse, + construct_type( + type_=TestsGetResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, test_id: str, *, request: TestsUpdateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[TestsUpdateResponse]: + """ + Updates an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request : TestsUpdateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TestsUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/{jsonable_encoder(test_id)}", + method="PUT", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TestsUpdateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TestsUpdateResponse, + construct_type( + type_=TestsUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, test_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Deletes an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/{jsonable_encoder(test_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def summaries( + self, *, test_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetTestsSummariesByIdsResponseModel]: + """ + Gets agent response test summaries for the requested test IDs. + + Parameters + ---------- + test_ids : typing.Sequence[str] + List of test IDs to fetch. No duplicates allowed. Prefer at most 1000 IDs per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetTestsSummariesByIdsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing/summaries", + method="POST", + json={ + "test_ids": test_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestsSummariesByIdsResponseModel, + construct_type( + type_=GetTestsSummariesByIdsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + parent_folder_id: typing.Optional[str] = None, + types: typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]] = None, + include_folders: typing.Optional[bool] = None, + sort_mode: typing.Optional[TestsListRequestSortMode] = None, + sharing_mode: typing.Optional[TestSharingMode] = None, + created_by_user_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetTestsPageResponseModel]: + """ + Lists all agent response tests with pagination support and optional search filtering. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many Tests to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search query to filter tests and folders by name. + + parent_folder_id : typing.Optional[str] + Filter by parent folder ID. Use 'root' to get items in the root folder. + + types : typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]] + If present, the endpoint will return only tests/folders of the given types. + + include_folders : typing.Optional[bool] + Deprecated. Use the `types` query param and include `folder` instead. + + sort_mode : typing.Optional[TestsListRequestSortMode] + Sort mode for listing tests. Use 'folders_first' to place folders before tests. + + sharing_mode : typing.Optional[TestSharingMode] + Filter test visibility. Use `shared_with_me` to return only tests/folders shared with the current user that they did not create. + + created_by_user_id : typing.Optional[str] + Filter tests and folders by creator user ID. Use '@me' to refer to the authenticated user. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetTestsPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "search": search, + "parent_folder_id": parent_folder_id, + "types": types, + "include_folders": include_folders, + "sort_mode": sort_mode, + "sharing_mode": sharing_mode, + "created_by_user_id": created_by_user_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestsPageResponseModel, + construct_type( + type_=GetTestsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTestsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, *, request: TestsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[CreateAgentTestResponseModel]: + """ + Creates a new agent response test. + + Parameters + ---------- + request : TestsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateAgentTestResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing/create", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TestsCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateAgentTestResponseModel, + construct_type( + type_=CreateAgentTestResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def move( + self, + *, + entity_ids: typing.Sequence[str], + move_to: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Moves multiple tests or folders from one folder to another. + + Parameters + ---------- + entity_ids : typing.Sequence[str] + The IDs of tests or folders to move. + + move_to : typing.Optional[str] + The folder to move the entities to. If not set, the entities will be moved to the root folder. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Tests or folders successfully moved to another folder + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing/bulk-move", + method="POST", + json={ + "entity_ids": entity_ids, + "move_to": move_to, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, test_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TestsGetResponse]: + """ + Gets an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TestsGetResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/{jsonable_encoder(test_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TestsGetResponse, + construct_type( + type_=TestsGetResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, test_id: str, *, request: TestsUpdateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TestsUpdateResponse]: + """ + Updates an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request : TestsUpdateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TestsUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/{jsonable_encoder(test_id)}", + method="PUT", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TestsUpdateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TestsUpdateResponse, + construct_type( + type_=TestsUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, test_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Deletes an agent response test by ID. + + Parameters + ---------- + test_id : str + The id of a chat response test. This is returned on test creation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agent-testing/{jsonable_encoder(test_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def summaries( + self, *, test_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetTestsSummariesByIdsResponseModel]: + """ + Gets agent response test summaries for the requested test IDs. + + Parameters + ---------- + test_ids : typing.Sequence[str] + List of test IDs to fetch. No duplicates allowed. Prefer at most 1000 IDs per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetTestsSummariesByIdsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing/summaries", + method="POST", + json={ + "test_ids": test_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestsSummariesByIdsResponseModel, + construct_type( + type_=GetTestsSummariesByIdsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + parent_folder_id: typing.Optional[str] = None, + types: typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]] = None, + include_folders: typing.Optional[bool] = None, + sort_mode: typing.Optional[TestsListRequestSortMode] = None, + sharing_mode: typing.Optional[TestSharingMode] = None, + created_by_user_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetTestsPageResponseModel]: + """ + Lists all agent response tests with pagination support and optional search filtering. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many Tests to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search query to filter tests and folders by name. + + parent_folder_id : typing.Optional[str] + Filter by parent folder ID. Use 'root' to get items in the root folder. + + types : typing.Optional[typing.Union[TestType, typing.Sequence[TestType]]] + If present, the endpoint will return only tests/folders of the given types. + + include_folders : typing.Optional[bool] + Deprecated. Use the `types` query param and include `folder` instead. + + sort_mode : typing.Optional[TestsListRequestSortMode] + Sort mode for listing tests. Use 'folders_first' to place folders before tests. + + sharing_mode : typing.Optional[TestSharingMode] + Filter test visibility. Use `shared_with_me` to return only tests/folders shared with the current user that they did not create. + + created_by_user_id : typing.Optional[str] + Filter tests and folders by creator user ID. Use '@me' to refer to the authenticated user. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetTestsPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/agent-testing", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "search": search, + "parent_folder_id": parent_folder_id, + "types": types, + "include_folders": include_folders, + "sort_mode": sort_mode, + "sharing_mode": sharing_mode, + "created_by_user_id": created_by_user_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetTestsPageResponseModel, + construct_type( + type_=GetTestsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/tests/types/__init__.py b/data/src/elevenlabs/conversational_ai/tests/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6250c08ec2835c540eba9f371054e2fdb7a0deef --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/types/__init__.py @@ -0,0 +1,94 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .tests_create_request_body import ( + TestsCreateRequestBody, + TestsCreateRequestBody_Llm, + TestsCreateRequestBody_Simulation, + TestsCreateRequestBody_Tool, + ) + from .tests_get_response import ( + TestsGetResponse, + TestsGetResponse_Llm, + TestsGetResponse_Simulation, + TestsGetResponse_Tool, + ) + from .tests_list_request_sort_mode import TestsListRequestSortMode + from .tests_update_request_body import ( + TestsUpdateRequestBody, + TestsUpdateRequestBody_Llm, + TestsUpdateRequestBody_Simulation, + TestsUpdateRequestBody_Tool, + ) + from .tests_update_response import ( + TestsUpdateResponse, + TestsUpdateResponse_Llm, + TestsUpdateResponse_Simulation, + TestsUpdateResponse_Tool, + ) +_dynamic_imports: typing.Dict[str, str] = { + "TestsCreateRequestBody": ".tests_create_request_body", + "TestsCreateRequestBody_Llm": ".tests_create_request_body", + "TestsCreateRequestBody_Simulation": ".tests_create_request_body", + "TestsCreateRequestBody_Tool": ".tests_create_request_body", + "TestsGetResponse": ".tests_get_response", + "TestsGetResponse_Llm": ".tests_get_response", + "TestsGetResponse_Simulation": ".tests_get_response", + "TestsGetResponse_Tool": ".tests_get_response", + "TestsListRequestSortMode": ".tests_list_request_sort_mode", + "TestsUpdateRequestBody": ".tests_update_request_body", + "TestsUpdateRequestBody_Llm": ".tests_update_request_body", + "TestsUpdateRequestBody_Simulation": ".tests_update_request_body", + "TestsUpdateRequestBody_Tool": ".tests_update_request_body", + "TestsUpdateResponse": ".tests_update_response", + "TestsUpdateResponse_Llm": ".tests_update_response", + "TestsUpdateResponse_Simulation": ".tests_update_response", + "TestsUpdateResponse_Tool": ".tests_update_response", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "TestsCreateRequestBody", + "TestsCreateRequestBody_Llm", + "TestsCreateRequestBody_Simulation", + "TestsCreateRequestBody_Tool", + "TestsGetResponse", + "TestsGetResponse_Llm", + "TestsGetResponse_Simulation", + "TestsGetResponse_Tool", + "TestsListRequestSortMode", + "TestsUpdateRequestBody", + "TestsUpdateRequestBody_Llm", + "TestsUpdateRequestBody_Simulation", + "TestsUpdateRequestBody_Tool", + "TestsUpdateResponse", + "TestsUpdateResponse_Llm", + "TestsUpdateResponse_Simulation", + "TestsUpdateResponse_Tool", +] diff --git a/data/src/elevenlabs/conversational_ai/tests/types/tests_create_request_body.py b/data/src/elevenlabs/conversational_ai/tests/types/tests_create_request_body.py new file mode 100644 index 0000000000000000000000000000000000000000..e160289bb51a2f478ae36a4ca4aefc282e9623cb --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/types/tests_create_request_body.py @@ -0,0 +1,114 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.agent_failure_response_example import AgentFailureResponseExample +from ....types.agent_successful_response_example import AgentSuccessfulResponseExample +from ....types.conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from ....types.conversation_initiation_source import ConversationInitiationSource +from ....types.llm import Llm +from ....types.simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from ....types.test_from_conversation_metadata_input import TestFromConversationMetadataInput +from ....types.tool_response_mock_config_input import ToolResponseMockConfigInput +from ....types.unit_test_tool_call_evaluation_model_input import UnitTestToolCallEvaluationModelInput + + +class TestsCreateRequestBody_Llm(UncheckedBaseModel): + """ + Create Chat Response Test Request Information + """ + + type: typing.Literal["llm"] = "llm" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = None + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = None + name: str + parent_folder_id: 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 + + +class TestsCreateRequestBody_Tool(UncheckedBaseModel): + """ + Create Chat Response Test Request Information + """ + + type: typing.Literal["tool"] = "tool" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelInput] = None + check_any_tool_matches: typing.Optional[bool] = None + name: str + parent_folder_id: 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 + + +class TestsCreateRequestBody_Simulation(UncheckedBaseModel): + """ + Create Chat Response Test Request Information + """ + + type: typing.Literal["simulation"] = "simulation" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_conditions: typing.Optional[typing.List[str]] = None + simulation_scenario: typing.Optional[str] = None + simulation_max_turns: typing.Optional[int] = None + simulation_environment: typing.Optional[str] = None + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = None + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigInput]]] = None + evaluation_model: typing.Optional[Llm] = None + simulated_user_model: typing.Optional[Llm] = None + name: str + parent_folder_id: 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 + + +TestsCreateRequestBody = typing_extensions.Annotated[ + typing.Union[TestsCreateRequestBody_Llm, TestsCreateRequestBody_Tool, TestsCreateRequestBody_Simulation], + UnionMetadata(discriminant="type"), +] +update_forward_refs(TestsCreateRequestBody_Llm) +update_forward_refs(TestsCreateRequestBody_Tool) +update_forward_refs(TestsCreateRequestBody_Simulation) diff --git a/data/src/elevenlabs/conversational_ai/tests/types/tests_get_response.py b/data/src/elevenlabs/conversational_ai/tests/types/tests_get_response.py new file mode 100644 index 0000000000000000000000000000000000000000..cf1ca377f88ad69a0b6c0b8e804c7454afc1ca04 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/types/tests_get_response.py @@ -0,0 +1,106 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.agent_failure_response_example import AgentFailureResponseExample +from ....types.agent_successful_response_example import AgentSuccessfulResponseExample +from ....types.conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from ....types.conversation_initiation_source import ConversationInitiationSource +from ....types.llm import Llm +from ....types.resource_access_info import ResourceAccessInfo +from ....types.simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from ....types.test_from_conversation_metadata_output import TestFromConversationMetadataOutput +from ....types.tool_response_mock_config_output import ToolResponseMockConfigOutput +from ....types.unit_test_tool_call_evaluation_model_output import UnitTestToolCallEvaluationModelOutput + + +class TestsGetResponse_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + access_info: typing.Optional[ResourceAccessInfo] = None + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = None + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = None + id: str + 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 + + +class TestsGetResponse_Tool(UncheckedBaseModel): + type: typing.Literal["tool"] = "tool" + access_info: typing.Optional[ResourceAccessInfo] = None + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelOutput] = None + check_any_tool_matches: typing.Optional[bool] = None + id: str + 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 + + +class TestsGetResponse_Simulation(UncheckedBaseModel): + type: typing.Literal["simulation"] = "simulation" + access_info: typing.Optional[ResourceAccessInfo] = None + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_conditions: typing.Optional[typing.List[str]] = None + simulation_scenario: typing.Optional[str] = None + simulation_max_turns: typing.Optional[int] = None + simulation_environment: typing.Optional[str] = None + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = None + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigOutput]]] = None + evaluation_model: typing.Optional[Llm] = None + simulated_user_model: typing.Optional[Llm] = None + id: str + 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 + + +TestsGetResponse = typing_extensions.Annotated[ + typing.Union[TestsGetResponse_Llm, TestsGetResponse_Tool, TestsGetResponse_Simulation], + UnionMetadata(discriminant="type"), +] +update_forward_refs(TestsGetResponse_Llm) +update_forward_refs(TestsGetResponse_Tool) +update_forward_refs(TestsGetResponse_Simulation) diff --git a/data/src/elevenlabs/conversational_ai/tests/types/tests_list_request_sort_mode.py b/data/src/elevenlabs/conversational_ai/tests/types/tests_list_request_sort_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..9c3abef79e8b618ae5280a9b2fb9c57e90d0ecfc --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/types/tests_list_request_sort_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TestsListRequestSortMode = typing.Union[typing.Literal["default", "folders_first"], typing.Any] diff --git a/data/src/elevenlabs/conversational_ai/tests/types/tests_update_request_body.py b/data/src/elevenlabs/conversational_ai/tests/types/tests_update_request_body.py new file mode 100644 index 0000000000000000000000000000000000000000..12c96af3c6f0073e892a3ebc1d4d288890fed4a7 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/types/tests_update_request_body.py @@ -0,0 +1,114 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.agent_failure_response_example import AgentFailureResponseExample +from ....types.agent_successful_response_example import AgentSuccessfulResponseExample +from ....types.conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from ....types.conversation_initiation_source import ConversationInitiationSource +from ....types.llm import Llm +from ....types.simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from ....types.test_from_conversation_metadata_input import TestFromConversationMetadataInput +from ....types.tool_response_mock_config_input import ToolResponseMockConfigInput +from ....types.unit_test_tool_call_evaluation_model_input import UnitTestToolCallEvaluationModelInput + + +class TestsUpdateRequestBody_Llm(UncheckedBaseModel): + """ + Agent test to update + """ + + type: typing.Literal["llm"] = "llm" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = None + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = None + name: str + parent_folder_id: 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 + + +class TestsUpdateRequestBody_Tool(UncheckedBaseModel): + """ + Agent test to update + """ + + type: typing.Literal["tool"] = "tool" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelInput] = None + check_any_tool_matches: typing.Optional[bool] = None + name: str + parent_folder_id: 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 + + +class TestsUpdateRequestBody_Simulation(UncheckedBaseModel): + """ + Agent test to update + """ + + type: typing.Literal["simulation"] = "simulation" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_conditions: typing.Optional[typing.List[str]] = None + simulation_scenario: typing.Optional[str] = None + simulation_max_turns: typing.Optional[int] = None + simulation_environment: typing.Optional[str] = None + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = None + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigInput]]] = None + evaluation_model: typing.Optional[Llm] = None + simulated_user_model: typing.Optional[Llm] = None + name: str + parent_folder_id: 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 + + +TestsUpdateRequestBody = typing_extensions.Annotated[ + typing.Union[TestsUpdateRequestBody_Llm, TestsUpdateRequestBody_Tool, TestsUpdateRequestBody_Simulation], + UnionMetadata(discriminant="type"), +] +update_forward_refs(TestsUpdateRequestBody_Llm) +update_forward_refs(TestsUpdateRequestBody_Tool) +update_forward_refs(TestsUpdateRequestBody_Simulation) diff --git a/data/src/elevenlabs/conversational_ai/tests/types/tests_update_response.py b/data/src/elevenlabs/conversational_ai/tests/types/tests_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..654f6f22f787a17b8089751f1c38980056f2fece --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tests/types/tests_update_response.py @@ -0,0 +1,106 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.agent_failure_response_example import AgentFailureResponseExample +from ....types.agent_successful_response_example import AgentSuccessfulResponseExample +from ....types.conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from ....types.conversation_initiation_source import ConversationInitiationSource +from ....types.llm import Llm +from ....types.resource_access_info import ResourceAccessInfo +from ....types.simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from ....types.test_from_conversation_metadata_output import TestFromConversationMetadataOutput +from ....types.tool_response_mock_config_output import ToolResponseMockConfigOutput +from ....types.unit_test_tool_call_evaluation_model_output import UnitTestToolCallEvaluationModelOutput + + +class TestsUpdateResponse_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + access_info: typing.Optional[ResourceAccessInfo] = None + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = None + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = None + id: str + 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 + + +class TestsUpdateResponse_Tool(UncheckedBaseModel): + type: typing.Literal["tool"] = "tool" + access_info: typing.Optional[ResourceAccessInfo] = None + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelOutput] = None + check_any_tool_matches: typing.Optional[bool] = None + id: str + 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 + + +class TestsUpdateResponse_Simulation(UncheckedBaseModel): + type: typing.Literal["simulation"] = "simulation" + access_info: typing.Optional[ResourceAccessInfo] = None + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_conditions: typing.Optional[typing.List[str]] = None + simulation_scenario: typing.Optional[str] = None + simulation_max_turns: typing.Optional[int] = None + simulation_environment: typing.Optional[str] = None + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = None + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigOutput]]] = None + evaluation_model: typing.Optional[Llm] = None + simulated_user_model: typing.Optional[Llm] = None + id: str + 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 + + +TestsUpdateResponse = typing_extensions.Annotated[ + typing.Union[TestsUpdateResponse_Llm, TestsUpdateResponse_Tool, TestsUpdateResponse_Simulation], + UnionMetadata(discriminant="type"), +] +update_forward_refs(TestsUpdateResponse_Llm) +update_forward_refs(TestsUpdateResponse_Tool) +update_forward_refs(TestsUpdateResponse_Simulation) diff --git a/data/src/elevenlabs/conversational_ai/tools/__init__.py b/data/src/elevenlabs/conversational_ai/tools/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a7fd1f87a4bac5e2cc43f5f6fdfa5bbfa2ad02ed --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tools/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import executions +_dynamic_imports: typing.Dict[str, str] = {"executions": ".executions"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["executions"] diff --git a/data/src/elevenlabs/conversational_ai/tools/client.py b/data/src/elevenlabs/conversational_ai/tools/client.py new file mode 100644 index 0000000000000000000000000000000000000000..687ca8e1c6c36eff2ce6d358de62adcda56b74dc --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tools/client.py @@ -0,0 +1,731 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.get_tool_dependent_agents_response_model import GetToolDependentAgentsResponseModel +from ...types.sort_direction import SortDirection +from ...types.tool_request_model import ToolRequestModel +from ...types.tool_response_model import ToolResponseModel +from ...types.tool_sort_by import ToolSortBy +from ...types.tool_type_filter import ToolTypeFilter +from ...types.tools_response_model import ToolsResponseModel +from .raw_client import AsyncRawToolsClient, RawToolsClient + +if typing.TYPE_CHECKING: + from .executions.client import AsyncExecutionsClient, ExecutionsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ToolsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawToolsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._executions: typing.Optional[ExecutionsClient] = None + + @property + def with_raw_response(self) -> RawToolsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawToolsClient + """ + return self._raw_client + + def list( + self, + *, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + show_only_owned_documents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + types: typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[ToolSortBy] = None, + used_by_agent_id: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ToolsResponseModel: + """ + Get all available tools in the workspace. + + Parameters + ---------- + search : typing.Optional[str] + If specified, the endpoint returns only tools whose names start with this string. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + show_only_owned_documents : typing.Optional[bool] + If set to true, the endpoint will return only tools owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter tools by creator user ID. When set, only tools created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + + types : typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]] + If present, the endpoint will return only tools of the given types. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[ToolSortBy] + The field to sort the results by + + used_by_agent_id : typing.Optional[str] + Filter to tools referenced by this agent's main branch: tools attached to the agent, tools on authored workflow nodes, and tools referenced by procedures. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ToolsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tools.list( + search="search", + page_size=1, + show_only_owned_documents=True, + created_by_user_id="created_by_user_id", + types=["webhook"], + sort_direction="asc", + sort_by="name", + used_by_agent_id="used_by_agent_id", + cursor="cursor", + ) + """ + _response = self._raw_client.list( + search=search, + page_size=page_size, + show_only_owned_documents=show_only_owned_documents, + created_by_user_id=created_by_user_id, + types=types, + sort_direction=sort_direction, + sort_by=sort_by, + used_by_agent_id=used_by_agent_id, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def create( + self, *, request: ToolRequestModel, request_options: typing.Optional[RequestOptions] = None + ) -> ToolResponseModel: + """ + Add a new tool to the available tools in the workspace. + + Parameters + ---------- + request : ToolRequestModel + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ToolResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ( + ElevenLabs, + ToolRequestModel, + ToolRequestModelToolConfig_Client, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tools.create( + request=ToolRequestModel( + tool_config=ToolRequestModelToolConfig_Client( + name="name", + description="description", + expects_response=False, + ), + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def get( + self, + tool_id: str, + *, + environment: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ToolResponseModel: + """ + Get tool that is available in the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ToolResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tools.get( + tool_id="tool_id", + environment="environment", + ) + """ + _response = self._raw_client.get(tool_id, environment=environment, request_options=request_options) + return _response.data + + def delete( + self, + tool_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Delete tool from the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + force : typing.Optional[bool] + If set to true, the tool will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents and branches. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tools.delete( + tool_id="tool_id", + force=True, + ) + """ + _response = self._raw_client.delete(tool_id, force=force, request_options=request_options) + return _response.data + + def update( + self, tool_id: str, *, request: ToolRequestModel, request_options: typing.Optional[RequestOptions] = None + ) -> ToolResponseModel: + """ + Update tool that is available in the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + request : ToolRequestModel + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ToolResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ( + ElevenLabs, + ToolRequestModel, + ToolRequestModelToolConfig_Client, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tools.update( + tool_id="tool_id", + request=ToolRequestModel( + tool_config=ToolRequestModelToolConfig_Client( + name="name", + description="description", + expects_response=False, + ), + ), + ) + """ + _response = self._raw_client.update(tool_id, request=request, request_options=request_options) + return _response.data + + def get_dependent_agents( + self, + tool_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetToolDependentAgentsResponseModel: + """ + Get a list of agents depending on this tool + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetToolDependentAgentsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tools.get_dependent_agents( + tool_id="tool_id", + cursor="cursor", + page_size=1, + ) + """ + _response = self._raw_client.get_dependent_agents( + tool_id, cursor=cursor, page_size=page_size, request_options=request_options + ) + return _response.data + + @property + def executions(self): + if self._executions is None: + from .executions.client import ExecutionsClient # noqa: E402 + + self._executions = ExecutionsClient(client_wrapper=self._client_wrapper) + return self._executions + + +class AsyncToolsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawToolsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._executions: typing.Optional[AsyncExecutionsClient] = None + + @property + def with_raw_response(self) -> AsyncRawToolsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawToolsClient + """ + return self._raw_client + + async def list( + self, + *, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + show_only_owned_documents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + types: typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[ToolSortBy] = None, + used_by_agent_id: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ToolsResponseModel: + """ + Get all available tools in the workspace. + + Parameters + ---------- + search : typing.Optional[str] + If specified, the endpoint returns only tools whose names start with this string. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + show_only_owned_documents : typing.Optional[bool] + If set to true, the endpoint will return only tools owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter tools by creator user ID. When set, only tools created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + + types : typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]] + If present, the endpoint will return only tools of the given types. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[ToolSortBy] + The field to sort the results by + + used_by_agent_id : typing.Optional[str] + Filter to tools referenced by this agent's main branch: tools attached to the agent, tools on authored workflow nodes, and tools referenced by procedures. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ToolsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tools.list( + search="search", + page_size=1, + show_only_owned_documents=True, + created_by_user_id="created_by_user_id", + types=["webhook"], + sort_direction="asc", + sort_by="name", + used_by_agent_id="used_by_agent_id", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + search=search, + page_size=page_size, + show_only_owned_documents=show_only_owned_documents, + created_by_user_id=created_by_user_id, + types=types, + sort_direction=sort_direction, + sort_by=sort_by, + used_by_agent_id=used_by_agent_id, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def create( + self, *, request: ToolRequestModel, request_options: typing.Optional[RequestOptions] = None + ) -> ToolResponseModel: + """ + Add a new tool to the available tools in the workspace. + + Parameters + ---------- + request : ToolRequestModel + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ToolResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AsyncElevenLabs, + ToolRequestModel, + ToolRequestModelToolConfig_Client, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tools.create( + request=ToolRequestModel( + tool_config=ToolRequestModelToolConfig_Client( + name="name", + description="description", + expects_response=False, + ), + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def get( + self, + tool_id: str, + *, + environment: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ToolResponseModel: + """ + Get tool that is available in the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ToolResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tools.get( + tool_id="tool_id", + environment="environment", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(tool_id, environment=environment, request_options=request_options) + return _response.data + + async def delete( + self, + tool_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Delete tool from the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + force : typing.Optional[bool] + If set to true, the tool will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents and branches. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tools.delete( + tool_id="tool_id", + force=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(tool_id, force=force, request_options=request_options) + return _response.data + + async def update( + self, tool_id: str, *, request: ToolRequestModel, request_options: typing.Optional[RequestOptions] = None + ) -> ToolResponseModel: + """ + Update tool that is available in the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + request : ToolRequestModel + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ToolResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AsyncElevenLabs, + ToolRequestModel, + ToolRequestModelToolConfig_Client, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tools.update( + tool_id="tool_id", + request=ToolRequestModel( + tool_config=ToolRequestModelToolConfig_Client( + name="name", + description="description", + expects_response=False, + ), + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(tool_id, request=request, request_options=request_options) + return _response.data + + async def get_dependent_agents( + self, + tool_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetToolDependentAgentsResponseModel: + """ + Get a list of agents depending on this tool + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetToolDependentAgentsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tools.get_dependent_agents( + tool_id="tool_id", + cursor="cursor", + page_size=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_dependent_agents( + tool_id, cursor=cursor, page_size=page_size, request_options=request_options + ) + return _response.data + + @property + def executions(self): + if self._executions is None: + from .executions.client import AsyncExecutionsClient # noqa: E402 + + self._executions = AsyncExecutionsClient(client_wrapper=self._client_wrapper) + return self._executions diff --git a/data/src/elevenlabs/conversational_ai/tools/executions/__init__.py b/data/src/elevenlabs/conversational_ai/tools/executions/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tools/executions/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/tools/executions/client.py b/data/src/elevenlabs/conversational_ai/tools/executions/client.py new file mode 100644 index 0000000000000000000000000000000000000000..24044aa4ad653fc942d56184cf7ece864742625d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tools/executions/client.py @@ -0,0 +1,210 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.get_tool_executions_page_response_model import GetToolExecutionsPageResponseModel +from .raw_client import AsyncRawExecutionsClient, RawExecutionsClient + + +class ExecutionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawExecutionsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawExecutionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawExecutionsClient + """ + return self._raw_client + + def get( + self, + tool_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + is_error: typing.Optional[bool] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + start_time: typing.Optional[float] = None, + end_time: typing.Optional[float] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetToolExecutionsPageResponseModel: + """ + Get paginated list of tool executions for a specific tool. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + is_error : typing.Optional[bool] + Filter by error status. If not provided, returns all executions. + + agent_id : typing.Optional[str] + Filter by agent ID. + + branch_id : typing.Optional[str] + Filter by agent branch ID. + + start_time : typing.Optional[float] + Filter executions from this Unix timestamp (inclusive). + + end_time : typing.Optional[float] + Filter executions until this Unix timestamp (inclusive). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetToolExecutionsPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.tools.executions.get( + tool_id="tool_id", + cursor="cursor", + page_size=1, + is_error=True, + agent_id="agent_id", + branch_id="branch_id", + start_time=1.1, + end_time=1.1, + ) + """ + _response = self._raw_client.get( + tool_id, + cursor=cursor, + page_size=page_size, + is_error=is_error, + agent_id=agent_id, + branch_id=branch_id, + start_time=start_time, + end_time=end_time, + request_options=request_options, + ) + return _response.data + + +class AsyncExecutionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawExecutionsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawExecutionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawExecutionsClient + """ + return self._raw_client + + async def get( + self, + tool_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + is_error: typing.Optional[bool] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + start_time: typing.Optional[float] = None, + end_time: typing.Optional[float] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetToolExecutionsPageResponseModel: + """ + Get paginated list of tool executions for a specific tool. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + is_error : typing.Optional[bool] + Filter by error status. If not provided, returns all executions. + + agent_id : typing.Optional[str] + Filter by agent ID. + + branch_id : typing.Optional[str] + Filter by agent branch ID. + + start_time : typing.Optional[float] + Filter executions from this Unix timestamp (inclusive). + + end_time : typing.Optional[float] + Filter executions until this Unix timestamp (inclusive). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetToolExecutionsPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.tools.executions.get( + tool_id="tool_id", + cursor="cursor", + page_size=1, + is_error=True, + agent_id="agent_id", + branch_id="branch_id", + start_time=1.1, + end_time=1.1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + tool_id, + cursor=cursor, + page_size=page_size, + is_error=is_error, + agent_id=agent_id, + branch_id=branch_id, + start_time=start_time, + end_time=end_time, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/tools/executions/raw_client.py b/data/src/elevenlabs/conversational_ai/tools/executions/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..7a3ab668bda109410cd27d6054fea3dc900b5948 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tools/executions/raw_client.py @@ -0,0 +1,213 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.get_tool_executions_page_response_model import GetToolExecutionsPageResponseModel +from pydantic import ValidationError + + +class RawExecutionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + tool_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + is_error: typing.Optional[bool] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + start_time: typing.Optional[float] = None, + end_time: typing.Optional[float] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetToolExecutionsPageResponseModel]: + """ + Get paginated list of tool executions for a specific tool. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + is_error : typing.Optional[bool] + Filter by error status. If not provided, returns all executions. + + agent_id : typing.Optional[str] + Filter by agent ID. + + branch_id : typing.Optional[str] + Filter by agent branch ID. + + start_time : typing.Optional[float] + Filter executions from this Unix timestamp (inclusive). + + end_time : typing.Optional[float] + Filter executions until this Unix timestamp (inclusive). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetToolExecutionsPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}/executions", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "is_error": is_error, + "agent_id": agent_id, + "branch_id": branch_id, + "start_time": start_time, + "end_time": end_time, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetToolExecutionsPageResponseModel, + construct_type( + type_=GetToolExecutionsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawExecutionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + tool_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + is_error: typing.Optional[bool] = None, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + start_time: typing.Optional[float] = None, + end_time: typing.Optional[float] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetToolExecutionsPageResponseModel]: + """ + Get paginated list of tool executions for a specific tool. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + is_error : typing.Optional[bool] + Filter by error status. If not provided, returns all executions. + + agent_id : typing.Optional[str] + Filter by agent ID. + + branch_id : typing.Optional[str] + Filter by agent branch ID. + + start_time : typing.Optional[float] + Filter executions from this Unix timestamp (inclusive). + + end_time : typing.Optional[float] + Filter executions until this Unix timestamp (inclusive). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetToolExecutionsPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}/executions", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "is_error": is_error, + "agent_id": agent_id, + "branch_id": branch_id, + "start_time": start_time, + "end_time": end_time, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetToolExecutionsPageResponseModel, + construct_type( + type_=GetToolExecutionsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/tools/raw_client.py b/data/src/elevenlabs/conversational_ai/tools/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..76d363d7fff0aa2619a5bf0ef58f28ffc1418abe --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/tools/raw_client.py @@ -0,0 +1,879 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.get_tool_dependent_agents_response_model import GetToolDependentAgentsResponseModel +from ...types.sort_direction import SortDirection +from ...types.tool_request_model import ToolRequestModel +from ...types.tool_response_model import ToolResponseModel +from ...types.tool_sort_by import ToolSortBy +from ...types.tool_type_filter import ToolTypeFilter +from ...types.tools_response_model import ToolsResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawToolsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + show_only_owned_documents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + types: typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[ToolSortBy] = None, + used_by_agent_id: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ToolsResponseModel]: + """ + Get all available tools in the workspace. + + Parameters + ---------- + search : typing.Optional[str] + If specified, the endpoint returns only tools whose names start with this string. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + show_only_owned_documents : typing.Optional[bool] + If set to true, the endpoint will return only tools owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter tools by creator user ID. When set, only tools created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + + types : typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]] + If present, the endpoint will return only tools of the given types. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[ToolSortBy] + The field to sort the results by + + used_by_agent_id : typing.Optional[str] + Filter to tools referenced by this agent's main branch: tools attached to the agent, tools on authored workflow nodes, and tools referenced by procedures. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ToolsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/tools", + method="GET", + params={ + "search": search, + "page_size": page_size, + "show_only_owned_documents": show_only_owned_documents, + "created_by_user_id": created_by_user_id, + "types": types, + "sort_direction": sort_direction, + "sort_by": sort_by, + "used_by_agent_id": used_by_agent_id, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ToolsResponseModel, + construct_type( + type_=ToolsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, request: ToolRequestModel, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ToolResponseModel]: + """ + Add a new tool to the available tools in the workspace. + + Parameters + ---------- + request : ToolRequestModel + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ToolResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/tools", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=ToolRequestModel, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ToolResponseModel, + construct_type( + type_=ToolResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + tool_id: str, + *, + environment: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ToolResponseModel]: + """ + Get tool that is available in the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ToolResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}", + method="GET", + params={ + "environment": environment, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ToolResponseModel, + construct_type( + type_=ToolResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, + tool_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Delete tool from the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + force : typing.Optional[bool] + If set to true, the tool will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents and branches. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}", + method="DELETE", + params={ + "force": force, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, tool_id: str, *, request: ToolRequestModel, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ToolResponseModel]: + """ + Update tool that is available in the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + request : ToolRequestModel + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ToolResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}", + method="PATCH", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=ToolRequestModel, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ToolResponseModel, + construct_type( + type_=ToolResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_dependent_agents( + self, + tool_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetToolDependentAgentsResponseModel]: + """ + Get a list of agents depending on this tool + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetToolDependentAgentsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}/dependent-agents", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetToolDependentAgentsResponseModel, + construct_type( + type_=GetToolDependentAgentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawToolsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + show_only_owned_documents: typing.Optional[bool] = None, + created_by_user_id: typing.Optional[str] = None, + types: typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[ToolSortBy] = None, + used_by_agent_id: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ToolsResponseModel]: + """ + Get all available tools in the workspace. + + Parameters + ---------- + search : typing.Optional[str] + If specified, the endpoint returns only tools whose names start with this string. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + show_only_owned_documents : typing.Optional[bool] + If set to true, the endpoint will return only tools owned by you (and not shared from somebody else). Deprecated: use created_by_user_id instead. + + created_by_user_id : typing.Optional[str] + Filter tools by creator user ID. When set, only tools created by this user are returned. Takes precedence over show_only_owned_documents. Use '@me' to refer to the authenticated user. + + types : typing.Optional[typing.Union[ToolTypeFilter, typing.Sequence[ToolTypeFilter]]] + If present, the endpoint will return only tools of the given types. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[ToolSortBy] + The field to sort the results by + + used_by_agent_id : typing.Optional[str] + Filter to tools referenced by this agent's main branch: tools attached to the agent, tools on authored workflow nodes, and tools referenced by procedures. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ToolsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/tools", + method="GET", + params={ + "search": search, + "page_size": page_size, + "show_only_owned_documents": show_only_owned_documents, + "created_by_user_id": created_by_user_id, + "types": types, + "sort_direction": sort_direction, + "sort_by": sort_by, + "used_by_agent_id": used_by_agent_id, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ToolsResponseModel, + construct_type( + type_=ToolsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, request: ToolRequestModel, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ToolResponseModel]: + """ + Add a new tool to the available tools in the workspace. + + Parameters + ---------- + request : ToolRequestModel + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ToolResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/tools", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=ToolRequestModel, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ToolResponseModel, + construct_type( + type_=ToolResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + tool_id: str, + *, + environment: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ToolResponseModel]: + """ + Get tool that is available in the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + environment : typing.Optional[str] + Environment whose values are used when the MCP server URL, headers, or auth connection reference environment variables. Mirrors the environment a conversation would run in; defaults to production. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ToolResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}", + method="GET", + params={ + "environment": environment, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ToolResponseModel, + construct_type( + type_=ToolResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, + tool_id: str, + *, + force: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete tool from the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + force : typing.Optional[bool] + If set to true, the tool will be deleted regardless of whether it is used by any agents and it will be removed from the dependent agents and branches. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}", + method="DELETE", + params={ + "force": force, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, tool_id: str, *, request: ToolRequestModel, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ToolResponseModel]: + """ + Update tool that is available in the workspace. + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + request : ToolRequestModel + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ToolResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}", + method="PATCH", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=ToolRequestModel, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ToolResponseModel, + construct_type( + type_=ToolResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_dependent_agents( + self, + tool_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetToolDependentAgentsResponseModel]: + """ + Get a list of agents depending on this tool + + Parameters + ---------- + tool_id : str + ID of the requested tool. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many documents to return at maximum. Can not exceed 100, defaults to 30. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetToolDependentAgentsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/tools/{jsonable_encoder(tool_id)}/dependent-agents", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetToolDependentAgentsResponseModel, + construct_type( + type_=GetToolDependentAgentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/triage_tickets/__init__.py b/data/src/elevenlabs/conversational_ai/triage_tickets/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/triage_tickets/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/triage_tickets/client.py b/data/src/elevenlabs/conversational_ai/triage_tickets/client.py new file mode 100644 index 0000000000000000000000000000000000000000..581668160eca92ef17b20db330787efa362bfb95 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/triage_tickets/client.py @@ -0,0 +1,1381 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.agent_conversation_ticket_issue_type import AgentConversationTicketIssueType +from ...types.agent_conversation_ticket_priority import AgentConversationTicketPriority +from ...types.agent_conversation_ticket_response_model import AgentConversationTicketResponseModel +from ...types.agent_conversation_ticket_sort_by import AgentConversationTicketSortBy +from ...types.agent_conversation_ticket_source import AgentConversationTicketSource +from ...types.agent_conversation_ticket_status import AgentConversationTicketStatus +from ...types.assignable_user_response_model import AssignableUserResponseModel +from ...types.get_agent_conversation_tickets_page_response_model import GetAgentConversationTicketsPageResponseModel +from ...types.turn_comment_request_model import TurnCommentRequestModel +from .raw_client import AsyncRawTriageTicketsClient, RawTriageTicketsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TriageTicketsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTriageTicketsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTriageTicketsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTriageTicketsClient + """ + return self._raw_client + + def list( + self, + agent_id: str, + *, + page_size: typing.Optional[int] = None, + conversation_id: typing.Optional[str] = None, + status: typing.Optional[AgentConversationTicketStatus] = None, + sources: typing.Optional[ + typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]] + ] = None, + priorities: typing.Optional[ + typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]] + ] = None, + sort_by: typing.Optional[AgentConversationTicketSortBy] = None, + owner_user_id: typing.Optional[str] = None, + assignee_user_id: typing.Optional[str] = None, + issue_type: typing.Optional[AgentConversationTicketIssueType] = None, + label: typing.Optional[str] = None, + merged_into_ticket_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentConversationTicketsPageResponseModel: + """ + List an agent's conversation triage tickets, ordered by most recently created first unless sorted by priority. These are tickets about the agent's own performance on a conversation (for triage with Architect), not tickets an agent opens for end users. + + Parameters + ---------- + agent_id : str + + page_size : typing.Optional[int] + How many agent conversation tickets to return. Can not exceed 100. + + conversation_id : typing.Optional[str] + Filter tickets by conversation id. + + status : typing.Optional[AgentConversationTicketStatus] + Filter tickets by status. + + sources : typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]] + Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + + priorities : typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]] + Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + + sort_by : typing.Optional[AgentConversationTicketSortBy] + Order by most recently created, or by priority (most urgent first, then most recently created). + + owner_user_id : typing.Optional[str] + Filter tickets by creator. Use 'agent' for agent-raised tickets. + + assignee_user_id : typing.Optional[str] + Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + + issue_type : typing.Optional[AgentConversationTicketIssueType] + Filter clusters by issue type. + + label : typing.Optional[str] + Filter tickets by an exact label. + + merged_into_ticket_id : typing.Optional[str] + Filter tickets merged into this ticket. + + search : typing.Optional[str] + Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentConversationTicketsPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.list( + agent_id="agent_id", + page_size=1, + conversation_id="conversation_id", + status="open", + sources=["qa"], + priorities=["low"], + sort_by="created_at", + owner_user_id="owner_user_id", + assignee_user_id="assignee_user_id", + issue_type="knowledge_gap", + label="label", + merged_into_ticket_id="merged_into_ticket_id", + search="search", + cursor="cursor", + ) + """ + _response = self._raw_client.list( + agent_id, + page_size=page_size, + conversation_id=conversation_id, + status=status, + sources=sources, + priorities=priorities, + sort_by=sort_by, + owner_user_id=owner_user_id, + assignee_user_id=assignee_user_id, + issue_type=issue_type, + label=label, + merged_into_ticket_id=merged_into_ticket_id, + search=search, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def create_manual( + self, + agent_id: str, + *, + qa_comment: str, + title: typing.Optional[str] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Manually raise a follow-up ticket against an agent, not tied to any conversation (for example a task like 'add the KB about X'). Without a title, one is derived from the comment. Requires viewer access to the agent. + + Parameters + ---------- + agent_id : str + + qa_comment : str + What the ticket is about, e.g. a follow-up task for the agent. + + title : typing.Optional[str] + One-line headline shown in the triage list. Defaults to one derived from qa_comment. + + priority : typing.Optional[AgentConversationTicketPriority] + How urgently the ticket needs attention. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.create_manual( + agent_id="agent_id", + qa_comment="qa_comment", + ) + """ + _response = self._raw_client.create_manual( + agent_id, qa_comment=qa_comment, title=title, priority=priority, request_options=request_options + ) + return _response.data + + def list_for_workspace( + self, + *, + page_size: typing.Optional[int] = None, + agent_id: typing.Optional[str] = None, + status: typing.Optional[AgentConversationTicketStatus] = None, + sources: typing.Optional[ + typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]] + ] = None, + priorities: typing.Optional[ + typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]] + ] = None, + sort_by: typing.Optional[AgentConversationTicketSortBy] = None, + owner_user_id: typing.Optional[str] = None, + assignee_user_id: typing.Optional[str] = None, + issue_type: typing.Optional[AgentConversationTicketIssueType] = None, + label: typing.Optional[str] = None, + merged_into_ticket_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentConversationTicketsPageResponseModel: + """ + List conversation triage tickets across every agent in the workspace, ordered by most recently created first. Use this to build a workspace-wide view (for example, tickets assigned to the caller). Supports the same filters, sorting and search as the per-agent endpoint. Tickets for agents the caller cannot access are omitted. + + Parameters + ---------- + page_size : typing.Optional[int] + How many agent conversation tickets to return. Can not exceed 100. + + agent_id : typing.Optional[str] + Only tickets for this agent. + + status : typing.Optional[AgentConversationTicketStatus] + Filter tickets by status. + + sources : typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]] + Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + + priorities : typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]] + Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + + sort_by : typing.Optional[AgentConversationTicketSortBy] + Order by most recently created, or by priority (most urgent first, then most recently created). + + owner_user_id : typing.Optional[str] + Filter tickets by creator. Use 'agent' for agent-raised tickets. + + assignee_user_id : typing.Optional[str] + Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + + issue_type : typing.Optional[AgentConversationTicketIssueType] + Filter clusters by issue type. + + label : typing.Optional[str] + Filter tickets by an exact label. + + merged_into_ticket_id : typing.Optional[str] + Filter tickets merged into this ticket. + + search : typing.Optional[str] + Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentConversationTicketsPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.list_for_workspace( + page_size=1, + agent_id="agent_id", + status="open", + sources=["qa"], + priorities=["low"], + sort_by="created_at", + owner_user_id="owner_user_id", + assignee_user_id="assignee_user_id", + issue_type="knowledge_gap", + label="label", + merged_into_ticket_id="merged_into_ticket_id", + search="search", + cursor="cursor", + ) + """ + _response = self._raw_client.list_for_workspace( + page_size=page_size, + agent_id=agent_id, + status=status, + sources=sources, + priorities=priorities, + sort_by=sort_by, + owner_user_id=owner_user_id, + assignee_user_id=assignee_user_id, + issue_type=issue_type, + label=label, + merged_into_ticket_id=merged_into_ticket_id, + search=search, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def create( + self, + *, + conversation_id: str, + title: typing.Optional[str] = OMIT, + qa_comment: typing.Optional[str] = OMIT, + turn_comments: typing.Optional[typing.Sequence[TurnCommentRequestModel]] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Raise a ticket about an agent's performance on a conversation, for triage with Architect. Provide an overall comment and/or turn-level comments describing what went wrong. + + Parameters + ---------- + conversation_id : str + Conversation this ticket is about. + + title : typing.Optional[str] + One-line headline shown in the triage list. Defaults to one derived from the comments, falling back to the conversation's summary title. Ignored when the comment is added to the conversation's open ticket. + + qa_comment : typing.Optional[str] + The issue this ticket is about, covering the whole conversation rather than a single turn. + + turn_comments : typing.Optional[typing.Sequence[TurnCommentRequestModel]] + Optional turn-level comments on what went wrong. + + priority : typing.Optional[AgentConversationTicketPriority] + How urgently the ticket needs attention. If the conversation already has an open ticket, it is raised to this priority when lower. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.create( + conversation_id="conversation_id", + ) + """ + _response = self._raw_client.create( + conversation_id=conversation_id, + title=title, + qa_comment=qa_comment, + turn_comments=turn_comments, + priority=priority, + request_options=request_options, + ) + return _response.data + + def list_assignable_users( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[AssignableUserResponseModel]: + """ + All non-service-account workspace members, each flagged with whether they currently have at least viewer access to the agent. Members without access are included (not filtered out) so the UI can offer them as an assignee and prompt to grant access first. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[AssignableUserResponseModel] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.list_assignable_users( + agent_id="agent_id", + ) + """ + _response = self._raw_client.list_assignable_users(agent_id, request_options=request_options) + return _response.data + + def get( + self, agentqa_ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AgentConversationTicketResponseModel: + """ + Get an agent conversation ticket by ID. + + Parameters + ---------- + agentqa_ticket_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.get( + agentqa_ticket_id="agentqa_ticket_id", + ) + """ + _response = self._raw_client.get(agentqa_ticket_id, request_options=request_options) + return _response.data + + def delete(self, agentqa_ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete an agent conversation ticket. Restricted to the ticket creator or a workspace admin. + + Parameters + ---------- + agentqa_ticket_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.delete( + agentqa_ticket_id="agentqa_ticket_id", + ) + """ + _response = self._raw_client.delete(agentqa_ticket_id, request_options=request_options) + return _response.data + + def update( + self, + agentqa_ticket_id: str, + *, + title: typing.Optional[str] = OMIT, + status: typing.Optional[AgentConversationTicketStatus] = OMIT, + assignee_user_id: typing.Optional[str] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Update a ticket's title, comment, status, priority, and/or assignee. Requires editor access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + title : typing.Optional[str] + If provided, updates the ticket title. Omit to leave unchanged. + + status : typing.Optional[AgentConversationTicketStatus] + If provided, updates the ticket status. Omit to leave unchanged. + + assignee_user_id : typing.Optional[str] + If provided, updates who is responsible for resolving this ticket. Must be a workspace member with at least viewer access to the agent. Pass null to unassign. Omit to leave unchanged. + + priority : typing.Optional[AgentConversationTicketPriority] + If provided, updates how urgently the ticket needs attention. Pass null to clear it. Omit to leave unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.update( + agentqa_ticket_id="agentqa_ticket_id", + ) + """ + _response = self._raw_client.update( + agentqa_ticket_id, + title=title, + status=status, + assignee_user_id=assignee_user_id, + priority=priority, + request_options=request_options, + ) + return _response.data + + def add_comment( + self, agentqa_ticket_id: str, *, comment: str, request_options: typing.Optional[RequestOptions] = None + ) -> AgentConversationTicketResponseModel: + """ + Append a comment discussing how to resolve the ticket. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + comment : str + A comment discussing how to resolve the ticket. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.add_comment( + agentqa_ticket_id="agentqa_ticket_id", + comment="comment", + ) + """ + _response = self._raw_client.add_comment(agentqa_ticket_id, comment=comment, request_options=request_options) + return _response.data + + def merge( + self, + agentqa_ticket_id: str, + *, + source_ticket_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Merge other open tickets of the same agent into this pending, in-progress, or resolved one. Their conversations move onto this ticket, its priority is raised to the highest among them, and they are kept with status 'merged'. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + source_ticket_ids : typing.Sequence[str] + Open tickets of the same agent to fold into this one. They are kept with status 'merged', pointing at this ticket. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.merge( + agentqa_ticket_id="agentqa_ticket_id", + source_ticket_ids=["source_ticket_ids"], + ) + """ + _response = self._raw_client.merge( + agentqa_ticket_id, source_ticket_ids=source_ticket_ids, request_options=request_options + ) + return _response.data + + def add_turn_comment( + self, + agentqa_ticket_id: str, + *, + turn_index: int, + comment: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Append a turn-level comment to a ticket. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + turn_index : int + Zero-based index of the transcript turn this comment refers to. + + comment : str + What went wrong at this turn. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.triage_tickets.add_turn_comment( + agentqa_ticket_id="agentqa_ticket_id", + turn_index=1, + comment="comment", + ) + """ + _response = self._raw_client.add_turn_comment( + agentqa_ticket_id, turn_index=turn_index, comment=comment, request_options=request_options + ) + return _response.data + + +class AsyncTriageTicketsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTriageTicketsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTriageTicketsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTriageTicketsClient + """ + return self._raw_client + + async def list( + self, + agent_id: str, + *, + page_size: typing.Optional[int] = None, + conversation_id: typing.Optional[str] = None, + status: typing.Optional[AgentConversationTicketStatus] = None, + sources: typing.Optional[ + typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]] + ] = None, + priorities: typing.Optional[ + typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]] + ] = None, + sort_by: typing.Optional[AgentConversationTicketSortBy] = None, + owner_user_id: typing.Optional[str] = None, + assignee_user_id: typing.Optional[str] = None, + issue_type: typing.Optional[AgentConversationTicketIssueType] = None, + label: typing.Optional[str] = None, + merged_into_ticket_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentConversationTicketsPageResponseModel: + """ + List an agent's conversation triage tickets, ordered by most recently created first unless sorted by priority. These are tickets about the agent's own performance on a conversation (for triage with Architect), not tickets an agent opens for end users. + + Parameters + ---------- + agent_id : str + + page_size : typing.Optional[int] + How many agent conversation tickets to return. Can not exceed 100. + + conversation_id : typing.Optional[str] + Filter tickets by conversation id. + + status : typing.Optional[AgentConversationTicketStatus] + Filter tickets by status. + + sources : typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]] + Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + + priorities : typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]] + Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + + sort_by : typing.Optional[AgentConversationTicketSortBy] + Order by most recently created, or by priority (most urgent first, then most recently created). + + owner_user_id : typing.Optional[str] + Filter tickets by creator. Use 'agent' for agent-raised tickets. + + assignee_user_id : typing.Optional[str] + Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + + issue_type : typing.Optional[AgentConversationTicketIssueType] + Filter clusters by issue type. + + label : typing.Optional[str] + Filter tickets by an exact label. + + merged_into_ticket_id : typing.Optional[str] + Filter tickets merged into this ticket. + + search : typing.Optional[str] + Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentConversationTicketsPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.list( + agent_id="agent_id", + page_size=1, + conversation_id="conversation_id", + status="open", + sources=["qa"], + priorities=["low"], + sort_by="created_at", + owner_user_id="owner_user_id", + assignee_user_id="assignee_user_id", + issue_type="knowledge_gap", + label="label", + merged_into_ticket_id="merged_into_ticket_id", + search="search", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + agent_id, + page_size=page_size, + conversation_id=conversation_id, + status=status, + sources=sources, + priorities=priorities, + sort_by=sort_by, + owner_user_id=owner_user_id, + assignee_user_id=assignee_user_id, + issue_type=issue_type, + label=label, + merged_into_ticket_id=merged_into_ticket_id, + search=search, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def create_manual( + self, + agent_id: str, + *, + qa_comment: str, + title: typing.Optional[str] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Manually raise a follow-up ticket against an agent, not tied to any conversation (for example a task like 'add the KB about X'). Without a title, one is derived from the comment. Requires viewer access to the agent. + + Parameters + ---------- + agent_id : str + + qa_comment : str + What the ticket is about, e.g. a follow-up task for the agent. + + title : typing.Optional[str] + One-line headline shown in the triage list. Defaults to one derived from qa_comment. + + priority : typing.Optional[AgentConversationTicketPriority] + How urgently the ticket needs attention. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.create_manual( + agent_id="agent_id", + qa_comment="qa_comment", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_manual( + agent_id, qa_comment=qa_comment, title=title, priority=priority, request_options=request_options + ) + return _response.data + + async def list_for_workspace( + self, + *, + page_size: typing.Optional[int] = None, + agent_id: typing.Optional[str] = None, + status: typing.Optional[AgentConversationTicketStatus] = None, + sources: typing.Optional[ + typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]] + ] = None, + priorities: typing.Optional[ + typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]] + ] = None, + sort_by: typing.Optional[AgentConversationTicketSortBy] = None, + owner_user_id: typing.Optional[str] = None, + assignee_user_id: typing.Optional[str] = None, + issue_type: typing.Optional[AgentConversationTicketIssueType] = None, + label: typing.Optional[str] = None, + merged_into_ticket_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetAgentConversationTicketsPageResponseModel: + """ + List conversation triage tickets across every agent in the workspace, ordered by most recently created first. Use this to build a workspace-wide view (for example, tickets assigned to the caller). Supports the same filters, sorting and search as the per-agent endpoint. Tickets for agents the caller cannot access are omitted. + + Parameters + ---------- + page_size : typing.Optional[int] + How many agent conversation tickets to return. Can not exceed 100. + + agent_id : typing.Optional[str] + Only tickets for this agent. + + status : typing.Optional[AgentConversationTicketStatus] + Filter tickets by status. + + sources : typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]] + Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + + priorities : typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]] + Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + + sort_by : typing.Optional[AgentConversationTicketSortBy] + Order by most recently created, or by priority (most urgent first, then most recently created). + + owner_user_id : typing.Optional[str] + Filter tickets by creator. Use 'agent' for agent-raised tickets. + + assignee_user_id : typing.Optional[str] + Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + + issue_type : typing.Optional[AgentConversationTicketIssueType] + Filter clusters by issue type. + + label : typing.Optional[str] + Filter tickets by an exact label. + + merged_into_ticket_id : typing.Optional[str] + Filter tickets merged into this ticket. + + search : typing.Optional[str] + Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAgentConversationTicketsPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.list_for_workspace( + page_size=1, + agent_id="agent_id", + status="open", + sources=["qa"], + priorities=["low"], + sort_by="created_at", + owner_user_id="owner_user_id", + assignee_user_id="assignee_user_id", + issue_type="knowledge_gap", + label="label", + merged_into_ticket_id="merged_into_ticket_id", + search="search", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_for_workspace( + page_size=page_size, + agent_id=agent_id, + status=status, + sources=sources, + priorities=priorities, + sort_by=sort_by, + owner_user_id=owner_user_id, + assignee_user_id=assignee_user_id, + issue_type=issue_type, + label=label, + merged_into_ticket_id=merged_into_ticket_id, + search=search, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def create( + self, + *, + conversation_id: str, + title: typing.Optional[str] = OMIT, + qa_comment: typing.Optional[str] = OMIT, + turn_comments: typing.Optional[typing.Sequence[TurnCommentRequestModel]] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Raise a ticket about an agent's performance on a conversation, for triage with Architect. Provide an overall comment and/or turn-level comments describing what went wrong. + + Parameters + ---------- + conversation_id : str + Conversation this ticket is about. + + title : typing.Optional[str] + One-line headline shown in the triage list. Defaults to one derived from the comments, falling back to the conversation's summary title. Ignored when the comment is added to the conversation's open ticket. + + qa_comment : typing.Optional[str] + The issue this ticket is about, covering the whole conversation rather than a single turn. + + turn_comments : typing.Optional[typing.Sequence[TurnCommentRequestModel]] + Optional turn-level comments on what went wrong. + + priority : typing.Optional[AgentConversationTicketPriority] + How urgently the ticket needs attention. If the conversation already has an open ticket, it is raised to this priority when lower. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.create( + conversation_id="conversation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + conversation_id=conversation_id, + title=title, + qa_comment=qa_comment, + turn_comments=turn_comments, + priority=priority, + request_options=request_options, + ) + return _response.data + + async def list_assignable_users( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[AssignableUserResponseModel]: + """ + All non-service-account workspace members, each flagged with whether they currently have at least viewer access to the agent. Members without access are included (not filtered out) so the UI can offer them as an assignee and prompt to grant access first. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[AssignableUserResponseModel] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.list_assignable_users( + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list_assignable_users(agent_id, request_options=request_options) + return _response.data + + async def get( + self, agentqa_ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AgentConversationTicketResponseModel: + """ + Get an agent conversation ticket by ID. + + Parameters + ---------- + agentqa_ticket_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.get( + agentqa_ticket_id="agentqa_ticket_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(agentqa_ticket_id, request_options=request_options) + return _response.data + + async def delete(self, agentqa_ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete an agent conversation ticket. Restricted to the ticket creator or a workspace admin. + + Parameters + ---------- + agentqa_ticket_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.delete( + agentqa_ticket_id="agentqa_ticket_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(agentqa_ticket_id, request_options=request_options) + return _response.data + + async def update( + self, + agentqa_ticket_id: str, + *, + title: typing.Optional[str] = OMIT, + status: typing.Optional[AgentConversationTicketStatus] = OMIT, + assignee_user_id: typing.Optional[str] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Update a ticket's title, comment, status, priority, and/or assignee. Requires editor access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + title : typing.Optional[str] + If provided, updates the ticket title. Omit to leave unchanged. + + status : typing.Optional[AgentConversationTicketStatus] + If provided, updates the ticket status. Omit to leave unchanged. + + assignee_user_id : typing.Optional[str] + If provided, updates who is responsible for resolving this ticket. Must be a workspace member with at least viewer access to the agent. Pass null to unassign. Omit to leave unchanged. + + priority : typing.Optional[AgentConversationTicketPriority] + If provided, updates how urgently the ticket needs attention. Pass null to clear it. Omit to leave unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.update( + agentqa_ticket_id="agentqa_ticket_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + agentqa_ticket_id, + title=title, + status=status, + assignee_user_id=assignee_user_id, + priority=priority, + request_options=request_options, + ) + return _response.data + + async def add_comment( + self, agentqa_ticket_id: str, *, comment: str, request_options: typing.Optional[RequestOptions] = None + ) -> AgentConversationTicketResponseModel: + """ + Append a comment discussing how to resolve the ticket. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + comment : str + A comment discussing how to resolve the ticket. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.add_comment( + agentqa_ticket_id="agentqa_ticket_id", + comment="comment", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add_comment( + agentqa_ticket_id, comment=comment, request_options=request_options + ) + return _response.data + + async def merge( + self, + agentqa_ticket_id: str, + *, + source_ticket_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Merge other open tickets of the same agent into this pending, in-progress, or resolved one. Their conversations move onto this ticket, its priority is raised to the highest among them, and they are kept with status 'merged'. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + source_ticket_ids : typing.Sequence[str] + Open tickets of the same agent to fold into this one. They are kept with status 'merged', pointing at this ticket. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.merge( + agentqa_ticket_id="agentqa_ticket_id", + source_ticket_ids=["source_ticket_ids"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.merge( + agentqa_ticket_id, source_ticket_ids=source_ticket_ids, request_options=request_options + ) + return _response.data + + async def add_turn_comment( + self, + agentqa_ticket_id: str, + *, + turn_index: int, + comment: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AgentConversationTicketResponseModel: + """ + Append a turn-level comment to a ticket. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + turn_index : int + Zero-based index of the transcript turn this comment refers to. + + comment : str + What went wrong at this turn. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AgentConversationTicketResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.triage_tickets.add_turn_comment( + agentqa_ticket_id="agentqa_ticket_id", + turn_index=1, + comment="comment", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add_turn_comment( + agentqa_ticket_id, turn_index=turn_index, comment=comment, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/triage_tickets/raw_client.py b/data/src/elevenlabs/conversational_ai/triage_tickets/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..51d068afe4cf442ea3dcde106c202c496488fa1e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/triage_tickets/raw_client.py @@ -0,0 +1,1735 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.agent_conversation_ticket_issue_type import AgentConversationTicketIssueType +from ...types.agent_conversation_ticket_priority import AgentConversationTicketPriority +from ...types.agent_conversation_ticket_response_model import AgentConversationTicketResponseModel +from ...types.agent_conversation_ticket_sort_by import AgentConversationTicketSortBy +from ...types.agent_conversation_ticket_source import AgentConversationTicketSource +from ...types.agent_conversation_ticket_status import AgentConversationTicketStatus +from ...types.assignable_user_response_model import AssignableUserResponseModel +from ...types.get_agent_conversation_tickets_page_response_model import GetAgentConversationTicketsPageResponseModel +from ...types.turn_comment_request_model import TurnCommentRequestModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTriageTicketsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + agent_id: str, + *, + page_size: typing.Optional[int] = None, + conversation_id: typing.Optional[str] = None, + status: typing.Optional[AgentConversationTicketStatus] = None, + sources: typing.Optional[ + typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]] + ] = None, + priorities: typing.Optional[ + typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]] + ] = None, + sort_by: typing.Optional[AgentConversationTicketSortBy] = None, + owner_user_id: typing.Optional[str] = None, + assignee_user_id: typing.Optional[str] = None, + issue_type: typing.Optional[AgentConversationTicketIssueType] = None, + label: typing.Optional[str] = None, + merged_into_ticket_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetAgentConversationTicketsPageResponseModel]: + """ + List an agent's conversation triage tickets, ordered by most recently created first unless sorted by priority. These are tickets about the agent's own performance on a conversation (for triage with Architect), not tickets an agent opens for end users. + + Parameters + ---------- + agent_id : str + + page_size : typing.Optional[int] + How many agent conversation tickets to return. Can not exceed 100. + + conversation_id : typing.Optional[str] + Filter tickets by conversation id. + + status : typing.Optional[AgentConversationTicketStatus] + Filter tickets by status. + + sources : typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]] + Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + + priorities : typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]] + Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + + sort_by : typing.Optional[AgentConversationTicketSortBy] + Order by most recently created, or by priority (most urgent first, then most recently created). + + owner_user_id : typing.Optional[str] + Filter tickets by creator. Use 'agent' for agent-raised tickets. + + assignee_user_id : typing.Optional[str] + Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + + issue_type : typing.Optional[AgentConversationTicketIssueType] + Filter clusters by issue type. + + label : typing.Optional[str] + Filter tickets by an exact label. + + merged_into_ticket_id : typing.Optional[str] + Filter tickets merged into this ticket. + + search : typing.Optional[str] + Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentConversationTicketsPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/triage-tickets", + method="GET", + params={ + "page_size": page_size, + "conversation_id": conversation_id, + "status": status, + "sources": sources, + "priorities": priorities, + "sort_by": sort_by, + "owner_user_id": owner_user_id, + "assignee_user_id": assignee_user_id, + "issue_type": issue_type, + "label": label, + "merged_into_ticket_id": merged_into_ticket_id, + "search": search, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentConversationTicketsPageResponseModel, + construct_type( + type_=GetAgentConversationTicketsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_manual( + self, + agent_id: str, + *, + qa_comment: str, + title: typing.Optional[str] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentConversationTicketResponseModel]: + """ + Manually raise a follow-up ticket against an agent, not tied to any conversation (for example a task like 'add the KB about X'). Without a title, one is derived from the comment. Requires viewer access to the agent. + + Parameters + ---------- + agent_id : str + + qa_comment : str + What the ticket is about, e.g. a follow-up task for the agent. + + title : typing.Optional[str] + One-line headline shown in the triage list. Defaults to one derived from qa_comment. + + priority : typing.Optional[AgentConversationTicketPriority] + How urgently the ticket needs attention. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/triage-tickets", + method="POST", + json={ + "title": title, + "qa_comment": qa_comment, + "priority": priority, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_for_workspace( + self, + *, + page_size: typing.Optional[int] = None, + agent_id: typing.Optional[str] = None, + status: typing.Optional[AgentConversationTicketStatus] = None, + sources: typing.Optional[ + typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]] + ] = None, + priorities: typing.Optional[ + typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]] + ] = None, + sort_by: typing.Optional[AgentConversationTicketSortBy] = None, + owner_user_id: typing.Optional[str] = None, + assignee_user_id: typing.Optional[str] = None, + issue_type: typing.Optional[AgentConversationTicketIssueType] = None, + label: typing.Optional[str] = None, + merged_into_ticket_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetAgentConversationTicketsPageResponseModel]: + """ + List conversation triage tickets across every agent in the workspace, ordered by most recently created first. Use this to build a workspace-wide view (for example, tickets assigned to the caller). Supports the same filters, sorting and search as the per-agent endpoint. Tickets for agents the caller cannot access are omitted. + + Parameters + ---------- + page_size : typing.Optional[int] + How many agent conversation tickets to return. Can not exceed 100. + + agent_id : typing.Optional[str] + Only tickets for this agent. + + status : typing.Optional[AgentConversationTicketStatus] + Filter tickets by status. + + sources : typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]] + Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + + priorities : typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]] + Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + + sort_by : typing.Optional[AgentConversationTicketSortBy] + Order by most recently created, or by priority (most urgent first, then most recently created). + + owner_user_id : typing.Optional[str] + Filter tickets by creator. Use 'agent' for agent-raised tickets. + + assignee_user_id : typing.Optional[str] + Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + + issue_type : typing.Optional[AgentConversationTicketIssueType] + Filter clusters by issue type. + + label : typing.Optional[str] + Filter tickets by an exact label. + + merged_into_ticket_id : typing.Optional[str] + Filter tickets merged into this ticket. + + search : typing.Optional[str] + Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetAgentConversationTicketsPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/triage-tickets", + method="GET", + params={ + "page_size": page_size, + "agent_id": agent_id, + "status": status, + "sources": sources, + "priorities": priorities, + "sort_by": sort_by, + "owner_user_id": owner_user_id, + "assignee_user_id": assignee_user_id, + "issue_type": issue_type, + "label": label, + "merged_into_ticket_id": merged_into_ticket_id, + "search": search, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentConversationTicketsPageResponseModel, + construct_type( + type_=GetAgentConversationTicketsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + conversation_id: str, + title: typing.Optional[str] = OMIT, + qa_comment: typing.Optional[str] = OMIT, + turn_comments: typing.Optional[typing.Sequence[TurnCommentRequestModel]] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentConversationTicketResponseModel]: + """ + Raise a ticket about an agent's performance on a conversation, for triage with Architect. Provide an overall comment and/or turn-level comments describing what went wrong. + + Parameters + ---------- + conversation_id : str + Conversation this ticket is about. + + title : typing.Optional[str] + One-line headline shown in the triage list. Defaults to one derived from the comments, falling back to the conversation's summary title. Ignored when the comment is added to the conversation's open ticket. + + qa_comment : typing.Optional[str] + The issue this ticket is about, covering the whole conversation rather than a single turn. + + turn_comments : typing.Optional[typing.Sequence[TurnCommentRequestModel]] + Optional turn-level comments on what went wrong. + + priority : typing.Optional[AgentConversationTicketPriority] + How urgently the ticket needs attention. If the conversation already has an open ticket, it is raised to this priority when lower. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/triage-tickets", + method="POST", + json={ + "conversation_id": conversation_id, + "title": title, + "qa_comment": qa_comment, + "turn_comments": convert_and_respect_annotation_metadata( + object_=turn_comments, annotation=typing.Sequence[TurnCommentRequestModel], direction="write" + ), + "priority": priority, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list_assignable_users( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.List[AssignableUserResponseModel]]: + """ + All non-service-account workspace members, each flagged with whether they currently have at least viewer access to the agent. Members without access are included (not filtered out) so the UI can offer them as an assignee and prompt to grant access first. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.List[AssignableUserResponseModel]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/triage-tickets/assignable-users", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[AssignableUserResponseModel], + construct_type( + type_=typing.List[AssignableUserResponseModel], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, agentqa_ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AgentConversationTicketResponseModel]: + """ + Get an agent conversation ticket by ID. + + Parameters + ---------- + agentqa_ticket_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, agentqa_ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Delete an agent conversation ticket. Restricted to the ticket creator or a workspace admin. + + Parameters + ---------- + agentqa_ticket_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + agentqa_ticket_id: str, + *, + title: typing.Optional[str] = OMIT, + status: typing.Optional[AgentConversationTicketStatus] = OMIT, + assignee_user_id: typing.Optional[str] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentConversationTicketResponseModel]: + """ + Update a ticket's title, comment, status, priority, and/or assignee. Requires editor access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + title : typing.Optional[str] + If provided, updates the ticket title. Omit to leave unchanged. + + status : typing.Optional[AgentConversationTicketStatus] + If provided, updates the ticket status. Omit to leave unchanged. + + assignee_user_id : typing.Optional[str] + If provided, updates who is responsible for resolving this ticket. Must be a workspace member with at least viewer access to the agent. Pass null to unassign. Omit to leave unchanged. + + priority : typing.Optional[AgentConversationTicketPriority] + If provided, updates how urgently the ticket needs attention. Pass null to clear it. Omit to leave unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}", + method="PATCH", + json={ + "title": title, + "status": status, + "assignee_user_id": assignee_user_id, + "priority": priority, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def add_comment( + self, agentqa_ticket_id: str, *, comment: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AgentConversationTicketResponseModel]: + """ + Append a comment discussing how to resolve the ticket. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + comment : str + A comment discussing how to resolve the ticket. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}/comments", + method="POST", + json={ + "comment": comment, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def merge( + self, + agentqa_ticket_id: str, + *, + source_ticket_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentConversationTicketResponseModel]: + """ + Merge other open tickets of the same agent into this pending, in-progress, or resolved one. Their conversations move onto this ticket, its priority is raised to the highest among them, and they are kept with status 'merged'. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + source_ticket_ids : typing.Sequence[str] + Open tickets of the same agent to fold into this one. They are kept with status 'merged', pointing at this ticket. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}/merge", + method="POST", + json={ + "source_ticket_ids": source_ticket_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def add_turn_comment( + self, + agentqa_ticket_id: str, + *, + turn_index: int, + comment: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AgentConversationTicketResponseModel]: + """ + Append a turn-level comment to a ticket. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + turn_index : int + Zero-based index of the transcript turn this comment refers to. + + comment : str + What went wrong at this turn. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}/turn-comments", + method="POST", + json={ + "turn_index": turn_index, + "comment": comment, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTriageTicketsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + agent_id: str, + *, + page_size: typing.Optional[int] = None, + conversation_id: typing.Optional[str] = None, + status: typing.Optional[AgentConversationTicketStatus] = None, + sources: typing.Optional[ + typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]] + ] = None, + priorities: typing.Optional[ + typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]] + ] = None, + sort_by: typing.Optional[AgentConversationTicketSortBy] = None, + owner_user_id: typing.Optional[str] = None, + assignee_user_id: typing.Optional[str] = None, + issue_type: typing.Optional[AgentConversationTicketIssueType] = None, + label: typing.Optional[str] = None, + merged_into_ticket_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetAgentConversationTicketsPageResponseModel]: + """ + List an agent's conversation triage tickets, ordered by most recently created first unless sorted by priority. These are tickets about the agent's own performance on a conversation (for triage with Architect), not tickets an agent opens for end users. + + Parameters + ---------- + agent_id : str + + page_size : typing.Optional[int] + How many agent conversation tickets to return. Can not exceed 100. + + conversation_id : typing.Optional[str] + Filter tickets by conversation id. + + status : typing.Optional[AgentConversationTicketStatus] + Filter tickets by status. + + sources : typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]] + Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + + priorities : typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]] + Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + + sort_by : typing.Optional[AgentConversationTicketSortBy] + Order by most recently created, or by priority (most urgent first, then most recently created). + + owner_user_id : typing.Optional[str] + Filter tickets by creator. Use 'agent' for agent-raised tickets. + + assignee_user_id : typing.Optional[str] + Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + + issue_type : typing.Optional[AgentConversationTicketIssueType] + Filter clusters by issue type. + + label : typing.Optional[str] + Filter tickets by an exact label. + + merged_into_ticket_id : typing.Optional[str] + Filter tickets merged into this ticket. + + search : typing.Optional[str] + Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentConversationTicketsPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/triage-tickets", + method="GET", + params={ + "page_size": page_size, + "conversation_id": conversation_id, + "status": status, + "sources": sources, + "priorities": priorities, + "sort_by": sort_by, + "owner_user_id": owner_user_id, + "assignee_user_id": assignee_user_id, + "issue_type": issue_type, + "label": label, + "merged_into_ticket_id": merged_into_ticket_id, + "search": search, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentConversationTicketsPageResponseModel, + construct_type( + type_=GetAgentConversationTicketsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_manual( + self, + agent_id: str, + *, + qa_comment: str, + title: typing.Optional[str] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentConversationTicketResponseModel]: + """ + Manually raise a follow-up ticket against an agent, not tied to any conversation (for example a task like 'add the KB about X'). Without a title, one is derived from the comment. Requires viewer access to the agent. + + Parameters + ---------- + agent_id : str + + qa_comment : str + What the ticket is about, e.g. a follow-up task for the agent. + + title : typing.Optional[str] + One-line headline shown in the triage list. Defaults to one derived from qa_comment. + + priority : typing.Optional[AgentConversationTicketPriority] + How urgently the ticket needs attention. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/triage-tickets", + method="POST", + json={ + "title": title, + "qa_comment": qa_comment, + "priority": priority, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_for_workspace( + self, + *, + page_size: typing.Optional[int] = None, + agent_id: typing.Optional[str] = None, + status: typing.Optional[AgentConversationTicketStatus] = None, + sources: typing.Optional[ + typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]] + ] = None, + priorities: typing.Optional[ + typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]] + ] = None, + sort_by: typing.Optional[AgentConversationTicketSortBy] = None, + owner_user_id: typing.Optional[str] = None, + assignee_user_id: typing.Optional[str] = None, + issue_type: typing.Optional[AgentConversationTicketIssueType] = None, + label: typing.Optional[str] = None, + merged_into_ticket_id: typing.Optional[str] = None, + search: typing.Optional[str] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetAgentConversationTicketsPageResponseModel]: + """ + List conversation triage tickets across every agent in the workspace, ordered by most recently created first. Use this to build a workspace-wide view (for example, tickets assigned to the caller). Supports the same filters, sorting and search as the per-agent endpoint. Tickets for agents the caller cannot access are omitted. + + Parameters + ---------- + page_size : typing.Optional[int] + How many agent conversation tickets to return. Can not exceed 100. + + agent_id : typing.Optional[str] + Only tickets for this agent. + + status : typing.Optional[AgentConversationTicketStatus] + Filter tickets by status. + + sources : typing.Optional[typing.Union[AgentConversationTicketSource, typing.Sequence[AgentConversationTicketSource]]] + Filter tickets by how they were raised (qa, agent, manual). Repeat the parameter to filter by multiple sources. + + priorities : typing.Optional[typing.Union[AgentConversationTicketPriority, typing.Sequence[AgentConversationTicketPriority]]] + Filter tickets by priority. Repeat the parameter to filter by multiple priorities. + + sort_by : typing.Optional[AgentConversationTicketSortBy] + Order by most recently created, or by priority (most urgent first, then most recently created). + + owner_user_id : typing.Optional[str] + Filter tickets by creator. Use 'agent' for agent-raised tickets. + + assignee_user_id : typing.Optional[str] + Filter tickets by assignee. Use 'unassigned' for tickets with no assignee. + + issue_type : typing.Optional[AgentConversationTicketIssueType] + Filter clusters by issue type. + + label : typing.Optional[str] + Filter tickets by an exact label. + + merged_into_ticket_id : typing.Optional[str] + Filter tickets merged into this ticket. + + search : typing.Optional[str] + Case-insensitive free-text search across the ticket's title, description, comments, and turn comments. + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetAgentConversationTicketsPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/triage-tickets", + method="GET", + params={ + "page_size": page_size, + "agent_id": agent_id, + "status": status, + "sources": sources, + "priorities": priorities, + "sort_by": sort_by, + "owner_user_id": owner_user_id, + "assignee_user_id": assignee_user_id, + "issue_type": issue_type, + "label": label, + "merged_into_ticket_id": merged_into_ticket_id, + "search": search, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetAgentConversationTicketsPageResponseModel, + construct_type( + type_=GetAgentConversationTicketsPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + conversation_id: str, + title: typing.Optional[str] = OMIT, + qa_comment: typing.Optional[str] = OMIT, + turn_comments: typing.Optional[typing.Sequence[TurnCommentRequestModel]] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentConversationTicketResponseModel]: + """ + Raise a ticket about an agent's performance on a conversation, for triage with Architect. Provide an overall comment and/or turn-level comments describing what went wrong. + + Parameters + ---------- + conversation_id : str + Conversation this ticket is about. + + title : typing.Optional[str] + One-line headline shown in the triage list. Defaults to one derived from the comments, falling back to the conversation's summary title. Ignored when the comment is added to the conversation's open ticket. + + qa_comment : typing.Optional[str] + The issue this ticket is about, covering the whole conversation rather than a single turn. + + turn_comments : typing.Optional[typing.Sequence[TurnCommentRequestModel]] + Optional turn-level comments on what went wrong. + + priority : typing.Optional[AgentConversationTicketPriority] + How urgently the ticket needs attention. If the conversation already has an open ticket, it is raised to this priority when lower. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/triage-tickets", + method="POST", + json={ + "conversation_id": conversation_id, + "title": title, + "qa_comment": qa_comment, + "turn_comments": convert_and_respect_annotation_metadata( + object_=turn_comments, annotation=typing.Sequence[TurnCommentRequestModel], direction="write" + ), + "priority": priority, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list_assignable_users( + self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.List[AssignableUserResponseModel]]: + """ + All non-service-account workspace members, each flagged with whether they currently have at least viewer access to the agent. Members without access are included (not filtered out) so the UI can offer them as an assignee and prompt to grant access first. + + Parameters + ---------- + agent_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.List[AssignableUserResponseModel]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/agents/{jsonable_encoder(agent_id)}/triage-tickets/assignable-users", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[AssignableUserResponseModel], + construct_type( + type_=typing.List[AssignableUserResponseModel], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, agentqa_ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AgentConversationTicketResponseModel]: + """ + Get an agent conversation ticket by ID. + + Parameters + ---------- + agentqa_ticket_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, agentqa_ticket_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete an agent conversation ticket. Restricted to the ticket creator or a workspace admin. + + Parameters + ---------- + agentqa_ticket_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + agentqa_ticket_id: str, + *, + title: typing.Optional[str] = OMIT, + status: typing.Optional[AgentConversationTicketStatus] = OMIT, + assignee_user_id: typing.Optional[str] = OMIT, + priority: typing.Optional[AgentConversationTicketPriority] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentConversationTicketResponseModel]: + """ + Update a ticket's title, comment, status, priority, and/or assignee. Requires editor access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + title : typing.Optional[str] + If provided, updates the ticket title. Omit to leave unchanged. + + status : typing.Optional[AgentConversationTicketStatus] + If provided, updates the ticket status. Omit to leave unchanged. + + assignee_user_id : typing.Optional[str] + If provided, updates who is responsible for resolving this ticket. Must be a workspace member with at least viewer access to the agent. Pass null to unassign. Omit to leave unchanged. + + priority : typing.Optional[AgentConversationTicketPriority] + If provided, updates how urgently the ticket needs attention. Pass null to clear it. Omit to leave unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}", + method="PATCH", + json={ + "title": title, + "status": status, + "assignee_user_id": assignee_user_id, + "priority": priority, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def add_comment( + self, agentqa_ticket_id: str, *, comment: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AgentConversationTicketResponseModel]: + """ + Append a comment discussing how to resolve the ticket. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + comment : str + A comment discussing how to resolve the ticket. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}/comments", + method="POST", + json={ + "comment": comment, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def merge( + self, + agentqa_ticket_id: str, + *, + source_ticket_ids: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentConversationTicketResponseModel]: + """ + Merge other open tickets of the same agent into this pending, in-progress, or resolved one. Their conversations move onto this ticket, its priority is raised to the highest among them, and they are kept with status 'merged'. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + source_ticket_ids : typing.Sequence[str] + Open tickets of the same agent to fold into this one. They are kept with status 'merged', pointing at this ticket. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}/merge", + method="POST", + json={ + "source_ticket_ids": source_ticket_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def add_turn_comment( + self, + agentqa_ticket_id: str, + *, + turn_index: int, + comment: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AgentConversationTicketResponseModel]: + """ + Append a turn-level comment to a ticket. Requires viewer access to the ticket's agent. + + Parameters + ---------- + agentqa_ticket_id : str + + turn_index : int + Zero-based index of the transcript turn this comment refers to. + + comment : str + What went wrong at this turn. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AgentConversationTicketResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/triage-tickets/{jsonable_encoder(agentqa_ticket_id)}/turn-comments", + method="POST", + json={ + "turn_index": turn_index, + "comment": comment, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AgentConversationTicketResponseModel, + construct_type( + type_=AgentConversationTicketResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/twilio/__init__.py b/data/src/elevenlabs/conversational_ai/twilio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/twilio/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/twilio/client.py b/data/src/elevenlabs/conversational_ai/twilio/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a3005a9c46b88e16455f73265bcabc77bb04c65b --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/twilio/client.py @@ -0,0 +1,296 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput +from ...types.telephony_call_config_input import TelephonyCallConfigInput +from ...types.telephony_direction import TelephonyDirection +from ...types.twilio_outbound_call_response import TwilioOutboundCallResponse +from .raw_client import AsyncRawTwilioClient, RawTwilioClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TwilioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTwilioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTwilioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTwilioClient + """ + return self._raw_client + + def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + call_recording_enabled: typing.Optional[bool] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TwilioOutboundCallResponse: + """ + Handle an outbound call via Twilio + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + call_recording_enabled : typing.Optional[bool] + Whether let Twilio record the call. + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TwilioOutboundCallResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.twilio.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", + ) + """ + _response = self._raw_client.outbound_call( + agent_id=agent_id, + agent_phone_number_id=agent_phone_number_id, + to_number=to_number, + conversation_initiation_client_data=conversation_initiation_client_data, + call_recording_enabled=call_recording_enabled, + telephony_call_config=telephony_call_config, + request_options=request_options, + ) + return _response.data + + def register_call( + self, + *, + agent_id: str, + from_number: str, + to_number: str, + direction: typing.Optional[TelephonyDirection] = OMIT, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> str: + """ + Register a Twilio call and return TwiML to connect the call + + Parameters + ---------- + agent_id : str + + from_number : str + + to_number : str + + direction : typing.Optional[TelephonyDirection] + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.twilio.register_call( + agent_id="agent_id", + from_number="from_number", + to_number="to_number", + ) + """ + _response = self._raw_client.register_call( + agent_id=agent_id, + from_number=from_number, + to_number=to_number, + direction=direction, + conversation_initiation_client_data=conversation_initiation_client_data, + request_options=request_options, + ) + return _response.data + + +class AsyncTwilioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTwilioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTwilioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTwilioClient + """ + return self._raw_client + + async def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + call_recording_enabled: typing.Optional[bool] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TwilioOutboundCallResponse: + """ + Handle an outbound call via Twilio + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + call_recording_enabled : typing.Optional[bool] + Whether let Twilio record the call. + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TwilioOutboundCallResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.twilio.outbound_call( + agent_id="agent_id", + agent_phone_number_id="agent_phone_number_id", + to_number="to_number", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.outbound_call( + agent_id=agent_id, + agent_phone_number_id=agent_phone_number_id, + to_number=to_number, + conversation_initiation_client_data=conversation_initiation_client_data, + call_recording_enabled=call_recording_enabled, + telephony_call_config=telephony_call_config, + request_options=request_options, + ) + return _response.data + + async def register_call( + self, + *, + agent_id: str, + from_number: str, + to_number: str, + direction: typing.Optional[TelephonyDirection] = OMIT, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> str: + """ + Register a Twilio call and return TwiML to connect the call + + Parameters + ---------- + agent_id : str + + from_number : str + + to_number : str + + direction : typing.Optional[TelephonyDirection] + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.twilio.register_call( + agent_id="agent_id", + from_number="from_number", + to_number="to_number", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.register_call( + agent_id=agent_id, + from_number=from_number, + to_number=to_number, + direction=direction, + conversation_initiation_client_data=conversation_initiation_client_data, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/twilio/raw_client.py b/data/src/elevenlabs/conversational_ai/twilio/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..89414637afd6d154af4ce0bd414ff9431f3cf45e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/twilio/raw_client.py @@ -0,0 +1,363 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput +from ...types.telephony_call_config_input import TelephonyCallConfigInput +from ...types.telephony_direction import TelephonyDirection +from ...types.twilio_outbound_call_response import TwilioOutboundCallResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTwilioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + call_recording_enabled: typing.Optional[bool] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TwilioOutboundCallResponse]: + """ + Handle an outbound call via Twilio + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + call_recording_enabled : typing.Optional[bool] + Whether let Twilio record the call. + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TwilioOutboundCallResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/twilio/outbound-call", + method="POST", + json={ + "agent_id": agent_id, + "agent_phone_number_id": agent_phone_number_id, + "to_number": to_number, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + "call_recording_enabled": call_recording_enabled, + "telephony_call_config": convert_and_respect_annotation_metadata( + object_=telephony_call_config, annotation=TelephonyCallConfigInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TwilioOutboundCallResponse, + construct_type( + type_=TwilioOutboundCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def register_call( + self, + *, + agent_id: str, + from_number: str, + to_number: str, + direction: typing.Optional[TelephonyDirection] = OMIT, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[str]: + """ + Register a Twilio call and return TwiML to connect the call + + Parameters + ---------- + agent_id : str + + from_number : str + + to_number : str + + direction : typing.Optional[TelephonyDirection] + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[str] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/twilio/register-call", + method="POST", + json={ + "agent_id": agent_id, + "from_number": from_number, + "to_number": to_number, + "direction": direction, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=_response.text) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTwilioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def outbound_call( + self, + *, + agent_id: str, + agent_phone_number_id: str, + to_number: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + call_recording_enabled: typing.Optional[bool] = OMIT, + telephony_call_config: typing.Optional[TelephonyCallConfigInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TwilioOutboundCallResponse]: + """ + Handle an outbound call via Twilio + + Parameters + ---------- + agent_id : str + + agent_phone_number_id : str + + to_number : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + call_recording_enabled : typing.Optional[bool] + Whether let Twilio record the call. + + telephony_call_config : typing.Optional[TelephonyCallConfigInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TwilioOutboundCallResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/twilio/outbound-call", + method="POST", + json={ + "agent_id": agent_id, + "agent_phone_number_id": agent_phone_number_id, + "to_number": to_number, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + "call_recording_enabled": call_recording_enabled, + "telephony_call_config": convert_and_respect_annotation_metadata( + object_=telephony_call_config, annotation=TelephonyCallConfigInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TwilioOutboundCallResponse, + construct_type( + type_=TwilioOutboundCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def register_call( + self, + *, + agent_id: str, + from_number: str, + to_number: str, + direction: typing.Optional[TelephonyDirection] = OMIT, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[str]: + """ + Register a Twilio call and return TwiML to connect the call + + Parameters + ---------- + agent_id : str + + from_number : str + + to_number : str + + direction : typing.Optional[TelephonyDirection] + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[str] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/twilio/register-call", + method="POST", + json={ + "agent_id": agent_id, + "from_number": from_number, + "to_number": to_number, + "direction": direction, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=_response.text) # type: ignore + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/users/__init__.py b/data/src/elevenlabs/conversational_ai/users/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/users/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/users/client.py b/data/src/elevenlabs/conversational_ai/users/client.py new file mode 100644 index 0000000000000000000000000000000000000000..c77fdc5f417088bcddf81a5779b2dcadab953efc --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/users/client.py @@ -0,0 +1,224 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.get_conversation_users_page_response_model import GetConversationUsersPageResponseModel +from ...types.sort_direction import SortDirection +from ...types.users_sort_by import UsersSortBy +from .raw_client import AsyncRawUsersClient, RawUsersClient + + +class UsersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawUsersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawUsersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawUsersClient + """ + return self._raw_client + + def list( + self, + *, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + sort_by: typing.Optional[UsersSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationUsersPageResponseModel: + """ + Get distinct users from conversations with pagination. + + Parameters + ---------- + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + search : typing.Optional[str] + Search/filter by user ID (exact match). + + page_size : typing.Optional[int] + How many users to return at maximum. Defaults to 30. + + sort_by : typing.Optional[UsersSortBy] + The field to sort the results by. Defaults to last_contact_unix_secs. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationUsersPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.users.list( + agent_id="agent_id", + branch_id="branch_id", + call_start_before_unix=1, + call_start_after_unix=1, + search="search", + page_size=1, + sort_by="last_contact_unix_secs", + sort_direction="asc", + cursor="cursor", + ) + """ + _response = self._raw_client.list( + agent_id=agent_id, + branch_id=branch_id, + call_start_before_unix=call_start_before_unix, + call_start_after_unix=call_start_after_unix, + search=search, + page_size=page_size, + sort_by=sort_by, + sort_direction=sort_direction, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + +class AsyncUsersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawUsersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawUsersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawUsersClient + """ + return self._raw_client + + async def list( + self, + *, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + sort_by: typing.Optional[UsersSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetConversationUsersPageResponseModel: + """ + Get distinct users from conversations with pagination. + + Parameters + ---------- + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + search : typing.Optional[str] + Search/filter by user ID (exact match). + + page_size : typing.Optional[int] + How many users to return at maximum. Defaults to 30. + + sort_by : typing.Optional[UsersSortBy] + The field to sort the results by. Defaults to last_contact_unix_secs. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetConversationUsersPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.users.list( + agent_id="agent_id", + branch_id="branch_id", + call_start_before_unix=1, + call_start_after_unix=1, + search="search", + page_size=1, + sort_by="last_contact_unix_secs", + sort_direction="asc", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + agent_id=agent_id, + branch_id=branch_id, + call_start_before_unix=call_start_before_unix, + call_start_after_unix=call_start_after_unix, + search=search, + page_size=page_size, + sort_by=sort_by, + sort_direction=sort_direction, + cursor=cursor, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/users/raw_client.py b/data/src/elevenlabs/conversational_ai/users/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..7069875742ae5d0b482755b921a612efb2bcfd40 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/users/raw_client.py @@ -0,0 +1,226 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.get_conversation_users_page_response_model import GetConversationUsersPageResponseModel +from ...types.sort_direction import SortDirection +from ...types.users_sort_by import UsersSortBy +from pydantic import ValidationError + + +class RawUsersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + sort_by: typing.Optional[UsersSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetConversationUsersPageResponseModel]: + """ + Get distinct users from conversations with pagination. + + Parameters + ---------- + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + search : typing.Optional[str] + Search/filter by user ID (exact match). + + page_size : typing.Optional[int] + How many users to return at maximum. Defaults to 30. + + sort_by : typing.Optional[UsersSortBy] + The field to sort the results by. Defaults to last_contact_unix_secs. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetConversationUsersPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/users", + method="GET", + params={ + "agent_id": agent_id, + "branch_id": branch_id, + "call_start_before_unix": call_start_before_unix, + "call_start_after_unix": call_start_after_unix, + "search": search, + "page_size": page_size, + "sort_by": sort_by, + "sort_direction": sort_direction, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationUsersPageResponseModel, + construct_type( + type_=GetConversationUsersPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawUsersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + agent_id: typing.Optional[str] = None, + branch_id: typing.Optional[str] = None, + call_start_before_unix: typing.Optional[int] = None, + call_start_after_unix: typing.Optional[int] = None, + search: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + sort_by: typing.Optional[UsersSortBy] = None, + sort_direction: typing.Optional[SortDirection] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetConversationUsersPageResponseModel]: + """ + Get distinct users from conversations with pagination. + + Parameters + ---------- + agent_id : typing.Optional[str] + Agent id (agent_…) or speech engine external id (seng_), resolved to the same underlying resource. + + branch_id : typing.Optional[str] + Filter conversations by branch ID. + + call_start_before_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations up to this start date. + + call_start_after_unix : typing.Optional[int] + Unix timestamp (in seconds) to filter conversations after to this start date. + + search : typing.Optional[str] + Search/filter by user ID (exact match). + + page_size : typing.Optional[int] + How many users to return at maximum. Defaults to 30. + + sort_by : typing.Optional[UsersSortBy] + The field to sort the results by. Defaults to last_contact_unix_secs. + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetConversationUsersPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/users", + method="GET", + params={ + "agent_id": agent_id, + "branch_id": branch_id, + "call_start_before_unix": call_start_before_unix, + "call_start_after_unix": call_start_after_unix, + "search": search, + "page_size": page_size, + "sort_by": sort_by, + "sort_direction": sort_direction, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetConversationUsersPageResponseModel, + construct_type( + type_=GetConversationUsersPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/whatsapp/__init__.py b/data/src/elevenlabs/conversational_ai/whatsapp/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4edd1a50e02d9aeeeaf6adca2f359b47058e4304 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/whatsapp/__init__.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem": ".types", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body": ".types", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button": ".types", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header", +] diff --git a/data/src/elevenlabs/conversational_ai/whatsapp/client.py b/data/src/elevenlabs/conversational_ai/whatsapp/client.py new file mode 100644 index 0000000000000000000000000000000000000000..66064ecd5d1726a287ce66a3debb896d0900349d --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/whatsapp/client.py @@ -0,0 +1,348 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput +from ...types.whats_app_outbound_call_response import WhatsAppOutboundCallResponse +from ...types.whats_app_outbound_message_response import WhatsAppOutboundMessageResponse +from .raw_client import AsyncRawWhatsappClient, RawWhatsappClient +from .types.body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item import ( + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem, +) + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class WhatsappClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawWhatsappClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawWhatsappClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawWhatsappClient + """ + return self._raw_client + + def outbound_call( + self, + *, + whatsapp_phone_number_id: str, + whatsapp_user_id: str, + whatsapp_call_permission_request_template_name: str, + whatsapp_call_permission_request_template_language_code: str, + agent_id: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WhatsAppOutboundCallResponse: + """ + Make an outbound call via WhatsApp + + Parameters + ---------- + whatsapp_phone_number_id : str + + whatsapp_user_id : str + + whatsapp_call_permission_request_template_name : str + + whatsapp_call_permission_request_template_language_code : str + + agent_id : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WhatsAppOutboundCallResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.whatsapp.outbound_call( + whatsapp_phone_number_id="whatsapp_phone_number_id", + whatsapp_user_id="whatsapp_user_id", + whatsapp_call_permission_request_template_name="whatsapp_call_permission_request_template_name", + whatsapp_call_permission_request_template_language_code="whatsapp_call_permission_request_template_language_code", + agent_id="agent_id", + ) + """ + _response = self._raw_client.outbound_call( + whatsapp_phone_number_id=whatsapp_phone_number_id, + whatsapp_user_id=whatsapp_user_id, + whatsapp_call_permission_request_template_name=whatsapp_call_permission_request_template_name, + whatsapp_call_permission_request_template_language_code=whatsapp_call_permission_request_template_language_code, + agent_id=agent_id, + conversation_initiation_client_data=conversation_initiation_client_data, + request_options=request_options, + ) + return _response.data + + def outbound_message( + self, + *, + whatsapp_phone_number_id: str, + whatsapp_user_id: str, + template_name: str, + template_language_code: str, + template_params: typing.Sequence[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem + ], + agent_id: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WhatsAppOutboundMessageResponse: + """ + Send an outbound message via WhatsApp + + Parameters + ---------- + whatsapp_phone_number_id : str + + whatsapp_user_id : str + + template_name : str + + template_language_code : str + + template_params : typing.Sequence[BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem] + + agent_id : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WhatsAppOutboundMessageResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, WhatsAppTemplateTextParam + from elevenlabs.conversational_ai.whatsapp import ( + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.whatsapp.outbound_message( + whatsapp_phone_number_id="whatsapp_phone_number_id", + whatsapp_user_id="whatsapp_user_id", + template_name="template_name", + template_language_code="template_language_code", + template_params=[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body( + parameters=[ + WhatsAppTemplateTextParam( + text="text", + ) + ], + ) + ], + agent_id="agent_id", + ) + """ + _response = self._raw_client.outbound_message( + whatsapp_phone_number_id=whatsapp_phone_number_id, + whatsapp_user_id=whatsapp_user_id, + template_name=template_name, + template_language_code=template_language_code, + template_params=template_params, + agent_id=agent_id, + conversation_initiation_client_data=conversation_initiation_client_data, + request_options=request_options, + ) + return _response.data + + +class AsyncWhatsappClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawWhatsappClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawWhatsappClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawWhatsappClient + """ + return self._raw_client + + async def outbound_call( + self, + *, + whatsapp_phone_number_id: str, + whatsapp_user_id: str, + whatsapp_call_permission_request_template_name: str, + whatsapp_call_permission_request_template_language_code: str, + agent_id: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WhatsAppOutboundCallResponse: + """ + Make an outbound call via WhatsApp + + Parameters + ---------- + whatsapp_phone_number_id : str + + whatsapp_user_id : str + + whatsapp_call_permission_request_template_name : str + + whatsapp_call_permission_request_template_language_code : str + + agent_id : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WhatsAppOutboundCallResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.whatsapp.outbound_call( + whatsapp_phone_number_id="whatsapp_phone_number_id", + whatsapp_user_id="whatsapp_user_id", + whatsapp_call_permission_request_template_name="whatsapp_call_permission_request_template_name", + whatsapp_call_permission_request_template_language_code="whatsapp_call_permission_request_template_language_code", + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.outbound_call( + whatsapp_phone_number_id=whatsapp_phone_number_id, + whatsapp_user_id=whatsapp_user_id, + whatsapp_call_permission_request_template_name=whatsapp_call_permission_request_template_name, + whatsapp_call_permission_request_template_language_code=whatsapp_call_permission_request_template_language_code, + agent_id=agent_id, + conversation_initiation_client_data=conversation_initiation_client_data, + request_options=request_options, + ) + return _response.data + + async def outbound_message( + self, + *, + whatsapp_phone_number_id: str, + whatsapp_user_id: str, + template_name: str, + template_language_code: str, + template_params: typing.Sequence[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem + ], + agent_id: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WhatsAppOutboundMessageResponse: + """ + Send an outbound message via WhatsApp + + Parameters + ---------- + whatsapp_phone_number_id : str + + whatsapp_user_id : str + + template_name : str + + template_language_code : str + + template_params : typing.Sequence[BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem] + + agent_id : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WhatsAppOutboundMessageResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, WhatsAppTemplateTextParam + from elevenlabs.conversational_ai.whatsapp import ( + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.whatsapp.outbound_message( + whatsapp_phone_number_id="whatsapp_phone_number_id", + whatsapp_user_id="whatsapp_user_id", + template_name="template_name", + template_language_code="template_language_code", + template_params=[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body( + parameters=[ + WhatsAppTemplateTextParam( + text="text", + ) + ], + ) + ], + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.outbound_message( + whatsapp_phone_number_id=whatsapp_phone_number_id, + whatsapp_user_id=whatsapp_user_id, + template_name=template_name, + template_language_code=template_language_code, + template_params=template_params, + agent_id=agent_id, + conversation_initiation_client_data=conversation_initiation_client_data, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/whatsapp/raw_client.py b/data/src/elevenlabs/conversational_ai/whatsapp/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c32a2afc218e747fa71c20b9672a013f1386d250 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/whatsapp/raw_client.py @@ -0,0 +1,405 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput +from ...types.whats_app_outbound_call_response import WhatsAppOutboundCallResponse +from ...types.whats_app_outbound_message_response import WhatsAppOutboundMessageResponse +from .types.body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item import ( + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawWhatsappClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def outbound_call( + self, + *, + whatsapp_phone_number_id: str, + whatsapp_user_id: str, + whatsapp_call_permission_request_template_name: str, + whatsapp_call_permission_request_template_language_code: str, + agent_id: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[WhatsAppOutboundCallResponse]: + """ + Make an outbound call via WhatsApp + + Parameters + ---------- + whatsapp_phone_number_id : str + + whatsapp_user_id : str + + whatsapp_call_permission_request_template_name : str + + whatsapp_call_permission_request_template_language_code : str + + agent_id : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WhatsAppOutboundCallResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/whatsapp/outbound-call", + method="POST", + json={ + "whatsapp_phone_number_id": whatsapp_phone_number_id, + "whatsapp_user_id": whatsapp_user_id, + "whatsapp_call_permission_request_template_name": whatsapp_call_permission_request_template_name, + "whatsapp_call_permission_request_template_language_code": whatsapp_call_permission_request_template_language_code, + "agent_id": agent_id, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WhatsAppOutboundCallResponse, + construct_type( + type_=WhatsAppOutboundCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def outbound_message( + self, + *, + whatsapp_phone_number_id: str, + whatsapp_user_id: str, + template_name: str, + template_language_code: str, + template_params: typing.Sequence[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem + ], + agent_id: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[WhatsAppOutboundMessageResponse]: + """ + Send an outbound message via WhatsApp + + Parameters + ---------- + whatsapp_phone_number_id : str + + whatsapp_user_id : str + + template_name : str + + template_language_code : str + + template_params : typing.Sequence[BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem] + + agent_id : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WhatsAppOutboundMessageResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/whatsapp/outbound-message", + method="POST", + json={ + "whatsapp_phone_number_id": whatsapp_phone_number_id, + "whatsapp_user_id": whatsapp_user_id, + "template_name": template_name, + "template_language_code": template_language_code, + "template_params": convert_and_respect_annotation_metadata( + object_=template_params, + annotation=typing.Sequence[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem + ], + direction="write", + ), + "agent_id": agent_id, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WhatsAppOutboundMessageResponse, + construct_type( + type_=WhatsAppOutboundMessageResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawWhatsappClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def outbound_call( + self, + *, + whatsapp_phone_number_id: str, + whatsapp_user_id: str, + whatsapp_call_permission_request_template_name: str, + whatsapp_call_permission_request_template_language_code: str, + agent_id: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[WhatsAppOutboundCallResponse]: + """ + Make an outbound call via WhatsApp + + Parameters + ---------- + whatsapp_phone_number_id : str + + whatsapp_user_id : str + + whatsapp_call_permission_request_template_name : str + + whatsapp_call_permission_request_template_language_code : str + + agent_id : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WhatsAppOutboundCallResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/whatsapp/outbound-call", + method="POST", + json={ + "whatsapp_phone_number_id": whatsapp_phone_number_id, + "whatsapp_user_id": whatsapp_user_id, + "whatsapp_call_permission_request_template_name": whatsapp_call_permission_request_template_name, + "whatsapp_call_permission_request_template_language_code": whatsapp_call_permission_request_template_language_code, + "agent_id": agent_id, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WhatsAppOutboundCallResponse, + construct_type( + type_=WhatsAppOutboundCallResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def outbound_message( + self, + *, + whatsapp_phone_number_id: str, + whatsapp_user_id: str, + template_name: str, + template_language_code: str, + template_params: typing.Sequence[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem + ], + agent_id: str, + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[WhatsAppOutboundMessageResponse]: + """ + Send an outbound message via WhatsApp + + Parameters + ---------- + whatsapp_phone_number_id : str + + whatsapp_user_id : str + + template_name : str + + template_language_code : str + + template_params : typing.Sequence[BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem] + + agent_id : str + + conversation_initiation_client_data : typing.Optional[ConversationInitiationClientDataRequestInput] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WhatsAppOutboundMessageResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/whatsapp/outbound-message", + method="POST", + json={ + "whatsapp_phone_number_id": whatsapp_phone_number_id, + "whatsapp_user_id": whatsapp_user_id, + "template_name": template_name, + "template_language_code": template_language_code, + "template_params": convert_and_respect_annotation_metadata( + object_=template_params, + annotation=typing.Sequence[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem + ], + direction="write", + ), + "agent_id": agent_id, + "conversation_initiation_client_data": convert_and_respect_annotation_metadata( + object_=conversation_initiation_client_data, + annotation=ConversationInitiationClientDataRequestInput, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WhatsAppOutboundMessageResponse, + construct_type( + type_=WhatsAppOutboundMessageResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/conversational_ai/whatsapp/types/__init__.py b/data/src/elevenlabs/conversational_ai/whatsapp/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d87226ef3e24cb25e531a8659e74f8c89b90156e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/whatsapp/types/__init__.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item import ( + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem": ".body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body": ".body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button": ".body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header": ".body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button", + "BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header", +] diff --git a/data/src/elevenlabs/conversational_ai/whatsapp/types/body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item.py b/data/src/elevenlabs/conversational_ai/whatsapp/types/body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item.py new file mode 100644 index 0000000000000000000000000000000000000000..70cd97a90a189cb092a369f4c1fd7927606b005e --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/whatsapp/types/body_send_an_outbound_message_via_whats_app_v_1_convai_whatsapp_outbound_message_post_template_params_item.py @@ -0,0 +1,74 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.whats_app_template_header_component_params_parameters_item import ( + WhatsAppTemplateHeaderComponentParamsParametersItem, +) +from ....types.whats_app_template_text_param import WhatsAppTemplateTextParam + + +class BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body( + UncheckedBaseModel +): + type: typing.Literal["body"] = "body" + parameters: typing.List[WhatsAppTemplateTextParam] + + 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 + + +class BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button( + UncheckedBaseModel +): + type: typing.Literal["button"] = "button" + parameters: typing.List[WhatsAppTemplateTextParam] + index: int + sub_type: 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 + + +class BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header( + UncheckedBaseModel +): + type: typing.Literal["header"] = "header" + parameters: typing.List[WhatsAppTemplateHeaderComponentParamsParametersItem] + + 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 + + +BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem = typing_extensions.Annotated[ + typing.Union[ + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Body, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Button, + BodySendAnOutboundMessageViaWhatsAppV1ConvaiWhatsappOutboundMessagePostTemplateParamsItem_Header, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/conversational_ai/whatsapp_accounts/__init__.py b/data/src/elevenlabs/conversational_ai/whatsapp_accounts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/whatsapp_accounts/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/conversational_ai/whatsapp_accounts/client.py b/data/src/elevenlabs/conversational_ai/whatsapp_accounts/client.py new file mode 100644 index 0000000000000000000000000000000000000000..40c5fb246fda13922788e5f38691d8cc3c9d47b9 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/whatsapp_accounts/client.py @@ -0,0 +1,376 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.get_whats_app_account_response import GetWhatsAppAccountResponse +from ...types.list_whats_app_accounts_response import ListWhatsAppAccountsResponse +from .raw_client import AsyncRawWhatsappAccountsClient, RawWhatsappAccountsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class WhatsappAccountsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawWhatsappAccountsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawWhatsappAccountsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawWhatsappAccountsClient + """ + return self._raw_client + + def get( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetWhatsAppAccountResponse: + """ + Get a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWhatsAppAccountResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.whatsapp_accounts.get( + phone_number_id="phone_number_id", + ) + """ + _response = self._raw_client.get(phone_number_id, request_options=request_options) + return _response.data + + def delete(self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.whatsapp_accounts.delete( + phone_number_id="phone_number_id", + ) + """ + _response = self._raw_client.delete(phone_number_id, request_options=request_options) + return _response.data + + def update( + self, + phone_number_id: str, + *, + assigned_agent_id: typing.Optional[str] = OMIT, + enable_messaging: typing.Optional[bool] = OMIT, + enable_audio_message_response: typing.Optional[bool] = OMIT, + enable_typing_indicator: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Update a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + assigned_agent_id : typing.Optional[str] + + enable_messaging : typing.Optional[bool] + + enable_audio_message_response : typing.Optional[bool] + + enable_typing_indicator : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.whatsapp_accounts.update( + phone_number_id="phone_number_id", + ) + """ + _response = self._raw_client.update( + phone_number_id, + assigned_agent_id=assigned_agent_id, + enable_messaging=enable_messaging, + enable_audio_message_response=enable_audio_message_response, + enable_typing_indicator=enable_typing_indicator, + request_options=request_options, + ) + return _response.data + + def list( + self, *, agent_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None + ) -> ListWhatsAppAccountsResponse: + """ + List all WhatsApp accounts + + Parameters + ---------- + agent_id : typing.Optional[str] + Filter by assigned agent ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListWhatsAppAccountsResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.conversational_ai.whatsapp_accounts.list( + agent_id="agent_id", + ) + """ + _response = self._raw_client.list(agent_id=agent_id, request_options=request_options) + return _response.data + + +class AsyncWhatsappAccountsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawWhatsappAccountsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawWhatsappAccountsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawWhatsappAccountsClient + """ + return self._raw_client + + async def get( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetWhatsAppAccountResponse: + """ + Get a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetWhatsAppAccountResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.whatsapp_accounts.get( + phone_number_id="phone_number_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(phone_number_id, request_options=request_options) + return _response.data + + async def delete( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.whatsapp_accounts.delete( + phone_number_id="phone_number_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(phone_number_id, request_options=request_options) + return _response.data + + async def update( + self, + phone_number_id: str, + *, + assigned_agent_id: typing.Optional[str] = OMIT, + enable_messaging: typing.Optional[bool] = OMIT, + enable_audio_message_response: typing.Optional[bool] = OMIT, + enable_typing_indicator: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Update a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + assigned_agent_id : typing.Optional[str] + + enable_messaging : typing.Optional[bool] + + enable_audio_message_response : typing.Optional[bool] + + enable_typing_indicator : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.whatsapp_accounts.update( + phone_number_id="phone_number_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + phone_number_id, + assigned_agent_id=assigned_agent_id, + enable_messaging=enable_messaging, + enable_audio_message_response=enable_audio_message_response, + enable_typing_indicator=enable_typing_indicator, + request_options=request_options, + ) + return _response.data + + async def list( + self, *, agent_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None + ) -> ListWhatsAppAccountsResponse: + """ + List all WhatsApp accounts + + Parameters + ---------- + agent_id : typing.Optional[str] + Filter by assigned agent ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListWhatsAppAccountsResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.conversational_ai.whatsapp_accounts.list( + agent_id="agent_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(agent_id=agent_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/conversational_ai/whatsapp_accounts/raw_client.py b/data/src/elevenlabs/conversational_ai/whatsapp_accounts/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..f6c9544c163ce7fb2ffd8b3a1cb08ecc0eb9f264 --- /dev/null +++ b/data/src/elevenlabs/conversational_ai/whatsapp_accounts/raw_client.py @@ -0,0 +1,519 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.get_whats_app_account_response import GetWhatsAppAccountResponse +from ...types.list_whats_app_accounts_response import ListWhatsAppAccountsResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawWhatsappAccountsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetWhatsAppAccountResponse]: + """ + Get a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetWhatsAppAccountResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/whatsapp-accounts/{jsonable_encoder(phone_number_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWhatsAppAccountResponse, + construct_type( + type_=GetWhatsAppAccountResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Delete a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/whatsapp-accounts/{jsonable_encoder(phone_number_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + phone_number_id: str, + *, + assigned_agent_id: typing.Optional[str] = OMIT, + enable_messaging: typing.Optional[bool] = OMIT, + enable_audio_message_response: typing.Optional[bool] = OMIT, + enable_typing_indicator: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Update a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + assigned_agent_id : typing.Optional[str] + + enable_messaging : typing.Optional[bool] + + enable_audio_message_response : typing.Optional[bool] + + enable_typing_indicator : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/whatsapp-accounts/{jsonable_encoder(phone_number_id)}", + method="PATCH", + json={ + "assigned_agent_id": assigned_agent_id, + "enable_messaging": enable_messaging, + "enable_audio_message_response": enable_audio_message_response, + "enable_typing_indicator": enable_typing_indicator, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def list( + self, *, agent_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ListWhatsAppAccountsResponse]: + """ + List all WhatsApp accounts + + Parameters + ---------- + agent_id : typing.Optional[str] + Filter by assigned agent ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListWhatsAppAccountsResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/whatsapp-accounts", + method="GET", + params={ + "agent_id": agent_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListWhatsAppAccountsResponse, + construct_type( + type_=ListWhatsAppAccountsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawWhatsappAccountsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetWhatsAppAccountResponse]: + """ + Get a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetWhatsAppAccountResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/whatsapp-accounts/{jsonable_encoder(phone_number_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetWhatsAppAccountResponse, + construct_type( + type_=GetWhatsAppAccountResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, phone_number_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/whatsapp-accounts/{jsonable_encoder(phone_number_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + phone_number_id: str, + *, + assigned_agent_id: typing.Optional[str] = OMIT, + enable_messaging: typing.Optional[bool] = OMIT, + enable_audio_message_response: typing.Optional[bool] = OMIT, + enable_typing_indicator: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Update a WhatsApp account + + Parameters + ---------- + phone_number_id : str + + assigned_agent_id : typing.Optional[str] + + enable_messaging : typing.Optional[bool] + + enable_audio_message_response : typing.Optional[bool] + + enable_typing_indicator : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/whatsapp-accounts/{jsonable_encoder(phone_number_id)}", + method="PATCH", + json={ + "assigned_agent_id": assigned_agent_id, + "enable_messaging": enable_messaging, + "enable_audio_message_response": enable_audio_message_response, + "enable_typing_indicator": enable_typing_indicator, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def list( + self, *, agent_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ListWhatsAppAccountsResponse]: + """ + List all WhatsApp accounts + + Parameters + ---------- + agent_id : typing.Optional[str] + Filter by assigned agent ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListWhatsAppAccountsResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/whatsapp-accounts", + method="GET", + params={ + "agent_id": agent_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListWhatsAppAccountsResponse, + construct_type( + type_=ListWhatsAppAccountsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/core/__init__.py b/data/src/elevenlabs/core/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3b227d7f24684460b2e783ee1ba9ab9d4da566d8 --- /dev/null +++ b/data/src/elevenlabs/core/__init__.py @@ -0,0 +1,132 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .api_error import ApiError + from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper + from .datetime_utils import Rfc2822DateTime, parse_rfc2822_datetime, serialize_datetime + from .file import File, convert_file_dict_to_httpx_tuples, with_content_type + from .http_client import AsyncHttpClient, HttpClient + from .http_response import AsyncHttpResponse, HttpResponse + from .jsonable_encoder import jsonable_encoder + from .logging import ConsoleLogger, ILogger, LogConfig, LogLevel, Logger, create_logger + from .parse_error import ParsingError + 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 + from .unchecked_base_model import UncheckedBaseModel, UnionMetadata, construct_type +_dynamic_imports: typing.Dict[str, str] = { + "ApiError": ".api_error", + "AsyncClientWrapper": ".client_wrapper", + "AsyncHttpClient": ".http_client", + "AsyncHttpResponse": ".http_response", + "BaseClientWrapper": ".client_wrapper", + "ConsoleLogger": ".logging", + "FieldMetadata": ".serialization", + "File": ".file", + "HttpClient": ".http_client", + "HttpResponse": ".http_response", + "ILogger": ".logging", + "IS_PYDANTIC_V2": ".pydantic_utilities", + "LogConfig": ".logging", + "LogLevel": ".logging", + "Logger": ".logging", + "ParsingError": ".parse_error", + "RequestOptions": ".request_options", + "Rfc2822DateTime": ".datetime_utils", + "SyncClientWrapper": ".client_wrapper", + "UncheckedBaseModel": ".unchecked_base_model", + "UnionMetadata": ".unchecked_base_model", + "UniversalBaseModel": ".pydantic_utilities", + "UniversalRootModel": ".pydantic_utilities", + "construct_type": ".unchecked_base_model", + "convert_and_respect_annotation_metadata": ".serialization", + "convert_file_dict_to_httpx_tuples": ".file", + "create_logger": ".logging", + "encode_query": ".query_encoder", + "jsonable_encoder": ".jsonable_encoder", + "parse_obj_as": ".pydantic_utilities", + "parse_rfc2822_datetime": ".datetime_utils", + "remove_none_from_dict": ".remove_none_from_dict", + "serialize_datetime": ".datetime_utils", + "universal_field_validator": ".pydantic_utilities", + "universal_root_validator": ".pydantic_utilities", + "update_forward_refs": ".pydantic_utilities", + "with_content_type": ".file", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ApiError", + "AsyncClientWrapper", + "AsyncHttpClient", + "AsyncHttpResponse", + "BaseClientWrapper", + "ConsoleLogger", + "FieldMetadata", + "File", + "HttpClient", + "HttpResponse", + "ILogger", + "IS_PYDANTIC_V2", + "LogConfig", + "LogLevel", + "Logger", + "ParsingError", + "RequestOptions", + "Rfc2822DateTime", + "SyncClientWrapper", + "UncheckedBaseModel", + "UnionMetadata", + "UniversalBaseModel", + "UniversalRootModel", + "construct_type", + "convert_and_respect_annotation_metadata", + "convert_file_dict_to_httpx_tuples", + "create_logger", + "encode_query", + "jsonable_encoder", + "parse_obj_as", + "parse_rfc2822_datetime", + "remove_none_from_dict", + "serialize_datetime", + "universal_field_validator", + "universal_root_validator", + "update_forward_refs", + "with_content_type", +] diff --git a/data/src/elevenlabs/core/api_error.py b/data/src/elevenlabs/core/api_error.py new file mode 100644 index 0000000000000000000000000000000000000000..6f850a60cba321de59f940ea48995e15c7978048 --- /dev/null +++ b/data/src/elevenlabs/core/api_error.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, Optional + + +class ApiError(Exception): + headers: Optional[Dict[str, str]] + status_code: Optional[int] + body: Any + + def __init__( + self, + *, + headers: Optional[Dict[str, str]] = None, + status_code: Optional[int] = None, + body: Any = None, + ) -> None: + self.headers = headers + self.status_code = status_code + self.body = body + + def __str__(self) -> str: + return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}" diff --git a/data/src/elevenlabs/core/client_wrapper.py b/data/src/elevenlabs/core/client_wrapper.py new file mode 100644 index 0000000000000000000000000000000000000000..5cf2126654b75bb2ecb0efdcf975367dd89ae8f8 --- /dev/null +++ b/data/src/elevenlabs/core/client_wrapper.py @@ -0,0 +1,101 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import httpx +from .http_client import AsyncHttpClient, HttpClient +from .logging import LogConfig, Logger + + +class BaseClientWrapper: + def __init__( + self, + *, + api_key: typing.Optional[str] = None, + headers: typing.Optional[typing.Dict[str, str]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + ): + self._api_key = api_key + self._headers = headers + self._base_url = base_url + self._timeout = timeout + self._logging = logging + + def get_headers(self) -> typing.Dict[str, str]: + import platform + + headers: typing.Dict[str, str] = { + "User-Agent": "elevenlabs/2.74.1", + "X-Fern-Language": "Python", + "X-Fern-Runtime": f"python/{platform.python_version()}", + "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", + "X-Fern-SDK-Name": "elevenlabs", + "X-Fern-SDK-Version": "2.74.1", + **(self.get_custom_headers() or {}), + } + if self._api_key is not None: + headers["xi-api-key"] = self._api_key + return headers + + def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]: + return self._headers + + 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, + *, + api_key: typing.Optional[str] = None, + headers: typing.Optional[typing.Dict[str, str]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + httpx_client: httpx.Client, + ): + super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout, logging=logging) + self.httpx_client = HttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers, + base_timeout=self.get_timeout, + base_url=self.get_base_url, + logging_config=self._logging, + ) + + +class AsyncClientWrapper(BaseClientWrapper): + def __init__( + self, + *, + api_key: typing.Optional[str] = None, + headers: typing.Optional[typing.Dict[str, str]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + logging: typing.Optional[typing.Union[LogConfig, Logger]] = None, + async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None, + httpx_client: httpx.AsyncClient, + ): + super().__init__(api_key=api_key, headers=headers, base_url=base_url, timeout=timeout, logging=logging) + self._async_token = async_token + self.httpx_client = AsyncHttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers, + base_timeout=self.get_timeout, + base_url=self.get_base_url, + async_base_headers=self.async_get_headers, + logging_config=self._logging, + ) + + async def async_get_headers(self) -> typing.Dict[str, str]: + headers = self.get_headers() + if self._async_token is not None: + token = await self._async_token() + headers["Authorization"] = f"Bearer {token}" + return headers diff --git a/data/src/elevenlabs/core/datetime_utils.py b/data/src/elevenlabs/core/datetime_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..a12b2ad03c5338e654ef64f96b9b0f25007a9d92 --- /dev/null +++ b/data/src/elevenlabs/core/datetime_utils.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +from email.utils import parsedate_to_datetime +from typing import Any + +import pydantic + +IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.") + + +def parse_rfc2822_datetime(v: Any) -> dt.datetime: + """ + Parse an RFC 2822 datetime string (e.g., "Wed, 02 Oct 2002 13:00:00 GMT") + into a datetime object. If the value is already a datetime, return it as-is. + Falls back to ISO 8601 parsing if RFC 2822 parsing fails. + """ + if isinstance(v, dt.datetime): + return v + if isinstance(v, str): + try: + return parsedate_to_datetime(v) + except Exception: + pass + # Fallback to ISO 8601 parsing + return dt.datetime.fromisoformat(v.replace("Z", "+00:00")) + raise ValueError(f"Expected str or datetime, got {type(v)}") + + +class Rfc2822DateTime(dt.datetime): + """A datetime subclass that parses RFC 2822 date strings. + + On Pydantic V1, uses __get_validators__ for pre-validation. + On Pydantic V2, uses __get_pydantic_core_schema__ for BeforeValidator-style parsing. + """ + + @classmethod + def __get_validators__(cls): # type: ignore[no-untyped-def] + yield parse_rfc2822_datetime + + @classmethod + def __get_pydantic_core_schema__(cls, _source_type: Any, _handler: Any) -> Any: # type: ignore[override] + from pydantic_core import core_schema + + return core_schema.no_info_before_validator_function(parse_rfc2822_datetime, core_schema.datetime_schema()) + + +def serialize_datetime(v: dt.datetime) -> str: + """ + Serialize a datetime including timezone info. + + Uses the timezone info provided if present, otherwise uses the current runtime's timezone info. + + UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00. + """ + + def _serialize_zoned_datetime(v: dt.datetime) -> str: + if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None): + # UTC is a special case where we use "Z" at the end instead of "+00:00" + return v.isoformat().replace("+00:00", "Z") + else: + # Delegate to the typical +/- offset format + return v.isoformat() + + if v.tzinfo is not None: + return _serialize_zoned_datetime(v) + else: + local_tz = dt.datetime.now().astimezone().tzinfo + localized_dt = v.replace(tzinfo=local_tz) + return _serialize_zoned_datetime(localized_dt) diff --git a/data/src/elevenlabs/core/file.py b/data/src/elevenlabs/core/file.py new file mode 100644 index 0000000000000000000000000000000000000000..44b0d27c08952bcf507d01558ee469408c8d9abe --- /dev/null +++ b/data/src/elevenlabs/core/file.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import IO, Dict, List, Mapping, Optional, Tuple, Union, cast + +# File typing inspired by the flexibility of types within the httpx library +# https://github.com/encode/httpx/blob/master/httpx/_types.py +FileContent = Union[IO[bytes], bytes, str] +File = Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + Tuple[Optional[str], FileContent], + # (filename, file (or bytes), content_type) + Tuple[Optional[str], FileContent, Optional[str]], + # (filename, file (or bytes), content_type, headers) + Tuple[ + Optional[str], + FileContent, + Optional[str], + Mapping[str, str], + ], +] + + +def convert_file_dict_to_httpx_tuples( + d: Dict[str, Union[File, List[File]]], +) -> List[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 + + +def with_content_type(*, file: File, default_content_type: str) -> File: + """ + This function resolves to the file's content type, if provided, and defaults + to the default_content_type value if not. + """ + if isinstance(file, tuple): + if len(file) == 2: + filename, content = cast(Tuple[Optional[str], FileContent], file) # type: ignore + return (filename, content, default_content_type) + elif len(file) == 3: + filename, content, file_content_type = cast(Tuple[Optional[str], FileContent, Optional[str]], file) # type: ignore + out_content_type = file_content_type or default_content_type + return (filename, content, out_content_type) + elif len(file) == 4: + filename, content, file_content_type, headers = cast( # type: ignore + Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], file + ) + out_content_type = file_content_type or default_content_type + return (filename, content, out_content_type, headers) + else: + raise ValueError(f"Unexpected tuple length: {len(file)}") + return (None, file, default_content_type) diff --git a/data/src/elevenlabs/core/force_multipart.py b/data/src/elevenlabs/core/force_multipart.py new file mode 100644 index 0000000000000000000000000000000000000000..5440913fd4bc8760e3cdb3a61855d87f5f41b859 --- /dev/null +++ b/data/src/elevenlabs/core/force_multipart.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict + + +class ForceMultipartDict(Dict[str, Any]): + """ + A dictionary subclass that always evaluates to True in boolean contexts. + + This is used to force multipart/form-data encoding in HTTP requests even when + the dictionary is empty, which would normally evaluate to False. + """ + + def __bool__(self) -> bool: + return True + + +FORCE_MULTIPART = ForceMultipartDict() diff --git a/data/src/elevenlabs/core/http_client.py b/data/src/elevenlabs/core/http_client.py new file mode 100644 index 0000000000000000000000000000000000000000..ee937589c9c7436ce73cf0960ae45e691c3e2aed --- /dev/null +++ b/data/src/elevenlabs/core/http_client.py @@ -0,0 +1,776 @@ +# This file was auto-generated by Fern from our API Definition. + +import asyncio +import email.utils +import re +import time +import typing +from contextlib import asynccontextmanager, contextmanager +from random import random + +import httpx +from .file import File, convert_file_dict_to_httpx_tuples +from .force_multipart import FORCE_MULTIPART +from .jsonable_encoder import jsonable_encoder +from .logging import LogConfig, Logger, create_logger +from .query_encoder import encode_query +from .remove_none_from_dict import remove_none_from_dict as remove_none_from_dict +from .request_options import RequestOptions +from httpx._types import RequestFiles + +INITIAL_RETRY_DELAY_SECONDS = 1.0 +MAX_RETRY_DELAY_SECONDS = 60.0 +JITTER_FACTOR = 0.2 # 20% random jitter + + +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 _add_positive_jitter(delay: float) -> float: + """Add positive jitter (0-20%) to prevent thundering herd.""" + jitter_multiplier = 1 + random() * JITTER_FACTOR + return delay * jitter_multiplier + + +def _add_symmetric_jitter(delay: float) -> float: + """Add symmetric jitter (±10%) for exponential backoff.""" + jitter_multiplier = 1 + (random() - 0.5) * JITTER_FACTOR + return delay * jitter_multiplier + + +def _parse_x_ratelimit_reset(response_headers: httpx.Headers) -> typing.Optional[float]: + """ + Parse the X-RateLimit-Reset header (Unix timestamp in seconds). + Returns seconds to wait, or None if header is missing/invalid. + """ + reset_time_str = response_headers.get("x-ratelimit-reset") + if reset_time_str is None: + return None + + try: + reset_time = int(reset_time_str) + delay = reset_time - time.time() + if delay > 0: + return delay + except (ValueError, TypeError): + pass + + return None + + +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. + """ + + # 1. Check Retry-After header first + retry_after = _parse_retry_after(response.headers) + if retry_after is not None and retry_after > 0: + return min(retry_after, MAX_RETRY_DELAY_SECONDS) + + # 2. Check X-RateLimit-Reset header (with positive jitter) + ratelimit_reset = _parse_x_ratelimit_reset(response.headers) + if ratelimit_reset is not None: + return _add_positive_jitter(min(ratelimit_reset, MAX_RETRY_DELAY_SECONDS)) + + # 3. Fall back to exponential backoff (with symmetric jitter) + backoff = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + return _add_symmetric_jitter(backoff) + + +def _should_retry(response: httpx.Response) -> bool: + retryable_400s = [429, 408, 409] + return response.status_code >= 500 or response.status_code in retryable_400s + + +_SENSITIVE_HEADERS = frozenset( + { + "authorization", + "www-authenticate", + "x-api-key", + "api-key", + "apikey", + "x-api-token", + "x-auth-token", + "auth-token", + "cookie", + "set-cookie", + "proxy-authorization", + "proxy-authenticate", + "x-csrf-token", + "x-xsrf-token", + "x-session-token", + "x-access-token", + } +) + + +def _redact_headers(headers: typing.Dict[str, str]) -> typing.Dict[str, str]: + return {k: ("[REDACTED]" if k.lower() in _SENSITIVE_HEADERS else v) for k, v in headers.items()} + + +def _build_url(base_url: str, path: typing.Optional[str]) -> str: + """ + Build a full URL by joining a base URL with a path. + + This function correctly handles base URLs that contain path prefixes (e.g., tenant-based URLs) + by using string concatenation instead of urllib.parse.urljoin(), which would incorrectly + strip path components when the path starts with '/'. + + Example: + >>> _build_url("https://cloud.example.com/org/tenant/api", "/users") + 'https://cloud.example.com/org/tenant/api/users' + + Args: + base_url: The base URL, which may contain path prefixes. + path: The path to append. Can be None or empty string. + + Returns: + The full URL with base_url and path properly joined. + """ + if not path: + return base_url + return f"{base_url.rstrip('/')}/{path.lstrip('/')}" + + +def _maybe_filter_none_from_multipart_data( + data: typing.Optional[typing.Any], + request_files: typing.Optional[RequestFiles], + force_multipart: typing.Optional[bool], +) -> typing.Optional[typing.Any]: + """ + Filter None values from data body for multipart/form requests. + This prevents httpx from converting None to empty strings in multipart encoding. + Only applies when files are present or force_multipart is True. + """ + if data is not None and isinstance(data, typing.Mapping) and (request_files or force_multipart): + return remove_none_from_dict(data) + return data + + +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) + + has_additional_body_parameters = bool( + request_options is not None and request_options.get("additional_body_parameters") + ) + + # Only collapse empty dict to None when the body was not explicitly provided + # and there are no additional body parameters. This preserves explicit empty + # bodies (e.g., when an endpoint has a request body type but all fields are optional). + if json_body == {} and json is None and not has_additional_body_parameters: + json_body = None + if data_body == {} and data is None and not has_additional_body_parameters: + data_body = None + + return json_body, data_body + + +class HttpClient: + def __init__( + self, + *, + httpx_client: httpx.Client, + base_timeout: typing.Callable[[], typing.Optional[float]], + base_headers: typing.Callable[[], typing.Dict[str, str]], + base_url: typing.Optional[typing.Callable[[], str]] = None, + logging_config: typing.Optional[typing.Union[LogConfig, Logger]] = None, + ): + self.base_url = base_url + self.base_timeout = base_timeout + self.base_headers = base_headers + self.httpx_client = httpx_client + self.logger = create_logger(logging_config) + + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: + base_url = maybe_base_url + if self.base_url is not None and base_url is None: + base_url = self.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.Union[ + typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]], + typing.List[typing.Tuple[str, 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, + force_multipart: typing.Optional[bool] = 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) + + request_files: typing.Optional[RequestFiles] = ( + convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit)) + if (files is not None and files is not omit and isinstance(files, dict)) + else None + ) + + if (request_files is None or len(request_files) == 0) and force_multipart: + request_files = FORCE_MULTIPART + + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_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, + ) + ) + ) + ) + + _request_url = _build_url(base_url, path) + _request_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 {}), + } + ) + ) + + if self.logger.is_debug(): + self.logger.debug( + "Making HTTP request", + method=method, + url=_request_url, + headers=_redact_headers(_request_headers), + has_body=json_body is not None or data_body is not None, + ) + + response = self.httpx_client.request( + method=method, + url=_request_url, + headers=_request_headers, + params=_encoded_params if _encoded_params else None, + json=json_body, + data=data_body, + content=content, + files=request_files, + timeout=timeout, + ) + + max_retries: int = request_options.get("max_retries", 2) if request_options is not None else 2 + if _should_retry(response=response): + if retries < max_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, + ) + + if self.logger.is_debug(): + if 200 <= response.status_code < 400: + self.logger.debug( + "HTTP request succeeded", + method=method, + url=_request_url, + status_code=response.status_code, + ) + + if self.logger.is_error(): + if response.status_code >= 400: + self.logger.error( + "HTTP request failed with error status", + method=method, + url=_request_url, + status_code=response.status_code, + ) + + 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.Union[ + typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]], + typing.List[typing.Tuple[str, 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, + force_multipart: typing.Optional[bool] = 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() + ) + + request_files: typing.Optional[RequestFiles] = ( + convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit)) + if (files is not None and files is not omit and isinstance(files, dict)) + else None + ) + + if (request_files is None or len(request_files) == 0) and force_multipart: + request_files = FORCE_MULTIPART + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_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, + ) + ) + ) + ) + + _request_url = _build_url(base_url, path) + _request_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 {}), + } + ) + ) + + if self.logger.is_debug(): + self.logger.debug( + "Making streaming HTTP request", + method=method, + url=_request_url, + headers=_redact_headers(_request_headers), + ) + + with self.httpx_client.stream( + method=method, + url=_request_url, + headers=_request_headers, + params=_encoded_params if _encoded_params else None, + json=json_body, + data=data_body, + content=content, + files=request_files, + timeout=timeout, + ) as stream: + yield stream + + +class AsyncHttpClient: + def __init__( + self, + *, + httpx_client: httpx.AsyncClient, + base_timeout: typing.Callable[[], typing.Optional[float]], + base_headers: typing.Callable[[], typing.Dict[str, str]], + base_url: typing.Optional[typing.Callable[[], str]] = None, + async_base_headers: typing.Optional[typing.Callable[[], typing.Awaitable[typing.Dict[str, str]]]] = None, + logging_config: typing.Optional[typing.Union[LogConfig, Logger]] = None, + ): + self.base_url = base_url + self.base_timeout = base_timeout + self.base_headers = base_headers + self.async_base_headers = async_base_headers + self.httpx_client = httpx_client + self.logger = create_logger(logging_config) + + async def _get_headers(self) -> typing.Dict[str, str]: + if self.async_base_headers is not None: + return await self.async_base_headers() + return self.base_headers() + + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: + base_url = maybe_base_url + if self.base_url is not None and base_url is None: + base_url = self.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.Union[ + typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]], + typing.List[typing.Tuple[str, 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, + force_multipart: typing.Optional[bool] = 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() + ) + + request_files: typing.Optional[RequestFiles] = ( + convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit)) + if (files is not None and files is not omit and isinstance(files, dict)) + else None + ) + + if (request_files is None or len(request_files) == 0) and force_multipart: + request_files = FORCE_MULTIPART + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Get headers (supports async token providers) + _headers = await self._get_headers() + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_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, + ) + ) + ) + ) + + _request_url = _build_url(base_url, path) + _request_headers = jsonable_encoder( + remove_none_from_dict( + { + **_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) or {} if request_options is not None else {}), + } + ) + ) + + if self.logger.is_debug(): + self.logger.debug( + "Making HTTP request", + method=method, + url=_request_url, + headers=_redact_headers(_request_headers), + has_body=json_body is not None or data_body is not None, + ) + + response = await self.httpx_client.request( + method=method, + url=_request_url, + headers=_request_headers, + params=_encoded_params if _encoded_params else None, + json=json_body, + data=data_body, + content=content, + files=request_files, + timeout=timeout, + ) + + max_retries: int = request_options.get("max_retries", 2) if request_options is not None else 2 + if _should_retry(response=response): + if retries < max_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, + ) + + if self.logger.is_debug(): + if 200 <= response.status_code < 400: + self.logger.debug( + "HTTP request succeeded", + method=method, + url=_request_url, + status_code=response.status_code, + ) + + if self.logger.is_error(): + if response.status_code >= 400: + self.logger.error( + "HTTP request failed with error status", + method=method, + url=_request_url, + status_code=response.status_code, + ) + + 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.Union[ + typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]], + typing.List[typing.Tuple[str, 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, + force_multipart: typing.Optional[bool] = 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() + ) + + request_files: typing.Optional[RequestFiles] = ( + convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit)) + if (files is not None and files is not omit and isinstance(files, dict)) + else None + ) + + if (request_files is None or len(request_files) == 0) and force_multipart: + request_files = FORCE_MULTIPART + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Get headers (supports async token providers) + _headers = await self._get_headers() + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_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, + ) + ) + ) + ) + + _request_url = _build_url(base_url, path) + _request_headers = jsonable_encoder( + remove_none_from_dict( + { + **_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ) + + if self.logger.is_debug(): + self.logger.debug( + "Making streaming HTTP request", + method=method, + url=_request_url, + headers=_redact_headers(_request_headers), + ) + + async with self.httpx_client.stream( + method=method, + url=_request_url, + headers=_request_headers, + params=_encoded_params if _encoded_params else None, + json=json_body, + data=data_body, + content=content, + files=request_files, + timeout=timeout, + ) as stream: + yield stream diff --git a/data/src/elevenlabs/core/http_response.py b/data/src/elevenlabs/core/http_response.py new file mode 100644 index 0000000000000000000000000000000000000000..00bb1096d2d0799ba4125298574fcb7dc96dff4f --- /dev/null +++ b/data/src/elevenlabs/core/http_response.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Dict, Generic, TypeVar + +import httpx + +# Generic to represent the underlying type of the data wrapped by the HTTP response. +T = TypeVar("T") + + +class BaseHttpResponse: + """Minimalist HTTP response wrapper that exposes response headers and status code.""" + + _response: httpx.Response + + def __init__(self, response: httpx.Response): + self._response = response + + @property + def headers(self) -> Dict[str, str]: + return dict(self._response.headers) + + @property + def status_code(self) -> int: + return self._response.status_code + + +class HttpResponse(Generic[T], BaseHttpResponse): + """HTTP response wrapper that exposes response headers and data.""" + + _data: T + + def __init__(self, response: httpx.Response, data: T): + super().__init__(response) + self._data = data + + @property + def data(self) -> T: + return self._data + + def close(self) -> None: + self._response.close() + + +class AsyncHttpResponse(Generic[T], BaseHttpResponse): + """HTTP response wrapper that exposes response headers and data.""" + + _data: T + + def __init__(self, response: httpx.Response, data: T): + super().__init__(response) + self._data = data + + @property + def data(self) -> T: + return self._data + + async def close(self) -> None: + await self._response.aclose() diff --git a/data/src/elevenlabs/core/http_sse/__init__.py b/data/src/elevenlabs/core/http_sse/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..730e5a3382ebb716c5bbd9159041430efea45a8c --- /dev/null +++ b/data/src/elevenlabs/core/http_sse/__init__.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from ._api import EventSource, aconnect_sse, connect_sse + from ._exceptions import SSEError + from ._models import ServerSentEvent +_dynamic_imports: typing.Dict[str, str] = { + "EventSource": "._api", + "SSEError": "._exceptions", + "ServerSentEvent": "._models", + "aconnect_sse": "._api", + "connect_sse": "._api", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["EventSource", "SSEError", "ServerSentEvent", "aconnect_sse", "connect_sse"] diff --git a/data/src/elevenlabs/core/http_sse/_api.py b/data/src/elevenlabs/core/http_sse/_api.py new file mode 100644 index 0000000000000000000000000000000000000000..f900b3b686de9701c1049f634b117403e76952ad --- /dev/null +++ b/data/src/elevenlabs/core/http_sse/_api.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +import re +from contextlib import asynccontextmanager, contextmanager +from typing import Any, AsyncGenerator, AsyncIterator, Iterator, cast + +import httpx +from ._decoders import SSEDecoder +from ._exceptions import SSEError +from ._models import ServerSentEvent + + +class EventSource: + def __init__(self, response: httpx.Response) -> None: + self._response = response + + def _check_content_type(self) -> None: + content_type = self._response.headers.get("content-type", "").partition(";")[0] + if "text/event-stream" not in content_type: + raise SSEError( + f"Expected response header Content-Type to contain 'text/event-stream', got {content_type!r}" + ) + + def _get_charset(self) -> str: + """Extract charset from Content-Type header, fallback to UTF-8.""" + content_type = self._response.headers.get("content-type", "") + + # Parse charset parameter using regex + charset_match = re.search(r"charset=([^;\s]+)", content_type, re.IGNORECASE) + if charset_match: + charset = charset_match.group(1).strip("\"'") + # Validate that it's a known encoding + try: + # Test if the charset is valid by trying to encode/decode + "test".encode(charset).decode(charset) + return charset + except (LookupError, UnicodeError): + # If charset is invalid, fall back to UTF-8 + pass + + # Default to UTF-8 if no charset specified or invalid charset + return "utf-8" + + @property + def response(self) -> httpx.Response: + return self._response + + def iter_sse(self) -> Iterator[ServerSentEvent]: + self._check_content_type() + decoder = SSEDecoder() + charset = self._get_charset() + + buffer = "" + for chunk in self._response.iter_bytes(): + # Decode chunk using detected charset + text_chunk = chunk.decode(charset, errors="replace") + buffer += text_chunk + + # Process complete lines + while "\n" in buffer: + line, buffer = buffer.split("\n", 1) + line = line.rstrip("\r") + sse = decoder.decode(line) + # when we reach a "\n\n" => line = '' + # => decoder will attempt to return an SSE Event + if sse is not None: + yield sse + + # Process any remaining data in buffer + if buffer.strip(): + line = buffer.rstrip("\r") + sse = decoder.decode(line) + if sse is not None: + yield sse + + async def aiter_sse(self) -> AsyncGenerator[ServerSentEvent, None]: + self._check_content_type() + decoder = SSEDecoder() + lines = cast(AsyncGenerator[str, None], self._response.aiter_lines()) + try: + async for line in lines: + line = line.rstrip("\n") + sse = decoder.decode(line) + if sse is not None: + yield sse + finally: + await lines.aclose() + + +@contextmanager +def connect_sse(client: httpx.Client, method: str, url: str, **kwargs: Any) -> Iterator[EventSource]: + headers = kwargs.pop("headers", {}) + headers["Accept"] = "text/event-stream" + headers["Cache-Control"] = "no-store" + + with client.stream(method, url, headers=headers, **kwargs) as response: + yield EventSource(response) + + +@asynccontextmanager +async def aconnect_sse( + client: httpx.AsyncClient, + method: str, + url: str, + **kwargs: Any, +) -> AsyncIterator[EventSource]: + headers = kwargs.pop("headers", {}) + headers["Accept"] = "text/event-stream" + headers["Cache-Control"] = "no-store" + + async with client.stream(method, url, headers=headers, **kwargs) as response: + yield EventSource(response) diff --git a/data/src/elevenlabs/core/http_sse/_decoders.py b/data/src/elevenlabs/core/http_sse/_decoders.py new file mode 100644 index 0000000000000000000000000000000000000000..339b0890138112b349d7446798a7e5f04643cbb1 --- /dev/null +++ b/data/src/elevenlabs/core/http_sse/_decoders.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import List, Optional + +from ._models import ServerSentEvent + + +class SSEDecoder: + def __init__(self) -> None: + self._event = "" + self._data: List[str] = [] + self._last_event_id = "" + self._retry: Optional[int] = None + + def decode(self, line: str) -> Optional[ServerSentEvent]: + # See: https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation # noqa: E501 + + if not line: + if not self._event and not self._data and not self._last_event_id and self._retry is None: + return None + + sse = ServerSentEvent( + event=self._event, + data="\n".join(self._data), + id=self._last_event_id, + retry=self._retry, + ) + + # NOTE: as per the SSE spec, do not reset last_event_id. + self._event = "" + self._data = [] + self._retry = None + + return sse + + if line.startswith(":"): + return None + + fieldname, _, value = line.partition(":") + + if value.startswith(" "): + value = value[1:] + + if fieldname == "event": + self._event = value + elif fieldname == "data": + self._data.append(value) + elif fieldname == "id": + if "\0" in value: + pass + else: + self._last_event_id = value + elif fieldname == "retry": + try: + self._retry = int(value) + except (TypeError, ValueError): + pass + else: + pass # Field is ignored. + + return None diff --git a/data/src/elevenlabs/core/http_sse/_exceptions.py b/data/src/elevenlabs/core/http_sse/_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..81605a8a65ed7f9cdae1a5aad58a8f57817b6886 --- /dev/null +++ b/data/src/elevenlabs/core/http_sse/_exceptions.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import httpx + + +class SSEError(httpx.TransportError): + pass diff --git a/data/src/elevenlabs/core/http_sse/_models.py b/data/src/elevenlabs/core/http_sse/_models.py new file mode 100644 index 0000000000000000000000000000000000000000..1af57f8fd0d2f9872ae06f67a13416ea3fb848e0 --- /dev/null +++ b/data/src/elevenlabs/core/http_sse/_models.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +from dataclasses import dataclass +from typing import Any, Optional + + +@dataclass(frozen=True) +class ServerSentEvent: + event: str = "message" + data: str = "" + id: str = "" + retry: Optional[int] = None + + def json(self) -> Any: + """Parse the data field as JSON.""" + return json.loads(self.data) diff --git a/data/src/elevenlabs/core/jsonable_encoder.py b/data/src/elevenlabs/core/jsonable_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..f8beaeafb17f697dff432cd199bf721d1cb77847 --- /dev/null +++ b/data/src/elevenlabs/core/jsonable_encoder.py @@ -0,0 +1,108 @@ +# This file was auto-generated by Fern from our API Definition. + +""" +jsonable_encoder converts a Python object to a JSON-friendly dict +(e.g. datetimes to strings, Pydantic models to dicts). + +Taken from FastAPI, and made a bit simpler +https://github.com/tiangolo/fastapi/blob/master/fastapi/encoders.py +""" + +import base64 +import dataclasses +import datetime as dt +from enum import Enum +from pathlib import PurePath +from types import GeneratorType +from typing import Any, Callable, Dict, List, Optional, Set, Union + +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 jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any: + custom_encoder = custom_encoder or {} + # Generated SDKs use Ellipsis (`...`) as the sentinel value for "OMIT". + # OMIT values should be excluded from serialized payloads. + if obj is Ellipsis: + return None + if custom_encoder: + if type(obj) in custom_encoder: + return custom_encoder[type(obj)](obj) + else: + for encoder_type, encoder_instance in custom_encoder.items(): + if isinstance(obj, encoder_type): + return encoder_instance(obj) + if isinstance(obj, pydantic.BaseModel): + 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) # 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.datetime): + return serialize_datetime(obj) + if isinstance(obj, dt.date): + return str(obj) + if isinstance(obj, dict): + encoded_dict = {} + allowed_keys = set(obj.keys()) + for key, value in obj.items(): + if key in allowed_keys: + if value is Ellipsis: + continue + encoded_key = jsonable_encoder(key, custom_encoder=custom_encoder) + encoded_value = jsonable_encoder(value, custom_encoder=custom_encoder) + encoded_dict[encoded_key] = encoded_value + return encoded_dict + if isinstance(obj, (list, set, frozenset, GeneratorType, tuple)): + encoded_list = [] + for item in obj: + if item is Ellipsis: + continue + encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder)) + return encoded_list + + def fallback_serializer(o: Any) -> Any: + attempt_encode = encode_by_type(o) + if attempt_encode is not None: + return attempt_encode + + try: + data = dict(o) + except Exception as e: + errors: List[Exception] = [] + errors.append(e) + 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/data/src/elevenlabs/core/logging.py b/data/src/elevenlabs/core/logging.py new file mode 100644 index 0000000000000000000000000000000000000000..e5e572458bc85f883d04ed74e6ab5d4871921d4a --- /dev/null +++ b/data/src/elevenlabs/core/logging.py @@ -0,0 +1,107 @@ +# This file was auto-generated by Fern from our API Definition. + +import logging +import typing + +LogLevel = typing.Literal["debug", "info", "warn", "error"] + +_LOG_LEVEL_MAP: typing.Dict[LogLevel, int] = { + "debug": 1, + "info": 2, + "warn": 3, + "error": 4, +} + + +class ILogger(typing.Protocol): + def debug(self, message: str, **kwargs: typing.Any) -> None: ... + def info(self, message: str, **kwargs: typing.Any) -> None: ... + def warn(self, message: str, **kwargs: typing.Any) -> None: ... + def error(self, message: str, **kwargs: typing.Any) -> None: ... + + +class ConsoleLogger: + _logger: logging.Logger + + def __init__(self) -> None: + self._logger = logging.getLogger("fern") + if not self._logger.handlers: + handler = logging.StreamHandler() + handler.setFormatter(logging.Formatter("%(levelname)s - %(message)s")) + self._logger.addHandler(handler) + self._logger.setLevel(logging.DEBUG) + + def debug(self, message: str, **kwargs: typing.Any) -> None: + self._logger.debug(message, extra=kwargs) + + def info(self, message: str, **kwargs: typing.Any) -> None: + self._logger.info(message, extra=kwargs) + + def warn(self, message: str, **kwargs: typing.Any) -> None: + self._logger.warning(message, extra=kwargs) + + def error(self, message: str, **kwargs: typing.Any) -> None: + self._logger.error(message, extra=kwargs) + + +class LogConfig(typing.TypedDict, total=False): + level: LogLevel + logger: ILogger + silent: bool + + +class Logger: + _level: int + _logger: ILogger + _silent: bool + + def __init__(self, *, level: LogLevel, logger: ILogger, silent: bool) -> None: + self._level = _LOG_LEVEL_MAP[level] + self._logger = logger + self._silent = silent + + def _should_log(self, level: LogLevel) -> bool: + return not self._silent and self._level <= _LOG_LEVEL_MAP[level] + + def is_debug(self) -> bool: + return self._should_log("debug") + + def is_info(self) -> bool: + return self._should_log("info") + + def is_warn(self) -> bool: + return self._should_log("warn") + + def is_error(self) -> bool: + return self._should_log("error") + + def debug(self, message: str, **kwargs: typing.Any) -> None: + if self.is_debug(): + self._logger.debug(message, **kwargs) + + def info(self, message: str, **kwargs: typing.Any) -> None: + if self.is_info(): + self._logger.info(message, **kwargs) + + def warn(self, message: str, **kwargs: typing.Any) -> None: + if self.is_warn(): + self._logger.warn(message, **kwargs) + + def error(self, message: str, **kwargs: typing.Any) -> None: + if self.is_error(): + self._logger.error(message, **kwargs) + + +_default_logger: Logger = Logger(level="info", logger=ConsoleLogger(), silent=True) + + +def create_logger(config: typing.Optional[typing.Union[LogConfig, Logger]] = None) -> Logger: + if config is None: + return _default_logger + if isinstance(config, Logger): + return config + return Logger( + level=config.get("level", "info"), + logger=config.get("logger", ConsoleLogger()), + silent=config.get("silent", True), + ) diff --git a/data/src/elevenlabs/core/parse_error.py b/data/src/elevenlabs/core/parse_error.py new file mode 100644 index 0000000000000000000000000000000000000000..4527c6a8adeca807f21c459c7098b0368d9aa36a --- /dev/null +++ b/data/src/elevenlabs/core/parse_error.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, Optional + + +class ParsingError(Exception): + """ + Raised when the SDK fails to parse/validate a response from the server. + This typically indicates that the server returned a response whose shape + does not match the expected schema. + """ + + headers: Optional[Dict[str, str]] + status_code: Optional[int] + body: Any + cause: Optional[Exception] + + def __init__( + self, + *, + headers: Optional[Dict[str, str]] = None, + status_code: Optional[int] = None, + body: Any = None, + cause: Optional[Exception] = None, + ) -> None: + self.headers = headers + self.status_code = status_code + self.body = body + self.cause = cause + super().__init__() + if cause is not None: + self.__cause__ = cause + + def __str__(self) -> str: + cause_str = f", cause: {self.cause}" if self.cause is not None else "" + return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}{cause_str}" diff --git a/data/src/elevenlabs/core/pydantic_utilities.py b/data/src/elevenlabs/core/pydantic_utilities.py new file mode 100644 index 0000000000000000000000000000000000000000..fea3a08d326853859034d04a13e25bbca9c73455 --- /dev/null +++ b/data/src/elevenlabs/core/pydantic_utilities.py @@ -0,0 +1,634 @@ +# This file was auto-generated by Fern from our API Definition. + +# nopycln: file +import datetime as dt +import inspect +import json +import logging +from collections import defaultdict +from dataclasses import asdict +from typing import ( + TYPE_CHECKING, + Any, + Callable, + ClassVar, + Dict, + List, + Mapping, + Optional, + Set, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +import pydantic +import typing_extensions +from pydantic.fields import FieldInfo as _FieldInfo + +_logger = logging.getLogger(__name__) + +if TYPE_CHECKING: + from .http_sse._models import ServerSentEvent + +IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.") + +if IS_PYDANTIC_V2: + _datetime_adapter = pydantic.TypeAdapter(dt.datetime) # type: ignore[attr-defined] + _date_adapter = pydantic.TypeAdapter(dt.date) # type: ignore[attr-defined] + + def parse_datetime(value: Any) -> dt.datetime: # type: ignore[misc] + if isinstance(value, dt.datetime): + return value + return _datetime_adapter.validate_python(value) + + def parse_date(value: Any) -> dt.date: # type: ignore[misc] + if isinstance(value, dt.datetime): + return value.date() + if isinstance(value, dt.date): + return value + return _date_adapter.validate_python(value) + + # Avoid importing from pydantic.v1 to maintain Python 3.14 compatibility. + from typing import get_args as get_args # type: ignore[assignment] + from typing import get_origin as get_origin # type: ignore[assignment] + + def is_literal_type(tp: Optional[Type[Any]]) -> bool: # type: ignore[misc] + return typing_extensions.get_origin(tp) is typing_extensions.Literal + + def is_union(tp: Optional[Type[Any]]) -> bool: # type: ignore[misc] + return tp is Union or typing_extensions.get_origin(tp) is Union # type: ignore[comparison-overlap] + + # Inline encoders_by_type to avoid importing from pydantic.v1.json + import re as _re + from collections import deque as _deque + from decimal import Decimal as _Decimal + from enum import Enum as _Enum + from ipaddress import ( + IPv4Address as _IPv4Address, + ) + from ipaddress import ( + IPv4Interface as _IPv4Interface, + ) + from ipaddress import ( + IPv4Network as _IPv4Network, + ) + from ipaddress import ( + IPv6Address as _IPv6Address, + ) + from ipaddress import ( + IPv6Interface as _IPv6Interface, + ) + from ipaddress import ( + IPv6Network as _IPv6Network, + ) + from pathlib import Path as _Path + from types import GeneratorType as _GeneratorType + from uuid import UUID as _UUID + + from pydantic.fields import FieldInfo as ModelField # type: ignore[no-redef, assignment] + + def _decimal_encoder(dec_value: Any) -> Any: + if dec_value.as_tuple().exponent >= 0: + return int(dec_value) + return float(dec_value) + + encoders_by_type: Dict[Type[Any], Callable[[Any], Any]] = { # type: ignore[no-redef] + bytes: lambda o: o.decode(), + dt.date: lambda o: o.isoformat(), + dt.datetime: lambda o: o.isoformat(), + dt.time: lambda o: o.isoformat(), + dt.timedelta: lambda td: td.total_seconds(), + _Decimal: _decimal_encoder, + _Enum: lambda o: o.value, + frozenset: list, + _deque: list, + _GeneratorType: list, + _IPv4Address: str, + _IPv4Interface: str, + _IPv4Network: str, + _IPv6Address: str, + _IPv6Interface: str, + _IPv6Network: str, + _Path: str, + _re.Pattern: lambda o: o.pattern, + set: list, + _UUID: str, + } +else: + from pydantic.datetime_parse import parse_date as parse_date # type: ignore[no-redef] + from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore[no-redef] + from pydantic.fields import ModelField as ModelField # type: ignore[attr-defined, no-redef, assignment] + from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[no-redef] + from pydantic.typing import get_args as get_args # type: ignore[no-redef] + from pydantic.typing import get_origin as get_origin # type: ignore[no-redef] + from pydantic.typing import is_literal_type as is_literal_type # type: ignore[no-redef, assignment] + from pydantic.typing import is_union as is_union # type: ignore[no-redef] + +from .datetime_utils import serialize_datetime +from .serialization import convert_and_respect_annotation_metadata +from typing_extensions import TypeAlias + +T = TypeVar("T") +Model = TypeVar("Model", bound=pydantic.BaseModel) + + +def _get_discriminator_and_variants(type_: Type[Any]) -> Tuple[Optional[str], Optional[List[Type[Any]]]]: + """ + Extract the discriminator field name and union variants from a discriminated union type. + Supports Annotated[Union[...], Field(discriminator=...)] patterns. + Returns (discriminator, variants) or (None, None) if not a discriminated union. + """ + origin = typing_extensions.get_origin(type_) + + if origin is typing_extensions.Annotated: + args = typing_extensions.get_args(type_) + if len(args) >= 2: + inner_type = args[0] + # Check annotations for discriminator + discriminator = None + for annotation in args[1:]: + if hasattr(annotation, "discriminator"): + discriminator = getattr(annotation, "discriminator", None) + break + + if discriminator: + inner_origin = typing_extensions.get_origin(inner_type) + if inner_origin is Union: + variants = list(typing_extensions.get_args(inner_type)) + return discriminator, variants + return None, None + + +def _get_field_annotation(model: Type[Any], field_name: str) -> Optional[Type[Any]]: + """Get the type annotation of a field from a Pydantic model.""" + if IS_PYDANTIC_V2: + fields = getattr(model, "model_fields", {}) + field_info = fields.get(field_name) + if field_info: + return cast(Optional[Type[Any]], field_info.annotation) + else: + fields = getattr(model, "__fields__", {}) + field_info = fields.get(field_name) + if field_info: + return cast(Optional[Type[Any]], field_info.outer_type_) + return None + + +def _find_variant_by_discriminator( + variants: List[Type[Any]], + discriminator: str, + discriminator_value: Any, +) -> Optional[Type[Any]]: + """Find the union variant that matches the discriminator value.""" + for variant in variants: + if not (inspect.isclass(variant) and issubclass(variant, pydantic.BaseModel)): + continue + + disc_annotation = _get_field_annotation(variant, discriminator) + if disc_annotation and is_literal_type(disc_annotation): + literal_args = get_args(disc_annotation) + if literal_args and literal_args[0] == discriminator_value: + return variant + return None + + +def _is_string_type(type_: Type[Any]) -> bool: + """Check if a type is str or Optional[str].""" + if type_ is str: + return True + + origin = typing_extensions.get_origin(type_) + if origin is Union: + args = typing_extensions.get_args(type_) + # Optional[str] = Union[str, None] + non_none_args = [a for a in args if a is not type(None)] + if len(non_none_args) == 1 and non_none_args[0] is str: + return True + + return False + + +def parse_sse_obj(sse: "ServerSentEvent", type_: Type[T]) -> T: + """ + Parse a ServerSentEvent into the appropriate type. + + Handles two scenarios based on where the discriminator field is located: + + 1. Data-level discrimination: The discriminator (e.g., 'type') is inside the 'data' payload. + The union describes the data content, not the SSE envelope. + -> Returns: json.loads(data) parsed into the type + + Example: ChatStreamResponse with discriminator='type' + Input: ServerSentEvent(event="message", data='{"type": "content-delta", ...}', id="") + Output: ContentDeltaEvent (parsed from data, SSE envelope stripped) + + 2. Event-level discrimination: The discriminator (e.g., 'event') is at the SSE event level. + The union describes the full SSE event structure. + -> Returns: SSE envelope with 'data' field JSON-parsed only if the variant expects non-string + + Example: JobStreamResponse with discriminator='event' + Input: ServerSentEvent(event="ERROR", data='{"code": "FAILED", ...}', id="123") + Output: JobStreamResponse_Error with data as ErrorData object + + But for variants where data is str (like STATUS_UPDATE): + Input: ServerSentEvent(event="STATUS_UPDATE", data='{"status": "processing"}', id="1") + Output: JobStreamResponse_StatusUpdate with data as string (not parsed) + + Args: + sse: The ServerSentEvent object to parse + type_: The target discriminated union type + + Returns: + The parsed object of type T + + Note: + This function is only available in SDK contexts where http_sse module exists. + """ + sse_event = asdict(sse) + discriminator, variants = _get_discriminator_and_variants(type_) + + if discriminator is None or variants is None: + # Not a discriminated union - parse the data field as JSON + data_value = sse_event.get("data") + if isinstance(data_value, str) and data_value: + try: + parsed_data = json.loads(data_value) + return parse_obj_as(type_, parsed_data) + except json.JSONDecodeError as e: + _logger.warning( + "Failed to parse SSE data field as JSON: %s, data: %s", + e, + data_value[:100] if len(data_value) > 100 else data_value, + ) + return parse_obj_as(type_, sse_event) + + data_value = sse_event.get("data") + + # Check if discriminator is at the top level (event-level discrimination) + if discriminator in sse_event: + # Case 2: Event-level discrimination + # Find the matching variant to check if 'data' field needs JSON parsing + disc_value = sse_event.get(discriminator) + matching_variant = _find_variant_by_discriminator(variants, discriminator, disc_value) + + if matching_variant is not None: + # Check what type the variant expects for 'data' + data_type = _get_field_annotation(matching_variant, "data") + if data_type is not None and not _is_string_type(data_type): + # Variant expects non-string data - parse JSON + if isinstance(data_value, str) and data_value: + try: + parsed_data = json.loads(data_value) + new_object = dict(sse_event) + new_object["data"] = parsed_data + return parse_obj_as(type_, new_object) + except json.JSONDecodeError as e: + _logger.warning( + "Failed to parse SSE data field as JSON for event-level discrimination: %s, data: %s", + e, + data_value[:100] if len(data_value) > 100 else data_value, + ) + # Either no matching variant, data is string type, or JSON parse failed + return parse_obj_as(type_, sse_event) + + else: + # Case 1: Data-level discrimination + # The discriminator is inside the data payload - extract and parse data only + if isinstance(data_value, str) and data_value: + try: + parsed_data = json.loads(data_value) + return parse_obj_as(type_, parsed_data) + except json.JSONDecodeError as e: + _logger.warning( + "Failed to parse SSE data field as JSON for data-level discrimination: %s, data: %s", + e, + data_value[:100] if len(data_value) > 100 else data_value, + ) + return parse_obj_as(type_, sse_event) + + +def parse_obj_as(type_: Type[T], object_: Any) -> T: + # convert_and_respect_annotation_metadata is required for TypedDict aliasing. + # + # For Pydantic models, whether we should pre-dealias depends on how the model encodes aliasing: + # - If the model uses real Pydantic aliases (pydantic.Field(alias=...)), then we must pass wire keys through + # unchanged so Pydantic can validate them. + # - If the model encodes aliasing only via FieldMetadata annotations, then we MUST pre-dealias because Pydantic + # will not recognize those aliases during validation. + if inspect.isclass(type_) and issubclass(type_, pydantic.BaseModel): + has_pydantic_aliases = False + if IS_PYDANTIC_V2: + for field_name, field_info in getattr(type_, "model_fields", {}).items(): # type: ignore[attr-defined] + alias = getattr(field_info, "alias", None) + if alias is not None and alias != field_name: + has_pydantic_aliases = True + break + else: + for field in getattr(type_, "__fields__", {}).values(): + alias = getattr(field, "alias", None) + name = getattr(field, "name", None) + if alias is not None and name is not None and alias != name: + has_pydantic_aliases = True + break + + dealiased_object = ( + object_ + if has_pydantic_aliases + else convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read") + ) + else: + dealiased_object = convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read") + if IS_PYDANTIC_V2: + adapter = pydantic.TypeAdapter(type_) # type: ignore[attr-defined] + return adapter.validate_python(dealiased_object) + return pydantic.parse_obj_as(type_, dealiased_object) + + +def to_jsonable_with_fallback(obj: Any, fallback_serializer: Callable[[Any], Any]) -> Any: + if IS_PYDANTIC_V2: + from pydantic_core import to_jsonable_python + + return to_jsonable_python(obj, fallback=fallback_serializer) + return fallback_serializer(obj) + + +class UniversalBaseModel(pydantic.BaseModel): + if IS_PYDANTIC_V2: + model_config: ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( # type: ignore[typeddict-unknown-key] + # Allow fields beginning with `model_` to be used in the model + protected_namespaces=(), + ) + + @pydantic.model_validator(mode="before") # type: ignore[attr-defined] + @classmethod + def _coerce_field_names_to_aliases(cls, data: Any) -> Any: + """ + Accept Python field names in input by rewriting them to their Pydantic aliases, + while avoiding silent collisions when a key could refer to multiple fields. + """ + if not isinstance(data, Mapping): + return data + + fields = getattr(cls, "model_fields", {}) # type: ignore[attr-defined] + name_to_alias: Dict[str, str] = {} + alias_to_name: Dict[str, str] = {} + + for name, field_info in fields.items(): + alias = getattr(field_info, "alias", None) or name + name_to_alias[name] = alias + if alias != name: + alias_to_name[alias] = name + + # Detect ambiguous keys: a key that is an alias for one field and a name for another. + ambiguous_keys = set(alias_to_name.keys()).intersection(set(name_to_alias.keys())) + for key in ambiguous_keys: + if key in data and name_to_alias[key] not in data: + raise ValueError( + f"Ambiguous input key '{key}': it is both a field name and an alias. " + "Provide the explicit alias key to disambiguate." + ) + + original_keys = set(data.keys()) + rewritten: Dict[str, Any] = dict(data) + for name, alias in name_to_alias.items(): + if alias != name and name in original_keys and alias not in rewritten: + rewritten[alias] = rewritten.pop(name) + + return rewritten + + @pydantic.model_serializer(mode="plain", when_used="json") # type: ignore[attr-defined] + def serialize_model(self) -> Any: # type: ignore[name-defined] + serialized = self.dict() # type: ignore[attr-defined] + data = {k: serialize_datetime(v) if isinstance(v, dt.datetime) else v for k, v in serialized.items()} + return data + + else: + + class Config: + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + @pydantic.root_validator(pre=True) + def _coerce_field_names_to_aliases(cls, values: Any) -> Any: + """ + Pydantic v1 equivalent of _coerce_field_names_to_aliases. + """ + if not isinstance(values, Mapping): + return values + + fields = getattr(cls, "__fields__", {}) + name_to_alias: Dict[str, str] = {} + alias_to_name: Dict[str, str] = {} + + for name, field in fields.items(): + alias = getattr(field, "alias", None) or name + name_to_alias[name] = alias + if alias != name: + alias_to_name[alias] = name + + ambiguous_keys = set(alias_to_name.keys()).intersection(set(name_to_alias.keys())) + for key in ambiguous_keys: + if key in values and name_to_alias[key] not in values: + raise ValueError( + f"Ambiguous input key '{key}': it is both a field name and an alias. " + "Provide the explicit alias key to disambiguate." + ) + + original_keys = set(values.keys()) + rewritten: Dict[str, Any] = dict(values) + for name, alias in name_to_alias.items(): + if alias != name and name in original_keys and alias not in rewritten: + rewritten[alias] = rewritten.pop(name) + + return rewritten + + @classmethod + def model_construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model": + dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read") + return cls.construct(_fields_set, **dealiased_object) + + @classmethod + def construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model": + dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read") + if IS_PYDANTIC_V2: + return super().model_construct(_fields_set, **dealiased_object) # type: ignore[misc] + return super().construct(_fields_set, **dealiased_object) + + def json(self, **kwargs: Any) -> str: + kwargs_with_defaults = { + "by_alias": True, + "exclude_unset": True, + **kwargs, + } + if IS_PYDANTIC_V2: + return super().model_dump_json(**kwargs_with_defaults) # type: ignore[misc] + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: Any) -> Dict[str, 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. + """ + # Note: the logic here is multiplexed given the levers exposed in Pydantic V1 vs V2 + # Pydantic V1's .dict can be extremely slow, so we do not want to call it twice. + # + # We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models + # that we have less control over, and this is less intrusive than custom serializers for now. + if IS_PYDANTIC_V2: + kwargs_with_defaults_exclude_unset = { + **kwargs, + "by_alias": True, + "exclude_unset": True, + "exclude_none": False, + } + kwargs_with_defaults_exclude_none = { + **kwargs, + "by_alias": True, + "exclude_none": True, + "exclude_unset": False, + } + dict_dump = deep_union_pydantic_dicts( + super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore[misc] + super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore[misc] + ) + + else: + _fields_set = self.__fields_set__.copy() + + 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 is not None or ("exclude_unset" in kwargs and not kwargs["exclude_unset"]): + _fields_set.add(name) + + if default is not None: + self.__fields_set__.add(name) + + kwargs_with_defaults_exclude_unset_include_fields = { + "by_alias": True, + "exclude_unset": True, + "include": _fields_set, + **kwargs, + } + + dict_dump = super().dict(**kwargs_with_defaults_exclude_unset_include_fields) + + return cast( + Dict[str, Any], + convert_and_respect_annotation_metadata(object_=dict_dump, annotation=self.__class__, direction="write"), + ) + + +def _union_list_of_pydantic_dicts(source: List[Any], destination: List[Any]) -> List[Any]: + converted_list: List[Any] = [] + for i, item in enumerate(source): + destination_value = destination[i] + if isinstance(item, dict): + converted_list.append(deep_union_pydantic_dicts(item, destination_value)) + elif isinstance(item, list): + converted_list.append(_union_list_of_pydantic_dicts(item, destination_value)) + else: + converted_list.append(item) + return converted_list + + +def deep_union_pydantic_dicts(source: Dict[str, Any], destination: Dict[str, Any]) -> Dict[str, Any]: + for key, value in source.items(): + node = destination.setdefault(key, {}) + if isinstance(value, dict): + deep_union_pydantic_dicts(value, node) + # Note: we do not do this same processing for sets given we do not have sets of models + # and given the sets are unordered, the processing of the set and matching objects would + # be non-trivial. + elif isinstance(value, list): + destination[key] = _union_list_of_pydantic_dicts(value, node) + else: + destination[key] = value + + return destination + + +if IS_PYDANTIC_V2: + + class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore[misc, name-defined, type-arg] + pass + + UniversalRootModel: TypeAlias = V2RootModel # type: ignore[misc] +else: + UniversalRootModel: TypeAlias = UniversalBaseModel # type: ignore[misc, no-redef] + + +def encode_by_type(o: Any) -> Any: + encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[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: Type["Model"], **localns: Any) -> None: + if IS_PYDANTIC_V2: + model.model_rebuild(raise_errors=False) # type: ignore[attr-defined] + else: + model.update_forward_refs(**localns) + + +# Mirrors Pydantic's internal typing +AnyCallable = Callable[..., Any] + + +def universal_root_validator( + pre: bool = False, +) -> Callable[[AnyCallable], AnyCallable]: + def decorator(func: AnyCallable) -> AnyCallable: + if IS_PYDANTIC_V2: + # In Pydantic v2, for RootModel we always use "before" mode + # The custom validators transform the input value before the model is created + return cast(AnyCallable, pydantic.model_validator(mode="before")(func)) # type: ignore[attr-defined] + return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload] + + return decorator + + +def universal_field_validator(field_name: str, pre: bool = False) -> Callable[[AnyCallable], AnyCallable]: + def decorator(func: AnyCallable) -> AnyCallable: + if IS_PYDANTIC_V2: + return cast(AnyCallable, pydantic.field_validator(field_name, mode="before" if pre else "after")(func)) # type: ignore[attr-defined] + return cast(AnyCallable, pydantic.validator(field_name, pre=pre)(func)) + + return decorator + + +PydanticField = Union[ModelField, _FieldInfo] + + +def _get_model_fields(model: Type["Model"]) -> Mapping[str, PydanticField]: + if IS_PYDANTIC_V2: + return cast(Mapping[str, PydanticField], model.model_fields) # type: ignore[attr-defined] + return cast(Mapping[str, PydanticField], model.__fields__) + + +def _get_field_default(field: PydanticField) -> Any: + try: + value = field.get_default() # type: ignore[union-attr] + 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/data/src/elevenlabs/core/query_encoder.py b/data/src/elevenlabs/core/query_encoder.py new file mode 100644 index 0000000000000000000000000000000000000000..3183001d40462d0f35f8c2aea4e309bc565ea79a --- /dev/null +++ b/data/src/elevenlabs/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/data/src/elevenlabs/core/remove_none_from_dict.py b/data/src/elevenlabs/core/remove_none_from_dict.py new file mode 100644 index 0000000000000000000000000000000000000000..c2298143f14a09aee4e01e9ad51d8fedd6bce545 --- /dev/null +++ b/data/src/elevenlabs/core/remove_none_from_dict.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, Mapping, Optional + + +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: + new[key] = value + return new diff --git a/data/src/elevenlabs/core/request_options.py b/data/src/elevenlabs/core/request_options.py new file mode 100644 index 0000000000000000000000000000000000000000..1b38804432ba93a2c474ed1d18eac356e9d197e3 --- /dev/null +++ b/data/src/elevenlabs/core/request_options.py @@ -0,0 +1,35 @@ +# 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 + + - chunk_size: int. The size, in bytes, to process each chunk of data being streamed back within the response. This equates to leveraging `chunk_size` within `requests` or `httpx`, and is only leveraged for file downloads. + """ + + 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]] + chunk_size: NotRequired[int] diff --git a/data/src/elevenlabs/core/serialization.py b/data/src/elevenlabs/core/serialization.py new file mode 100644 index 0000000000000000000000000000000000000000..c36e865cc729e0d8aa42fc223aadd5410ca42c15 --- /dev/null +++ b/data/src/elevenlabs/core/serialization.py @@ -0,0 +1,276 @@ +# This file was auto-generated by Fern from our API Definition. + +import collections +import inspect +import typing + +import pydantic +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, + direction: typing.Literal["read", "write"], +) -> 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) + # Pydantic models + if ( + inspect.isclass(clean_type) + and issubclass(clean_type, pydantic.BaseModel) + and isinstance(object_, typing.Mapping) + ): + return _convert_mapping(object_, clean_type, direction) + # TypedDicts + if typing_extensions.is_typeddict(clean_type) and isinstance(object_, typing.Mapping): + return _convert_mapping(object_, clean_type, direction) + + if ( + typing_extensions.get_origin(clean_type) == typing.Dict + or typing_extensions.get_origin(clean_type) == dict + or clean_type == typing.Dict + ) and isinstance(object_, typing.Dict): + key_type = typing_extensions.get_args(clean_type)[0] + value_type = typing_extensions.get_args(clean_type)[1] + + return { + key: convert_and_respect_annotation_metadata( + object_=value, + annotation=annotation, + inner_type=value_type, + direction=direction, + ) + for key, value in object_.items() + } + + # If you're iterating on a string, do not bother to coerce it to a sequence. + if not isinstance(object_, str): + if ( + 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): + inner_type = typing_extensions.get_args(clean_type)[0] + return { + convert_and_respect_annotation_metadata( + object_=item, + annotation=annotation, + inner_type=inner_type, + direction=direction, + ) + for item in object_ + } + elif ( + ( + 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.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, + direction=direction, + ) + 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, + direction=direction, + ) + 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_mapping( + object_: typing.Mapping[str, object], + expected_type: typing.Any, + direction: typing.Literal["read", "write"], +) -> typing.Mapping[str, object]: + converted_object: typing.Dict[str, object] = {} + try: + annotations = typing_extensions.get_type_hints(expected_type, include_extras=True) + except NameError: + # The TypedDict contains a circular reference, so + # we use the __annotations__ attribute directly. + annotations = getattr(expected_type, "__annotations__", {}) + aliases_to_field_names = _get_alias_to_field_name(annotations) + for key, value in object_.items(): + if direction == "read" and key in aliases_to_field_names: + dealiased_key = aliases_to_field_names.get(key) + if dealiased_key is not None: + type_ = annotations.get(dealiased_key) + else: + type_ = annotations.get(key) + # Note you can't get the annotation by the field name if you're in read mode, so you must check the aliases map + # + # So this is effectively saying if we're in write mode, and we don't have a type, or if we're in read mode and we don't have an alias + # then we can just pass the value through as is + if type_ is None: + converted_object[key] = value + elif direction == "read" and key not in aliases_to_field_names: + converted_object[key] = convert_and_respect_annotation_metadata( + object_=value, annotation=type_, direction=direction + ) + else: + converted_object[_alias_key(key, type_, direction, aliases_to_field_names)] = ( + convert_and_respect_annotation_metadata(object_=value, annotation=type_, direction=direction) + ) + 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 get_alias_to_field_mapping(type_: typing.Any) -> typing.Dict[str, str]: + annotations = typing_extensions.get_type_hints(type_, include_extras=True) + return _get_alias_to_field_name(annotations) + + +def get_field_to_alias_mapping(type_: typing.Any) -> typing.Dict[str, str]: + annotations = typing_extensions.get_type_hints(type_, include_extras=True) + return _get_field_to_alias_name(annotations) + + +def _get_alias_to_field_name( + field_to_hint: typing.Dict[str, typing.Any], +) -> typing.Dict[str, str]: + aliases = {} + for field, hint in field_to_hint.items(): + maybe_alias = _get_alias_from_type(hint) + if maybe_alias is not None: + aliases[maybe_alias] = field + return aliases + + +def _get_field_to_alias_name( + field_to_hint: typing.Dict[str, typing.Any], +) -> typing.Dict[str, str]: + aliases = {} + for field, hint in field_to_hint.items(): + maybe_alias = _get_alias_from_type(hint) + if maybe_alias is not None: + aliases[field] = maybe_alias + return aliases + + +def _get_alias_from_type(type_: typing.Any) -> typing.Optional[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 None + + +def _alias_key( + key: str, + type_: typing.Any, + direction: typing.Literal["read", "write"], + aliases_to_field_names: typing.Dict[str, str], +) -> str: + if direction == "read": + return aliases_to_field_names.get(key, key) + return _get_alias_from_type(type_=type_) or key diff --git a/data/src/elevenlabs/core/unchecked_base_model.py b/data/src/elevenlabs/core/unchecked_base_model.py new file mode 100644 index 0000000000000000000000000000000000000000..05b20639777d5afed8a1bc5ff4e4677d6e42f9b7 --- /dev/null +++ b/data/src/elevenlabs/core/unchecked_base_model.py @@ -0,0 +1,378 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import inspect +import typing +import uuid + +import pydantic +import typing_extensions +from .pydantic_utilities import ( # type: ignore[attr-defined] + IS_PYDANTIC_V2, + ModelField, + UniversalBaseModel, + get_args, + get_origin, + is_literal_type, + is_union, + parse_date, + parse_datetime, + parse_obj_as, +) +from .serialization import get_field_to_alias_mapping +from pydantic_core import PydanticUndefined + + +class UnionMetadata: + discriminant: str + + def __init__(self, *, discriminant: str) -> None: + self.discriminant = discriminant + + +Model = typing.TypeVar("Model", bound=pydantic.BaseModel) + + +class UncheckedBaseModel(UniversalBaseModel): + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.allow + + @classmethod + def model_construct( + cls: typing.Type["Model"], + _fields_set: typing.Optional[typing.Set[str]] = None, + **values: typing.Any, + ) -> "Model": + # Fallback construct function to the specified override below. + return cls.construct(_fields_set=_fields_set, **values) + + # Allow construct to not validate model + # Implementation taken from: https://github.com/pydantic/pydantic/issues/1168#issuecomment-817742836 + @classmethod + def construct( + cls: typing.Type["Model"], + _fields_set: typing.Optional[typing.Set[str]] = None, + **values: typing.Any, + ) -> "Model": + m = cls.__new__(cls) + fields_values = {} + + if _fields_set is None: + _fields_set = set(values.keys()) + + fields = _get_model_fields(cls) + populate_by_name = _get_is_populate_by_name(cls) + field_aliases = get_field_to_alias_mapping(cls) + + for name, field in fields.items(): + # Key here is only used to pull data from the values dict + # you should always use the NAME of the field to for field_values, etc. + # because that's how the object is constructed from a pydantic perspective + key = field.alias + if (key is None or field.alias == name) and name in field_aliases: + key = field_aliases[name] + + if key is None or (key not in values and populate_by_name): # Added this to allow population by field name + key = name + + if key in values: + if IS_PYDANTIC_V2: + type_ = field.annotation # type: ignore # Pydantic v2 + else: + type_ = typing.cast(typing.Type, field.outer_type_) # type: ignore # Pydantic < v1.10.15 + + fields_values[name] = ( + construct_type(object_=values[key], type_=type_) if type_ is not None else values[key] + ) + _fields_set.add(name) + else: + default = _get_field_default(field) + fields_values[name] = default + + # 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 and default != PydanticUndefined: + _fields_set.add(name) + + # Add extras back in + extras = {} + pydantic_alias_fields = [field.alias for field in fields.values()] + internal_alias_fields = list(field_aliases.values()) + for key, value in values.items(): + # If the key is not a field by name, nor an alias to a field, then it's extra + if (key not in pydantic_alias_fields and key not in internal_alias_fields) and key not in fields: + if IS_PYDANTIC_V2: + extras[key] = value + else: + _fields_set.add(key) + fields_values[key] = value + + object.__setattr__(m, "__dict__", fields_values) + + if IS_PYDANTIC_V2: + object.__setattr__(m, "__pydantic_private__", None) + object.__setattr__(m, "__pydantic_extra__", extras) + object.__setattr__(m, "__pydantic_fields_set__", _fields_set) + else: + object.__setattr__(m, "__fields_set__", _fields_set) + m._init_private_attributes() # type: ignore # Pydantic v1 + return m + + +def _validate_collection_items_compatible(collection: typing.Any, target_type: typing.Type[typing.Any]) -> bool: + """ + Validate that all items in a collection are compatible with the target type. + + Args: + collection: The collection to validate (list, set, or dict values) + target_type: The target type to validate against + + Returns: + True if all items are compatible, False otherwise + """ + if inspect.isclass(target_type) and issubclass(target_type, pydantic.BaseModel): + for item in collection: + try: + # Try to validate the item against the target type + if isinstance(item, dict): + parse_obj_as(target_type, item) + else: + # If it's not a dict, it might already be the right type + if not isinstance(item, target_type): + return False + except Exception: + return False + return True + + +def _convert_undiscriminated_union_type(union_type: typing.Type[typing.Any], object_: typing.Any) -> typing.Any: + inner_types = get_args(union_type) + if typing.Any in inner_types: + return object_ + + for inner_type in inner_types: + # Handle lists of objects that need parsing + if get_origin(inner_type) is list and isinstance(object_, list): + list_inner_type = get_args(inner_type)[0] + try: + if inspect.isclass(list_inner_type) and issubclass(list_inner_type, pydantic.BaseModel): + # Validate that all items in the list are compatible with the target type + if _validate_collection_items_compatible(object_, list_inner_type): + parsed_list = [parse_obj_as(object_=item, type_=list_inner_type) for item in object_] + return parsed_list + except Exception: + pass + + try: + if inspect.isclass(inner_type) and issubclass(inner_type, pydantic.BaseModel): + # Attempt a validated parse until one works + return parse_obj_as(inner_type, object_) + except Exception: + continue + + # If none of the types work, try matching literal fields first, then fall back + # First pass: try types where all literal fields match the object's values + for inner_type in inner_types: + if inspect.isclass(inner_type) and issubclass(inner_type, pydantic.BaseModel): + fields = _get_model_fields(inner_type) + literal_fields_match = True + + for field_name, field in fields.items(): + # Check if this field has a Literal type + if IS_PYDANTIC_V2: + field_type = field.annotation # type: ignore # Pydantic v2 + else: + field_type = field.outer_type_ # type: ignore # Pydantic v1 + + if is_literal_type(field_type): # type: ignore[arg-type] + field_default = _get_field_default(field) + name_or_alias = get_field_to_alias_mapping(inner_type).get(field_name, field_name) + # Get the value from the object + if isinstance(object_, dict): + object_value = object_.get(name_or_alias) + else: + object_value = getattr(object_, name_or_alias, None) + + # If the literal field value doesn't match, this type is not a match + if object_value is not None and field_default != object_value: + literal_fields_match = False + break + + # If all literal fields match, try to construct this type + if literal_fields_match: + try: + return construct_type(object_=object_, type_=inner_type) + except Exception: + continue + + # Second pass: if no literal matches, just return the first successful cast + for inner_type in inner_types: + try: + return construct_type(object_=object_, type_=inner_type) + except Exception: + continue + + +def _convert_union_type(type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any: + base_type = get_origin(type_) or type_ + union_type = type_ + if base_type == typing_extensions.Annotated: # type: ignore[comparison-overlap] + union_type = get_args(type_)[0] + annotated_metadata = get_args(type_)[1:] + for metadata in annotated_metadata: + if isinstance(metadata, UnionMetadata): + try: + # Cast to the correct type, based on the discriminant + for inner_type in get_args(union_type): + try: + objects_discriminant = getattr(object_, metadata.discriminant) + except: + objects_discriminant = object_[metadata.discriminant] + if inner_type.__fields__[metadata.discriminant].default == objects_discriminant: + return construct_type(object_=object_, type_=inner_type) + except Exception: + # Allow to fall through to our regular union handling + pass + return _convert_undiscriminated_union_type(union_type, object_) + + +def construct_type(*, type_: typing.Type[typing.Any], object_: typing.Any) -> typing.Any: + """ + Here we are essentially creating the same `construct` method in spirit as the above, but for all types, not just + Pydantic models. + The idea is to essentially attempt to coerce object_ to type_ (recursively) + """ + # Short circuit when dealing with optionals, don't try to coerces None to a type + if object_ is None: + return None + + base_type = get_origin(type_) or type_ + is_annotated = base_type == typing_extensions.Annotated # type: ignore[comparison-overlap] + maybe_annotation_members = get_args(type_) + is_annotated_union = is_annotated and is_union(get_origin(maybe_annotation_members[0])) + + if base_type == typing.Any: # type: ignore[comparison-overlap] + return object_ + + if base_type == dict: + if not isinstance(object_, typing.Mapping): + return object_ + + key_type, items_type = get_args(type_) + d = { + construct_type(object_=key, type_=key_type): construct_type(object_=item, type_=items_type) + for key, item in object_.items() + } + return d + + if base_type == list: + if not isinstance(object_, list): + return object_ + + inner_type = get_args(type_)[0] + return [construct_type(object_=entry, type_=inner_type) for entry in object_] + + if base_type == set: + if not isinstance(object_, set) and not isinstance(object_, list): + return object_ + + inner_type = get_args(type_)[0] + return {construct_type(object_=entry, type_=inner_type) for entry in object_} + + if is_union(base_type) or is_annotated_union: + return _convert_union_type(type_, object_) + + # Cannot do an `issubclass` with a literal type, let's also just confirm we have a class before this call + if ( + object_ is not None + and not is_literal_type(type_) + and ( + (inspect.isclass(base_type) and issubclass(base_type, pydantic.BaseModel)) + or ( + is_annotated + and inspect.isclass(maybe_annotation_members[0]) + and issubclass(maybe_annotation_members[0], pydantic.BaseModel) + ) + ) + ): + if IS_PYDANTIC_V2: + return type_.model_construct(**object_) + else: + return type_.construct(**object_) + + if base_type == dt.datetime: + try: + return parse_datetime(object_) + except Exception: + return object_ + + if base_type == dt.date: + try: + return parse_date(object_) + except Exception: + return object_ + + if base_type == uuid.UUID: + try: + return uuid.UUID(object_) + except Exception: + return object_ + + if base_type == int: + try: + return int(object_) + except Exception: + return object_ + + if base_type == bool: + try: + if isinstance(object_, str): + stringified_object = object_.lower() + return stringified_object == "true" or stringified_object == "1" + + return bool(object_) + except Exception: + return object_ + + return object_ + + +def _get_is_populate_by_name(model: typing.Type["Model"]) -> bool: + if IS_PYDANTIC_V2: + return model.model_config.get("populate_by_name", False) # type: ignore # Pydantic v2 + return model.__config__.allow_population_by_field_name # type: ignore # Pydantic v1 + + +from pydantic.fields import FieldInfo as _FieldInfo + +PydanticField = typing.Union[ModelField, _FieldInfo] + + +# Pydantic V1 swapped the typing of __fields__'s values from ModelField to FieldInfo +# And so we try to handle both V1 cases, as well as V2 (FieldInfo from model.model_fields) +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/data/src/elevenlabs/dubbing/__init__.py b/data/src/elevenlabs/dubbing/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0c3a6b315766c816c798a325d419195c3a6f04f2 --- /dev/null +++ b/data/src/elevenlabs/dubbing/__init__.py @@ -0,0 +1,85 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + DubRequestMode, + DubbingListRequestCreationSourcesItem, + DubbingListRequestDubbingModelsItem, + DubbingListRequestDubbingStatus, + DubbingListRequestDubbingStatusesItem, + DubbingListRequestFilterByCreator, + DubbingListRequestOrderBy, + DubbingListRequestOrderDirection, + ) + from . import audio, project, resource, transcript, transcripts + from .project import ProjectCreateRequestModelId, ProjectListRequestSortDirection + from .transcript import TranscriptGetTranscriptForDubRequestFormatType, TranscriptGetTranscriptForDubResponse + from .transcripts import TranscriptsGetRequestFormatType +_dynamic_imports: typing.Dict[str, str] = { + "DubRequestMode": ".types", + "DubbingListRequestCreationSourcesItem": ".types", + "DubbingListRequestDubbingModelsItem": ".types", + "DubbingListRequestDubbingStatus": ".types", + "DubbingListRequestDubbingStatusesItem": ".types", + "DubbingListRequestFilterByCreator": ".types", + "DubbingListRequestOrderBy": ".types", + "DubbingListRequestOrderDirection": ".types", + "ProjectCreateRequestModelId": ".project", + "ProjectListRequestSortDirection": ".project", + "TranscriptGetTranscriptForDubRequestFormatType": ".transcript", + "TranscriptGetTranscriptForDubResponse": ".transcript", + "TranscriptsGetRequestFormatType": ".transcripts", + "audio": ".audio", + "project": ".project", + "resource": ".resource", + "transcript": ".transcript", + "transcripts": ".transcripts", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "DubRequestMode", + "DubbingListRequestCreationSourcesItem", + "DubbingListRequestDubbingModelsItem", + "DubbingListRequestDubbingStatus", + "DubbingListRequestDubbingStatusesItem", + "DubbingListRequestFilterByCreator", + "DubbingListRequestOrderBy", + "DubbingListRequestOrderDirection", + "ProjectCreateRequestModelId", + "ProjectListRequestSortDirection", + "TranscriptGetTranscriptForDubRequestFormatType", + "TranscriptGetTranscriptForDubResponse", + "TranscriptsGetRequestFormatType", + "audio", + "project", + "resource", + "transcript", + "transcripts", +] diff --git a/data/src/elevenlabs/dubbing/audio/__init__.py b/data/src/elevenlabs/dubbing/audio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/dubbing/audio/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/dubbing/audio/client.py b/data/src/elevenlabs/dubbing/audio/client.py new file mode 100644 index 0000000000000000000000000000000000000000..6ddb897bf13e96ffb7e3568c194d65ee6d388e3c --- /dev/null +++ b/data/src/elevenlabs/dubbing/audio/client.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from .raw_client import AsyncRawAudioClient, RawAudioClient + + +class AudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAudioClient + """ + return self._raw_client + + def get( + self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ID of the language. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The dubbed audio or video file + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.audio.get( + dubbing_id="dubbing_id", + language_code="language_code", + ) + """ + with self._raw_client.get(dubbing_id, language_code, request_options=request_options) as r: + yield from r.data + + +class AsyncAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAudioClient + """ + return self._raw_client + + async def get( + self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ID of the language. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The dubbed audio or video file + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.audio.get( + dubbing_id="dubbing_id", + language_code="language_code", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.get(dubbing_id, language_code, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/dubbing/audio/raw_client.py b/data/src/elevenlabs/dubbing/audio/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b87efed99e50c3092973f59f3278568500ba6754 --- /dev/null +++ b/data/src/elevenlabs/dubbing/audio/raw_client.py @@ -0,0 +1,223 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.forbidden_error import ForbiddenError +from ...errors.not_found_error import NotFoundError +from ...errors.too_early_error import TooEarlyError +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from pydantic import ValidationError + + +class RawAudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def get( + self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ID of the language. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The dubbed audio or video file + """ + with self._client_wrapper.httpx_client.stream( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}/audio/{jsonable_encoder(language_code)}", + method="GET", + request_options=request_options, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 425: + raise TooEarlyError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def get( + self, dubbing_id: str, language_code: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Returns dub as a streamed MP3 or MP4 file. If this dub has been edited using Dubbing Studio you need to use the resource render endpoint as this endpoint only returns the original automatic dub result. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ID of the language. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The dubbed audio or video file + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}/audio/{jsonable_encoder(language_code)}", + method="GET", + request_options=request_options, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 425: + raise TooEarlyError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/dubbing/client.py b/data/src/elevenlabs/dubbing/client.py new file mode 100644 index 0000000000000000000000000000000000000000..390858f04dc89518b7a72a98b94ff38aea0bc52e --- /dev/null +++ b/data/src/elevenlabs/dubbing/client.py @@ -0,0 +1,781 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.delete_dubbing_response_model import DeleteDubbingResponseModel +from ..types.do_dubbing_response import DoDubbingResponse +from ..types.dubbing_metadata_page_response_model import DubbingMetadataPageResponseModel +from ..types.dubbing_metadata_response import DubbingMetadataResponse +from .raw_client import AsyncRawDubbingClient, RawDubbingClient +from .types.dub_request_mode import DubRequestMode +from .types.dubbing_list_request_creation_sources_item import DubbingListRequestCreationSourcesItem +from .types.dubbing_list_request_dubbing_models_item import DubbingListRequestDubbingModelsItem +from .types.dubbing_list_request_dubbing_status import DubbingListRequestDubbingStatus +from .types.dubbing_list_request_dubbing_statuses_item import DubbingListRequestDubbingStatusesItem +from .types.dubbing_list_request_filter_by_creator import DubbingListRequestFilterByCreator +from .types.dubbing_list_request_order_by import DubbingListRequestOrderBy +from .types.dubbing_list_request_order_direction import DubbingListRequestOrderDirection + +if typing.TYPE_CHECKING: + from .audio.client import AsyncAudioClient, AudioClient + from .project.client import AsyncProjectClient, ProjectClient + from .resource.client import AsyncResourceClient, ResourceClient + from .transcript.client import AsyncTranscriptClient, TranscriptClient + from .transcripts.client import AsyncTranscriptsClient, TranscriptsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class DubbingClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawDubbingClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._project: typing.Optional[ProjectClient] = None + self._resource: typing.Optional[ResourceClient] = None + self._audio: typing.Optional[AudioClient] = None + self._transcript: typing.Optional[TranscriptClient] = None + self._transcripts: typing.Optional[TranscriptsClient] = None + + @property + def with_raw_response(self) -> RawDubbingClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawDubbingClient + """ + return self._raw_client + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + dubbing_status: typing.Optional[DubbingListRequestDubbingStatus] = None, + dubbing_statuses: typing.Optional[ + typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]] + ] = None, + dubbing_models: typing.Optional[ + typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]] + ] = None, + target_language_codes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + creation_sources: typing.Optional[ + typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]] + ] = None, + filter_by_creator: typing.Optional[DubbingListRequestFilterByCreator] = None, + order_by: typing.Optional[DubbingListRequestOrderBy] = None, + order_direction: typing.Optional[DubbingListRequestOrderDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingMetadataPageResponseModel: + """ + List the dubs you have access to. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many dubs to return at maximum. Can not exceed 200, defaults to 100. + + dubbing_status : typing.Optional[DubbingListRequestDubbingStatus] + What state the dub is currently in. + + dubbing_statuses : typing.Optional[typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]]] + Filter by dubbing status. + + dubbing_models : typing.Optional[typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]]] + Filter by dubbing model generation. + + target_language_codes : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter by target language code. + + creation_sources : typing.Optional[typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]]] + Filter by dubbing creation source. + + filter_by_creator : typing.Optional[DubbingListRequestFilterByCreator] + Filters who created the resources being listed, whether it was the user running the request or someone else that shared the resource with them. + + order_by : typing.Optional[DubbingListRequestOrderBy] + The field to use for ordering results from this query. + + order_direction : typing.Optional[DubbingListRequestOrderDirection] + The order direction to use for results from this query. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingMetadataPageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.list( + cursor="cursor", + page_size=1, + dubbing_status="dubbing", + dubbing_statuses=["queued"], + dubbing_models=["dubbing_v1"], + target_language_codes=["target_language_codes"], + creation_sources=["flow_node"], + filter_by_creator="personal", + order_by="created_at", + order_direction="DESCENDING", + ) + """ + _response = self._raw_client.list( + cursor=cursor, + page_size=page_size, + dubbing_status=dubbing_status, + dubbing_statuses=dubbing_statuses, + dubbing_models=dubbing_models, + target_language_codes=target_language_codes, + creation_sources=creation_sources, + filter_by_creator=filter_by_creator, + order_by=order_by, + order_direction=order_direction, + request_options=request_options, + ) + return _response.data + + def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + csv_file: typing.Optional[core.File] = OMIT, + foreground_audio_file: typing.Optional[core.File] = OMIT, + background_audio_file: typing.Optional[core.File] = OMIT, + name: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + source_lang: typing.Optional[str] = OMIT, + target_lang: typing.Optional[str] = OMIT, + target_accent: typing.Optional[str] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + watermark: typing.Optional[bool] = OMIT, + start_time: typing.Optional[int] = OMIT, + end_time: typing.Optional[int] = OMIT, + highest_resolution: typing.Optional[bool] = OMIT, + drop_background_audio: typing.Optional[bool] = OMIT, + use_profanity_filter: typing.Optional[bool] = OMIT, + dubbing_studio: typing.Optional[bool] = OMIT, + disable_voice_cloning: typing.Optional[bool] = OMIT, + mode: typing.Optional[DubRequestMode] = OMIT, + csv_fps: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DoDubbingResponse: + """ + Dubs a provided audio or video file into given language. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + csv_file : typing.Optional[core.File] + See core.File for more documentation + + foreground_audio_file : typing.Optional[core.File] + See core.File for more documentation + + background_audio_file : typing.Optional[core.File] + See core.File for more documentation + + name : typing.Optional[str] + Name of the dubbing project. + + source_url : typing.Optional[str] + URL of the source video/audio file. + + source_lang : typing.Optional[str] + Source language. Expects a valid iso639-1 or iso639-3 language code. + + target_lang : typing.Optional[str] + The Target language to dub the content into. Expects a valid iso639-1 or iso639-3 language code. + + target_accent : typing.Optional[str] + [Experimental] An accent to apply when selecting voices from the library and to use to inform translation of the dialect to prefer. + + num_speakers : typing.Optional[int] + Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers + + watermark : typing.Optional[bool] + Whether to apply watermark to the output video. + + start_time : typing.Optional[int] + Start time of the source video/audio file. + + end_time : typing.Optional[int] + End time of the source video/audio file. + + highest_resolution : typing.Optional[bool] + Whether to use the highest resolution available. + + drop_background_audio : typing.Optional[bool] + An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. + + use_profanity_filter : typing.Optional[bool] + [BETA] Whether transcripts should have profanities censored with the words '[censored]' + + dubbing_studio : typing.Optional[bool] + Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. + + disable_voice_cloning : typing.Optional[bool] + Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. Voices used from the library will contribute towards a workspace's custom voices limit, and if there aren't enough available slots the dub will fail. Using this feature requires the caller to have the 'add_voice_from_voice_library' permission on their workspace to access new voices. + + mode : typing.Optional[DubRequestMode] + The mode in which to run this Dubbing job. Defaults to automatic, use manual if specifically providing a CSV transcript to use. Note that manual mode is experimental and production use is strongly discouraged. + + csv_fps : typing.Optional[float] + Frames per second to use when parsing a CSV file for dubbing. If not provided, FPS will be inferred from timecodes. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DoDubbingResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.create() + """ + _response = self._raw_client.create( + file=file, + csv_file=csv_file, + foreground_audio_file=foreground_audio_file, + background_audio_file=background_audio_file, + name=name, + source_url=source_url, + source_lang=source_lang, + target_lang=target_lang, + target_accent=target_accent, + num_speakers=num_speakers, + watermark=watermark, + start_time=start_time, + end_time=end_time, + highest_resolution=highest_resolution, + drop_background_audio=drop_background_audio, + use_profanity_filter=use_profanity_filter, + dubbing_studio=dubbing_studio, + disable_voice_cloning=disable_voice_cloning, + mode=mode, + csv_fps=csv_fps, + request_options=request_options, + ) + return _response.data + + def get( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingMetadataResponse: + """ + Returns metadata about a dubbing project, including whether it's still in progress or not + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingMetadataResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.get( + dubbing_id="dubbing_id", + ) + """ + _response = self._raw_client.get(dubbing_id, request_options=request_options) + return _response.data + + def delete( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteDubbingResponseModel: + """ + Deletes a dubbing project. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteDubbingResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.delete( + dubbing_id="dubbing_id", + ) + """ + _response = self._raw_client.delete(dubbing_id, request_options=request_options) + return _response.data + + @property + def project(self): + if self._project is None: + from .project.client import ProjectClient # noqa: E402 + + self._project = ProjectClient(client_wrapper=self._client_wrapper) + return self._project + + @property + def resource(self): + if self._resource is None: + from .resource.client import ResourceClient # noqa: E402 + + self._resource = ResourceClient(client_wrapper=self._client_wrapper) + return self._resource + + @property + def audio(self): + if self._audio is None: + from .audio.client import AudioClient # noqa: E402 + + self._audio = AudioClient(client_wrapper=self._client_wrapper) + return self._audio + + @property + def transcript(self): + if self._transcript is None: + from .transcript.client import TranscriptClient # noqa: E402 + + self._transcript = TranscriptClient(client_wrapper=self._client_wrapper) + return self._transcript + + @property + def transcripts(self): + if self._transcripts is None: + from .transcripts.client import TranscriptsClient # noqa: E402 + + self._transcripts = TranscriptsClient(client_wrapper=self._client_wrapper) + return self._transcripts + + +class AsyncDubbingClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawDubbingClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._project: typing.Optional[AsyncProjectClient] = None + self._resource: typing.Optional[AsyncResourceClient] = None + self._audio: typing.Optional[AsyncAudioClient] = None + self._transcript: typing.Optional[AsyncTranscriptClient] = None + self._transcripts: typing.Optional[AsyncTranscriptsClient] = None + + @property + def with_raw_response(self) -> AsyncRawDubbingClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawDubbingClient + """ + return self._raw_client + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + dubbing_status: typing.Optional[DubbingListRequestDubbingStatus] = None, + dubbing_statuses: typing.Optional[ + typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]] + ] = None, + dubbing_models: typing.Optional[ + typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]] + ] = None, + target_language_codes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + creation_sources: typing.Optional[ + typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]] + ] = None, + filter_by_creator: typing.Optional[DubbingListRequestFilterByCreator] = None, + order_by: typing.Optional[DubbingListRequestOrderBy] = None, + order_direction: typing.Optional[DubbingListRequestOrderDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingMetadataPageResponseModel: + """ + List the dubs you have access to. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many dubs to return at maximum. Can not exceed 200, defaults to 100. + + dubbing_status : typing.Optional[DubbingListRequestDubbingStatus] + What state the dub is currently in. + + dubbing_statuses : typing.Optional[typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]]] + Filter by dubbing status. + + dubbing_models : typing.Optional[typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]]] + Filter by dubbing model generation. + + target_language_codes : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter by target language code. + + creation_sources : typing.Optional[typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]]] + Filter by dubbing creation source. + + filter_by_creator : typing.Optional[DubbingListRequestFilterByCreator] + Filters who created the resources being listed, whether it was the user running the request or someone else that shared the resource with them. + + order_by : typing.Optional[DubbingListRequestOrderBy] + The field to use for ordering results from this query. + + order_direction : typing.Optional[DubbingListRequestOrderDirection] + The order direction to use for results from this query. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingMetadataPageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.list( + cursor="cursor", + page_size=1, + dubbing_status="dubbing", + dubbing_statuses=["queued"], + dubbing_models=["dubbing_v1"], + target_language_codes=["target_language_codes"], + creation_sources=["flow_node"], + filter_by_creator="personal", + order_by="created_at", + order_direction="DESCENDING", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, + page_size=page_size, + dubbing_status=dubbing_status, + dubbing_statuses=dubbing_statuses, + dubbing_models=dubbing_models, + target_language_codes=target_language_codes, + creation_sources=creation_sources, + filter_by_creator=filter_by_creator, + order_by=order_by, + order_direction=order_direction, + request_options=request_options, + ) + return _response.data + + async def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + csv_file: typing.Optional[core.File] = OMIT, + foreground_audio_file: typing.Optional[core.File] = OMIT, + background_audio_file: typing.Optional[core.File] = OMIT, + name: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + source_lang: typing.Optional[str] = OMIT, + target_lang: typing.Optional[str] = OMIT, + target_accent: typing.Optional[str] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + watermark: typing.Optional[bool] = OMIT, + start_time: typing.Optional[int] = OMIT, + end_time: typing.Optional[int] = OMIT, + highest_resolution: typing.Optional[bool] = OMIT, + drop_background_audio: typing.Optional[bool] = OMIT, + use_profanity_filter: typing.Optional[bool] = OMIT, + dubbing_studio: typing.Optional[bool] = OMIT, + disable_voice_cloning: typing.Optional[bool] = OMIT, + mode: typing.Optional[DubRequestMode] = OMIT, + csv_fps: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DoDubbingResponse: + """ + Dubs a provided audio or video file into given language. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + csv_file : typing.Optional[core.File] + See core.File for more documentation + + foreground_audio_file : typing.Optional[core.File] + See core.File for more documentation + + background_audio_file : typing.Optional[core.File] + See core.File for more documentation + + name : typing.Optional[str] + Name of the dubbing project. + + source_url : typing.Optional[str] + URL of the source video/audio file. + + source_lang : typing.Optional[str] + Source language. Expects a valid iso639-1 or iso639-3 language code. + + target_lang : typing.Optional[str] + The Target language to dub the content into. Expects a valid iso639-1 or iso639-3 language code. + + target_accent : typing.Optional[str] + [Experimental] An accent to apply when selecting voices from the library and to use to inform translation of the dialect to prefer. + + num_speakers : typing.Optional[int] + Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers + + watermark : typing.Optional[bool] + Whether to apply watermark to the output video. + + start_time : typing.Optional[int] + Start time of the source video/audio file. + + end_time : typing.Optional[int] + End time of the source video/audio file. + + highest_resolution : typing.Optional[bool] + Whether to use the highest resolution available. + + drop_background_audio : typing.Optional[bool] + An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. + + use_profanity_filter : typing.Optional[bool] + [BETA] Whether transcripts should have profanities censored with the words '[censored]' + + dubbing_studio : typing.Optional[bool] + Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. + + disable_voice_cloning : typing.Optional[bool] + Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. Voices used from the library will contribute towards a workspace's custom voices limit, and if there aren't enough available slots the dub will fail. Using this feature requires the caller to have the 'add_voice_from_voice_library' permission on their workspace to access new voices. + + mode : typing.Optional[DubRequestMode] + The mode in which to run this Dubbing job. Defaults to automatic, use manual if specifically providing a CSV transcript to use. Note that manual mode is experimental and production use is strongly discouraged. + + csv_fps : typing.Optional[float] + Frames per second to use when parsing a CSV file for dubbing. If not provided, FPS will be inferred from timecodes. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DoDubbingResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.create() + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + file=file, + csv_file=csv_file, + foreground_audio_file=foreground_audio_file, + background_audio_file=background_audio_file, + name=name, + source_url=source_url, + source_lang=source_lang, + target_lang=target_lang, + target_accent=target_accent, + num_speakers=num_speakers, + watermark=watermark, + start_time=start_time, + end_time=end_time, + highest_resolution=highest_resolution, + drop_background_audio=drop_background_audio, + use_profanity_filter=use_profanity_filter, + dubbing_studio=dubbing_studio, + disable_voice_cloning=disable_voice_cloning, + mode=mode, + csv_fps=csv_fps, + request_options=request_options, + ) + return _response.data + + async def get( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingMetadataResponse: + """ + Returns metadata about a dubbing project, including whether it's still in progress or not + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingMetadataResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.get( + dubbing_id="dubbing_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(dubbing_id, request_options=request_options) + return _response.data + + async def delete( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteDubbingResponseModel: + """ + Deletes a dubbing project. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteDubbingResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.delete( + dubbing_id="dubbing_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(dubbing_id, request_options=request_options) + return _response.data + + @property + def project(self): + if self._project is None: + from .project.client import AsyncProjectClient # noqa: E402 + + self._project = AsyncProjectClient(client_wrapper=self._client_wrapper) + return self._project + + @property + def resource(self): + if self._resource is None: + from .resource.client import AsyncResourceClient # noqa: E402 + + self._resource = AsyncResourceClient(client_wrapper=self._client_wrapper) + return self._resource + + @property + def audio(self): + if self._audio is None: + from .audio.client import AsyncAudioClient # noqa: E402 + + self._audio = AsyncAudioClient(client_wrapper=self._client_wrapper) + return self._audio + + @property + def transcript(self): + if self._transcript is None: + from .transcript.client import AsyncTranscriptClient # noqa: E402 + + self._transcript = AsyncTranscriptClient(client_wrapper=self._client_wrapper) + return self._transcript + + @property + def transcripts(self): + if self._transcripts is None: + from .transcripts.client import AsyncTranscriptsClient # noqa: E402 + + self._transcripts = AsyncTranscriptsClient(client_wrapper=self._client_wrapper) + return self._transcripts diff --git a/data/src/elevenlabs/dubbing/project/__init__.py b/data/src/elevenlabs/dubbing/project/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..832fadbbba0d324b5e78f21b403df1353babe178 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/__init__.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ProjectCreateRequestModelId, ProjectListRequestSortDirection + from . import language, transcript +_dynamic_imports: typing.Dict[str, str] = { + "ProjectCreateRequestModelId": ".types", + "ProjectListRequestSortDirection": ".types", + "language": ".language", + "transcript": ".transcript", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ProjectCreateRequestModelId", "ProjectListRequestSortDirection", "language", "transcript"] diff --git a/data/src/elevenlabs/dubbing/project/client.py b/data/src/elevenlabs/dubbing/project/client.py new file mode 100644 index 0000000000000000000000000000000000000000..69c47cd7d8bab3b2df909683105ab3fcc13ddef7 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/client.py @@ -0,0 +1,530 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ... import core +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.dubbing_project_list_response import DubbingProjectListResponse +from ...types.dubbing_project_response import DubbingProjectResponse +from .raw_client import AsyncRawProjectClient, RawProjectClient +from .types.project_create_request_model_id import ProjectCreateRequestModelId +from .types.project_list_request_sort_direction import ProjectListRequestSortDirection + +if typing.TYPE_CHECKING: + from .language.client import AsyncLanguageClient, LanguageClient + from .transcript.client import AsyncTranscriptClient, TranscriptClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ProjectClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawProjectClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._language: typing.Optional[LanguageClient] = None + self._transcript: typing.Optional[TranscriptClient] = None + + @property + def with_raw_response(self) -> RawProjectClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawProjectClient + """ + return self._raw_client + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + sort_direction: typing.Optional[ProjectListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingProjectListResponse: + """ + List the dubbing projects in your workspace that you can access, newest first, cursor-paginated. Listed projects carry no `language_ids`; fetch a project, or list its language targets, to see them. + + Parameters + ---------- + cursor : typing.Optional[str] + Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + + page_size : typing.Optional[int] + Number of projects per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + + status : typing.Optional[str] + Filter to projects in this status: `queued`, `preparing`, `ready`, or `failed`. Omit to return every status. + + sort_direction : typing.Optional[ProjectListRequestSortDirection] + Sort by creation time; newest first by default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingProjectListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.list( + page_size=20, + ) + """ + _response = self._raw_client.list( + cursor=cursor, + page_size=page_size, + status=status, + sort_direction=sort_direction, + request_options=request_options, + ) + return _response.data + + def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + source_url: typing.Optional[str] = OMIT, + reference: typing.Optional[str] = OMIT, + source_language: typing.Optional[str] = OMIT, + model_id: typing.Optional[ProjectCreateRequestModelId] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + webhook_ids: typing.Optional[typing.List[str]] = OMIT, + target_language: typing.Optional[str] = OMIT, + transcript: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingProjectResponse: + """ + Create a dubbing project from an uploaded file (`file`) or a source URL (`source_url`). + + Returns as soon as the project record exists, before the source has been fetched: the project starts `queued` and reaches `ready` once its source has been transcribed. Add a language target to it for each language you want, or pass `target_language` to queue the first one here. + + Creating a project incurs a minimum charge of one language: you are charged for at least one language's dubbing when the project is created, before any output exists. This charge prepays the first language target — the first target you add, or the one queued via `target_language`, consumes it — and each additional language is charged separately. + + Preparation can take minutes on a long source, so we recommend passing `webhook_ids` to be notified when the project turns `ready` or `failed`, rather than polling for it. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + source_url : typing.Optional[str] + Public HTTP(S) URL the source media is fetched from server-side, subject to the same size and format limits as an upload. Provide this or `file`, not both. + + reference : typing.Optional[str] + Optional free-form string (at most 500 characters) to identify the project on your end. Stored and echoed back verbatim; it does not affect the dub. + + source_language : typing.Optional[str] + BCP-47 language tag of the source media; must be a language the transcription model supports. Any region or script subtag is ignored, since transcription is per-language. Omit to auto-detect. + + model_id : typing.Optional[ProjectCreateRequestModelId] + Dubbing model (`dubbing_v1` or `dubbing_v2`) every language target of this project is dubbed with. Defaults to `dubbing_v2`. Fixed at create time — the source is prepared for this model, so neither the project nor an individual target can change it later. + + keyterms : typing.Optional[typing.List[str]] + Key terms to bias transcription and translation toward (for example, product or brand names). At most 1,000 terms; each term at most 50 characters and 5 words; the characters `<>{}[]\\` are not allowed. Terms are trimmed and deduplicated. Repeat the field once per term, or pass a single JSON array. + + webhook_ids : typing.Optional[typing.List[str]] + IDs of workspace webhooks to notify as this project progresses — the alternative to polling, and what we recommend. Each receives a `dubbing_project_ready` or `dubbing_project_failed` event for the project, and a `dubbing_language_completed` or `dubbing_language_failed` event for every language under it; `dubbing_language_completed` carries the output download URLs. At most 3 IDs, each already configured in your workspace — see [Webhooks](https://elevenlabs.io/docs/eleven-api/resources/webhooks) for how to create one and verify its signature. Repeat the field once per ID, or pass a single JSON array or comma-separated string. Delivery is best-effort and can repeat, so we recommend handling events idempotently. + + target_language : typing.Optional[str] + Optional shortcut: also create a language target in this BCP-47 language, queued to start once the project is ready — equivalent to creating the project and then creating one language target. Must be one of the [languages the dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. This is the first language target, so it consumes the project's minimum charge rather than adding to it. Its ID is returned in `language_ids`. + + transcript : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingProjectResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.create( + source_url="https://example.com/promo.mp4", + source_language="en", + reference="Q3 marketing video", + ) + """ + _response = self._raw_client.create( + file=file, + source_url=source_url, + reference=reference, + source_language=source_language, + model_id=model_id, + keyterms=keyterms, + webhook_ids=webhook_ids, + target_language=target_language, + transcript=transcript, + request_options=request_options, + ) + return _response.data + + def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingProjectResponse: + """ + Full project detail, including the IDs of every language target under it. To follow a project to `ready`, we recommend a `webhook_ids` subscription rather than polling this endpoint. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingProjectResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + ) + """ + _response = self._raw_client.get(project_id, request_options=request_options) + return _response.data + + def delete(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a project, every language target under it, and their stored media and outputs. This cannot be undone, and a dub already running is still billed. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.delete( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + ) + """ + _response = self._raw_client.delete(project_id, request_options=request_options) + return _response.data + + @property + def language(self): + if self._language is None: + from .language.client import LanguageClient # noqa: E402 + + self._language = LanguageClient(client_wrapper=self._client_wrapper) + return self._language + + @property + def transcript(self): + if self._transcript is None: + from .transcript.client import TranscriptClient # noqa: E402 + + self._transcript = TranscriptClient(client_wrapper=self._client_wrapper) + return self._transcript + + +class AsyncProjectClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawProjectClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._language: typing.Optional[AsyncLanguageClient] = None + self._transcript: typing.Optional[AsyncTranscriptClient] = None + + @property + def with_raw_response(self) -> AsyncRawProjectClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawProjectClient + """ + return self._raw_client + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + sort_direction: typing.Optional[ProjectListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingProjectListResponse: + """ + List the dubbing projects in your workspace that you can access, newest first, cursor-paginated. Listed projects carry no `language_ids`; fetch a project, or list its language targets, to see them. + + Parameters + ---------- + cursor : typing.Optional[str] + Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + + page_size : typing.Optional[int] + Number of projects per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + + status : typing.Optional[str] + Filter to projects in this status: `queued`, `preparing`, `ready`, or `failed`. Omit to return every status. + + sort_direction : typing.Optional[ProjectListRequestSortDirection] + Sort by creation time; newest first by default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingProjectListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.list( + page_size=20, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, + page_size=page_size, + status=status, + sort_direction=sort_direction, + request_options=request_options, + ) + return _response.data + + async def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + source_url: typing.Optional[str] = OMIT, + reference: typing.Optional[str] = OMIT, + source_language: typing.Optional[str] = OMIT, + model_id: typing.Optional[ProjectCreateRequestModelId] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + webhook_ids: typing.Optional[typing.List[str]] = OMIT, + target_language: typing.Optional[str] = OMIT, + transcript: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingProjectResponse: + """ + Create a dubbing project from an uploaded file (`file`) or a source URL (`source_url`). + + Returns as soon as the project record exists, before the source has been fetched: the project starts `queued` and reaches `ready` once its source has been transcribed. Add a language target to it for each language you want, or pass `target_language` to queue the first one here. + + Creating a project incurs a minimum charge of one language: you are charged for at least one language's dubbing when the project is created, before any output exists. This charge prepays the first language target — the first target you add, or the one queued via `target_language`, consumes it — and each additional language is charged separately. + + Preparation can take minutes on a long source, so we recommend passing `webhook_ids` to be notified when the project turns `ready` or `failed`, rather than polling for it. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + source_url : typing.Optional[str] + Public HTTP(S) URL the source media is fetched from server-side, subject to the same size and format limits as an upload. Provide this or `file`, not both. + + reference : typing.Optional[str] + Optional free-form string (at most 500 characters) to identify the project on your end. Stored and echoed back verbatim; it does not affect the dub. + + source_language : typing.Optional[str] + BCP-47 language tag of the source media; must be a language the transcription model supports. Any region or script subtag is ignored, since transcription is per-language. Omit to auto-detect. + + model_id : typing.Optional[ProjectCreateRequestModelId] + Dubbing model (`dubbing_v1` or `dubbing_v2`) every language target of this project is dubbed with. Defaults to `dubbing_v2`. Fixed at create time — the source is prepared for this model, so neither the project nor an individual target can change it later. + + keyterms : typing.Optional[typing.List[str]] + Key terms to bias transcription and translation toward (for example, product or brand names). At most 1,000 terms; each term at most 50 characters and 5 words; the characters `<>{}[]\\` are not allowed. Terms are trimmed and deduplicated. Repeat the field once per term, or pass a single JSON array. + + webhook_ids : typing.Optional[typing.List[str]] + IDs of workspace webhooks to notify as this project progresses — the alternative to polling, and what we recommend. Each receives a `dubbing_project_ready` or `dubbing_project_failed` event for the project, and a `dubbing_language_completed` or `dubbing_language_failed` event for every language under it; `dubbing_language_completed` carries the output download URLs. At most 3 IDs, each already configured in your workspace — see [Webhooks](https://elevenlabs.io/docs/eleven-api/resources/webhooks) for how to create one and verify its signature. Repeat the field once per ID, or pass a single JSON array or comma-separated string. Delivery is best-effort and can repeat, so we recommend handling events idempotently. + + target_language : typing.Optional[str] + Optional shortcut: also create a language target in this BCP-47 language, queued to start once the project is ready — equivalent to creating the project and then creating one language target. Must be one of the [languages the dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. This is the first language target, so it consumes the project's minimum charge rather than adding to it. Its ID is returned in `language_ids`. + + transcript : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingProjectResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.create( + source_url="https://example.com/promo.mp4", + source_language="en", + reference="Q3 marketing video", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + file=file, + source_url=source_url, + reference=reference, + source_language=source_language, + model_id=model_id, + keyterms=keyterms, + webhook_ids=webhook_ids, + target_language=target_language, + transcript=transcript, + request_options=request_options, + ) + return _response.data + + async def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingProjectResponse: + """ + Full project detail, including the IDs of every language target under it. To follow a project to `ready`, we recommend a `webhook_ids` subscription rather than polling this endpoint. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingProjectResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(project_id, request_options=request_options) + return _response.data + + async def delete(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a project, every language target under it, and their stored media and outputs. This cannot be undone, and a dub already running is still billed. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.delete( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(project_id, request_options=request_options) + return _response.data + + @property + def language(self): + if self._language is None: + from .language.client import AsyncLanguageClient # noqa: E402 + + self._language = AsyncLanguageClient(client_wrapper=self._client_wrapper) + return self._language + + @property + def transcript(self): + if self._transcript is None: + from .transcript.client import AsyncTranscriptClient # noqa: E402 + + self._transcript = AsyncTranscriptClient(client_wrapper=self._client_wrapper) + return self._transcript diff --git a/data/src/elevenlabs/dubbing/project/language/__init__.py b/data/src/elevenlabs/dubbing/project/language/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bc91e07c9de2dc7fffabf4c21589eef75468d4ce --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/language/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import transcript +_dynamic_imports: typing.Dict[str, str] = {"transcript": ".transcript"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["transcript"] diff --git a/data/src/elevenlabs/dubbing/project/language/client.py b/data/src/elevenlabs/dubbing/project/language/client.py new file mode 100644 index 0000000000000000000000000000000000000000..43ab0163799e5077f6c5ecdf417a64f2127d0cc5 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/language/client.py @@ -0,0 +1,467 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.dubbing_language_list_response import DubbingLanguageListResponse +from ....types.dubbing_language_response import DubbingLanguageResponse +from ....types.voice_settings import VoiceSettings +from .raw_client import AsyncRawLanguageClient, RawLanguageClient + +if typing.TYPE_CHECKING: + from .transcript.client import AsyncTranscriptClient, TranscriptClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class LanguageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLanguageClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._transcript: typing.Optional[TranscriptClient] = None + + @property + def with_raw_response(self) -> RawLanguageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLanguageClient + """ + return self._raw_client + + def list( + self, + project_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingLanguageListResponse: + """ + List a project's language targets, cursor-paginated, each with signed output URLs once it has produced an output. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + cursor : typing.Optional[str] + Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + + page_size : typing.Optional[int] + Number of language targets per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + + status : typing.Optional[str] + Filter to targets in this status: `queued`, `processing`, `completed`, `stale`, or `failed`. Omit to return every status. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingLanguageListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.language.list( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + page_size=20, + ) + """ + _response = self._raw_client.list( + project_id, cursor=cursor, page_size=page_size, status=status, request_options=request_options + ) + return _response.data + + def create( + self, + project_id: str, + *, + target_language: str, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingLanguageResponse: + """ + Add a language to dub a project into, and queue the dub. + + This is the call that produces dubbed audio, and it is billed per generation. The target is created `queued` and starts as soon as the project is `ready`, so it can be added at any point after the project is created. It inherits the project's dubbing model and cannot pick another. + + A project created with `webhook_ids` sends a `dubbing_language_completed` event carrying the output download URLs, so we recommend subscribing rather than polling this target to completion. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + target_language : str + BCP-47 language tag to dub the project into (for example, `fr` or `es-MX`). Must be one of the [languages the project's dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings applied to every speaker in this language. Omit to use the defaults. + + translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Enterprise only. Optional translations to use instead of machine translation. A map from each source segment's `external_id` (or its `id`, if you supplied none) to the translated text; every source segment must be covered exactly once. At most 20,000 entries, totaling at most 4 MiB of text. See [Bring your own transcript](https://elevenlabs.io/docs/eleven-api/guides/how-to/dubbing/bring-your-own-transcript). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingLanguageResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.language.create( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + target_language="es", + ) + """ + _response = self._raw_client.create( + project_id, + target_language=target_language, + voice_settings=voice_settings, + translations=translations, + request_options=request_options, + ) + return _response.data + + def get( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingLanguageResponse: + """ + Full language-target detail. Once the target reports `completed`, `outputs` carries the signed download URLs. To learn when that happens, we recommend the project's `webhook_ids` subscription rather than polling this endpoint; fetch here when a delivered URL has expired, or to reconcile after an edit. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + language_id : str + Identifier of the language target to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingLanguageResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.language.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + ) + """ + _response = self._raw_client.get(project_id, language_id, request_options=request_options) + return _response.data + + def delete( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Delete a language target and its outputs, leaving the project and its other languages intact. This cannot be undone, and a dub already running is still billed. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + language_id : str + Identifier of the language target to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.language.delete( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + ) + """ + _response = self._raw_client.delete(project_id, language_id, request_options=request_options) + return _response.data + + @property + def transcript(self): + if self._transcript is None: + from .transcript.client import TranscriptClient # noqa: E402 + + self._transcript = TranscriptClient(client_wrapper=self._client_wrapper) + return self._transcript + + +class AsyncLanguageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLanguageClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._transcript: typing.Optional[AsyncTranscriptClient] = None + + @property + def with_raw_response(self) -> AsyncRawLanguageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLanguageClient + """ + return self._raw_client + + async def list( + self, + project_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingLanguageListResponse: + """ + List a project's language targets, cursor-paginated, each with signed output URLs once it has produced an output. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + cursor : typing.Optional[str] + Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + + page_size : typing.Optional[int] + Number of language targets per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + + status : typing.Optional[str] + Filter to targets in this status: `queued`, `processing`, `completed`, `stale`, or `failed`. Omit to return every status. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingLanguageListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.language.list( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + page_size=20, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + project_id, cursor=cursor, page_size=page_size, status=status, request_options=request_options + ) + return _response.data + + async def create( + self, + project_id: str, + *, + target_language: str, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingLanguageResponse: + """ + Add a language to dub a project into, and queue the dub. + + This is the call that produces dubbed audio, and it is billed per generation. The target is created `queued` and starts as soon as the project is `ready`, so it can be added at any point after the project is created. It inherits the project's dubbing model and cannot pick another. + + A project created with `webhook_ids` sends a `dubbing_language_completed` event carrying the output download URLs, so we recommend subscribing rather than polling this target to completion. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + target_language : str + BCP-47 language tag to dub the project into (for example, `fr` or `es-MX`). Must be one of the [languages the project's dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings applied to every speaker in this language. Omit to use the defaults. + + translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Enterprise only. Optional translations to use instead of machine translation. A map from each source segment's `external_id` (or its `id`, if you supplied none) to the translated text; every source segment must be covered exactly once. At most 20,000 entries, totaling at most 4 MiB of text. See [Bring your own transcript](https://elevenlabs.io/docs/eleven-api/guides/how-to/dubbing/bring-your-own-transcript). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingLanguageResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.language.create( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + target_language="es", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + project_id, + target_language=target_language, + voice_settings=voice_settings, + translations=translations, + request_options=request_options, + ) + return _response.data + + async def get( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingLanguageResponse: + """ + Full language-target detail. Once the target reports `completed`, `outputs` carries the signed download URLs. To learn when that happens, we recommend the project's `webhook_ids` subscription rather than polling this endpoint; fetch here when a delivered URL has expired, or to reconcile after an edit. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + language_id : str + Identifier of the language target to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingLanguageResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.language.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(project_id, language_id, request_options=request_options) + return _response.data + + async def delete( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Delete a language target and its outputs, leaving the project and its other languages intact. This cannot be undone, and a dub already running is still billed. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + language_id : str + Identifier of the language target to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.language.delete( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(project_id, language_id, request_options=request_options) + return _response.data + + @property + def transcript(self): + if self._transcript is None: + from .transcript.client import AsyncTranscriptClient # noqa: E402 + + self._transcript = AsyncTranscriptClient(client_wrapper=self._client_wrapper) + return self._transcript diff --git a/data/src/elevenlabs/dubbing/project/language/raw_client.py b/data/src/elevenlabs/dubbing/project/language/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..7a832fc0301181720bfa2931012638744e063e5c --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/language/raw_client.py @@ -0,0 +1,559 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.dubbing_language_list_response import DubbingLanguageListResponse +from ....types.dubbing_language_response import DubbingLanguageResponse +from ....types.voice_settings import VoiceSettings +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawLanguageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + project_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingLanguageListResponse]: + """ + List a project's language targets, cursor-paginated, each with signed output URLs once it has produced an output. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + cursor : typing.Optional[str] + Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + + page_size : typing.Optional[int] + Number of language targets per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + + status : typing.Optional[str] + Filter to targets in this status: `queued`, `processing`, `completed`, `stale`, or `failed`. Omit to return every status. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingLanguageListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingLanguageListResponse, + construct_type( + type_=DubbingLanguageListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + project_id: str, + *, + target_language: str, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingLanguageResponse]: + """ + Add a language to dub a project into, and queue the dub. + + This is the call that produces dubbed audio, and it is billed per generation. The target is created `queued` and starts as soon as the project is `ready`, so it can be added at any point after the project is created. It inherits the project's dubbing model and cannot pick another. + + A project created with `webhook_ids` sends a `dubbing_language_completed` event carrying the output download URLs, so we recommend subscribing rather than polling this target to completion. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + target_language : str + BCP-47 language tag to dub the project into (for example, `fr` or `es-MX`). Must be one of the [languages the project's dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings applied to every speaker in this language. Omit to use the defaults. + + translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Enterprise only. Optional translations to use instead of machine translation. A map from each source segment's `external_id` (or its `id`, if you supplied none) to the translated text; every source segment must be covered exactly once. At most 20,000 entries, totaling at most 4 MiB of text. See [Bring your own transcript](https://elevenlabs.io/docs/eleven-api/guides/how-to/dubbing/bring-your-own-transcript). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingLanguageResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language", + method="POST", + json={ + "target_language": target_language, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "translations": translations, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingLanguageResponse, + construct_type( + type_=DubbingLanguageResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingLanguageResponse]: + """ + Full language-target detail. Once the target reports `completed`, `outputs` carries the signed download URLs. To learn when that happens, we recommend the project's `webhook_ids` subscription rather than polling this endpoint; fetch here when a delivered URL has expired, or to reconcile after an edit. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + language_id : str + Identifier of the language target to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingLanguageResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingLanguageResponse, + construct_type( + type_=DubbingLanguageResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Delete a language target and its outputs, leaving the project and its other languages intact. This cannot be undone, and a dub already running is still billed. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + language_id : str + Identifier of the language target to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLanguageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + project_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingLanguageListResponse]: + """ + List a project's language targets, cursor-paginated, each with signed output URLs once it has produced an output. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + cursor : typing.Optional[str] + Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + + page_size : typing.Optional[int] + Number of language targets per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + + status : typing.Optional[str] + Filter to targets in this status: `queued`, `processing`, `completed`, `stale`, or `failed`. Omit to return every status. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingLanguageListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingLanguageListResponse, + construct_type( + type_=DubbingLanguageListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + project_id: str, + *, + target_language: str, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingLanguageResponse]: + """ + Add a language to dub a project into, and queue the dub. + + This is the call that produces dubbed audio, and it is billed per generation. The target is created `queued` and starts as soon as the project is `ready`, so it can be added at any point after the project is created. It inherits the project's dubbing model and cannot pick another. + + A project created with `webhook_ids` sends a `dubbing_language_completed` event carrying the output download URLs, so we recommend subscribing rather than polling this target to completion. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + target_language : str + BCP-47 language tag to dub the project into (for example, `fr` or `es-MX`). Must be one of the [languages the project's dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings applied to every speaker in this language. Omit to use the defaults. + + translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Enterprise only. Optional translations to use instead of machine translation. A map from each source segment's `external_id` (or its `id`, if you supplied none) to the translated text; every source segment must be covered exactly once. At most 20,000 entries, totaling at most 4 MiB of text. See [Bring your own transcript](https://elevenlabs.io/docs/eleven-api/guides/how-to/dubbing/bring-your-own-transcript). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingLanguageResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language", + method="POST", + json={ + "target_language": target_language, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "translations": translations, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingLanguageResponse, + construct_type( + type_=DubbingLanguageResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingLanguageResponse]: + """ + Full language-target detail. Once the target reports `completed`, `outputs` carries the signed download URLs. To learn when that happens, we recommend the project's `webhook_ids` subscription rather than polling this endpoint; fetch here when a delivered URL has expired, or to reconcile after an edit. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + language_id : str + Identifier of the language target to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingLanguageResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingLanguageResponse, + construct_type( + type_=DubbingLanguageResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete a language target and its outputs, leaving the project and its other languages intact. This cannot be undone, and a dub already running is still billed. + + Parameters + ---------- + project_id : str + Identifier of the parent dubbing project. + + language_id : str + Identifier of the language target to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/project/language/transcript/__init__.py b/data/src/elevenlabs/dubbing/project/language/transcript/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/language/transcript/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/dubbing/project/language/transcript/client.py b/data/src/elevenlabs/dubbing/project/language/transcript/client.py new file mode 100644 index 0000000000000000000000000000000000000000..942ce8aaaf4bf4297ddbf0a7436f1c0fd0b59f25 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/language/transcript/client.py @@ -0,0 +1,445 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.dubbing_bulk_target_segment_update_response import DubbingBulkTargetSegmentUpdateResponse +from .....types.dubbing_regenerate_response import DubbingRegenerateResponse +from .....types.dubbing_target_segment_update_request import DubbingTargetSegmentUpdateRequest +from .....types.dubbing_target_segment_update_response import DubbingTargetSegmentUpdateResponse +from .....types.dubbing_target_transcript_response import DubbingTargetTranscriptResponse +from .raw_client import AsyncRawTranscriptClient, RawTranscriptClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TranscriptClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTranscriptClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTranscriptClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTranscriptClient + """ + return self._raw_client + + def get( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingTargetTranscriptResponse: + """ + A language target's transcript: source segments with their translations. Available once the target has produced an output. Returns a conflict while the target is still on its first dub, since it has no translations to return yet. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingTargetTranscriptResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.language.transcript.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + ) + """ + _response = self._raw_client.get(project_id, language_id, request_options=request_options) + return _response.data + + def update_segment( + self, + project_id: str, + language_id: str, + segment_id: str, + *, + request: DubbingTargetSegmentUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingTargetSegmentUpdateResponse: + """ + Enterprise only. Edit a segment's translation for a language target. Omitted fields are left unchanged; an explicit null clears the field. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + segment_id : str + Identifier of the segment to edit. + + request : DubbingTargetSegmentUpdateRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingTargetSegmentUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import DubbingTargetSegmentUpdateRequest, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.language.transcript.update_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", + request=DubbingTargetSegmentUpdateRequest( + translation="Bienvenido a nuestra última demostración de producto.", + ), + ) + """ + _response = self._raw_client.update_segment( + project_id, language_id, segment_id, request=request, request_options=request_options + ) + return _response.data + + def update_segments( + self, + project_id: str, + language_id: str, + *, + segments: typing.Dict[str, DubbingTargetSegmentUpdateRequest], + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingBulkTargetSegmentUpdateResponse: + """ + Enterprise only. Edit several segments' translations for a language target in one atomic request: every edit applies or none does. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + segments : typing.Dict[str, DubbingTargetSegmentUpdateRequest] + Map of segment ID to the translation edit to apply to that segment. At least one entry and at most 500. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingBulkTargetSegmentUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import DubbingTargetSegmentUpdateRequest, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.language.transcript.update_segments( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + segments={ + "0199a3f0-1c2d-7abc-8def-0123456789ab": DubbingTargetSegmentUpdateRequest( + translation="Bienvenido a nuestra última demostración de producto.", + ), + "0199a3f0-3e4f-7abc-8def-0123456789cd": DubbingTargetSegmentUpdateRequest( + translation="Empecemos.", + ), + }, + ) + """ + _response = self._raw_client.update_segments( + project_id, language_id, segments=segments, request_options=request_options + ) + return _response.data + + def regenerate( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingRegenerateResponse: + """ + Enterprise only. Re-dub a target from its edited transcript, re-synthesizing only the edited regions (charged like a generation, less the free-regeneration allowance). Accepted asynchronously: the target returns to `processing` and sends a `dubbing_language_completed` event to the project's `webhook_ids` when the re-dub lands, carrying the new output URLs. Returns a conflict when the target has no edits to apply — nothing is dispatched and nothing is charged. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingRegenerateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.language.transcript.regenerate( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + ) + """ + _response = self._raw_client.regenerate(project_id, language_id, request_options=request_options) + return _response.data + + +class AsyncTranscriptClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTranscriptClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTranscriptClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTranscriptClient + """ + return self._raw_client + + async def get( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingTargetTranscriptResponse: + """ + A language target's transcript: source segments with their translations. Available once the target has produced an output. Returns a conflict while the target is still on its first dub, since it has no translations to return yet. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingTargetTranscriptResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.language.transcript.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(project_id, language_id, request_options=request_options) + return _response.data + + async def update_segment( + self, + project_id: str, + language_id: str, + segment_id: str, + *, + request: DubbingTargetSegmentUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingTargetSegmentUpdateResponse: + """ + Enterprise only. Edit a segment's translation for a language target. Omitted fields are left unchanged; an explicit null clears the field. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + segment_id : str + Identifier of the segment to edit. + + request : DubbingTargetSegmentUpdateRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingTargetSegmentUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, DubbingTargetSegmentUpdateRequest + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.language.transcript.update_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", + request=DubbingTargetSegmentUpdateRequest( + translation="Bienvenido a nuestra última demostración de producto.", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_segment( + project_id, language_id, segment_id, request=request, request_options=request_options + ) + return _response.data + + async def update_segments( + self, + project_id: str, + language_id: str, + *, + segments: typing.Dict[str, DubbingTargetSegmentUpdateRequest], + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingBulkTargetSegmentUpdateResponse: + """ + Enterprise only. Edit several segments' translations for a language target in one atomic request: every edit applies or none does. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + segments : typing.Dict[str, DubbingTargetSegmentUpdateRequest] + Map of segment ID to the translation edit to apply to that segment. At least one entry and at most 500. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingBulkTargetSegmentUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, DubbingTargetSegmentUpdateRequest + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.language.transcript.update_segments( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + segments={ + "0199a3f0-1c2d-7abc-8def-0123456789ab": DubbingTargetSegmentUpdateRequest( + translation="Bienvenido a nuestra última demostración de producto.", + ), + "0199a3f0-3e4f-7abc-8def-0123456789cd": DubbingTargetSegmentUpdateRequest( + translation="Empecemos.", + ), + }, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_segments( + project_id, language_id, segments=segments, request_options=request_options + ) + return _response.data + + async def regenerate( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingRegenerateResponse: + """ + Enterprise only. Re-dub a target from its edited transcript, re-synthesizing only the edited regions (charged like a generation, less the free-regeneration allowance). Accepted asynchronously: the target returns to `processing` and sends a `dubbing_language_completed` event to the project's `webhook_ids` when the re-dub lands, carrying the new output URLs. Returns a conflict when the target has no edits to apply — nothing is dispatched and nothing is charged. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingRegenerateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.language.transcript.regenerate( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + language_id="lang_1001kwkyxp0je6ktn4knsfrasx5s", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.regenerate(project_id, language_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/dubbing/project/language/transcript/raw_client.py b/data/src/elevenlabs/dubbing/project/language/transcript/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..edc06ae262e36917d13becf2548680b0c2cb8d3a --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/language/transcript/raw_client.py @@ -0,0 +1,559 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.serialization import convert_and_respect_annotation_metadata +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.dubbing_bulk_target_segment_update_response import DubbingBulkTargetSegmentUpdateResponse +from .....types.dubbing_regenerate_response import DubbingRegenerateResponse +from .....types.dubbing_target_segment_update_request import DubbingTargetSegmentUpdateRequest +from .....types.dubbing_target_segment_update_response import DubbingTargetSegmentUpdateResponse +from .....types.dubbing_target_transcript_response import DubbingTargetTranscriptResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTranscriptClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingTargetTranscriptResponse]: + """ + A language target's transcript: source segments with their translations. Available once the target has produced an output. Returns a conflict while the target is still on its first dub, since it has no translations to return yet. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingTargetTranscriptResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}/transcript", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingTargetTranscriptResponse, + construct_type( + type_=DubbingTargetTranscriptResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_segment( + self, + project_id: str, + language_id: str, + segment_id: str, + *, + request: DubbingTargetSegmentUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingTargetSegmentUpdateResponse]: + """ + Enterprise only. Edit a segment's translation for a language target. Omitted fields are left unchanged; an explicit null clears the field. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + segment_id : str + Identifier of the segment to edit. + + request : DubbingTargetSegmentUpdateRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingTargetSegmentUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}/transcript/segment/{jsonable_encoder(segment_id)}", + method="PATCH", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=DubbingTargetSegmentUpdateRequest, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingTargetSegmentUpdateResponse, + construct_type( + type_=DubbingTargetSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_segments( + self, + project_id: str, + language_id: str, + *, + segments: typing.Dict[str, DubbingTargetSegmentUpdateRequest], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingBulkTargetSegmentUpdateResponse]: + """ + Enterprise only. Edit several segments' translations for a language target in one atomic request: every edit applies or none does. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + segments : typing.Dict[str, DubbingTargetSegmentUpdateRequest] + Map of segment ID to the translation edit to apply to that segment. At least one entry and at most 500. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingBulkTargetSegmentUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}/transcript/segments", + method="PATCH", + json={ + "segments": convert_and_respect_annotation_metadata( + object_=segments, annotation=typing.Dict[str, DubbingTargetSegmentUpdateRequest], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingBulkTargetSegmentUpdateResponse, + construct_type( + type_=DubbingBulkTargetSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def regenerate( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingRegenerateResponse]: + """ + Enterprise only. Re-dub a target from its edited transcript, re-synthesizing only the edited regions (charged like a generation, less the free-regeneration allowance). Accepted asynchronously: the target returns to `processing` and sends a `dubbing_language_completed` event to the project's `webhook_ids` when the re-dub lands, carrying the new output URLs. Returns a conflict when the target has no edits to apply — nothing is dispatched and nothing is charged. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingRegenerateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}/transcript/regenerate", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingRegenerateResponse, + construct_type( + type_=DubbingRegenerateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTranscriptClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingTargetTranscriptResponse]: + """ + A language target's transcript: source segments with their translations. Available once the target has produced an output. Returns a conflict while the target is still on its first dub, since it has no translations to return yet. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingTargetTranscriptResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}/transcript", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingTargetTranscriptResponse, + construct_type( + type_=DubbingTargetTranscriptResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_segment( + self, + project_id: str, + language_id: str, + segment_id: str, + *, + request: DubbingTargetSegmentUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingTargetSegmentUpdateResponse]: + """ + Enterprise only. Edit a segment's translation for a language target. Omitted fields are left unchanged; an explicit null clears the field. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + segment_id : str + Identifier of the segment to edit. + + request : DubbingTargetSegmentUpdateRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingTargetSegmentUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}/transcript/segment/{jsonable_encoder(segment_id)}", + method="PATCH", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=DubbingTargetSegmentUpdateRequest, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingTargetSegmentUpdateResponse, + construct_type( + type_=DubbingTargetSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_segments( + self, + project_id: str, + language_id: str, + *, + segments: typing.Dict[str, DubbingTargetSegmentUpdateRequest], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingBulkTargetSegmentUpdateResponse]: + """ + Enterprise only. Edit several segments' translations for a language target in one atomic request: every edit applies or none does. Bumps the target's `revision` and marks it `stale` if it had already completed. The source transcript and the project's other languages are untouched, and no audio changes until you regenerate the target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + segments : typing.Dict[str, DubbingTargetSegmentUpdateRequest] + Map of segment ID to the translation edit to apply to that segment. At least one entry and at most 500. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingBulkTargetSegmentUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}/transcript/segments", + method="PATCH", + json={ + "segments": convert_and_respect_annotation_metadata( + object_=segments, annotation=typing.Dict[str, DubbingTargetSegmentUpdateRequest], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingBulkTargetSegmentUpdateResponse, + construct_type( + type_=DubbingBulkTargetSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def regenerate( + self, project_id: str, language_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingRegenerateResponse]: + """ + Enterprise only. Re-dub a target from its edited transcript, re-synthesizing only the edited regions (charged like a generation, less the free-regeneration allowance). Accepted asynchronously: the target returns to `processing` and sends a `dubbing_language_completed` event to the project's `webhook_ids` when the re-dub lands, carrying the new output URLs. Returns a conflict when the target has no edits to apply — nothing is dispatched and nothing is charged. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + language_id : str + Identifier of the language target. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingRegenerateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/language/{jsonable_encoder(language_id)}/transcript/regenerate", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingRegenerateResponse, + construct_type( + type_=DubbingRegenerateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/project/raw_client.py b/data/src/elevenlabs/dubbing/project/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..786054674ae366534d59efe8d51cdf3bf9fb0db5 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/raw_client.py @@ -0,0 +1,600 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ... import core +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.dubbing_project_list_response import DubbingProjectListResponse +from ...types.dubbing_project_response import DubbingProjectResponse +from .types.project_create_request_model_id import ProjectCreateRequestModelId +from .types.project_list_request_sort_direction import ProjectListRequestSortDirection +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawProjectClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + sort_direction: typing.Optional[ProjectListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingProjectListResponse]: + """ + List the dubbing projects in your workspace that you can access, newest first, cursor-paginated. Listed projects carry no `language_ids`; fetch a project, or list its language targets, to see them. + + Parameters + ---------- + cursor : typing.Optional[str] + Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + + page_size : typing.Optional[int] + Number of projects per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + + status : typing.Optional[str] + Filter to projects in this status: `queued`, `preparing`, `ready`, or `failed`. Omit to return every status. + + sort_direction : typing.Optional[ProjectListRequestSortDirection] + Sort by creation time; newest first by default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingProjectListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/dubbing/project", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectListResponse, + construct_type( + type_=DubbingProjectListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + source_url: typing.Optional[str] = OMIT, + reference: typing.Optional[str] = OMIT, + source_language: typing.Optional[str] = OMIT, + model_id: typing.Optional[ProjectCreateRequestModelId] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + webhook_ids: typing.Optional[typing.List[str]] = OMIT, + target_language: typing.Optional[str] = OMIT, + transcript: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingProjectResponse]: + """ + Create a dubbing project from an uploaded file (`file`) or a source URL (`source_url`). + + Returns as soon as the project record exists, before the source has been fetched: the project starts `queued` and reaches `ready` once its source has been transcribed. Add a language target to it for each language you want, or pass `target_language` to queue the first one here. + + Creating a project incurs a minimum charge of one language: you are charged for at least one language's dubbing when the project is created, before any output exists. This charge prepays the first language target — the first target you add, or the one queued via `target_language`, consumes it — and each additional language is charged separately. + + Preparation can take minutes on a long source, so we recommend passing `webhook_ids` to be notified when the project turns `ready` or `failed`, rather than polling for it. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + source_url : typing.Optional[str] + Public HTTP(S) URL the source media is fetched from server-side, subject to the same size and format limits as an upload. Provide this or `file`, not both. + + reference : typing.Optional[str] + Optional free-form string (at most 500 characters) to identify the project on your end. Stored and echoed back verbatim; it does not affect the dub. + + source_language : typing.Optional[str] + BCP-47 language tag of the source media; must be a language the transcription model supports. Any region or script subtag is ignored, since transcription is per-language. Omit to auto-detect. + + model_id : typing.Optional[ProjectCreateRequestModelId] + Dubbing model (`dubbing_v1` or `dubbing_v2`) every language target of this project is dubbed with. Defaults to `dubbing_v2`. Fixed at create time — the source is prepared for this model, so neither the project nor an individual target can change it later. + + keyterms : typing.Optional[typing.List[str]] + Key terms to bias transcription and translation toward (for example, product or brand names). At most 1,000 terms; each term at most 50 characters and 5 words; the characters `<>{}[]\\` are not allowed. Terms are trimmed and deduplicated. Repeat the field once per term, or pass a single JSON array. + + webhook_ids : typing.Optional[typing.List[str]] + IDs of workspace webhooks to notify as this project progresses — the alternative to polling, and what we recommend. Each receives a `dubbing_project_ready` or `dubbing_project_failed` event for the project, and a `dubbing_language_completed` or `dubbing_language_failed` event for every language under it; `dubbing_language_completed` carries the output download URLs. At most 3 IDs, each already configured in your workspace — see [Webhooks](https://elevenlabs.io/docs/eleven-api/resources/webhooks) for how to create one and verify its signature. Repeat the field once per ID, or pass a single JSON array or comma-separated string. Delivery is best-effort and can repeat, so we recommend handling events idempotently. + + target_language : typing.Optional[str] + Optional shortcut: also create a language target in this BCP-47 language, queued to start once the project is ready — equivalent to creating the project and then creating one language target. Must be one of the [languages the dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. This is the first language target, so it consumes the project's minimum charge rather than adding to it. Its ID is returned in `language_ids`. + + transcript : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingProjectResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/dubbing/project", + method="POST", + data={ + "source_url": source_url, + "reference": reference, + "source_language": source_language, + "model_id": model_id, + "keyterms": keyterms, + "webhook_ids": webhook_ids, + "target_language": target_language, + }, + files={ + **({"file": file} if file is not None else {}), + **({"transcript": transcript} if transcript is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectResponse, + construct_type( + type_=DubbingProjectResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingProjectResponse]: + """ + Full project detail, including the IDs of every language target under it. To follow a project to `ready`, we recommend a `webhook_ids` subscription rather than polling this endpoint. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingProjectResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectResponse, + construct_type( + type_=DubbingProjectResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Delete a project, every language target under it, and their stored media and outputs. This cannot be undone, and a dub already running is still billed. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawProjectClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[str] = None, + sort_direction: typing.Optional[ProjectListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingProjectListResponse]: + """ + List the dubbing projects in your workspace that you can access, newest first, cursor-paginated. Listed projects carry no `language_ids`; fetch a project, or list its language targets, to see them. + + Parameters + ---------- + cursor : typing.Optional[str] + Pass the `next_cursor` from a previous response to fetch the page after it. Omit for the first page. + + page_size : typing.Optional[int] + Number of projects per page. Clamped to between 1 and 100 rather than rejected, so a larger value returns a full page. + + status : typing.Optional[str] + Filter to projects in this status: `queued`, `preparing`, `ready`, or `failed`. Omit to return every status. + + sort_direction : typing.Optional[ProjectListRequestSortDirection] + Sort by creation time; newest first by default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingProjectListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/dubbing/project", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectListResponse, + construct_type( + type_=DubbingProjectListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + source_url: typing.Optional[str] = OMIT, + reference: typing.Optional[str] = OMIT, + source_language: typing.Optional[str] = OMIT, + model_id: typing.Optional[ProjectCreateRequestModelId] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + webhook_ids: typing.Optional[typing.List[str]] = OMIT, + target_language: typing.Optional[str] = OMIT, + transcript: typing.Optional[core.File] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingProjectResponse]: + """ + Create a dubbing project from an uploaded file (`file`) or a source URL (`source_url`). + + Returns as soon as the project record exists, before the source has been fetched: the project starts `queued` and reaches `ready` once its source has been transcribed. Add a language target to it for each language you want, or pass `target_language` to queue the first one here. + + Creating a project incurs a minimum charge of one language: you are charged for at least one language's dubbing when the project is created, before any output exists. This charge prepays the first language target — the first target you add, or the one queued via `target_language`, consumes it — and each additional language is charged separately. + + Preparation can take minutes on a long source, so we recommend passing `webhook_ids` to be notified when the project turns `ready` or `failed`, rather than polling for it. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + source_url : typing.Optional[str] + Public HTTP(S) URL the source media is fetched from server-side, subject to the same size and format limits as an upload. Provide this or `file`, not both. + + reference : typing.Optional[str] + Optional free-form string (at most 500 characters) to identify the project on your end. Stored and echoed back verbatim; it does not affect the dub. + + source_language : typing.Optional[str] + BCP-47 language tag of the source media; must be a language the transcription model supports. Any region or script subtag is ignored, since transcription is per-language. Omit to auto-detect. + + model_id : typing.Optional[ProjectCreateRequestModelId] + Dubbing model (`dubbing_v1` or `dubbing_v2`) every language target of this project is dubbed with. Defaults to `dubbing_v2`. Fixed at create time — the source is prepared for this model, so neither the project nor an individual target can change it later. + + keyterms : typing.Optional[typing.List[str]] + Key terms to bias transcription and translation toward (for example, product or brand names). At most 1,000 terms; each term at most 50 characters and 5 words; the characters `<>{}[]\\` are not allowed. Terms are trimmed and deduplicated. Repeat the field once per term, or pass a single JSON array. + + webhook_ids : typing.Optional[typing.List[str]] + IDs of workspace webhooks to notify as this project progresses — the alternative to polling, and what we recommend. Each receives a `dubbing_project_ready` or `dubbing_project_failed` event for the project, and a `dubbing_language_completed` or `dubbing_language_failed` event for every language under it; `dubbing_language_completed` carries the output download URLs. At most 3 IDs, each already configured in your workspace — see [Webhooks](https://elevenlabs.io/docs/eleven-api/resources/webhooks) for how to create one and verify its signature. Repeat the field once per ID, or pass a single JSON array or comma-separated string. Delivery is best-effort and can repeat, so we recommend handling events idempotently. + + target_language : typing.Optional[str] + Optional shortcut: also create a language target in this BCP-47 language, queued to start once the project is ready — equivalent to creating the project and then creating one language target. Must be one of the [languages the dubbing model supports](https://elevenlabs.io/docs/help-center/product/dubbing/which-languages-are-supported-in-dubbing), and a region-qualified tag must be one of the supported dialects. This is the first language target, so it consumes the project's minimum charge rather than adding to it. Its ID is returned in `language_ids`. + + transcript : typing.Optional[core.File] + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingProjectResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/dubbing/project", + method="POST", + data={ + "source_url": source_url, + "reference": reference, + "source_language": source_language, + "model_id": model_id, + "keyterms": keyterms, + "webhook_ids": webhook_ids, + "target_language": target_language, + }, + files={ + **({"file": file} if file is not None else {}), + **({"transcript": transcript} if transcript is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectResponse, + construct_type( + type_=DubbingProjectResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingProjectResponse]: + """ + Full project detail, including the IDs of every language target under it. To follow a project to `ready`, we recommend a `webhook_ids` subscription rather than polling this endpoint. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to fetch. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingProjectResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingProjectResponse, + construct_type( + type_=DubbingProjectResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete a project, every language target under it, and their stored media and outputs. This cannot be undone, and a dub already running is still billed. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project to delete. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/project/transcript/__init__.py b/data/src/elevenlabs/dubbing/project/transcript/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/transcript/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/dubbing/project/transcript/client.py b/data/src/elevenlabs/dubbing/project/transcript/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7b4e8c63e1a570531a432cd301b7e96d9c52bfb2 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/transcript/client.py @@ -0,0 +1,539 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.dubbing_bulk_source_segment_update_response import DubbingBulkSourceSegmentUpdateResponse +from ....types.dubbing_segment_update_request import DubbingSegmentUpdateRequest +from ....types.dubbing_source_segment_update_response import DubbingSourceSegmentUpdateResponse +from ....types.dubbing_source_transcript_response import DubbingSourceTranscriptResponse +from ....types.dubbing_transcript_revision_response import DubbingTranscriptRevisionResponse +from .raw_client import AsyncRawTranscriptClient, RawTranscriptClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TranscriptClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTranscriptClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTranscriptClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTranscriptClient + """ + return self._raw_client + + def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingSourceTranscriptResponse: + """ + The project's source transcript, as editable segments. Available once the project is `ready`. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingSourceTranscriptResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.transcript.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + ) + """ + _response = self._raw_client.get(project_id, request_options=request_options) + return _response.data + + def delete_segment( + self, project_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingTranscriptRevisionResponse: + """ + Enterprise only. Remove a source segment from the transcript so it is no longer dubbed. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segment_id : str + Identifier of the segment to remove. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingTranscriptRevisionResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.transcript.delete_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", + ) + """ + _response = self._raw_client.delete_segment(project_id, segment_id, request_options=request_options) + return _response.data + + def update_segment( + self, + project_id: str, + segment_id: str, + *, + request: DubbingSegmentUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingSourceSegmentUpdateResponse: + """ + Enterprise only. Edit a source segment's text, speaker, or timing. Omitted fields are left unchanged. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segment_id : str + Identifier of the segment to edit. + + request : DubbingSegmentUpdateRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingSourceSegmentUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import DubbingSegmentUpdateRequest, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.transcript.update_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", + request=DubbingSegmentUpdateRequest( + text="Welcome to our latest product demo.", + ), + ) + """ + _response = self._raw_client.update_segment( + project_id, segment_id, request=request, request_options=request_options + ) + return _response.data + + def update_segments( + self, + project_id: str, + *, + segments: typing.Dict[str, DubbingSegmentUpdateRequest], + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingBulkSourceSegmentUpdateResponse: + """ + Enterprise only. Edit several source segments' text, speaker, or timing in one atomic request: every edit applies or none does. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segments : typing.Dict[str, DubbingSegmentUpdateRequest] + Map of segment ID to the partial update to apply to that segment. At least one entry and at most 500. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingBulkSourceSegmentUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import DubbingSegmentUpdateRequest, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.transcript.update_segments( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segments={ + "0199a3f0-1c2d-7abc-8def-0123456789ab": DubbingSegmentUpdateRequest( + text="Welcome to our latest product demo.", + ), + "0199a3f0-3e4f-7abc-8def-0123456789cd": DubbingSegmentUpdateRequest( + speaker_id="narrator", + ), + }, + ) + """ + _response = self._raw_client.update_segments(project_id, segments=segments, request_options=request_options) + return _response.data + + def create_segment( + self, + project_id: str, + *, + text: str, + speaker_id: str, + start_s: float, + end_s: float, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingSourceSegmentUpdateResponse: + """ + Enterprise only. Add a new source segment to the transcript. Its span must lie within the source media, last between 0.1 and 25 seconds, and not overlap another segment by the same speaker. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + text : str + The text of the new segment. + + speaker_id : str + Identifier of the segment's speaker. + + start_s : float + Start time of the segment, in seconds. + + end_s : float + End time of the segment, in seconds. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingSourceSegmentUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.project.transcript.create_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + text="Thanks for watching.", + speaker_id="default_speaker", + start_s=42.0, + end_s=44.0, + ) + """ + _response = self._raw_client.create_segment( + project_id, text=text, speaker_id=speaker_id, start_s=start_s, end_s=end_s, request_options=request_options + ) + return _response.data + + +class AsyncTranscriptClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTranscriptClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTranscriptClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTranscriptClient + """ + return self._raw_client + + async def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingSourceTranscriptResponse: + """ + The project's source transcript, as editable segments. Available once the project is `ready`. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingSourceTranscriptResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.transcript.get( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(project_id, request_options=request_options) + return _response.data + + async def delete_segment( + self, project_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DubbingTranscriptRevisionResponse: + """ + Enterprise only. Remove a source segment from the transcript so it is no longer dubbed. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segment_id : str + Identifier of the segment to remove. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingTranscriptRevisionResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.transcript.delete_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete_segment(project_id, segment_id, request_options=request_options) + return _response.data + + async def update_segment( + self, + project_id: str, + segment_id: str, + *, + request: DubbingSegmentUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingSourceSegmentUpdateResponse: + """ + Enterprise only. Edit a source segment's text, speaker, or timing. Omitted fields are left unchanged. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segment_id : str + Identifier of the segment to edit. + + request : DubbingSegmentUpdateRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingSourceSegmentUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, DubbingSegmentUpdateRequest + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.transcript.update_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segment_id="0199a3f0-1c2d-7abc-8def-0123456789ab", + request=DubbingSegmentUpdateRequest( + text="Welcome to our latest product demo.", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_segment( + project_id, segment_id, request=request, request_options=request_options + ) + return _response.data + + async def update_segments( + self, + project_id: str, + *, + segments: typing.Dict[str, DubbingSegmentUpdateRequest], + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingBulkSourceSegmentUpdateResponse: + """ + Enterprise only. Edit several source segments' text, speaker, or timing in one atomic request: every edit applies or none does. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segments : typing.Dict[str, DubbingSegmentUpdateRequest] + Map of segment ID to the partial update to apply to that segment. At least one entry and at most 500. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingBulkSourceSegmentUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, DubbingSegmentUpdateRequest + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.transcript.update_segments( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + segments={ + "0199a3f0-1c2d-7abc-8def-0123456789ab": DubbingSegmentUpdateRequest( + text="Welcome to our latest product demo.", + ), + "0199a3f0-3e4f-7abc-8def-0123456789cd": DubbingSegmentUpdateRequest( + speaker_id="narrator", + ), + }, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update_segments( + project_id, segments=segments, request_options=request_options + ) + return _response.data + + async def create_segment( + self, + project_id: str, + *, + text: str, + speaker_id: str, + start_s: float, + end_s: float, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingSourceSegmentUpdateResponse: + """ + Enterprise only. Add a new source segment to the transcript. Its span must lie within the source media, last between 0.1 and 25 seconds, and not overlap another segment by the same speaker. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + text : str + The text of the new segment. + + speaker_id : str + Identifier of the segment's speaker. + + start_s : float + Start time of the segment, in seconds. + + end_s : float + End time of the segment, in seconds. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingSourceSegmentUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.project.transcript.create_segment( + project_id="proj_1601kwkyxp0hfzvtmyxwqxx6mcy3", + text="Thanks for watching.", + speaker_id="default_speaker", + start_s=42.0, + end_s=44.0, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_segment( + project_id, text=text, speaker_id=speaker_id, start_s=start_s, end_s=end_s, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/dubbing/project/transcript/raw_client.py b/data/src/elevenlabs/dubbing/project/transcript/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..3fcbaafe06c2c61608baf9490e4c1354930275d9 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/transcript/raw_client.py @@ -0,0 +1,703 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.dubbing_bulk_source_segment_update_response import DubbingBulkSourceSegmentUpdateResponse +from ....types.dubbing_segment_update_request import DubbingSegmentUpdateRequest +from ....types.dubbing_source_segment_update_response import DubbingSourceSegmentUpdateResponse +from ....types.dubbing_source_transcript_response import DubbingSourceTranscriptResponse +from ....types.dubbing_transcript_revision_response import DubbingTranscriptRevisionResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTranscriptClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingSourceTranscriptResponse]: + """ + The project's source transcript, as editable segments. Available once the project is `ready`. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingSourceTranscriptResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingSourceTranscriptResponse, + construct_type( + type_=DubbingSourceTranscriptResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete_segment( + self, project_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingTranscriptRevisionResponse]: + """ + Enterprise only. Remove a source segment from the transcript so it is no longer dubbed. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segment_id : str + Identifier of the segment to remove. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingTranscriptRevisionResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript/segment/{jsonable_encoder(segment_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingTranscriptRevisionResponse, + construct_type( + type_=DubbingTranscriptRevisionResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_segment( + self, + project_id: str, + segment_id: str, + *, + request: DubbingSegmentUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingSourceSegmentUpdateResponse]: + """ + Enterprise only. Edit a source segment's text, speaker, or timing. Omitted fields are left unchanged. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segment_id : str + Identifier of the segment to edit. + + request : DubbingSegmentUpdateRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingSourceSegmentUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript/segment/{jsonable_encoder(segment_id)}", + method="PATCH", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=DubbingSegmentUpdateRequest, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingSourceSegmentUpdateResponse, + construct_type( + type_=DubbingSourceSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update_segments( + self, + project_id: str, + *, + segments: typing.Dict[str, DubbingSegmentUpdateRequest], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingBulkSourceSegmentUpdateResponse]: + """ + Enterprise only. Edit several source segments' text, speaker, or timing in one atomic request: every edit applies or none does. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segments : typing.Dict[str, DubbingSegmentUpdateRequest] + Map of segment ID to the partial update to apply to that segment. At least one entry and at most 500. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingBulkSourceSegmentUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript/segments", + method="PATCH", + json={ + "segments": convert_and_respect_annotation_metadata( + object_=segments, annotation=typing.Dict[str, DubbingSegmentUpdateRequest], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingBulkSourceSegmentUpdateResponse, + construct_type( + type_=DubbingBulkSourceSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_segment( + self, + project_id: str, + *, + text: str, + speaker_id: str, + start_s: float, + end_s: float, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingSourceSegmentUpdateResponse]: + """ + Enterprise only. Add a new source segment to the transcript. Its span must lie within the source media, last between 0.1 and 25 seconds, and not overlap another segment by the same speaker. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + text : str + The text of the new segment. + + speaker_id : str + Identifier of the segment's speaker. + + start_s : float + Start time of the segment, in seconds. + + end_s : float + End time of the segment, in seconds. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingSourceSegmentUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript/segment", + method="POST", + json={ + "text": text, + "speaker_id": speaker_id, + "start_s": start_s, + "end_s": end_s, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingSourceSegmentUpdateResponse, + construct_type( + type_=DubbingSourceSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTranscriptClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingSourceTranscriptResponse]: + """ + The project's source transcript, as editable segments. Available once the project is `ready`. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingSourceTranscriptResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingSourceTranscriptResponse, + construct_type( + type_=DubbingSourceTranscriptResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete_segment( + self, project_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingTranscriptRevisionResponse]: + """ + Enterprise only. Remove a source segment from the transcript so it is no longer dubbed. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segment_id : str + Identifier of the segment to remove. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingTranscriptRevisionResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript/segment/{jsonable_encoder(segment_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingTranscriptRevisionResponse, + construct_type( + type_=DubbingTranscriptRevisionResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_segment( + self, + project_id: str, + segment_id: str, + *, + request: DubbingSegmentUpdateRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingSourceSegmentUpdateResponse]: + """ + Enterprise only. Edit a source segment's text, speaker, or timing. Omitted fields are left unchanged. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segment_id : str + Identifier of the segment to edit. + + request : DubbingSegmentUpdateRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingSourceSegmentUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript/segment/{jsonable_encoder(segment_id)}", + method="PATCH", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=DubbingSegmentUpdateRequest, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingSourceSegmentUpdateResponse, + construct_type( + type_=DubbingSourceSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update_segments( + self, + project_id: str, + *, + segments: typing.Dict[str, DubbingSegmentUpdateRequest], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingBulkSourceSegmentUpdateResponse]: + """ + Enterprise only. Edit several source segments' text, speaker, or timing in one atomic request: every edit applies or none does. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + segments : typing.Dict[str, DubbingSegmentUpdateRequest] + Map of segment ID to the partial update to apply to that segment. At least one entry and at most 500. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingBulkSourceSegmentUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript/segments", + method="PATCH", + json={ + "segments": convert_and_respect_annotation_metadata( + object_=segments, annotation=typing.Dict[str, DubbingSegmentUpdateRequest], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingBulkSourceSegmentUpdateResponse, + construct_type( + type_=DubbingBulkSourceSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_segment( + self, + project_id: str, + *, + text: str, + speaker_id: str, + start_s: float, + end_s: float, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingSourceSegmentUpdateResponse]: + """ + Enterprise only. Add a new source segment to the transcript. Its span must lie within the source media, last between 0.1 and 25 seconds, and not overlap another segment by the same speaker. Bumps the project's `revision`, discards the affected translations in every language target, and marks any target that had already completed `stale`. No audio changes until you regenerate a target. + + Parameters + ---------- + project_id : str + Identifier of the dubbing project. + + text : str + The text of the new segment. + + speaker_id : str + Identifier of the segment's speaker. + + start_s : float + Start time of the segment, in seconds. + + end_s : float + End time of the segment, in seconds. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingSourceSegmentUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/project/{jsonable_encoder(project_id)}/transcript/segment", + method="POST", + json={ + "text": text, + "speaker_id": speaker_id, + "start_s": start_s, + "end_s": end_s, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingSourceSegmentUpdateResponse, + construct_type( + type_=DubbingSourceSegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/project/types/__init__.py b/data/src/elevenlabs/dubbing/project/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ea8caf5284c81e038a6604748d1a3322ece2f0ec --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .project_create_request_model_id import ProjectCreateRequestModelId + from .project_list_request_sort_direction import ProjectListRequestSortDirection +_dynamic_imports: typing.Dict[str, str] = { + "ProjectCreateRequestModelId": ".project_create_request_model_id", + "ProjectListRequestSortDirection": ".project_list_request_sort_direction", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ProjectCreateRequestModelId", "ProjectListRequestSortDirection"] diff --git a/data/src/elevenlabs/dubbing/project/types/project_create_request_model_id.py b/data/src/elevenlabs/dubbing/project/types/project_create_request_model_id.py new file mode 100644 index 0000000000000000000000000000000000000000..03b60f018006651695a3ea3ffa0178fb91cc5cd3 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/types/project_create_request_model_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectCreateRequestModelId = typing.Union[typing.Literal["dubbing_v1"], typing.Literal["dubbing_v2"], str] diff --git a/data/src/elevenlabs/dubbing/project/types/project_list_request_sort_direction.py b/data/src/elevenlabs/dubbing/project/types/project_list_request_sort_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..b17b4c63a117101d1e919950d9e4d099901f8f35 --- /dev/null +++ b/data/src/elevenlabs/dubbing/project/types/project_list_request_sort_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectListRequestSortDirection = typing.Union[typing.Literal["ASCENDING", "DESCENDING"], typing.Any] diff --git a/data/src/elevenlabs/dubbing/raw_client.py b/data/src/elevenlabs/dubbing/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..45867097983b97675c7b06ca74c6c5e20abac2c9 --- /dev/null +++ b/data/src/elevenlabs/dubbing/raw_client.py @@ -0,0 +1,796 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.delete_dubbing_response_model import DeleteDubbingResponseModel +from ..types.do_dubbing_response import DoDubbingResponse +from ..types.dubbing_metadata_page_response_model import DubbingMetadataPageResponseModel +from ..types.dubbing_metadata_response import DubbingMetadataResponse +from .types.dub_request_mode import DubRequestMode +from .types.dubbing_list_request_creation_sources_item import DubbingListRequestCreationSourcesItem +from .types.dubbing_list_request_dubbing_models_item import DubbingListRequestDubbingModelsItem +from .types.dubbing_list_request_dubbing_status import DubbingListRequestDubbingStatus +from .types.dubbing_list_request_dubbing_statuses_item import DubbingListRequestDubbingStatusesItem +from .types.dubbing_list_request_filter_by_creator import DubbingListRequestFilterByCreator +from .types.dubbing_list_request_order_by import DubbingListRequestOrderBy +from .types.dubbing_list_request_order_direction import DubbingListRequestOrderDirection +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawDubbingClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + dubbing_status: typing.Optional[DubbingListRequestDubbingStatus] = None, + dubbing_statuses: typing.Optional[ + typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]] + ] = None, + dubbing_models: typing.Optional[ + typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]] + ] = None, + target_language_codes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + creation_sources: typing.Optional[ + typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]] + ] = None, + filter_by_creator: typing.Optional[DubbingListRequestFilterByCreator] = None, + order_by: typing.Optional[DubbingListRequestOrderBy] = None, + order_direction: typing.Optional[DubbingListRequestOrderDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingMetadataPageResponseModel]: + """ + List the dubs you have access to. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many dubs to return at maximum. Can not exceed 200, defaults to 100. + + dubbing_status : typing.Optional[DubbingListRequestDubbingStatus] + What state the dub is currently in. + + dubbing_statuses : typing.Optional[typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]]] + Filter by dubbing status. + + dubbing_models : typing.Optional[typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]]] + Filter by dubbing model generation. + + target_language_codes : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter by target language code. + + creation_sources : typing.Optional[typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]]] + Filter by dubbing creation source. + + filter_by_creator : typing.Optional[DubbingListRequestFilterByCreator] + Filters who created the resources being listed, whether it was the user running the request or someone else that shared the resource with them. + + order_by : typing.Optional[DubbingListRequestOrderBy] + The field to use for ordering results from this query. + + order_direction : typing.Optional[DubbingListRequestOrderDirection] + The order direction to use for results from this query. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingMetadataPageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/dubbing", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "dubbing_status": dubbing_status, + "dubbing_statuses": dubbing_statuses, + "dubbing_models": dubbing_models, + "target_language_codes": target_language_codes, + "creation_sources": creation_sources, + "filter_by_creator": filter_by_creator, + "order_by": order_by, + "order_direction": order_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingMetadataPageResponseModel, + construct_type( + type_=DubbingMetadataPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + csv_file: typing.Optional[core.File] = OMIT, + foreground_audio_file: typing.Optional[core.File] = OMIT, + background_audio_file: typing.Optional[core.File] = OMIT, + name: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + source_lang: typing.Optional[str] = OMIT, + target_lang: typing.Optional[str] = OMIT, + target_accent: typing.Optional[str] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + watermark: typing.Optional[bool] = OMIT, + start_time: typing.Optional[int] = OMIT, + end_time: typing.Optional[int] = OMIT, + highest_resolution: typing.Optional[bool] = OMIT, + drop_background_audio: typing.Optional[bool] = OMIT, + use_profanity_filter: typing.Optional[bool] = OMIT, + dubbing_studio: typing.Optional[bool] = OMIT, + disable_voice_cloning: typing.Optional[bool] = OMIT, + mode: typing.Optional[DubRequestMode] = OMIT, + csv_fps: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DoDubbingResponse]: + """ + Dubs a provided audio or video file into given language. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + csv_file : typing.Optional[core.File] + See core.File for more documentation + + foreground_audio_file : typing.Optional[core.File] + See core.File for more documentation + + background_audio_file : typing.Optional[core.File] + See core.File for more documentation + + name : typing.Optional[str] + Name of the dubbing project. + + source_url : typing.Optional[str] + URL of the source video/audio file. + + source_lang : typing.Optional[str] + Source language. Expects a valid iso639-1 or iso639-3 language code. + + target_lang : typing.Optional[str] + The Target language to dub the content into. Expects a valid iso639-1 or iso639-3 language code. + + target_accent : typing.Optional[str] + [Experimental] An accent to apply when selecting voices from the library and to use to inform translation of the dialect to prefer. + + num_speakers : typing.Optional[int] + Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers + + watermark : typing.Optional[bool] + Whether to apply watermark to the output video. + + start_time : typing.Optional[int] + Start time of the source video/audio file. + + end_time : typing.Optional[int] + End time of the source video/audio file. + + highest_resolution : typing.Optional[bool] + Whether to use the highest resolution available. + + drop_background_audio : typing.Optional[bool] + An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. + + use_profanity_filter : typing.Optional[bool] + [BETA] Whether transcripts should have profanities censored with the words '[censored]' + + dubbing_studio : typing.Optional[bool] + Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. + + disable_voice_cloning : typing.Optional[bool] + Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. Voices used from the library will contribute towards a workspace's custom voices limit, and if there aren't enough available slots the dub will fail. Using this feature requires the caller to have the 'add_voice_from_voice_library' permission on their workspace to access new voices. + + mode : typing.Optional[DubRequestMode] + The mode in which to run this Dubbing job. Defaults to automatic, use manual if specifically providing a CSV transcript to use. Note that manual mode is experimental and production use is strongly discouraged. + + csv_fps : typing.Optional[float] + Frames per second to use when parsing a CSV file for dubbing. If not provided, FPS will be inferred from timecodes. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DoDubbingResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/dubbing", + method="POST", + data={ + "name": name, + "source_url": source_url, + "source_lang": source_lang, + "target_lang": target_lang, + "target_accent": target_accent, + "num_speakers": num_speakers, + "watermark": watermark, + "start_time": start_time, + "end_time": end_time, + "highest_resolution": highest_resolution, + "drop_background_audio": drop_background_audio, + "use_profanity_filter": use_profanity_filter, + "dubbing_studio": dubbing_studio, + "disable_voice_cloning": disable_voice_cloning, + "mode": mode, + "csv_fps": csv_fps, + }, + files={ + **({"file": file} if file is not None else {}), + **({"csv_file": csv_file} if csv_file is not None else {}), + **({"foreground_audio_file": foreground_audio_file} if foreground_audio_file is not None else {}), + **({"background_audio_file": background_audio_file} if background_audio_file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DoDubbingResponse, + construct_type( + type_=DoDubbingResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingMetadataResponse]: + """ + Returns metadata about a dubbing project, including whether it's still in progress or not + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingMetadataResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingMetadataResponse, + construct_type( + type_=DubbingMetadataResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteDubbingResponseModel]: + """ + Deletes a dubbing project. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteDubbingResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteDubbingResponseModel, + construct_type( + type_=DeleteDubbingResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawDubbingClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + dubbing_status: typing.Optional[DubbingListRequestDubbingStatus] = None, + dubbing_statuses: typing.Optional[ + typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]] + ] = None, + dubbing_models: typing.Optional[ + typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]] + ] = None, + target_language_codes: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + creation_sources: typing.Optional[ + typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]] + ] = None, + filter_by_creator: typing.Optional[DubbingListRequestFilterByCreator] = None, + order_by: typing.Optional[DubbingListRequestOrderBy] = None, + order_direction: typing.Optional[DubbingListRequestOrderDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingMetadataPageResponseModel]: + """ + List the dubs you have access to. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many dubs to return at maximum. Can not exceed 200, defaults to 100. + + dubbing_status : typing.Optional[DubbingListRequestDubbingStatus] + What state the dub is currently in. + + dubbing_statuses : typing.Optional[typing.Union[DubbingListRequestDubbingStatusesItem, typing.Sequence[DubbingListRequestDubbingStatusesItem]]] + Filter by dubbing status. + + dubbing_models : typing.Optional[typing.Union[DubbingListRequestDubbingModelsItem, typing.Sequence[DubbingListRequestDubbingModelsItem]]] + Filter by dubbing model generation. + + target_language_codes : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Filter by target language code. + + creation_sources : typing.Optional[typing.Union[DubbingListRequestCreationSourcesItem, typing.Sequence[DubbingListRequestCreationSourcesItem]]] + Filter by dubbing creation source. + + filter_by_creator : typing.Optional[DubbingListRequestFilterByCreator] + Filters who created the resources being listed, whether it was the user running the request or someone else that shared the resource with them. + + order_by : typing.Optional[DubbingListRequestOrderBy] + The field to use for ordering results from this query. + + order_direction : typing.Optional[DubbingListRequestOrderDirection] + The order direction to use for results from this query. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingMetadataPageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/dubbing", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "dubbing_status": dubbing_status, + "dubbing_statuses": dubbing_statuses, + "dubbing_models": dubbing_models, + "target_language_codes": target_language_codes, + "creation_sources": creation_sources, + "filter_by_creator": filter_by_creator, + "order_by": order_by, + "order_direction": order_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingMetadataPageResponseModel, + construct_type( + type_=DubbingMetadataPageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + file: typing.Optional[core.File] = OMIT, + csv_file: typing.Optional[core.File] = OMIT, + foreground_audio_file: typing.Optional[core.File] = OMIT, + background_audio_file: typing.Optional[core.File] = OMIT, + name: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + source_lang: typing.Optional[str] = OMIT, + target_lang: typing.Optional[str] = OMIT, + target_accent: typing.Optional[str] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + watermark: typing.Optional[bool] = OMIT, + start_time: typing.Optional[int] = OMIT, + end_time: typing.Optional[int] = OMIT, + highest_resolution: typing.Optional[bool] = OMIT, + drop_background_audio: typing.Optional[bool] = OMIT, + use_profanity_filter: typing.Optional[bool] = OMIT, + dubbing_studio: typing.Optional[bool] = OMIT, + disable_voice_cloning: typing.Optional[bool] = OMIT, + mode: typing.Optional[DubRequestMode] = OMIT, + csv_fps: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DoDubbingResponse]: + """ + Dubs a provided audio or video file into given language. + + Parameters + ---------- + file : typing.Optional[core.File] + See core.File for more documentation + + csv_file : typing.Optional[core.File] + See core.File for more documentation + + foreground_audio_file : typing.Optional[core.File] + See core.File for more documentation + + background_audio_file : typing.Optional[core.File] + See core.File for more documentation + + name : typing.Optional[str] + Name of the dubbing project. + + source_url : typing.Optional[str] + URL of the source video/audio file. + + source_lang : typing.Optional[str] + Source language. Expects a valid iso639-1 or iso639-3 language code. + + target_lang : typing.Optional[str] + The Target language to dub the content into. Expects a valid iso639-1 or iso639-3 language code. + + target_accent : typing.Optional[str] + [Experimental] An accent to apply when selecting voices from the library and to use to inform translation of the dialect to prefer. + + num_speakers : typing.Optional[int] + Number of speakers to use for the dubbing. Set to 0 to automatically detect the number of speakers + + watermark : typing.Optional[bool] + Whether to apply watermark to the output video. + + start_time : typing.Optional[int] + Start time of the source video/audio file. + + end_time : typing.Optional[int] + End time of the source video/audio file. + + highest_resolution : typing.Optional[bool] + Whether to use the highest resolution available. + + drop_background_audio : typing.Optional[bool] + An advanced setting. Whether to drop background audio from the final dub. This can improve dub quality where it's known that audio shouldn't have a background track such as for speeches or monologues. + + use_profanity_filter : typing.Optional[bool] + [BETA] Whether transcripts should have profanities censored with the words '[censored]' + + dubbing_studio : typing.Optional[bool] + Whether to prepare dub for edits in dubbing studio or edits as a dubbing resource. + + disable_voice_cloning : typing.Optional[bool] + Instead of using a voice clone in dubbing, use a similar voice from the ElevenLabs Voice Library. Voices used from the library will contribute towards a workspace's custom voices limit, and if there aren't enough available slots the dub will fail. Using this feature requires the caller to have the 'add_voice_from_voice_library' permission on their workspace to access new voices. + + mode : typing.Optional[DubRequestMode] + The mode in which to run this Dubbing job. Defaults to automatic, use manual if specifically providing a CSV transcript to use. Note that manual mode is experimental and production use is strongly discouraged. + + csv_fps : typing.Optional[float] + Frames per second to use when parsing a CSV file for dubbing. If not provided, FPS will be inferred from timecodes. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DoDubbingResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/dubbing", + method="POST", + data={ + "name": name, + "source_url": source_url, + "source_lang": source_lang, + "target_lang": target_lang, + "target_accent": target_accent, + "num_speakers": num_speakers, + "watermark": watermark, + "start_time": start_time, + "end_time": end_time, + "highest_resolution": highest_resolution, + "drop_background_audio": drop_background_audio, + "use_profanity_filter": use_profanity_filter, + "dubbing_studio": dubbing_studio, + "disable_voice_cloning": disable_voice_cloning, + "mode": mode, + "csv_fps": csv_fps, + }, + files={ + **({"file": file} if file is not None else {}), + **({"csv_file": csv_file} if csv_file is not None else {}), + **({"foreground_audio_file": foreground_audio_file} if foreground_audio_file is not None else {}), + **({"background_audio_file": background_audio_file} if background_audio_file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DoDubbingResponse, + construct_type( + type_=DoDubbingResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingMetadataResponse]: + """ + Returns metadata about a dubbing project, including whether it's still in progress or not + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingMetadataResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingMetadataResponse, + construct_type( + type_=DubbingMetadataResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteDubbingResponseModel]: + """ + Deletes a dubbing project. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteDubbingResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteDubbingResponseModel, + construct_type( + type_=DeleteDubbingResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/resource/__init__.py b/data/src/elevenlabs/dubbing/resource/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b3e1a31002ffba0568959d71363ac38cd57cf6bb --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import language, segment, speaker +_dynamic_imports: typing.Dict[str, str] = {"language": ".language", "segment": ".segment", "speaker": ".speaker"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["language", "segment", "speaker"] diff --git a/data/src/elevenlabs/dubbing/resource/client.py b/data/src/elevenlabs/dubbing/resource/client.py new file mode 100644 index 0000000000000000000000000000000000000000..b15714c8a1363069284b0edc3ad23b8645dbe9cb --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/client.py @@ -0,0 +1,695 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.dubbing_render_response_model import DubbingRenderResponseModel +from ...types.dubbing_resource import DubbingResource +from ...types.render_type import RenderType +from ...types.segment_dub_response import SegmentDubResponse +from ...types.segment_migration_response import SegmentMigrationResponse +from ...types.segment_transcription_response import SegmentTranscriptionResponse +from ...types.segment_translation_response import SegmentTranslationResponse +from .raw_client import AsyncRawResourceClient, RawResourceClient + +if typing.TYPE_CHECKING: + from .language.client import AsyncLanguageClient, LanguageClient + from .segment.client import AsyncSegmentClient, SegmentClient + from .speaker.client import AsyncSpeakerClient, SpeakerClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ResourceClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawResourceClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._language: typing.Optional[LanguageClient] = None + self._segment: typing.Optional[SegmentClient] = None + self._speaker: typing.Optional[SpeakerClient] = None + + @property + def with_raw_response(self) -> RawResourceClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawResourceClient + """ + return self._raw_client + + def get(self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DubbingResource: + """ + Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingResource + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.get( + dubbing_id="dubbing_id", + ) + """ + _response = self._raw_client.get(dubbing_id, request_options=request_options) + return _response.data + + def migrate_segments( + self, + dubbing_id: str, + *, + segment_ids: typing.Sequence[str], + speaker_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentMigrationResponse: + """ + Change the attribution of one or more segments to a different speaker. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_ids : typing.Sequence[str] + + speaker_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentMigrationResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.migrate_segments( + dubbing_id="dubbing_id", + segment_ids=["segment_ids"], + speaker_id="speaker_id", + ) + """ + _response = self._raw_client.migrate_segments( + dubbing_id, segment_ids=segment_ids, speaker_id=speaker_id, request_options=request_options + ) + return _response.data + + def transcribe( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentTranscriptionResponse: + """ + Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Transcribe this specific list of segments. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentTranscriptionResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.transcribe( + dubbing_id="dubbing_id", + segments=["segments"], + ) + """ + _response = self._raw_client.transcribe(dubbing_id, segments=segments, request_options=request_options) + return _response.data + + def translate( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentTranslationResponse: + """ + Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Translate only this list of segments. + + languages : typing.Optional[typing.Sequence[str]] + Translate only these languages for each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentTranslationResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.translate( + dubbing_id="dubbing_id", + segments=["segments"], + ) + """ + _response = self._raw_client.translate( + dubbing_id, segments=segments, languages=languages, request_options=request_options + ) + return _response.data + + def dub( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentDubResponse: + """ + Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Dub only this list of segments. + + languages : typing.Optional[typing.Sequence[str]] + Dub only these languages for each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentDubResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.dub( + dubbing_id="dubbing_id", + segments=["segments"], + ) + """ + _response = self._raw_client.dub( + dubbing_id, segments=segments, languages=languages, request_options=request_options + ) + return _response.data + + def render( + self, + dubbing_id: str, + language: str, + *, + render_type: RenderType, + normalize_volume: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingRenderResponseModel: + """ + Regenerate the output media for a language using the latest Studio state. Please ensure all segments have been dubbed before rendering, otherwise they will be omitted. Renders are generated asynchronously, and to check the status of all renders please use the 'Get Dubbing Resource' endpoint. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language : str + The target language code to render, eg. 'es'. To render the source track use 'original'. + + render_type : RenderType + The type of the render. One of ['mp4', 'aac', 'mp3', 'wav', 'aaf', 'tracks_zip', 'clips_zip'] + + normalize_volume : typing.Optional[bool] + Whether to normalize the volume of the rendered audio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingRenderResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.render( + dubbing_id="dubbing_id", + language="language", + render_type="mp4", + ) + """ + _response = self._raw_client.render( + dubbing_id, + language, + render_type=render_type, + normalize_volume=normalize_volume, + request_options=request_options, + ) + return _response.data + + @property + def language(self): + if self._language is None: + from .language.client import LanguageClient # noqa: E402 + + self._language = LanguageClient(client_wrapper=self._client_wrapper) + return self._language + + @property + def segment(self): + if self._segment is None: + from .segment.client import SegmentClient # noqa: E402 + + self._segment = SegmentClient(client_wrapper=self._client_wrapper) + return self._segment + + @property + def speaker(self): + if self._speaker is None: + from .speaker.client import SpeakerClient # noqa: E402 + + self._speaker = SpeakerClient(client_wrapper=self._client_wrapper) + return self._speaker + + +class AsyncResourceClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawResourceClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._language: typing.Optional[AsyncLanguageClient] = None + self._segment: typing.Optional[AsyncSegmentClient] = None + self._speaker: typing.Optional[AsyncSpeakerClient] = None + + @property + def with_raw_response(self) -> AsyncRawResourceClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawResourceClient + """ + return self._raw_client + + async def get(self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DubbingResource: + """ + Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingResource + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.get( + dubbing_id="dubbing_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(dubbing_id, request_options=request_options) + return _response.data + + async def migrate_segments( + self, + dubbing_id: str, + *, + segment_ids: typing.Sequence[str], + speaker_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentMigrationResponse: + """ + Change the attribution of one or more segments to a different speaker. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_ids : typing.Sequence[str] + + speaker_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentMigrationResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.migrate_segments( + dubbing_id="dubbing_id", + segment_ids=["segment_ids"], + speaker_id="speaker_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.migrate_segments( + dubbing_id, segment_ids=segment_ids, speaker_id=speaker_id, request_options=request_options + ) + return _response.data + + async def transcribe( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentTranscriptionResponse: + """ + Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Transcribe this specific list of segments. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentTranscriptionResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.transcribe( + dubbing_id="dubbing_id", + segments=["segments"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.transcribe(dubbing_id, segments=segments, request_options=request_options) + return _response.data + + async def translate( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentTranslationResponse: + """ + Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Translate only this list of segments. + + languages : typing.Optional[typing.Sequence[str]] + Translate only these languages for each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentTranslationResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.translate( + dubbing_id="dubbing_id", + segments=["segments"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.translate( + dubbing_id, segments=segments, languages=languages, request_options=request_options + ) + return _response.data + + async def dub( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentDubResponse: + """ + Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Dub only this list of segments. + + languages : typing.Optional[typing.Sequence[str]] + Dub only these languages for each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentDubResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.dub( + dubbing_id="dubbing_id", + segments=["segments"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.dub( + dubbing_id, segments=segments, languages=languages, request_options=request_options + ) + return _response.data + + async def render( + self, + dubbing_id: str, + language: str, + *, + render_type: RenderType, + normalize_volume: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingRenderResponseModel: + """ + Regenerate the output media for a language using the latest Studio state. Please ensure all segments have been dubbed before rendering, otherwise they will be omitted. Renders are generated asynchronously, and to check the status of all renders please use the 'Get Dubbing Resource' endpoint. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language : str + The target language code to render, eg. 'es'. To render the source track use 'original'. + + render_type : RenderType + The type of the render. One of ['mp4', 'aac', 'mp3', 'wav', 'aaf', 'tracks_zip', 'clips_zip'] + + normalize_volume : typing.Optional[bool] + Whether to normalize the volume of the rendered audio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingRenderResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.render( + dubbing_id="dubbing_id", + language="language", + render_type="mp4", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.render( + dubbing_id, + language, + render_type=render_type, + normalize_volume=normalize_volume, + request_options=request_options, + ) + return _response.data + + @property + def language(self): + if self._language is None: + from .language.client import AsyncLanguageClient # noqa: E402 + + self._language = AsyncLanguageClient(client_wrapper=self._client_wrapper) + return self._language + + @property + def segment(self): + if self._segment is None: + from .segment.client import AsyncSegmentClient # noqa: E402 + + self._segment = AsyncSegmentClient(client_wrapper=self._client_wrapper) + return self._segment + + @property + def speaker(self): + if self._speaker is None: + from .speaker.client import AsyncSpeakerClient # noqa: E402 + + self._speaker = AsyncSpeakerClient(client_wrapper=self._client_wrapper) + return self._speaker diff --git a/data/src/elevenlabs/dubbing/resource/language/__init__.py b/data/src/elevenlabs/dubbing/resource/language/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/language/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/dubbing/resource/language/client.py b/data/src/elevenlabs/dubbing/resource/language/client.py new file mode 100644 index 0000000000000000000000000000000000000000..bbf2c129a0c0da3b2d95094cff16fd8f5716f3b0 --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/language/client.py @@ -0,0 +1,131 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.language_added_response import LanguageAddedResponse +from .raw_client import AsyncRawLanguageClient, RawLanguageClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class LanguageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLanguageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLanguageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLanguageClient + """ + return self._raw_client + + def add( + self, + dubbing_id: str, + *, + language: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LanguageAddedResponse: + """ + Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language : typing.Optional[str] + The Target language. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LanguageAddedResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.language.add( + dubbing_id="dubbing_id", + ) + """ + _response = self._raw_client.add(dubbing_id, language=language, request_options=request_options) + return _response.data + + +class AsyncLanguageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLanguageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLanguageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLanguageClient + """ + return self._raw_client + + async def add( + self, + dubbing_id: str, + *, + language: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> LanguageAddedResponse: + """ + Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language : typing.Optional[str] + The Target language. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LanguageAddedResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.language.add( + dubbing_id="dubbing_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add(dubbing_id, language=language, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/dubbing/resource/language/raw_client.py b/data/src/elevenlabs/dubbing/resource/language/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..7e8bd9961e0936e8072bed5a5888349e3a3265cc --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/language/raw_client.py @@ -0,0 +1,164 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.language_added_response import LanguageAddedResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawLanguageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def add( + self, + dubbing_id: str, + *, + language: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[LanguageAddedResponse]: + """ + Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language : typing.Optional[str] + The Target language. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[LanguageAddedResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/language", + method="POST", + json={ + "language": language, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LanguageAddedResponse, + construct_type( + type_=LanguageAddedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLanguageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def add( + self, + dubbing_id: str, + *, + language: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[LanguageAddedResponse]: + """ + Adds the given ElevenLab Turbo V2/V2.5 language code to the resource. Does not automatically generate transcripts/translations/audio. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language : typing.Optional[str] + The Target language. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[LanguageAddedResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/language", + method="POST", + json={ + "language": language, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LanguageAddedResponse, + construct_type( + type_=LanguageAddedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/resource/raw_client.py b/data/src/elevenlabs/dubbing/resource/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..6a302a80913d9a5d5d7724c1007d47dd37044900 --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/raw_client.py @@ -0,0 +1,866 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.dubbing_render_response_model import DubbingRenderResponseModel +from ...types.dubbing_resource import DubbingResource +from ...types.render_type import RenderType +from ...types.segment_dub_response import SegmentDubResponse +from ...types.segment_migration_response import SegmentMigrationResponse +from ...types.segment_transcription_response import SegmentTranscriptionResponse +from ...types.segment_translation_response import SegmentTranslationResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawResourceClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DubbingResource]: + """ + Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingResource] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingResource, + construct_type( + type_=DubbingResource, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def migrate_segments( + self, + dubbing_id: str, + *, + segment_ids: typing.Sequence[str], + speaker_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SegmentMigrationResponse]: + """ + Change the attribution of one or more segments to a different speaker. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_ids : typing.Sequence[str] + + speaker_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentMigrationResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/migrate-segments", + method="POST", + json={ + "segment_ids": segment_ids, + "speaker_id": speaker_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentMigrationResponse, + construct_type( + type_=SegmentMigrationResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def transcribe( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SegmentTranscriptionResponse]: + """ + Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Transcribe this specific list of segments. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentTranscriptionResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/transcribe", + method="POST", + json={ + "segments": segments, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentTranscriptionResponse, + construct_type( + type_=SegmentTranscriptionResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def translate( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SegmentTranslationResponse]: + """ + Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Translate only this list of segments. + + languages : typing.Optional[typing.Sequence[str]] + Translate only these languages for each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentTranslationResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/translate", + method="POST", + json={ + "segments": segments, + "languages": languages, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentTranslationResponse, + construct_type( + type_=SegmentTranslationResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def dub( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SegmentDubResponse]: + """ + Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Dub only this list of segments. + + languages : typing.Optional[typing.Sequence[str]] + Dub only these languages for each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentDubResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/dub", + method="POST", + json={ + "segments": segments, + "languages": languages, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentDubResponse, + construct_type( + type_=SegmentDubResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def render( + self, + dubbing_id: str, + language: str, + *, + render_type: RenderType, + normalize_volume: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingRenderResponseModel]: + """ + Regenerate the output media for a language using the latest Studio state. Please ensure all segments have been dubbed before rendering, otherwise they will be omitted. Renders are generated asynchronously, and to check the status of all renders please use the 'Get Dubbing Resource' endpoint. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language : str + The target language code to render, eg. 'es'. To render the source track use 'original'. + + render_type : RenderType + The type of the render. One of ['mp4', 'aac', 'mp3', 'wav', 'aaf', 'tracks_zip', 'clips_zip'] + + normalize_volume : typing.Optional[bool] + Whether to normalize the volume of the rendered audio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingRenderResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/render/{jsonable_encoder(language)}", + method="POST", + json={ + "render_type": render_type, + "normalize_volume": normalize_volume, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingRenderResponseModel, + construct_type( + type_=DubbingRenderResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawResourceClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, dubbing_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DubbingResource]: + """ + Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingResource] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingResource, + construct_type( + type_=DubbingResource, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def migrate_segments( + self, + dubbing_id: str, + *, + segment_ids: typing.Sequence[str], + speaker_id: str, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SegmentMigrationResponse]: + """ + Change the attribution of one or more segments to a different speaker. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_ids : typing.Sequence[str] + + speaker_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentMigrationResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/migrate-segments", + method="POST", + json={ + "segment_ids": segment_ids, + "speaker_id": speaker_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentMigrationResponse, + construct_type( + type_=SegmentMigrationResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def transcribe( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SegmentTranscriptionResponse]: + """ + Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Transcribe this specific list of segments. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentTranscriptionResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/transcribe", + method="POST", + json={ + "segments": segments, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentTranscriptionResponse, + construct_type( + type_=SegmentTranscriptionResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def translate( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SegmentTranslationResponse]: + """ + Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Translate only this list of segments. + + languages : typing.Optional[typing.Sequence[str]] + Translate only these languages for each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentTranslationResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/translate", + method="POST", + json={ + "segments": segments, + "languages": languages, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentTranslationResponse, + construct_type( + type_=SegmentTranslationResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def dub( + self, + dubbing_id: str, + *, + segments: typing.Sequence[str], + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SegmentDubResponse]: + """ + Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segments : typing.Sequence[str] + Dub only this list of segments. + + languages : typing.Optional[typing.Sequence[str]] + Dub only these languages for each segment. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentDubResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/dub", + method="POST", + json={ + "segments": segments, + "languages": languages, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentDubResponse, + construct_type( + type_=SegmentDubResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def render( + self, + dubbing_id: str, + language: str, + *, + render_type: RenderType, + normalize_volume: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingRenderResponseModel]: + """ + Regenerate the output media for a language using the latest Studio state. Please ensure all segments have been dubbed before rendering, otherwise they will be omitted. Renders are generated asynchronously, and to check the status of all renders please use the 'Get Dubbing Resource' endpoint. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language : str + The target language code to render, eg. 'es'. To render the source track use 'original'. + + render_type : RenderType + The type of the render. One of ['mp4', 'aac', 'mp3', 'wav', 'aaf', 'tracks_zip', 'clips_zip'] + + normalize_volume : typing.Optional[bool] + Whether to normalize the volume of the rendered audio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingRenderResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/render/{jsonable_encoder(language)}", + method="POST", + json={ + "render_type": render_type, + "normalize_volume": normalize_volume, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingRenderResponseModel, + construct_type( + type_=DubbingRenderResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/resource/segment/__init__.py b/data/src/elevenlabs/dubbing/resource/segment/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/segment/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/dubbing/resource/segment/client.py b/data/src/elevenlabs/dubbing/resource/segment/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a6fcda0576dab5d3cd0a885a04cf5f7113c1ad2d --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/segment/client.py @@ -0,0 +1,260 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.segment_delete_response import SegmentDeleteResponse +from ....types.segment_update_response import SegmentUpdateResponse +from .raw_client import AsyncRawSegmentClient, RawSegmentClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SegmentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSegmentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSegmentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSegmentClient + """ + return self._raw_client + + def update( + self, + dubbing_id: str, + segment_id: str, + language: str, + *, + start_time: typing.Optional[float] = OMIT, + end_time: typing.Optional[float] = OMIT, + text: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentUpdateResponse: + """ + Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_id : str + ID of the segment + + language : str + ID of the language. + + start_time : typing.Optional[float] + + end_time : typing.Optional[float] + + text : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.segment.update( + dubbing_id="dubbing_id", + segment_id="segment_id", + language="language", + ) + """ + _response = self._raw_client.update( + dubbing_id, + segment_id, + language, + start_time=start_time, + end_time=end_time, + text=text, + request_options=request_options, + ) + return _response.data + + def delete( + self, dubbing_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SegmentDeleteResponse: + """ + Deletes a single segment from the dubbing. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_id : str + ID of the segment + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentDeleteResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.segment.delete( + dubbing_id="dubbing_id", + segment_id="segment_id", + ) + """ + _response = self._raw_client.delete(dubbing_id, segment_id, request_options=request_options) + return _response.data + + +class AsyncSegmentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSegmentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSegmentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSegmentClient + """ + return self._raw_client + + async def update( + self, + dubbing_id: str, + segment_id: str, + language: str, + *, + start_time: typing.Optional[float] = OMIT, + end_time: typing.Optional[float] = OMIT, + text: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentUpdateResponse: + """ + Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_id : str + ID of the segment + + language : str + ID of the language. + + start_time : typing.Optional[float] + + end_time : typing.Optional[float] + + text : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.segment.update( + dubbing_id="dubbing_id", + segment_id="segment_id", + language="language", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + dubbing_id, + segment_id, + language, + start_time=start_time, + end_time=end_time, + text=text, + request_options=request_options, + ) + return _response.data + + async def delete( + self, dubbing_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SegmentDeleteResponse: + """ + Deletes a single segment from the dubbing. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_id : str + ID of the segment + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentDeleteResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.segment.delete( + dubbing_id="dubbing_id", + segment_id="segment_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(dubbing_id, segment_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/dubbing/resource/segment/raw_client.py b/data/src/elevenlabs/dubbing/resource/segment/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8f8184d1fa9927f9f9890ed898dfab1ad2941bf8 --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/segment/raw_client.py @@ -0,0 +1,309 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.segment_delete_response import SegmentDeleteResponse +from ....types.segment_update_response import SegmentUpdateResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSegmentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def update( + self, + dubbing_id: str, + segment_id: str, + language: str, + *, + start_time: typing.Optional[float] = OMIT, + end_time: typing.Optional[float] = OMIT, + text: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SegmentUpdateResponse]: + """ + Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_id : str + ID of the segment + + language : str + ID of the language. + + start_time : typing.Optional[float] + + end_time : typing.Optional[float] + + text : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/segment/{jsonable_encoder(segment_id)}/{jsonable_encoder(language)}", + method="PATCH", + json={ + "start_time": start_time, + "end_time": end_time, + "text": text, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentUpdateResponse, + construct_type( + type_=SegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, dubbing_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SegmentDeleteResponse]: + """ + Deletes a single segment from the dubbing. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_id : str + ID of the segment + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentDeleteResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/segment/{jsonable_encoder(segment_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentDeleteResponse, + construct_type( + type_=SegmentDeleteResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSegmentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def update( + self, + dubbing_id: str, + segment_id: str, + language: str, + *, + start_time: typing.Optional[float] = OMIT, + end_time: typing.Optional[float] = OMIT, + text: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SegmentUpdateResponse]: + """ + Modifies a single segment with new text and/or start/end times. Will update the values for only a specific language of a segment. Does not automatically regenerate the dub. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_id : str + ID of the segment + + language : str + ID of the language. + + start_time : typing.Optional[float] + + end_time : typing.Optional[float] + + text : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/segment/{jsonable_encoder(segment_id)}/{jsonable_encoder(language)}", + method="PATCH", + json={ + "start_time": start_time, + "end_time": end_time, + "text": text, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentUpdateResponse, + construct_type( + type_=SegmentUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, dubbing_id: str, segment_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SegmentDeleteResponse]: + """ + Deletes a single segment from the dubbing. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + segment_id : str + ID of the segment + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentDeleteResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/segment/{jsonable_encoder(segment_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentDeleteResponse, + construct_type( + type_=SegmentDeleteResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/resource/speaker/__init__.py b/data/src/elevenlabs/dubbing/resource/speaker/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0f567a06b3e80a45b1e77d529b338debe5f37d2e --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/speaker/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import segment +_dynamic_imports: typing.Dict[str, str] = {"segment": ".segment"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["segment"] diff --git a/data/src/elevenlabs/dubbing/resource/speaker/client.py b/data/src/elevenlabs/dubbing/resource/speaker/client.py new file mode 100644 index 0000000000000000000000000000000000000000..15291cab162726756119e235aae61601fda7db4c --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/speaker/client.py @@ -0,0 +1,445 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.similar_voices_for_speaker_response import SimilarVoicesForSpeakerResponse +from ....types.speaker_created_response import SpeakerCreatedResponse +from ....types.speaker_updated_response import SpeakerUpdatedResponse +from .raw_client import AsyncRawSpeakerClient, RawSpeakerClient + +if typing.TYPE_CHECKING: + from .segment.client import AsyncSegmentClient, SegmentClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SpeakerClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSpeakerClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._segment: typing.Optional[SegmentClient] = None + + @property + def with_raw_response(self) -> RawSpeakerClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSpeakerClient + """ + return self._raw_client + + def update( + self, + dubbing_id: str, + speaker_id: str, + *, + speaker_name: typing.Optional[str] = OMIT, + voice_id: typing.Optional[str] = OMIT, + voice_stability: typing.Optional[float] = OMIT, + voice_similarity: typing.Optional[float] = OMIT, + voice_style: typing.Optional[float] = OMIT, + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeakerUpdatedResponse: + """ + Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + speaker_name : typing.Optional[str] + Name to attribute to this speaker. + + voice_id : typing.Optional[str] + Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + + voice_stability : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + + voice_similarity : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + voice_style : typing.Optional[float] + For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + languages : typing.Optional[typing.Sequence[str]] + Languages to apply these changes to. If empty, will apply to all languages. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeakerUpdatedResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.speaker.update( + dubbing_id="dubbing_id", + speaker_id="speaker_id", + ) + """ + _response = self._raw_client.update( + dubbing_id, + speaker_id, + speaker_name=speaker_name, + voice_id=voice_id, + voice_stability=voice_stability, + voice_similarity=voice_similarity, + voice_style=voice_style, + languages=languages, + request_options=request_options, + ) + return _response.data + + def create( + self, + dubbing_id: str, + *, + speaker_name: typing.Optional[str] = OMIT, + voice_id: typing.Optional[str] = OMIT, + voice_stability: typing.Optional[float] = OMIT, + voice_similarity: typing.Optional[float] = OMIT, + voice_style: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeakerCreatedResponse: + """ + Creates a new speaker in a dubbing resource. The speaker is added to every available language and can optionally be associated with an ElevenLabs voice and voice settings. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_name : typing.Optional[str] + Name to attribute to this speaker. + + voice_id : typing.Optional[str] + Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + + voice_stability : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + + voice_similarity : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + voice_style : typing.Optional[float] + For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeakerCreatedResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.speaker.create( + dubbing_id="dubbing_id", + ) + """ + _response = self._raw_client.create( + dubbing_id, + speaker_name=speaker_name, + voice_id=voice_id, + voice_stability=voice_stability, + voice_similarity=voice_similarity, + voice_style=voice_style, + request_options=request_options, + ) + return _response.data + + def find_similar_voices( + self, dubbing_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SimilarVoicesForSpeakerResponse: + """ + Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SimilarVoicesForSpeakerResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.speaker.find_similar_voices( + dubbing_id="dubbing_id", + speaker_id="speaker_id", + ) + """ + _response = self._raw_client.find_similar_voices(dubbing_id, speaker_id, request_options=request_options) + return _response.data + + @property + def segment(self): + if self._segment is None: + from .segment.client import SegmentClient # noqa: E402 + + self._segment = SegmentClient(client_wrapper=self._client_wrapper) + return self._segment + + +class AsyncSpeakerClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSpeakerClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._segment: typing.Optional[AsyncSegmentClient] = None + + @property + def with_raw_response(self) -> AsyncRawSpeakerClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSpeakerClient + """ + return self._raw_client + + async def update( + self, + dubbing_id: str, + speaker_id: str, + *, + speaker_name: typing.Optional[str] = OMIT, + voice_id: typing.Optional[str] = OMIT, + voice_stability: typing.Optional[float] = OMIT, + voice_similarity: typing.Optional[float] = OMIT, + voice_style: typing.Optional[float] = OMIT, + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeakerUpdatedResponse: + """ + Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + speaker_name : typing.Optional[str] + Name to attribute to this speaker. + + voice_id : typing.Optional[str] + Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + + voice_stability : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + + voice_similarity : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + voice_style : typing.Optional[float] + For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + languages : typing.Optional[typing.Sequence[str]] + Languages to apply these changes to. If empty, will apply to all languages. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeakerUpdatedResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.speaker.update( + dubbing_id="dubbing_id", + speaker_id="speaker_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + dubbing_id, + speaker_id, + speaker_name=speaker_name, + voice_id=voice_id, + voice_stability=voice_stability, + voice_similarity=voice_similarity, + voice_style=voice_style, + languages=languages, + request_options=request_options, + ) + return _response.data + + async def create( + self, + dubbing_id: str, + *, + speaker_name: typing.Optional[str] = OMIT, + voice_id: typing.Optional[str] = OMIT, + voice_stability: typing.Optional[float] = OMIT, + voice_similarity: typing.Optional[float] = OMIT, + voice_style: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeakerCreatedResponse: + """ + Creates a new speaker in a dubbing resource. The speaker is added to every available language and can optionally be associated with an ElevenLabs voice and voice settings. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_name : typing.Optional[str] + Name to attribute to this speaker. + + voice_id : typing.Optional[str] + Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + + voice_stability : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + + voice_similarity : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + voice_style : typing.Optional[float] + For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeakerCreatedResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.speaker.create( + dubbing_id="dubbing_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + dubbing_id, + speaker_name=speaker_name, + voice_id=voice_id, + voice_stability=voice_stability, + voice_similarity=voice_similarity, + voice_style=voice_style, + request_options=request_options, + ) + return _response.data + + async def find_similar_voices( + self, dubbing_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SimilarVoicesForSpeakerResponse: + """ + Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SimilarVoicesForSpeakerResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.speaker.find_similar_voices( + dubbing_id="dubbing_id", + speaker_id="speaker_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.find_similar_voices(dubbing_id, speaker_id, request_options=request_options) + return _response.data + + @property + def segment(self): + if self._segment is None: + from .segment.client import AsyncSegmentClient # noqa: E402 + + self._segment = AsyncSegmentClient(client_wrapper=self._client_wrapper) + return self._segment diff --git a/data/src/elevenlabs/dubbing/resource/speaker/raw_client.py b/data/src/elevenlabs/dubbing/resource/speaker/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..35f13714a02b111c1908379f723cc5329d609fd0 --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/speaker/raw_client.py @@ -0,0 +1,514 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.similar_voices_for_speaker_response import SimilarVoicesForSpeakerResponse +from ....types.speaker_created_response import SpeakerCreatedResponse +from ....types.speaker_updated_response import SpeakerUpdatedResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSpeakerClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def update( + self, + dubbing_id: str, + speaker_id: str, + *, + speaker_name: typing.Optional[str] = OMIT, + voice_id: typing.Optional[str] = OMIT, + voice_stability: typing.Optional[float] = OMIT, + voice_similarity: typing.Optional[float] = OMIT, + voice_style: typing.Optional[float] = OMIT, + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SpeakerUpdatedResponse]: + """ + Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + speaker_name : typing.Optional[str] + Name to attribute to this speaker. + + voice_id : typing.Optional[str] + Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + + voice_stability : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + + voice_similarity : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + voice_style : typing.Optional[float] + For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + languages : typing.Optional[typing.Sequence[str]] + Languages to apply these changes to. If empty, will apply to all languages. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeakerUpdatedResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}", + method="PATCH", + json={ + "speaker_name": speaker_name, + "voice_id": voice_id, + "voice_stability": voice_stability, + "voice_similarity": voice_similarity, + "voice_style": voice_style, + "languages": languages, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeakerUpdatedResponse, + construct_type( + type_=SpeakerUpdatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + dubbing_id: str, + *, + speaker_name: typing.Optional[str] = OMIT, + voice_id: typing.Optional[str] = OMIT, + voice_stability: typing.Optional[float] = OMIT, + voice_similarity: typing.Optional[float] = OMIT, + voice_style: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SpeakerCreatedResponse]: + """ + Creates a new speaker in a dubbing resource. The speaker is added to every available language and can optionally be associated with an ElevenLabs voice and voice settings. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_name : typing.Optional[str] + Name to attribute to this speaker. + + voice_id : typing.Optional[str] + Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + + voice_stability : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + + voice_similarity : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + voice_style : typing.Optional[float] + For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeakerCreatedResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker", + method="POST", + json={ + "speaker_name": speaker_name, + "voice_id": voice_id, + "voice_stability": voice_stability, + "voice_similarity": voice_similarity, + "voice_style": voice_style, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeakerCreatedResponse, + construct_type( + type_=SpeakerCreatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def find_similar_voices( + self, dubbing_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SimilarVoicesForSpeakerResponse]: + """ + Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SimilarVoicesForSpeakerResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}/similar-voices", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SimilarVoicesForSpeakerResponse, + construct_type( + type_=SimilarVoicesForSpeakerResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSpeakerClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def update( + self, + dubbing_id: str, + speaker_id: str, + *, + speaker_name: typing.Optional[str] = OMIT, + voice_id: typing.Optional[str] = OMIT, + voice_stability: typing.Optional[float] = OMIT, + voice_similarity: typing.Optional[float] = OMIT, + voice_style: typing.Optional[float] = OMIT, + languages: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SpeakerUpdatedResponse]: + """ + Amend the metadata associated with a speaker, such as their voice. Both voice cloning and using voices from the ElevenLabs library are supported. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + speaker_name : typing.Optional[str] + Name to attribute to this speaker. + + voice_id : typing.Optional[str] + Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + + voice_stability : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + + voice_similarity : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + voice_style : typing.Optional[float] + For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + languages : typing.Optional[typing.Sequence[str]] + Languages to apply these changes to. If empty, will apply to all languages. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeakerUpdatedResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}", + method="PATCH", + json={ + "speaker_name": speaker_name, + "voice_id": voice_id, + "voice_stability": voice_stability, + "voice_similarity": voice_similarity, + "voice_style": voice_style, + "languages": languages, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeakerUpdatedResponse, + construct_type( + type_=SpeakerUpdatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + dubbing_id: str, + *, + speaker_name: typing.Optional[str] = OMIT, + voice_id: typing.Optional[str] = OMIT, + voice_stability: typing.Optional[float] = OMIT, + voice_similarity: typing.Optional[float] = OMIT, + voice_style: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SpeakerCreatedResponse]: + """ + Creates a new speaker in a dubbing resource. The speaker is added to every available language and can optionally be associated with an ElevenLabs voice and voice settings. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_name : typing.Optional[str] + Name to attribute to this speaker. + + voice_id : typing.Optional[str] + Either the identifier of a voice from the ElevenLabs voice library, or one of ['track-clone', 'clip-clone']. + + voice_stability : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 0.65, with a valid range of [0.0, 1.0]. + + voice_similarity : typing.Optional[float] + For models that support it, the voice similarity value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + voice_style : typing.Optional[float] + For models that support it, the voice style value to use. This will default to 1.0, with a valid range of [0.0, 1.0]. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeakerCreatedResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker", + method="POST", + json={ + "speaker_name": speaker_name, + "voice_id": voice_id, + "voice_stability": voice_stability, + "voice_similarity": voice_similarity, + "voice_style": voice_style, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeakerCreatedResponse, + construct_type( + type_=SpeakerCreatedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def find_similar_voices( + self, dubbing_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SimilarVoicesForSpeakerResponse]: + """ + Fetch the top 10 similar voices to a speaker, including the voice IDs, names, descriptions, and, where possible, a sample audio recording. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SimilarVoicesForSpeakerResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}/similar-voices", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SimilarVoicesForSpeakerResponse, + construct_type( + type_=SimilarVoicesForSpeakerResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/resource/speaker/segment/__init__.py b/data/src/elevenlabs/dubbing/resource/speaker/segment/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/speaker/segment/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/dubbing/resource/speaker/segment/client.py b/data/src/elevenlabs/dubbing/resource/speaker/segment/client.py new file mode 100644 index 0000000000000000000000000000000000000000..5996fec9b784575ae7ea5c055fe1cc5535c32606 --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/speaker/segment/client.py @@ -0,0 +1,177 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.segment_create_response import SegmentCreateResponse +from .raw_client import AsyncRawSegmentClient, RawSegmentClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SegmentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSegmentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSegmentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSegmentClient + """ + return self._raw_client + + def create( + self, + dubbing_id: str, + speaker_id: str, + *, + start_time: float, + end_time: float, + text: typing.Optional[str] = OMIT, + translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentCreateResponse: + """ + Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + start_time : float + + end_time : float + + text : typing.Optional[str] + + translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentCreateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.resource.speaker.segment.create( + dubbing_id="dubbing_id", + speaker_id="speaker_id", + start_time=1.1, + end_time=1.1, + ) + """ + _response = self._raw_client.create( + dubbing_id, + speaker_id, + start_time=start_time, + end_time=end_time, + text=text, + translations=translations, + request_options=request_options, + ) + return _response.data + + +class AsyncSegmentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSegmentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSegmentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSegmentClient + """ + return self._raw_client + + async def create( + self, + dubbing_id: str, + speaker_id: str, + *, + start_time: float, + end_time: float, + text: typing.Optional[str] = OMIT, + translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SegmentCreateResponse: + """ + Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + start_time : float + + end_time : float + + text : typing.Optional[str] + + translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SegmentCreateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.resource.speaker.segment.create( + dubbing_id="dubbing_id", + speaker_id="speaker_id", + start_time=1.1, + end_time=1.1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + dubbing_id, + speaker_id, + start_time=start_time, + end_time=end_time, + text=text, + translations=translations, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/dubbing/resource/speaker/segment/raw_client.py b/data/src/elevenlabs/dubbing/resource/speaker/segment/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..77a244e8aa12b96b9a4cfa70af7a1ac83cf79853 --- /dev/null +++ b/data/src/elevenlabs/dubbing/resource/speaker/segment/raw_client.py @@ -0,0 +1,194 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.segment_create_response import SegmentCreateResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSegmentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + dubbing_id: str, + speaker_id: str, + *, + start_time: float, + end_time: float, + text: typing.Optional[str] = OMIT, + translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SegmentCreateResponse]: + """ + Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + start_time : float + + end_time : float + + text : typing.Optional[str] + + translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SegmentCreateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}/segment", + method="POST", + json={ + "start_time": start_time, + "end_time": end_time, + "text": text, + "translations": translations, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentCreateResponse, + construct_type( + type_=SegmentCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSegmentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + dubbing_id: str, + speaker_id: str, + *, + start_time: float, + end_time: float, + text: typing.Optional[str] = OMIT, + translations: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SegmentCreateResponse]: + """ + Creates a new segment in dubbing resource with a start and end time for the speaker in every available language. Does not automatically generate transcripts/translations/audio. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + speaker_id : str + ID of the speaker. + + start_time : float + + end_time : float + + text : typing.Optional[str] + + translations : typing.Optional[typing.Dict[str, typing.Optional[str]]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SegmentCreateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/resource/{jsonable_encoder(dubbing_id)}/speaker/{jsonable_encoder(speaker_id)}/segment", + method="POST", + json={ + "start_time": start_time, + "end_time": end_time, + "text": text, + "translations": translations, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SegmentCreateResponse, + construct_type( + type_=SegmentCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/transcript/__init__.py b/data/src/elevenlabs/dubbing/transcript/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..aae8fc15eed7639532014941709638d522d62aba --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcript/__init__.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import TranscriptGetTranscriptForDubRequestFormatType, TranscriptGetTranscriptForDubResponse +_dynamic_imports: typing.Dict[str, str] = { + "TranscriptGetTranscriptForDubRequestFormatType": ".types", + "TranscriptGetTranscriptForDubResponse": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TranscriptGetTranscriptForDubRequestFormatType", "TranscriptGetTranscriptForDubResponse"] diff --git a/data/src/elevenlabs/dubbing/transcript/client.py b/data/src/elevenlabs/dubbing/transcript/client.py new file mode 100644 index 0000000000000000000000000000000000000000..8e98cc0369501f8ae9dc8042859ad6eadef0004e --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcript/client.py @@ -0,0 +1,145 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from .raw_client import AsyncRawTranscriptClient, RawTranscriptClient +from .types.transcript_get_transcript_for_dub_request_format_type import TranscriptGetTranscriptForDubRequestFormatType +from .types.transcript_get_transcript_for_dub_response import TranscriptGetTranscriptForDubResponse + + +class TranscriptClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTranscriptClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTranscriptClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTranscriptClient + """ + return self._raw_client + + def get_transcript_for_dub( + self, + dubbing_id: str, + language_code: str, + *, + format_type: typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TranscriptGetTranscriptForDubResponse: + """ + Returns transcript for the dub as an SRT or WEBVTT file. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + + format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] + Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TranscriptGetTranscriptForDubResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.transcript.get_transcript_for_dub( + dubbing_id="dubbing_id", + language_code="source", + format_type="srt", + ) + """ + _response = self._raw_client.get_transcript_for_dub( + dubbing_id, language_code, format_type=format_type, request_options=request_options + ) + return _response.data + + +class AsyncTranscriptClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTranscriptClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTranscriptClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTranscriptClient + """ + return self._raw_client + + async def get_transcript_for_dub( + self, + dubbing_id: str, + language_code: str, + *, + format_type: typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TranscriptGetTranscriptForDubResponse: + """ + Returns transcript for the dub as an SRT or WEBVTT file. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + + format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] + Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TranscriptGetTranscriptForDubResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.transcript.get_transcript_for_dub( + dubbing_id="dubbing_id", + language_code="source", + format_type="srt", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_transcript_for_dub( + dubbing_id, language_code, format_type=format_type, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/dubbing/transcript/raw_client.py b/data/src/elevenlabs/dubbing/transcript/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..08728b64108c6a526ad3aa7f84076c01f71f3788 --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcript/raw_client.py @@ -0,0 +1,231 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.forbidden_error import ForbiddenError +from ...errors.not_found_error import NotFoundError +from ...errors.too_early_error import TooEarlyError +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from .types.transcript_get_transcript_for_dub_request_format_type import TranscriptGetTranscriptForDubRequestFormatType +from .types.transcript_get_transcript_for_dub_response import TranscriptGetTranscriptForDubResponse +from pydantic import ValidationError + + +class RawTranscriptClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_transcript_for_dub( + self, + dubbing_id: str, + language_code: str, + *, + format_type: typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TranscriptGetTranscriptForDubResponse]: + """ + Returns transcript for the dub as an SRT or WEBVTT file. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + + format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] + Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TranscriptGetTranscriptForDubResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}/transcript/{jsonable_encoder(language_code)}", + method="GET", + params={ + "format_type": format_type, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TranscriptGetTranscriptForDubResponse, + construct_type( + type_=TranscriptGetTranscriptForDubResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 425: + raise TooEarlyError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTranscriptClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_transcript_for_dub( + self, + dubbing_id: str, + language_code: str, + *, + format_type: typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TranscriptGetTranscriptForDubResponse]: + """ + Returns transcript for the dub as an SRT or WEBVTT file. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + + format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType] + Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TranscriptGetTranscriptForDubResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}/transcript/{jsonable_encoder(language_code)}", + method="GET", + params={ + "format_type": format_type, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TranscriptGetTranscriptForDubResponse, + construct_type( + type_=TranscriptGetTranscriptForDubResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 425: + raise TooEarlyError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/transcript/types/__init__.py b/data/src/elevenlabs/dubbing/transcript/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0d3a7f904204478c99b269021f38325c484da40d --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcript/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .transcript_get_transcript_for_dub_request_format_type import TranscriptGetTranscriptForDubRequestFormatType + from .transcript_get_transcript_for_dub_response import TranscriptGetTranscriptForDubResponse +_dynamic_imports: typing.Dict[str, str] = { + "TranscriptGetTranscriptForDubRequestFormatType": ".transcript_get_transcript_for_dub_request_format_type", + "TranscriptGetTranscriptForDubResponse": ".transcript_get_transcript_for_dub_response", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TranscriptGetTranscriptForDubRequestFormatType", "TranscriptGetTranscriptForDubResponse"] diff --git a/data/src/elevenlabs/dubbing/transcript/types/transcript_get_transcript_for_dub_request_format_type.py b/data/src/elevenlabs/dubbing/transcript/types/transcript_get_transcript_for_dub_request_format_type.py new file mode 100644 index 0000000000000000000000000000000000000000..a7e334e1569dd495ead342f8928a2c11804bc6da --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcript/types/transcript_get_transcript_for_dub_request_format_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TranscriptGetTranscriptForDubRequestFormatType = typing.Union[typing.Literal["srt", "webvtt", "json"], typing.Any] diff --git a/data/src/elevenlabs/dubbing/transcript/types/transcript_get_transcript_for_dub_response.py b/data/src/elevenlabs/dubbing/transcript/types/transcript_get_transcript_for_dub_response.py new file mode 100644 index 0000000000000000000000000000000000000000..386639087a7235890950dbd60a543bad2f4e1be7 --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcript/types/transcript_get_transcript_for_dub_response.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.dubbing_transcript_response_model import DubbingTranscriptResponseModel + +TranscriptGetTranscriptForDubResponse = typing.Union[DubbingTranscriptResponseModel, str] diff --git a/data/src/elevenlabs/dubbing/transcripts/__init__.py b/data/src/elevenlabs/dubbing/transcripts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bd875a7511044149358df15cd3a324e6bb83f57c --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcripts/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import TranscriptsGetRequestFormatType +_dynamic_imports: typing.Dict[str, str] = {"TranscriptsGetRequestFormatType": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TranscriptsGetRequestFormatType"] diff --git a/data/src/elevenlabs/dubbing/transcripts/client.py b/data/src/elevenlabs/dubbing/transcripts/client.py new file mode 100644 index 0000000000000000000000000000000000000000..b98eb5dd0bfb224b3a15fe4f09ecd0b85b44291c --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcripts/client.py @@ -0,0 +1,141 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.dubbing_transcripts_response_model import DubbingTranscriptsResponseModel +from .raw_client import AsyncRawTranscriptsClient, RawTranscriptsClient +from .types.transcripts_get_request_format_type import TranscriptsGetRequestFormatType + + +class TranscriptsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTranscriptsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTranscriptsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTranscriptsClient + """ + return self._raw_client + + def get( + self, + dubbing_id: str, + language_code: str, + format_type: TranscriptsGetRequestFormatType, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingTranscriptsResponseModel: + """ + Fetch the transcript for one of the languages in a dub. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + + format_type : TranscriptsGetRequestFormatType + Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingTranscriptsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.dubbing.transcripts.get( + dubbing_id="dubbing_id", + language_code="source", + format_type="srt", + ) + """ + _response = self._raw_client.get(dubbing_id, language_code, format_type, request_options=request_options) + return _response.data + + +class AsyncTranscriptsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTranscriptsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTranscriptsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTranscriptsClient + """ + return self._raw_client + + async def get( + self, + dubbing_id: str, + language_code: str, + format_type: TranscriptsGetRequestFormatType, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> DubbingTranscriptsResponseModel: + """ + Fetch the transcript for one of the languages in a dub. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + + format_type : TranscriptsGetRequestFormatType + Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DubbingTranscriptsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.dubbing.transcripts.get( + dubbing_id="dubbing_id", + language_code="source", + format_type="srt", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(dubbing_id, language_code, format_type, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/dubbing/transcripts/raw_client.py b/data/src/elevenlabs/dubbing/transcripts/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..37e0bb009944f89b8391b9932b560356c0643d13 --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcripts/raw_client.py @@ -0,0 +1,156 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.dubbing_transcripts_response_model import DubbingTranscriptsResponseModel +from .types.transcripts_get_request_format_type import TranscriptsGetRequestFormatType +from pydantic import ValidationError + + +class RawTranscriptsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + dubbing_id: str, + language_code: str, + format_type: TranscriptsGetRequestFormatType, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[DubbingTranscriptsResponseModel]: + """ + Fetch the transcript for one of the languages in a dub. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + + format_type : TranscriptsGetRequestFormatType + Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DubbingTranscriptsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}/transcripts/{jsonable_encoder(language_code)}/format/{jsonable_encoder(format_type)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingTranscriptsResponseModel, + construct_type( + type_=DubbingTranscriptsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTranscriptsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + dubbing_id: str, + language_code: str, + format_type: TranscriptsGetRequestFormatType, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[DubbingTranscriptsResponseModel]: + """ + Fetch the transcript for one of the languages in a dub. + + Parameters + ---------- + dubbing_id : str + ID of the dubbing project. + + language_code : str + ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media. + + format_type : TranscriptsGetRequestFormatType + Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DubbingTranscriptsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/dubbing/{jsonable_encoder(dubbing_id)}/transcripts/{jsonable_encoder(language_code)}/format/{jsonable_encoder(format_type)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DubbingTranscriptsResponseModel, + construct_type( + type_=DubbingTranscriptsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/dubbing/transcripts/types/__init__.py b/data/src/elevenlabs/dubbing/transcripts/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d1811cfe5352cef7c17a4771aa2e39c9d0229ed3 --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcripts/types/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .transcripts_get_request_format_type import TranscriptsGetRequestFormatType +_dynamic_imports: typing.Dict[str, str] = {"TranscriptsGetRequestFormatType": ".transcripts_get_request_format_type"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TranscriptsGetRequestFormatType"] diff --git a/data/src/elevenlabs/dubbing/transcripts/types/transcripts_get_request_format_type.py b/data/src/elevenlabs/dubbing/transcripts/types/transcripts_get_request_format_type.py new file mode 100644 index 0000000000000000000000000000000000000000..2677aa1881662a1b637cce0320dfc958b4380a37 --- /dev/null +++ b/data/src/elevenlabs/dubbing/transcripts/types/transcripts_get_request_format_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TranscriptsGetRequestFormatType = typing.Union[typing.Literal["srt", "webvtt", "json"], typing.Any] diff --git a/data/src/elevenlabs/dubbing/types/__init__.py b/data/src/elevenlabs/dubbing/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2824c3f8803f3a79ddfa42735792d566ebabcbc5 --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/__init__.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .dub_request_mode import DubRequestMode + from .dubbing_list_request_creation_sources_item import DubbingListRequestCreationSourcesItem + from .dubbing_list_request_dubbing_models_item import DubbingListRequestDubbingModelsItem + from .dubbing_list_request_dubbing_status import DubbingListRequestDubbingStatus + from .dubbing_list_request_dubbing_statuses_item import DubbingListRequestDubbingStatusesItem + from .dubbing_list_request_filter_by_creator import DubbingListRequestFilterByCreator + from .dubbing_list_request_order_by import DubbingListRequestOrderBy + from .dubbing_list_request_order_direction import DubbingListRequestOrderDirection +_dynamic_imports: typing.Dict[str, str] = { + "DubRequestMode": ".dub_request_mode", + "DubbingListRequestCreationSourcesItem": ".dubbing_list_request_creation_sources_item", + "DubbingListRequestDubbingModelsItem": ".dubbing_list_request_dubbing_models_item", + "DubbingListRequestDubbingStatus": ".dubbing_list_request_dubbing_status", + "DubbingListRequestDubbingStatusesItem": ".dubbing_list_request_dubbing_statuses_item", + "DubbingListRequestFilterByCreator": ".dubbing_list_request_filter_by_creator", + "DubbingListRequestOrderBy": ".dubbing_list_request_order_by", + "DubbingListRequestOrderDirection": ".dubbing_list_request_order_direction", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "DubRequestMode", + "DubbingListRequestCreationSourcesItem", + "DubbingListRequestDubbingModelsItem", + "DubbingListRequestDubbingStatus", + "DubbingListRequestDubbingStatusesItem", + "DubbingListRequestFilterByCreator", + "DubbingListRequestOrderBy", + "DubbingListRequestOrderDirection", +] diff --git a/data/src/elevenlabs/dubbing/types/dub_request_mode.py b/data/src/elevenlabs/dubbing/types/dub_request_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..cff36c6d9a8b1425b1b602a604fccf8094f7c386 --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/dub_request_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubRequestMode = typing.Union[typing.Literal["automatic", "manual"], typing.Any] diff --git a/data/src/elevenlabs/dubbing/types/dubbing_list_request_creation_sources_item.py b/data/src/elevenlabs/dubbing/types/dubbing_list_request_creation_sources_item.py new file mode 100644 index 0000000000000000000000000000000000000000..4d67996f6442b537f36bf7647f25918b7b1d88db --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/dubbing_list_request_creation_sources_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingListRequestCreationSourcesItem = typing.Union[ + typing.Literal["flow_node", "dubbing_ui", "dubbing_api"], typing.Any +] diff --git a/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_models_item.py b/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_models_item.py new file mode 100644 index 0000000000000000000000000000000000000000..cd51bfe0807d6601cde88ced055162ad411a5fed --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_models_item.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingListRequestDubbingModelsItem = typing.Union[typing.Literal["dubbing_v1", "dubbing_v2"], typing.Any] diff --git a/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_status.py b/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_status.py new file mode 100644 index 0000000000000000000000000000000000000000..6e15bec12f312db2e31301201ad46239906e3b9d --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingListRequestDubbingStatus = typing.Union[typing.Literal["dubbing", "dubbed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_statuses_item.py b/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_statuses_item.py new file mode 100644 index 0000000000000000000000000000000000000000..f477948190f9cdb0f7557eb499a44460c4e7243c --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/dubbing_list_request_dubbing_statuses_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingListRequestDubbingStatusesItem = typing.Union[ + typing.Literal["queued", "preparing", "dubbing", "dubbed", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/dubbing/types/dubbing_list_request_filter_by_creator.py b/data/src/elevenlabs/dubbing/types/dubbing_list_request_filter_by_creator.py new file mode 100644 index 0000000000000000000000000000000000000000..55cc941f8ba9b149bf1f722e9cc4da3f52ccc114 --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/dubbing_list_request_filter_by_creator.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingListRequestFilterByCreator = typing.Union[typing.Literal["personal", "others", "all"], typing.Any] diff --git a/data/src/elevenlabs/dubbing/types/dubbing_list_request_order_by.py b/data/src/elevenlabs/dubbing/types/dubbing_list_request_order_by.py new file mode 100644 index 0000000000000000000000000000000000000000..296b33e5a9183be77f0961375e800eb571921135 --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/dubbing_list_request_order_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingListRequestOrderBy = typing.Union[typing.Literal["created_at", "name"], typing.Any] diff --git a/data/src/elevenlabs/dubbing/types/dubbing_list_request_order_direction.py b/data/src/elevenlabs/dubbing/types/dubbing_list_request_order_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..06b05b2eef66024a6bc68e6db9aa90321e657a32 --- /dev/null +++ b/data/src/elevenlabs/dubbing/types/dubbing_list_request_order_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingListRequestOrderDirection = typing.Union[typing.Literal["DESCENDING", "ASCENDING"], typing.Any] diff --git a/data/src/elevenlabs/environment.py b/data/src/elevenlabs/environment.py new file mode 100644 index 0000000000000000000000000000000000000000..5ebdca4119faf5594eec150dc8354026c1e9af7d --- /dev/null +++ b/data/src/elevenlabs/environment.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum + + +class ElevenLabsEnvironment(enum.Enum): + PRODUCTION = "https://api.elevenlabs.io" + PRODUCTION_US = "https://api.us.elevenlabs.io" + PRODUCTION_EU = "https://api.eu.residency.elevenlabs.io" + PRODUCTION_INDIA = "https://api.in.residency.elevenlabs.io" + PRODUCTION_SINGAPORE = "https://api.sg.residency.elevenlabs.io" diff --git a/data/src/elevenlabs/environment_variables/__init__.py b/data/src/elevenlabs/environment_variables/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..83f0473a9d7e350a5aebffbe4a1557807cb436d7 --- /dev/null +++ b/data/src/elevenlabs/environment_variables/__init__.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + EnvironmentVariablesCreateRequestBody, + EnvironmentVariablesCreateRequestBody_AuthConnection, + EnvironmentVariablesCreateRequestBody_Secret, + EnvironmentVariablesCreateRequestBody_String, + EnvironmentVariablesListRequestType, + UpdateEnvironmentVariableRequestValuesValue, + ) +_dynamic_imports: typing.Dict[str, str] = { + "EnvironmentVariablesCreateRequestBody": ".types", + "EnvironmentVariablesCreateRequestBody_AuthConnection": ".types", + "EnvironmentVariablesCreateRequestBody_Secret": ".types", + "EnvironmentVariablesCreateRequestBody_String": ".types", + "EnvironmentVariablesListRequestType": ".types", + "UpdateEnvironmentVariableRequestValuesValue": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "EnvironmentVariablesCreateRequestBody", + "EnvironmentVariablesCreateRequestBody_AuthConnection", + "EnvironmentVariablesCreateRequestBody_Secret", + "EnvironmentVariablesCreateRequestBody_String", + "EnvironmentVariablesListRequestType", + "UpdateEnvironmentVariableRequestValuesValue", +] diff --git a/data/src/elevenlabs/environment_variables/client.py b/data/src/elevenlabs/environment_variables/client.py new file mode 100644 index 0000000000000000000000000000000000000000..24234fe6074da531f83a07a418cc277e6c777f59 --- /dev/null +++ b/data/src/elevenlabs/environment_variables/client.py @@ -0,0 +1,425 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.environment_variable_response import EnvironmentVariableResponse +from ..types.environment_variables_list_response import EnvironmentVariablesListResponse +from .raw_client import AsyncRawEnvironmentVariablesClient, RawEnvironmentVariablesClient +from .types.environment_variables_create_request_body import EnvironmentVariablesCreateRequestBody +from .types.environment_variables_list_request_type import EnvironmentVariablesListRequestType +from .types.update_environment_variable_request_values_value import UpdateEnvironmentVariableRequestValuesValue + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class EnvironmentVariablesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawEnvironmentVariablesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawEnvironmentVariablesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawEnvironmentVariablesClient + """ + return self._raw_client + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + label: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + type: typing.Optional[EnvironmentVariablesListRequestType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> EnvironmentVariablesListResponse: + """ + List all environment variables for the workspace with optional filtering + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor from previous response + + page_size : typing.Optional[int] + Number of items to return (1-100) + + label : typing.Optional[str] + Filter by exact label match + + environment : typing.Optional[str] + Filter to only return variables that have this environment. When specified, the values dict in the response will only contain this environment. + + type : typing.Optional[EnvironmentVariablesListRequestType] + Filter by variable type + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentVariablesListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.environment_variables.list( + cursor="cursor", + page_size=1, + label="label", + environment="environment", + type="string", + ) + """ + _response = self._raw_client.list( + cursor=cursor, + page_size=page_size, + label=label, + environment=environment, + type=type, + request_options=request_options, + ) + return _response.data + + def create( + self, *, request: EnvironmentVariablesCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> EnvironmentVariableResponse: + """ + Create a new environment variable for the workspace + + Parameters + ---------- + request : EnvironmentVariablesCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentVariableResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.environment_variables import ( + EnvironmentVariablesCreateRequestBody_String, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.environment_variables.create( + request=EnvironmentVariablesCreateRequestBody_String( + label="label", + values={"key": "value"}, + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def get( + self, env_var_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> EnvironmentVariableResponse: + """ + Get a specific environment variable by ID + + Parameters + ---------- + env_var_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentVariableResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.environment_variables.get( + env_var_id="env_var_id", + ) + """ + _response = self._raw_client.get(env_var_id, request_options=request_options) + return _response.data + + def update( + self, + env_var_id: str, + *, + values: typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]], + request_options: typing.Optional[RequestOptions] = None, + ) -> EnvironmentVariableResponse: + """ + Replace an environment variable's values. Use null to remove its value for an environment (except production); delete an environment with DELETE /v1/convai/environments/{environment}. + + Parameters + ---------- + env_var_id : str + + values : typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]] + Values to replace. Set to null to remove the value for an environment (except 'production'). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentVariableResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.environment_variables.update( + env_var_id="env_var_id", + values={}, + ) + """ + _response = self._raw_client.update(env_var_id, values=values, request_options=request_options) + return _response.data + + +class AsyncEnvironmentVariablesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawEnvironmentVariablesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawEnvironmentVariablesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawEnvironmentVariablesClient + """ + return self._raw_client + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + label: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + type: typing.Optional[EnvironmentVariablesListRequestType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> EnvironmentVariablesListResponse: + """ + List all environment variables for the workspace with optional filtering + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor from previous response + + page_size : typing.Optional[int] + Number of items to return (1-100) + + label : typing.Optional[str] + Filter by exact label match + + environment : typing.Optional[str] + Filter to only return variables that have this environment. When specified, the values dict in the response will only contain this environment. + + type : typing.Optional[EnvironmentVariablesListRequestType] + Filter by variable type + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentVariablesListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.environment_variables.list( + cursor="cursor", + page_size=1, + label="label", + environment="environment", + type="string", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, + page_size=page_size, + label=label, + environment=environment, + type=type, + request_options=request_options, + ) + return _response.data + + async def create( + self, *, request: EnvironmentVariablesCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> EnvironmentVariableResponse: + """ + Create a new environment variable for the workspace + + Parameters + ---------- + request : EnvironmentVariablesCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentVariableResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.environment_variables import ( + EnvironmentVariablesCreateRequestBody_String, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.environment_variables.create( + request=EnvironmentVariablesCreateRequestBody_String( + label="label", + values={"key": "value"}, + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def get( + self, env_var_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> EnvironmentVariableResponse: + """ + Get a specific environment variable by ID + + Parameters + ---------- + env_var_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentVariableResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.environment_variables.get( + env_var_id="env_var_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(env_var_id, request_options=request_options) + return _response.data + + async def update( + self, + env_var_id: str, + *, + values: typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]], + request_options: typing.Optional[RequestOptions] = None, + ) -> EnvironmentVariableResponse: + """ + Replace an environment variable's values. Use null to remove its value for an environment (except production); delete an environment with DELETE /v1/convai/environments/{environment}. + + Parameters + ---------- + env_var_id : str + + values : typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]] + Values to replace. Set to null to remove the value for an environment (except 'production'). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentVariableResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.environment_variables.update( + env_var_id="env_var_id", + values={}, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(env_var_id, values=values, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/environment_variables/raw_client.py b/data/src/elevenlabs/environment_variables/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d7bd414ccaebcc2825cc20f6e683ddcd5aca4403 --- /dev/null +++ b/data/src/elevenlabs/environment_variables/raw_client.py @@ -0,0 +1,696 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.conflict_error import ConflictError +from ..errors.not_found_error import NotFoundError +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.environment_variable_response import EnvironmentVariableResponse +from ..types.environment_variables_list_response import EnvironmentVariablesListResponse +from .types.environment_variables_create_request_body import EnvironmentVariablesCreateRequestBody +from .types.environment_variables_list_request_type import EnvironmentVariablesListRequestType +from .types.update_environment_variable_request_values_value import UpdateEnvironmentVariableRequestValuesValue +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawEnvironmentVariablesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + label: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + type: typing.Optional[EnvironmentVariablesListRequestType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[EnvironmentVariablesListResponse]: + """ + List all environment variables for the workspace with optional filtering + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor from previous response + + page_size : typing.Optional[int] + Number of items to return (1-100) + + label : typing.Optional[str] + Filter by exact label match + + environment : typing.Optional[str] + Filter to only return variables that have this environment. When specified, the values dict in the response will only contain this environment. + + type : typing.Optional[EnvironmentVariablesListRequestType] + Filter by variable type + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EnvironmentVariablesListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/environment-variables", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "label": label, + "environment": environment, + "type": type, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentVariablesListResponse, + construct_type( + type_=EnvironmentVariablesListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, request: EnvironmentVariablesCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[EnvironmentVariableResponse]: + """ + Create a new environment variable for the workspace + + Parameters + ---------- + request : EnvironmentVariablesCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EnvironmentVariableResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/environment-variables", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=EnvironmentVariablesCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentVariableResponse, + construct_type( + type_=EnvironmentVariableResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, env_var_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[EnvironmentVariableResponse]: + """ + Get a specific environment variable by ID + + Parameters + ---------- + env_var_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EnvironmentVariableResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/environment-variables/{jsonable_encoder(env_var_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentVariableResponse, + construct_type( + type_=EnvironmentVariableResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + env_var_id: str, + *, + values: typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[EnvironmentVariableResponse]: + """ + Replace an environment variable's values. Use null to remove its value for an environment (except production); delete an environment with DELETE /v1/convai/environments/{environment}. + + Parameters + ---------- + env_var_id : str + + values : typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]] + Values to replace. Set to null to remove the value for an environment (except 'production'). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EnvironmentVariableResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/environment-variables/{jsonable_encoder(env_var_id)}", + method="PATCH", + json={ + "values": convert_and_respect_annotation_metadata( + object_=values, + annotation=typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentVariableResponse, + construct_type( + type_=EnvironmentVariableResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawEnvironmentVariablesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + label: typing.Optional[str] = None, + environment: typing.Optional[str] = None, + type: typing.Optional[EnvironmentVariablesListRequestType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[EnvironmentVariablesListResponse]: + """ + List all environment variables for the workspace with optional filtering + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor from previous response + + page_size : typing.Optional[int] + Number of items to return (1-100) + + label : typing.Optional[str] + Filter by exact label match + + environment : typing.Optional[str] + Filter to only return variables that have this environment. When specified, the values dict in the response will only contain this environment. + + type : typing.Optional[EnvironmentVariablesListRequestType] + Filter by variable type + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EnvironmentVariablesListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/environment-variables", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "label": label, + "environment": environment, + "type": type, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentVariablesListResponse, + construct_type( + type_=EnvironmentVariablesListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, request: EnvironmentVariablesCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[EnvironmentVariableResponse]: + """ + Create a new environment variable for the workspace + + Parameters + ---------- + request : EnvironmentVariablesCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EnvironmentVariableResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/environment-variables", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=EnvironmentVariablesCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentVariableResponse, + construct_type( + type_=EnvironmentVariableResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, env_var_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[EnvironmentVariableResponse]: + """ + Get a specific environment variable by ID + + Parameters + ---------- + env_var_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EnvironmentVariableResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/environment-variables/{jsonable_encoder(env_var_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentVariableResponse, + construct_type( + type_=EnvironmentVariableResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + env_var_id: str, + *, + values: typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[EnvironmentVariableResponse]: + """ + Replace an environment variable's values. Use null to remove its value for an environment (except production); delete an environment with DELETE /v1/convai/environments/{environment}. + + Parameters + ---------- + env_var_id : str + + values : typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]] + Values to replace. Set to null to remove the value for an environment (except 'production'). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EnvironmentVariableResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/environment-variables/{jsonable_encoder(env_var_id)}", + method="PATCH", + json={ + "values": convert_and_respect_annotation_metadata( + object_=values, + annotation=typing.Dict[str, typing.Optional[UpdateEnvironmentVariableRequestValuesValue]], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentVariableResponse, + construct_type( + type_=EnvironmentVariableResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/environment_variables/types/__init__.py b/data/src/elevenlabs/environment_variables/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4ad942e6054ebd3f15759a157fba832b2fc6e837 --- /dev/null +++ b/data/src/elevenlabs/environment_variables/types/__init__.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .environment_variables_create_request_body import ( + EnvironmentVariablesCreateRequestBody, + EnvironmentVariablesCreateRequestBody_AuthConnection, + EnvironmentVariablesCreateRequestBody_Secret, + EnvironmentVariablesCreateRequestBody_String, + ) + from .environment_variables_list_request_type import EnvironmentVariablesListRequestType + from .update_environment_variable_request_values_value import UpdateEnvironmentVariableRequestValuesValue +_dynamic_imports: typing.Dict[str, str] = { + "EnvironmentVariablesCreateRequestBody": ".environment_variables_create_request_body", + "EnvironmentVariablesCreateRequestBody_AuthConnection": ".environment_variables_create_request_body", + "EnvironmentVariablesCreateRequestBody_Secret": ".environment_variables_create_request_body", + "EnvironmentVariablesCreateRequestBody_String": ".environment_variables_create_request_body", + "EnvironmentVariablesListRequestType": ".environment_variables_list_request_type", + "UpdateEnvironmentVariableRequestValuesValue": ".update_environment_variable_request_values_value", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "EnvironmentVariablesCreateRequestBody", + "EnvironmentVariablesCreateRequestBody_AuthConnection", + "EnvironmentVariablesCreateRequestBody_Secret", + "EnvironmentVariablesCreateRequestBody_String", + "EnvironmentVariablesListRequestType", + "UpdateEnvironmentVariableRequestValuesValue", +] diff --git a/data/src/elevenlabs/environment_variables/types/environment_variables_create_request_body.py b/data/src/elevenlabs/environment_variables/types/environment_variables_create_request_body.py new file mode 100644 index 0000000000000000000000000000000000000000..b8cada129478d96056d457d9f811e4de31ee9dbb --- /dev/null +++ b/data/src/elevenlabs/environment_variables/types/environment_variables_create_request_body.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ...types.environment_variable_auth_connection_value_request import EnvironmentVariableAuthConnectionValueRequest +from ...types.environment_variable_secret_value_request import EnvironmentVariableSecretValueRequest + + +class EnvironmentVariablesCreateRequestBody_String(UncheckedBaseModel): + type: typing.Literal["string"] = "string" + label: str + values: typing.Dict[str, 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 + + +class EnvironmentVariablesCreateRequestBody_Secret(UncheckedBaseModel): + type: typing.Literal["secret"] = "secret" + label: str + values: typing.Dict[str, EnvironmentVariableSecretValueRequest] + + 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 + + +class EnvironmentVariablesCreateRequestBody_AuthConnection(UncheckedBaseModel): + type: typing.Literal["auth_connection"] = "auth_connection" + label: str + values: typing.Dict[str, EnvironmentVariableAuthConnectionValueRequest] + + 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 + + +EnvironmentVariablesCreateRequestBody = typing_extensions.Annotated[ + typing.Union[ + EnvironmentVariablesCreateRequestBody_String, + EnvironmentVariablesCreateRequestBody_Secret, + EnvironmentVariablesCreateRequestBody_AuthConnection, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/environment_variables/types/environment_variables_list_request_type.py b/data/src/elevenlabs/environment_variables/types/environment_variables_list_request_type.py new file mode 100644 index 0000000000000000000000000000000000000000..b914aa00cd208cf7a9827c5c1aef46694c77b534 --- /dev/null +++ b/data/src/elevenlabs/environment_variables/types/environment_variables_list_request_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EnvironmentVariablesListRequestType = typing.Union[typing.Literal["string", "secret", "auth_connection"], typing.Any] diff --git a/data/src/elevenlabs/environment_variables/types/update_environment_variable_request_values_value.py b/data/src/elevenlabs/environment_variables/types/update_environment_variable_request_values_value.py new file mode 100644 index 0000000000000000000000000000000000000000..477cb1c4ce3ec23be99bef1c4e07ae2811a5ab56 --- /dev/null +++ b/data/src/elevenlabs/environment_variables/types/update_environment_variable_request_values_value.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.environment_variable_auth_connection_value_request import EnvironmentVariableAuthConnectionValueRequest +from ...types.environment_variable_secret_value_request import EnvironmentVariableSecretValueRequest + +UpdateEnvironmentVariableRequestValuesValue = typing.Union[ + str, EnvironmentVariableSecretValueRequest, EnvironmentVariableAuthConnectionValueRequest +] diff --git a/data/src/elevenlabs/environments/__init__.py b/data/src/elevenlabs/environments/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/environments/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/environments/client.py b/data/src/elevenlabs/environments/client.py new file mode 100644 index 0000000000000000000000000000000000000000..1cf1de9982173187de32e86e970522bed1f21f8e --- /dev/null +++ b/data/src/elevenlabs/environments/client.py @@ -0,0 +1,244 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.environment_response import EnvironmentResponse +from ..types.environments_list_response import EnvironmentsListResponse +from .raw_client import AsyncRawEnvironmentsClient, RawEnvironmentsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class EnvironmentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawEnvironmentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawEnvironmentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawEnvironmentsClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> EnvironmentsListResponse: + """ + List the workspace environments, including 'production'. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentsListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.environments.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def create(self, *, name: str, request_options: typing.Optional[RequestOptions] = None) -> EnvironmentResponse: + """ + Create a workspace environment. Variables without a value for it fall back to their production value. + + Parameters + ---------- + name : str + Unique name of the environment, e.g. 'staging'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.environments.create( + name="name", + ) + """ + _response = self._raw_client.create(name=name, request_options=request_options) + return _response.data + + def delete(self, environment: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a workspace environment and remove its values from all environment variables. 'production' cannot be deleted. + + Parameters + ---------- + environment : str + Name of the environment to delete, e.g. 'staging'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.environments.delete( + environment="environment", + ) + """ + _response = self._raw_client.delete(environment, request_options=request_options) + return _response.data + + +class AsyncEnvironmentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawEnvironmentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawEnvironmentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawEnvironmentsClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> EnvironmentsListResponse: + """ + List the workspace environments, including 'production'. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentsListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.environments.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> EnvironmentResponse: + """ + Create a workspace environment. Variables without a value for it fall back to their production value. + + Parameters + ---------- + name : str + Unique name of the environment, e.g. 'staging'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EnvironmentResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.environments.create( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(name=name, request_options=request_options) + return _response.data + + async def delete(self, environment: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a workspace environment and remove its values from all environment variables. 'production' cannot be deleted. + + Parameters + ---------- + environment : str + Name of the environment to delete, e.g. 'staging'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.environments.delete( + environment="environment", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(environment, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/environments/raw_client.py b/data/src/elevenlabs/environments/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..e3049cb4ad7b8119e25cb01d9b4dbdd86ad57187 --- /dev/null +++ b/data/src/elevenlabs/environments/raw_client.py @@ -0,0 +1,436 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.conflict_error import ConflictError +from ..errors.not_found_error import NotFoundError +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.environment_response import EnvironmentResponse +from ..types.environments_list_response import EnvironmentsListResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawEnvironmentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[EnvironmentsListResponse]: + """ + List the workspace environments, including 'production'. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EnvironmentsListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/environments", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentsListResponse, + construct_type( + type_=EnvironmentsListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[EnvironmentResponse]: + """ + Create a workspace environment. Variables without a value for it fall back to their production value. + + Parameters + ---------- + name : str + Unique name of the environment, e.g. 'staging'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EnvironmentResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/convai/environments", + method="POST", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentResponse, + construct_type( + type_=EnvironmentResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, environment: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Delete a workspace environment and remove its values from all environment variables. 'production' cannot be deleted. + + Parameters + ---------- + environment : str + Name of the environment to delete, e.g. 'staging'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/convai/environments/{jsonable_encoder(environment)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawEnvironmentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[EnvironmentsListResponse]: + """ + List the workspace environments, including 'production'. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EnvironmentsListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/environments", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentsListResponse, + construct_type( + type_=EnvironmentsListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[EnvironmentResponse]: + """ + Create a workspace environment. Variables without a value for it fall back to their production value. + + Parameters + ---------- + name : str + Unique name of the environment, e.g. 'staging'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EnvironmentResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/convai/environments", + method="POST", + json={ + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EnvironmentResponse, + construct_type( + type_=EnvironmentResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, environment: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete a workspace environment and remove its values from all environment variables. 'production' cannot be deleted. + + Parameters + ---------- + environment : str + Name of the environment to delete, e.g. 'staging'. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/convai/environments/{jsonable_encoder(environment)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/errors/__init__.py b/data/src/elevenlabs/errors/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cf2bd8f153a3e06c3494d55b865b7a91d85fd0c1 --- /dev/null +++ b/data/src/elevenlabs/errors/__init__.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .bad_request_error import BadRequestError + from .conflict_error import ConflictError + from .forbidden_error import ForbiddenError + from .not_found_error import NotFoundError + from .too_early_error import TooEarlyError + from .unauthorized_error import UnauthorizedError + from .unprocessable_entity_error import UnprocessableEntityError +_dynamic_imports: typing.Dict[str, str] = { + "BadRequestError": ".bad_request_error", + "ConflictError": ".conflict_error", + "ForbiddenError": ".forbidden_error", + "NotFoundError": ".not_found_error", + "TooEarlyError": ".too_early_error", + "UnauthorizedError": ".unauthorized_error", + "UnprocessableEntityError": ".unprocessable_entity_error", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BadRequestError", + "ConflictError", + "ForbiddenError", + "NotFoundError", + "TooEarlyError", + "UnauthorizedError", + "UnprocessableEntityError", +] diff --git a/data/src/elevenlabs/errors/bad_request_error.py b/data/src/elevenlabs/errors/bad_request_error.py new file mode 100644 index 0000000000000000000000000000000000000000..ec78e2697a834d83fdb55fad71f2994d943d55d0 --- /dev/null +++ b/data/src/elevenlabs/errors/bad_request_error.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError + + +class BadRequestError(ApiError): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=400, headers=headers, body=body) diff --git a/data/src/elevenlabs/errors/conflict_error.py b/data/src/elevenlabs/errors/conflict_error.py new file mode 100644 index 0000000000000000000000000000000000000000..be04e01aee710b8f3f96b5ca52ec95932c273ac9 --- /dev/null +++ b/data/src/elevenlabs/errors/conflict_error.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError + + +class ConflictError(ApiError): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=409, headers=headers, body=body) diff --git a/data/src/elevenlabs/errors/forbidden_error.py b/data/src/elevenlabs/errors/forbidden_error.py new file mode 100644 index 0000000000000000000000000000000000000000..07d7e45b85a17844bc95f36afaf0e614ae225950 --- /dev/null +++ b/data/src/elevenlabs/errors/forbidden_error.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError + + +class ForbiddenError(ApiError): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=403, headers=headers, body=body) diff --git a/data/src/elevenlabs/errors/not_found_error.py b/data/src/elevenlabs/errors/not_found_error.py new file mode 100644 index 0000000000000000000000000000000000000000..75f557df64af15e8bf0d091d0a5253f84a7afe9e --- /dev/null +++ b/data/src/elevenlabs/errors/not_found_error.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError + + +class NotFoundError(ApiError): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=404, headers=headers, body=body) diff --git a/data/src/elevenlabs/errors/too_early_error.py b/data/src/elevenlabs/errors/too_early_error.py new file mode 100644 index 0000000000000000000000000000000000000000..418b8abb71082c67187bc8a844891f50ff36e515 --- /dev/null +++ b/data/src/elevenlabs/errors/too_early_error.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError + + +class TooEarlyError(ApiError): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=425, headers=headers, body=body) diff --git a/data/src/elevenlabs/errors/unauthorized_error.py b/data/src/elevenlabs/errors/unauthorized_error.py new file mode 100644 index 0000000000000000000000000000000000000000..7e48bb6f1f1067df47dadc5b89888d9aa99ff291 --- /dev/null +++ b/data/src/elevenlabs/errors/unauthorized_error.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError + + +class UnauthorizedError(ApiError): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=401, headers=headers, body=body) diff --git a/data/src/elevenlabs/errors/unprocessable_entity_error.py b/data/src/elevenlabs/errors/unprocessable_entity_error.py new file mode 100644 index 0000000000000000000000000000000000000000..1c801a4bc08bb1e0c42e59f978ad275f4656a150 --- /dev/null +++ b/data/src/elevenlabs/errors/unprocessable_entity_error.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.api_error import ApiError + + +class UnprocessableEntityError(ApiError): + def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + super().__init__(status_code=422, headers=headers, body=body) diff --git a/data/src/elevenlabs/flows/__init__.py b/data/src/elevenlabs/flows/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8a5bdfaa07efca442efc6361283969b823bae3fc --- /dev/null +++ b/data/src/elevenlabs/flows/__init__.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import image, templates, text_to_speech, video + from .image import ImageListRequestStatus + from .text_to_speech import TextToSpeechListRequestStatus + from .video import VideoListRequestStatus +_dynamic_imports: typing.Dict[str, str] = { + "ImageListRequestStatus": ".image", + "TextToSpeechListRequestStatus": ".text_to_speech", + "VideoListRequestStatus": ".video", + "image": ".image", + "templates": ".templates", + "text_to_speech": ".text_to_speech", + "video": ".video", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ImageListRequestStatus", + "TextToSpeechListRequestStatus", + "VideoListRequestStatus", + "image", + "templates", + "text_to_speech", + "video", +] diff --git a/data/src/elevenlabs/flows/client.py b/data/src/elevenlabs/flows/client.py new file mode 100644 index 0000000000000000000000000000000000000000..0b59cda1c0fc5c409ab44cf3f87fe8ff32435206 --- /dev/null +++ b/data/src/elevenlabs/flows/client.py @@ -0,0 +1,120 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .raw_client import AsyncRawFlowsClient, RawFlowsClient + +if typing.TYPE_CHECKING: + from .image.client import AsyncImageClient, ImageClient + from .templates.client import AsyncTemplatesClient, TemplatesClient + from .text_to_speech.client import AsyncTextToSpeechClient, TextToSpeechClient + from .video.client import AsyncVideoClient, VideoClient + + +class FlowsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawFlowsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._video: typing.Optional[VideoClient] = None + self._image: typing.Optional[ImageClient] = None + self._text_to_speech: typing.Optional[TextToSpeechClient] = None + self._templates: typing.Optional[TemplatesClient] = None + + @property + def with_raw_response(self) -> RawFlowsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawFlowsClient + """ + return self._raw_client + + @property + def video(self): + if self._video is None: + from .video.client import VideoClient # noqa: E402 + + self._video = VideoClient(client_wrapper=self._client_wrapper) + return self._video + + @property + def image(self): + if self._image is None: + from .image.client import ImageClient # noqa: E402 + + self._image = ImageClient(client_wrapper=self._client_wrapper) + return self._image + + @property + def text_to_speech(self): + if self._text_to_speech is None: + from .text_to_speech.client import TextToSpeechClient # noqa: E402 + + self._text_to_speech = TextToSpeechClient(client_wrapper=self._client_wrapper) + return self._text_to_speech + + @property + def templates(self): + if self._templates is None: + from .templates.client import TemplatesClient # noqa: E402 + + self._templates = TemplatesClient(client_wrapper=self._client_wrapper) + return self._templates + + +class AsyncFlowsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawFlowsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._video: typing.Optional[AsyncVideoClient] = None + self._image: typing.Optional[AsyncImageClient] = None + self._text_to_speech: typing.Optional[AsyncTextToSpeechClient] = None + self._templates: typing.Optional[AsyncTemplatesClient] = None + + @property + def with_raw_response(self) -> AsyncRawFlowsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawFlowsClient + """ + return self._raw_client + + @property + def video(self): + if self._video is None: + from .video.client import AsyncVideoClient # noqa: E402 + + self._video = AsyncVideoClient(client_wrapper=self._client_wrapper) + return self._video + + @property + def image(self): + if self._image is None: + from .image.client import AsyncImageClient # noqa: E402 + + self._image = AsyncImageClient(client_wrapper=self._client_wrapper) + return self._image + + @property + def text_to_speech(self): + if self._text_to_speech is None: + from .text_to_speech.client import AsyncTextToSpeechClient # noqa: E402 + + self._text_to_speech = AsyncTextToSpeechClient(client_wrapper=self._client_wrapper) + return self._text_to_speech + + @property + def templates(self): + if self._templates is None: + from .templates.client import AsyncTemplatesClient # noqa: E402 + + self._templates = AsyncTemplatesClient(client_wrapper=self._client_wrapper) + return self._templates diff --git a/data/src/elevenlabs/flows/image/__init__.py b/data/src/elevenlabs/flows/image/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3905fda16c02f2077817d9a98f94351de45fa385 --- /dev/null +++ b/data/src/elevenlabs/flows/image/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ImageListRequestStatus +_dynamic_imports: typing.Dict[str, str] = {"ImageListRequestStatus": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ImageListRequestStatus"] diff --git a/data/src/elevenlabs/flows/image/client.py b/data/src/elevenlabs/flows/image/client.py new file mode 100644 index 0000000000000000000000000000000000000000..1a080e5970bfe6bcf2f691fe44b8759a5b4ef589 --- /dev/null +++ b/data/src/elevenlabs/flows/image/client.py @@ -0,0 +1,312 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.image_generation_request import ImageGenerationRequest +from ...types.media_generation_create_response import MediaGenerationCreateResponse +from ...types.media_generation_list_response import MediaGenerationListResponse +from ...types.media_generation_response import MediaGenerationResponse +from .raw_client import AsyncRawImageClient, RawImageClient +from .types.image_list_request_status import ImageListRequestStatus + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ImageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawImageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawImageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawImageClient + """ + return self._raw_client + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[ImageListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MediaGenerationListResponse: + """ + List the image generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[ImageListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.image.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", + ) + """ + _response = self._raw_client.list( + cursor=cursor, page_size=page_size, status=status, model_id=model_id, request_options=request_options + ) + return _response.data + + def create( + self, *, request: ImageGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationCreateResponse: + """ + Start an image generation with the selected model. + + Parameters + ---------- + request : ImageGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationCreateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, ImageGenerationRequest_BytedanceSeedream5Lite + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.image.create( + request=ImageGenerationRequest_BytedanceSeedream5Lite( + prompt="A corgi in a tiny lifeguard chair on a sunlit beach at golden hour, photorealistic", + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationResponse: + """ + Retrieve the status of an image generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.image.get( + generation_id="generation_id", + ) + """ + _response = self._raw_client.get(generation_id, request_options=request_options) + return _response.data + + +class AsyncImageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawImageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawImageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawImageClient + """ + return self._raw_client + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[ImageListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MediaGenerationListResponse: + """ + List the image generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[ImageListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.image.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, page_size=page_size, status=status, model_id=model_id, request_options=request_options + ) + return _response.data + + async def create( + self, *, request: ImageGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationCreateResponse: + """ + Start an image generation with the selected model. + + Parameters + ---------- + request : ImageGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationCreateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AsyncElevenLabs, + ImageGenerationRequest_BytedanceSeedream5Lite, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.image.create( + request=ImageGenerationRequest_BytedanceSeedream5Lite( + prompt="A corgi in a tiny lifeguard chair on a sunlit beach at golden hour, photorealistic", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationResponse: + """ + Retrieve the status of an image generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.image.get( + generation_id="generation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(generation_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/flows/image/raw_client.py b/data/src/elevenlabs/flows/image/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8aaddd77c87e6dfce340eb3f29b038dc5ee6e791 --- /dev/null +++ b/data/src/elevenlabs/flows/image/raw_client.py @@ -0,0 +1,403 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.image_generation_request import ImageGenerationRequest +from ...types.media_generation_create_response import MediaGenerationCreateResponse +from ...types.media_generation_list_response import MediaGenerationListResponse +from ...types.media_generation_response import MediaGenerationResponse +from .types.image_list_request_status import ImageListRequestStatus +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawImageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[ImageListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MediaGenerationListResponse]: + """ + List the image generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[ImageListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/flows/image", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "model_id": model_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationListResponse, + construct_type( + type_=MediaGenerationListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, request: ImageGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MediaGenerationCreateResponse]: + """ + Start an image generation with the selected model. + + Parameters + ---------- + request : ImageGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationCreateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/flows/image", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=ImageGenerationRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationCreateResponse, + construct_type( + type_=MediaGenerationCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MediaGenerationResponse]: + """ + Retrieve the status of an image generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/flows/image/{jsonable_encoder(generation_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationResponse, + construct_type( + type_=MediaGenerationResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawImageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[ImageListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MediaGenerationListResponse]: + """ + List the image generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[ImageListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/flows/image", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "model_id": model_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationListResponse, + construct_type( + type_=MediaGenerationListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, request: ImageGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MediaGenerationCreateResponse]: + """ + Start an image generation with the selected model. + + Parameters + ---------- + request : ImageGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationCreateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/flows/image", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=ImageGenerationRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationCreateResponse, + construct_type( + type_=MediaGenerationCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MediaGenerationResponse]: + """ + Retrieve the status of an image generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/flows/image/{jsonable_encoder(generation_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationResponse, + construct_type( + type_=MediaGenerationResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/flows/image/types/__init__.py b/data/src/elevenlabs/flows/image/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b0b84a974cb05953601e83c154de1a9a34888141 --- /dev/null +++ b/data/src/elevenlabs/flows/image/types/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .image_list_request_status import ImageListRequestStatus +_dynamic_imports: typing.Dict[str, str] = {"ImageListRequestStatus": ".image_list_request_status"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ImageListRequestStatus"] diff --git a/data/src/elevenlabs/flows/image/types/image_list_request_status.py b/data/src/elevenlabs/flows/image/types/image_list_request_status.py new file mode 100644 index 0000000000000000000000000000000000000000..ba6e454477813026a3293c74f1a61ea10d15fee5 --- /dev/null +++ b/data/src/elevenlabs/flows/image/types/image_list_request_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ImageListRequestStatus = typing.Union[typing.Literal["pending", "generating", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/flows/raw_client.py b/data/src/elevenlabs/flows/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..659416376edb4e2889442226b250b5cf40d7ee5a --- /dev/null +++ b/data/src/elevenlabs/flows/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawFlowsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawFlowsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/data/src/elevenlabs/flows/templates/__init__.py b/data/src/elevenlabs/flows/templates/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..477b869323a290142dc4c280896e9ada9535ab94 --- /dev/null +++ b/data/src/elevenlabs/flows/templates/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import runs +_dynamic_imports: typing.Dict[str, str] = {"runs": ".runs"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["runs"] diff --git a/data/src/elevenlabs/flows/templates/client.py b/data/src/elevenlabs/flows/templates/client.py new file mode 100644 index 0000000000000000000000000000000000000000..233f4590bbc44cd7f6b20eb3f2014a5104b1e63b --- /dev/null +++ b/data/src/elevenlabs/flows/templates/client.py @@ -0,0 +1,282 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.template_list_response import TemplateListResponse +from ...types.template_summary import TemplateSummary +from .raw_client import AsyncRawTemplatesClient, RawTemplatesClient + +if typing.TYPE_CHECKING: + from .runs.client import AsyncRunsClient, RunsClient + + +class TemplatesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTemplatesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._runs: typing.Optional[RunsClient] = None + + @property + def with_raw_response(self) -> RawTemplatesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTemplatesClient + """ + return self._raw_client + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + versions_per_template: typing.Optional[int] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateListResponse: + """ + List the published flows templates in your workspace, together with each runnable version's inputs and outputs. Use the ids here as `template_id` / `version_id` on `POST /v1/flows/templates/{template_id}/runs`. Versions built on models that are not available to you through the API are left out, so `versions` is empty when none of a template's published versions is runnable through this API. Templates shared with you by link, or published to Explore from another workspace, are not listed but can still be fetched and run by `template_id`. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many templates to return per page. Lower than the run list's ceiling because each row expands its versions' input and output schemas. + + versions_per_template : typing.Optional[int] + How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + + search : typing.Optional[str] + Only return templates whose name or description contains this text. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.templates.list( + cursor="cursor", + page_size=1, + versions_per_template=1, + search="search", + ) + """ + _response = self._raw_client.list( + cursor=cursor, + page_size=page_size, + versions_per_template=versions_per_template, + search=search, + request_options=request_options, + ) + return _response.data + + def get( + self, + template_id: str, + *, + versions_per_template: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateSummary: + """ + Retrieve one flows template, together with each runnable version's inputs and outputs. `versions` is empty when no published version is runnable through this API. Works for any template you can open, including templates shared with you by link or published to Explore from another workspace, which `GET /v1/flows/templates` does not list. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + versions_per_template : typing.Optional[int] + How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateSummary + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.templates.get( + template_id="template_id", + versions_per_template=1, + ) + """ + _response = self._raw_client.get( + template_id, versions_per_template=versions_per_template, request_options=request_options + ) + return _response.data + + @property + def runs(self): + if self._runs is None: + from .runs.client import RunsClient # noqa: E402 + + self._runs = RunsClient(client_wrapper=self._client_wrapper) + return self._runs + + +class AsyncTemplatesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTemplatesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._runs: typing.Optional[AsyncRunsClient] = None + + @property + def with_raw_response(self) -> AsyncRawTemplatesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTemplatesClient + """ + return self._raw_client + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + versions_per_template: typing.Optional[int] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateListResponse: + """ + List the published flows templates in your workspace, together with each runnable version's inputs and outputs. Use the ids here as `template_id` / `version_id` on `POST /v1/flows/templates/{template_id}/runs`. Versions built on models that are not available to you through the API are left out, so `versions` is empty when none of a template's published versions is runnable through this API. Templates shared with you by link, or published to Explore from another workspace, are not listed but can still be fetched and run by `template_id`. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many templates to return per page. Lower than the run list's ceiling because each row expands its versions' input and output schemas. + + versions_per_template : typing.Optional[int] + How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + + search : typing.Optional[str] + Only return templates whose name or description contains this text. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.templates.list( + cursor="cursor", + page_size=1, + versions_per_template=1, + search="search", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, + page_size=page_size, + versions_per_template=versions_per_template, + search=search, + request_options=request_options, + ) + return _response.data + + async def get( + self, + template_id: str, + *, + versions_per_template: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateSummary: + """ + Retrieve one flows template, together with each runnable version's inputs and outputs. `versions` is empty when no published version is runnable through this API. Works for any template you can open, including templates shared with you by link or published to Explore from another workspace, which `GET /v1/flows/templates` does not list. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + versions_per_template : typing.Optional[int] + How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateSummary + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.templates.get( + template_id="template_id", + versions_per_template=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + template_id, versions_per_template=versions_per_template, request_options=request_options + ) + return _response.data + + @property + def runs(self): + if self._runs is None: + from .runs.client import AsyncRunsClient # noqa: E402 + + self._runs = AsyncRunsClient(client_wrapper=self._client_wrapper) + return self._runs diff --git a/data/src/elevenlabs/flows/templates/raw_client.py b/data/src/elevenlabs/flows/templates/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..fe8d8ea4fe173068b7926061d673d983d7de4e6a --- /dev/null +++ b/data/src/elevenlabs/flows/templates/raw_client.py @@ -0,0 +1,304 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.template_list_response import TemplateListResponse +from ...types.template_summary import TemplateSummary +from pydantic import ValidationError + + +class RawTemplatesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + versions_per_template: typing.Optional[int] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TemplateListResponse]: + """ + List the published flows templates in your workspace, together with each runnable version's inputs and outputs. Use the ids here as `template_id` / `version_id` on `POST /v1/flows/templates/{template_id}/runs`. Versions built on models that are not available to you through the API are left out, so `versions` is empty when none of a template's published versions is runnable through this API. Templates shared with you by link, or published to Explore from another workspace, are not listed but can still be fetched and run by `template_id`. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many templates to return per page. Lower than the run list's ceiling because each row expands its versions' input and output schemas. + + versions_per_template : typing.Optional[int] + How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + + search : typing.Optional[str] + Only return templates whose name or description contains this text. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TemplateListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/flows/templates", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "versions_per_template": versions_per_template, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateListResponse, + construct_type( + type_=TemplateListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + template_id: str, + *, + versions_per_template: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TemplateSummary]: + """ + Retrieve one flows template, together with each runnable version's inputs and outputs. `versions` is empty when no published version is runnable through this API. Works for any template you can open, including templates shared with you by link or published to Explore from another workspace, which `GET /v1/flows/templates` does not list. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + versions_per_template : typing.Optional[int] + How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TemplateSummary] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/flows/templates/{jsonable_encoder(template_id)}", + method="GET", + params={ + "versions_per_template": versions_per_template, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateSummary, + construct_type( + type_=TemplateSummary, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTemplatesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + versions_per_template: typing.Optional[int] = None, + search: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TemplateListResponse]: + """ + List the published flows templates in your workspace, together with each runnable version's inputs and outputs. Use the ids here as `template_id` / `version_id` on `POST /v1/flows/templates/{template_id}/runs`. Versions built on models that are not available to you through the API are left out, so `versions` is empty when none of a template's published versions is runnable through this API. Templates shared with you by link, or published to Explore from another workspace, are not listed but can still be fetched and run by `template_id`. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many templates to return per page. Lower than the run list's ceiling because each row expands its versions' input and output schemas. + + versions_per_template : typing.Optional[int] + How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + + search : typing.Optional[str] + Only return templates whose name or description contains this text. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TemplateListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/flows/templates", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "versions_per_template": versions_per_template, + "search": search, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateListResponse, + construct_type( + type_=TemplateListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + template_id: str, + *, + versions_per_template: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TemplateSummary]: + """ + Retrieve one flows template, together with each runnable version's inputs and outputs. `versions` is empty when no published version is runnable through this API. Works for any template you can open, including templates shared with you by link or published to Explore from another workspace, which `GET /v1/flows/templates` does not list. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + versions_per_template : typing.Optional[int] + How many of each template's published versions to return, newest first. `has_more_versions` tells you when a template has more. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TemplateSummary] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/flows/templates/{jsonable_encoder(template_id)}", + method="GET", + params={ + "versions_per_template": versions_per_template, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateSummary, + construct_type( + type_=TemplateSummary, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/flows/templates/runs/__init__.py b/data/src/elevenlabs/flows/templates/runs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/flows/templates/runs/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/flows/templates/runs/client.py b/data/src/elevenlabs/flows/templates/runs/client.py new file mode 100644 index 0000000000000000000000000000000000000000..b27bc5833360ea8e9eca2325f452f8ff4afc4b99 --- /dev/null +++ b/data/src/elevenlabs/flows/templates/runs/client.py @@ -0,0 +1,372 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.template_run_input import TemplateRunInput +from ....types.template_run_list_response import TemplateRunListResponse +from ....types.template_run_response import TemplateRunResponse +from ....types.webhook_target import WebhookTarget +from .raw_client import AsyncRawRunsClient, RawRunsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RunsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawRunsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawRunsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawRunsClient + """ + return self._raw_client + + def list( + self, + template_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateRunListResponse: + """ + List this template's runs created through this API, newest first. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many runs to return per page. + + version_id : typing.Optional[str] + Only return runs of this template version id. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateRunListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.templates.runs.list( + template_id="template_id", + cursor="cursor", + page_size=1, + version_id="version_id", + ) + """ + _response = self._raw_client.list( + template_id, cursor=cursor, page_size=page_size, version_id=version_id, request_options=request_options + ) + return _response.data + + def create( + self, + template_id: str, + *, + inputs: typing.Dict[str, TemplateRunInput], + version_id: typing.Optional[str] = OMIT, + webhook: typing.Optional[WebhookTarget] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateRunResponse: + """ + Start a run of a flows template. Pass `version_id` to pin a snapshot, or omit it / pass `latest` to run the latest published version. Set input values under `inputs`, keyed by input port id. The response is the run in its initial state, with every output already listed under its port id in `outputs`. Include `webhook` to receive a `flows_template_run` event carrying the finished run once its `status` is `completed` or `failed`; this is the recommended way to wait. Without one, fetch `GET /v1/flows/templates/{template_id}/runs/{run_id}` at a modest interval until the `status` is terminal. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + inputs : typing.Dict[str, TemplateRunInput] + Input values keyed by input port id. Every input port of the version being run must be given; a missing or unknown id is rejected. Pass `{}` for a template with no inputs. + + version_id : typing.Optional[str] + The template snapshot to run. Pass a specific version id to pin that snapshot, or `latest` (the default when omitted) to run the template's most recently published version. Only published versions can be pinned, except by the template's owner, who may also pin an unpublished saved snapshot to try it out before publishing. The live draft is never run through this API. + + webhook : typing.Optional[WebhookTarget] + Include to send the run's result to the workspace's configured flows webhooks once the run's `status` reaches `completed` or `failed`. One event for the whole run: the `flows_template_run` event's `data` matches the terminal response of `GET /v1/flows/templates/{template_id}/runs/{run_id}`. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateRunResponse + Successful Response + + Examples + -------- + from elevenlabs import ( + ElevenLabs, + TemplateInputReference_Asset, + WebhookTarget_All, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.templates.runs.create( + template_id="template_id", + inputs={ + "prompt": "a corgi on a surfboard", + "reference": TemplateInputReference_Asset( + asset_id="5xM2KqOnZyce22SPZ9d4", + ), + }, + version_id="latest", + webhook=WebhookTarget_All(), + ) + """ + _response = self._raw_client.create( + template_id, inputs=inputs, version_id=version_id, webhook=webhook, request_options=request_options + ) + return _response.data + + def get( + self, template_id: str, run_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> TemplateRunResponse: + """ + Retrieve a template run: its `status`, rolled up from its outputs, and each output's own status and download URL once completed. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + run_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateRunResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.templates.runs.get( + template_id="template_id", + run_id="run_id", + ) + """ + _response = self._raw_client.get(template_id, run_id, request_options=request_options) + return _response.data + + +class AsyncRunsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawRunsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawRunsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawRunsClient + """ + return self._raw_client + + async def list( + self, + template_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateRunListResponse: + """ + List this template's runs created through this API, newest first. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many runs to return per page. + + version_id : typing.Optional[str] + Only return runs of this template version id. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateRunListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.templates.runs.list( + template_id="template_id", + cursor="cursor", + page_size=1, + version_id="version_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + template_id, cursor=cursor, page_size=page_size, version_id=version_id, request_options=request_options + ) + return _response.data + + async def create( + self, + template_id: str, + *, + inputs: typing.Dict[str, TemplateRunInput], + version_id: typing.Optional[str] = OMIT, + webhook: typing.Optional[WebhookTarget] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateRunResponse: + """ + Start a run of a flows template. Pass `version_id` to pin a snapshot, or omit it / pass `latest` to run the latest published version. Set input values under `inputs`, keyed by input port id. The response is the run in its initial state, with every output already listed under its port id in `outputs`. Include `webhook` to receive a `flows_template_run` event carrying the finished run once its `status` is `completed` or `failed`; this is the recommended way to wait. Without one, fetch `GET /v1/flows/templates/{template_id}/runs/{run_id}` at a modest interval until the `status` is terminal. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + inputs : typing.Dict[str, TemplateRunInput] + Input values keyed by input port id. Every input port of the version being run must be given; a missing or unknown id is rejected. Pass `{}` for a template with no inputs. + + version_id : typing.Optional[str] + The template snapshot to run. Pass a specific version id to pin that snapshot, or `latest` (the default when omitted) to run the template's most recently published version. Only published versions can be pinned, except by the template's owner, who may also pin an unpublished saved snapshot to try it out before publishing. The live draft is never run through this API. + + webhook : typing.Optional[WebhookTarget] + Include to send the run's result to the workspace's configured flows webhooks once the run's `status` reaches `completed` or `failed`. One event for the whole run: the `flows_template_run` event's `data` matches the terminal response of `GET /v1/flows/templates/{template_id}/runs/{run_id}`. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateRunResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AsyncElevenLabs, + TemplateInputReference_Asset, + WebhookTarget_All, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.templates.runs.create( + template_id="template_id", + inputs={ + "prompt": "a corgi on a surfboard", + "reference": TemplateInputReference_Asset( + asset_id="5xM2KqOnZyce22SPZ9d4", + ), + }, + version_id="latest", + webhook=WebhookTarget_All(), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + template_id, inputs=inputs, version_id=version_id, webhook=webhook, request_options=request_options + ) + return _response.data + + async def get( + self, template_id: str, run_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> TemplateRunResponse: + """ + Retrieve a template run: its `status`, rolled up from its outputs, and each output's own status and download URL once completed. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + run_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TemplateRunResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.templates.runs.get( + template_id="template_id", + run_id="run_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(template_id, run_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/flows/templates/runs/raw_client.py b/data/src/elevenlabs/flows/templates/runs/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..61e8b8e83e09ebae84ece3d48149bb1c627f41b9 --- /dev/null +++ b/data/src/elevenlabs/flows/templates/runs/raw_client.py @@ -0,0 +1,456 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.template_run_input import TemplateRunInput +from ....types.template_run_list_response import TemplateRunListResponse +from ....types.template_run_response import TemplateRunResponse +from ....types.webhook_target import WebhookTarget +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawRunsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + template_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TemplateRunListResponse]: + """ + List this template's runs created through this API, newest first. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many runs to return per page. + + version_id : typing.Optional[str] + Only return runs of this template version id. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TemplateRunListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/flows/templates/{jsonable_encoder(template_id)}/runs", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "version_id": version_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateRunListResponse, + construct_type( + type_=TemplateRunListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + template_id: str, + *, + inputs: typing.Dict[str, TemplateRunInput], + version_id: typing.Optional[str] = OMIT, + webhook: typing.Optional[WebhookTarget] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[TemplateRunResponse]: + """ + Start a run of a flows template. Pass `version_id` to pin a snapshot, or omit it / pass `latest` to run the latest published version. Set input values under `inputs`, keyed by input port id. The response is the run in its initial state, with every output already listed under its port id in `outputs`. Include `webhook` to receive a `flows_template_run` event carrying the finished run once its `status` is `completed` or `failed`; this is the recommended way to wait. Without one, fetch `GET /v1/flows/templates/{template_id}/runs/{run_id}` at a modest interval until the `status` is terminal. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + inputs : typing.Dict[str, TemplateRunInput] + Input values keyed by input port id. Every input port of the version being run must be given; a missing or unknown id is rejected. Pass `{}` for a template with no inputs. + + version_id : typing.Optional[str] + The template snapshot to run. Pass a specific version id to pin that snapshot, or `latest` (the default when omitted) to run the template's most recently published version. Only published versions can be pinned, except by the template's owner, who may also pin an unpublished saved snapshot to try it out before publishing. The live draft is never run through this API. + + webhook : typing.Optional[WebhookTarget] + Include to send the run's result to the workspace's configured flows webhooks once the run's `status` reaches `completed` or `failed`. One event for the whole run: the `flows_template_run` event's `data` matches the terminal response of `GET /v1/flows/templates/{template_id}/runs/{run_id}`. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TemplateRunResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/flows/templates/{jsonable_encoder(template_id)}/runs", + method="POST", + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Dict[str, TemplateRunInput], direction="write" + ), + "version_id": version_id, + "webhook": convert_and_respect_annotation_metadata( + object_=webhook, annotation=WebhookTarget, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateRunResponse, + construct_type( + type_=TemplateRunResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, template_id: str, run_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[TemplateRunResponse]: + """ + Retrieve a template run: its `status`, rolled up from its outputs, and each output's own status and download URL once completed. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + run_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TemplateRunResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/flows/templates/{jsonable_encoder(template_id)}/runs/{jsonable_encoder(run_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateRunResponse, + construct_type( + type_=TemplateRunResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawRunsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + template_id: str, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + version_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TemplateRunListResponse]: + """ + List this template's runs created through this API, newest first. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many runs to return per page. + + version_id : typing.Optional[str] + Only return runs of this template version id. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TemplateRunListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/flows/templates/{jsonable_encoder(template_id)}/runs", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "version_id": version_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateRunListResponse, + construct_type( + type_=TemplateRunListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + template_id: str, + *, + inputs: typing.Dict[str, TemplateRunInput], + version_id: typing.Optional[str] = OMIT, + webhook: typing.Optional[WebhookTarget] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[TemplateRunResponse]: + """ + Start a run of a flows template. Pass `version_id` to pin a snapshot, or omit it / pass `latest` to run the latest published version. Set input values under `inputs`, keyed by input port id. The response is the run in its initial state, with every output already listed under its port id in `outputs`. Include `webhook` to receive a `flows_template_run` event carrying the finished run once its `status` is `completed` or `failed`; this is the recommended way to wait. Without one, fetch `GET /v1/flows/templates/{template_id}/runs/{run_id}` at a modest interval until the `status` is terminal. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + inputs : typing.Dict[str, TemplateRunInput] + Input values keyed by input port id. Every input port of the version being run must be given; a missing or unknown id is rejected. Pass `{}` for a template with no inputs. + + version_id : typing.Optional[str] + The template snapshot to run. Pass a specific version id to pin that snapshot, or `latest` (the default when omitted) to run the template's most recently published version. Only published versions can be pinned, except by the template's owner, who may also pin an unpublished saved snapshot to try it out before publishing. The live draft is never run through this API. + + webhook : typing.Optional[WebhookTarget] + Include to send the run's result to the workspace's configured flows webhooks once the run's `status` reaches `completed` or `failed`. One event for the whole run: the `flows_template_run` event's `data` matches the terminal response of `GET /v1/flows/templates/{template_id}/runs/{run_id}`. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TemplateRunResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/flows/templates/{jsonable_encoder(template_id)}/runs", + method="POST", + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Dict[str, TemplateRunInput], direction="write" + ), + "version_id": version_id, + "webhook": convert_and_respect_annotation_metadata( + object_=webhook, annotation=WebhookTarget, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateRunResponse, + construct_type( + type_=TemplateRunResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, template_id: str, run_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TemplateRunResponse]: + """ + Retrieve a template run: its `status`, rolled up from its outputs, and each output's own status and download URL once completed. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + run_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TemplateRunResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/flows/templates/{jsonable_encoder(template_id)}/runs/{jsonable_encoder(run_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TemplateRunResponse, + construct_type( + type_=TemplateRunResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/flows/text_to_speech/__init__.py b/data/src/elevenlabs/flows/text_to_speech/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c693e864b92aa4c09a8c39beb18ee77c8fd48206 --- /dev/null +++ b/data/src/elevenlabs/flows/text_to_speech/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import TextToSpeechListRequestStatus +_dynamic_imports: typing.Dict[str, str] = {"TextToSpeechListRequestStatus": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TextToSpeechListRequestStatus"] diff --git a/data/src/elevenlabs/flows/text_to_speech/client.py b/data/src/elevenlabs/flows/text_to_speech/client.py new file mode 100644 index 0000000000000000000000000000000000000000..51376547ac2c51c3ff2f8606be5ac1dfd46b29be --- /dev/null +++ b/data/src/elevenlabs/flows/text_to_speech/client.py @@ -0,0 +1,314 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.media_generation_create_response import MediaGenerationCreateResponse +from ...types.media_generation_list_response import MediaGenerationListResponse +from ...types.media_generation_response import MediaGenerationResponse +from ...types.text_to_speech_generation_request import TextToSpeechGenerationRequest +from .raw_client import AsyncRawTextToSpeechClient, RawTextToSpeechClient +from .types.text_to_speech_list_request_status import TextToSpeechListRequestStatus + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TextToSpeechClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTextToSpeechClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTextToSpeechClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTextToSpeechClient + """ + return self._raw_client + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[TextToSpeechListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MediaGenerationListResponse: + """ + List the speech generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[TextToSpeechListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.text_to_speech.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", + ) + """ + _response = self._raw_client.list( + cursor=cursor, page_size=page_size, status=status, model_id=model_id, request_options=request_options + ) + return _response.data + + def create( + self, *, request: TextToSpeechGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationCreateResponse: + """ + Start a speech generation with the selected model. Charged per character via text-to-speech billing. Use this over `/v1/text-to-speech` for the asynchronous generation lifecycle or for models not offered there; for direct, synchronous speech synthesis, prefer `/v1/text-to-speech`. + + Parameters + ---------- + request : TextToSpeechGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationCreateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, TextToSpeechGenerationRequest_ElevenFlashV25 + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.text_to_speech.create( + request=TextToSpeechGenerationRequest_ElevenFlashV25( + text="The first move is what sets everything in motion.", + voice="JBFqnCBsd6RMkjVDRZzb", + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationResponse: + """ + Retrieve the status of a speech generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.text_to_speech.get( + generation_id="generation_id", + ) + """ + _response = self._raw_client.get(generation_id, request_options=request_options) + return _response.data + + +class AsyncTextToSpeechClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTextToSpeechClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTextToSpeechClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTextToSpeechClient + """ + return self._raw_client + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[TextToSpeechListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MediaGenerationListResponse: + """ + List the speech generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[TextToSpeechListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.text_to_speech.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, page_size=page_size, status=status, model_id=model_id, request_options=request_options + ) + return _response.data + + async def create( + self, *, request: TextToSpeechGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationCreateResponse: + """ + Start a speech generation with the selected model. Charged per character via text-to-speech billing. Use this over `/v1/text-to-speech` for the asynchronous generation lifecycle or for models not offered there; for direct, synchronous speech synthesis, prefer `/v1/text-to-speech`. + + Parameters + ---------- + request : TextToSpeechGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationCreateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AsyncElevenLabs, + TextToSpeechGenerationRequest_ElevenFlashV25, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.text_to_speech.create( + request=TextToSpeechGenerationRequest_ElevenFlashV25( + text="The first move is what sets everything in motion.", + voice="JBFqnCBsd6RMkjVDRZzb", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationResponse: + """ + Retrieve the status of a speech generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.text_to_speech.get( + generation_id="generation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(generation_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/flows/text_to_speech/raw_client.py b/data/src/elevenlabs/flows/text_to_speech/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..bc93696fef90fe6ac6b270151309c07dbf35ea6e --- /dev/null +++ b/data/src/elevenlabs/flows/text_to_speech/raw_client.py @@ -0,0 +1,403 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.media_generation_create_response import MediaGenerationCreateResponse +from ...types.media_generation_list_response import MediaGenerationListResponse +from ...types.media_generation_response import MediaGenerationResponse +from ...types.text_to_speech_generation_request import TextToSpeechGenerationRequest +from .types.text_to_speech_list_request_status import TextToSpeechListRequestStatus +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTextToSpeechClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[TextToSpeechListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MediaGenerationListResponse]: + """ + List the speech generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[TextToSpeechListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/flows/text-to-speech", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "model_id": model_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationListResponse, + construct_type( + type_=MediaGenerationListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, request: TextToSpeechGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MediaGenerationCreateResponse]: + """ + Start a speech generation with the selected model. Charged per character via text-to-speech billing. Use this over `/v1/text-to-speech` for the asynchronous generation lifecycle or for models not offered there; for direct, synchronous speech synthesis, prefer `/v1/text-to-speech`. + + Parameters + ---------- + request : TextToSpeechGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationCreateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/flows/text-to-speech", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TextToSpeechGenerationRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationCreateResponse, + construct_type( + type_=MediaGenerationCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MediaGenerationResponse]: + """ + Retrieve the status of a speech generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/flows/text-to-speech/{jsonable_encoder(generation_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationResponse, + construct_type( + type_=MediaGenerationResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTextToSpeechClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[TextToSpeechListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MediaGenerationListResponse]: + """ + List the speech generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[TextToSpeechListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/flows/text-to-speech", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "model_id": model_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationListResponse, + construct_type( + type_=MediaGenerationListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, request: TextToSpeechGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MediaGenerationCreateResponse]: + """ + Start a speech generation with the selected model. Charged per character via text-to-speech billing. Use this over `/v1/text-to-speech` for the asynchronous generation lifecycle or for models not offered there; for direct, synchronous speech synthesis, prefer `/v1/text-to-speech`. + + Parameters + ---------- + request : TextToSpeechGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationCreateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/flows/text-to-speech", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=TextToSpeechGenerationRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationCreateResponse, + construct_type( + type_=MediaGenerationCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MediaGenerationResponse]: + """ + Retrieve the status of a speech generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/flows/text-to-speech/{jsonable_encoder(generation_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationResponse, + construct_type( + type_=MediaGenerationResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/flows/text_to_speech/types/__init__.py b/data/src/elevenlabs/flows/text_to_speech/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..743516548b477ebd3f8194465a32624a7bd065f8 --- /dev/null +++ b/data/src/elevenlabs/flows/text_to_speech/types/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .text_to_speech_list_request_status import TextToSpeechListRequestStatus +_dynamic_imports: typing.Dict[str, str] = {"TextToSpeechListRequestStatus": ".text_to_speech_list_request_status"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TextToSpeechListRequestStatus"] diff --git a/data/src/elevenlabs/flows/text_to_speech/types/text_to_speech_list_request_status.py b/data/src/elevenlabs/flows/text_to_speech/types/text_to_speech_list_request_status.py new file mode 100644 index 0000000000000000000000000000000000000000..3289a9cc6c65ab5a6640dec4cb99b0bdddf85112 --- /dev/null +++ b/data/src/elevenlabs/flows/text_to_speech/types/text_to_speech_list_request_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechListRequestStatus = typing.Union[typing.Literal["pending", "generating", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/flows/video/__init__.py b/data/src/elevenlabs/flows/video/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cb1f6a520b288e555b1d4614cd685fd787e7c545 --- /dev/null +++ b/data/src/elevenlabs/flows/video/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import VideoListRequestStatus +_dynamic_imports: typing.Dict[str, str] = {"VideoListRequestStatus": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["VideoListRequestStatus"] diff --git a/data/src/elevenlabs/flows/video/client.py b/data/src/elevenlabs/flows/video/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7d00989d51a92effd482615157ca9d17835df16b --- /dev/null +++ b/data/src/elevenlabs/flows/video/client.py @@ -0,0 +1,312 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.media_generation_create_response import MediaGenerationCreateResponse +from ...types.media_generation_list_response import MediaGenerationListResponse +from ...types.media_generation_response import MediaGenerationResponse +from ...types.video_generation_request import VideoGenerationRequest +from .raw_client import AsyncRawVideoClient, RawVideoClient +from .types.video_list_request_status import VideoListRequestStatus + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class VideoClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawVideoClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawVideoClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawVideoClient + """ + return self._raw_client + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[VideoListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MediaGenerationListResponse: + """ + List the video generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[VideoListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationListResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.video.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", + ) + """ + _response = self._raw_client.list( + cursor=cursor, page_size=page_size, status=status, model_id=model_id, request_options=request_options + ) + return _response.data + + def create( + self, *, request: VideoGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationCreateResponse: + """ + Start a video generation with the selected model. + + Parameters + ---------- + request : VideoGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationCreateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, VideoGenerationRequest_BytedanceSeedanceV2 + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.video.create( + request=VideoGenerationRequest_BytedanceSeedanceV2( + prompt="A corgi rides a tiny surfboard across a sunlit wave at golden hour, cinematic", + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationResponse: + """ + Retrieve the status of a video generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.flows.video.get( + generation_id="generation_id", + ) + """ + _response = self._raw_client.get(generation_id, request_options=request_options) + return _response.data + + +class AsyncVideoClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawVideoClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawVideoClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawVideoClient + """ + return self._raw_client + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[VideoListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MediaGenerationListResponse: + """ + List the video generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[VideoListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationListResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.video.list( + cursor="cursor", + page_size=1, + status="pending", + model_id="model_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, page_size=page_size, status=status, model_id=model_id, request_options=request_options + ) + return _response.data + + async def create( + self, *, request: VideoGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationCreateResponse: + """ + Start a video generation with the selected model. + + Parameters + ---------- + request : VideoGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationCreateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AsyncElevenLabs, + VideoGenerationRequest_BytedanceSeedanceV2, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.video.create( + request=VideoGenerationRequest_BytedanceSeedanceV2( + prompt="A corgi rides a tiny surfboard across a sunlit wave at golden hour, cinematic", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MediaGenerationResponse: + """ + Retrieve the status of a video generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MediaGenerationResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.flows.video.get( + generation_id="generation_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(generation_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/flows/video/raw_client.py b/data/src/elevenlabs/flows/video/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..656ea99cf999b1f87ab32b4bc4ca1bdc718c2709 --- /dev/null +++ b/data/src/elevenlabs/flows/video/raw_client.py @@ -0,0 +1,403 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.media_generation_create_response import MediaGenerationCreateResponse +from ...types.media_generation_list_response import MediaGenerationListResponse +from ...types.media_generation_response import MediaGenerationResponse +from ...types.video_generation_request import VideoGenerationRequest +from .types.video_list_request_status import VideoListRequestStatus +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawVideoClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[VideoListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MediaGenerationListResponse]: + """ + List the video generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[VideoListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationListResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/flows/video", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "model_id": model_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationListResponse, + construct_type( + type_=MediaGenerationListResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, request: VideoGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MediaGenerationCreateResponse]: + """ + Start a video generation with the selected model. + + Parameters + ---------- + request : VideoGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationCreateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/flows/video", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=VideoGenerationRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationCreateResponse, + construct_type( + type_=MediaGenerationCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MediaGenerationResponse]: + """ + Retrieve the status of a video generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MediaGenerationResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/flows/video/{jsonable_encoder(generation_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationResponse, + construct_type( + type_=MediaGenerationResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawVideoClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + status: typing.Optional[VideoListRequestStatus] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MediaGenerationListResponse]: + """ + List the video generations created through this API, newest first. + + Parameters + ---------- + cursor : typing.Optional[str] + Pagination cursor: the `next_cursor` value of the previous page's response. Omit it for the first page. + + page_size : typing.Optional[int] + How many generations to return per page. + + status : typing.Optional[VideoListRequestStatus] + Only return generations with this lifecycle status. + + model_id : typing.Optional[str] + Only return generations of this model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationListResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/flows/video", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "status": status, + "model_id": model_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationListResponse, + construct_type( + type_=MediaGenerationListResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, request: VideoGenerationRequest, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MediaGenerationCreateResponse]: + """ + Start a video generation with the selected model. + + Parameters + ---------- + request : VideoGenerationRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationCreateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/flows/video", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=VideoGenerationRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationCreateResponse, + construct_type( + type_=MediaGenerationCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, generation_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MediaGenerationResponse]: + """ + Retrieve the status of a video generation, and retrieve its output URL once completed. + + Parameters + ---------- + generation_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MediaGenerationResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/flows/video/{jsonable_encoder(generation_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MediaGenerationResponse, + construct_type( + type_=MediaGenerationResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/flows/video/types/__init__.py b/data/src/elevenlabs/flows/video/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..505437753b6d00b4d65d0346fd23892cb5e1b70d --- /dev/null +++ b/data/src/elevenlabs/flows/video/types/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .video_list_request_status import VideoListRequestStatus +_dynamic_imports: typing.Dict[str, str] = {"VideoListRequestStatus": ".video_list_request_status"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["VideoListRequestStatus"] diff --git a/data/src/elevenlabs/flows/video/types/video_list_request_status.py b/data/src/elevenlabs/flows/video/types/video_list_request_status.py new file mode 100644 index 0000000000000000000000000000000000000000..4e1b6e90e481d8fa04ddd3a845499e39f0f196d4 --- /dev/null +++ b/data/src/elevenlabs/flows/video/types/video_list_request_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VideoListRequestStatus = typing.Union[typing.Literal["pending", "generating", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/flows_custom.py b/data/src/elevenlabs/flows_custom.py new file mode 100644 index 0000000000000000000000000000000000000000..8698288a8dfbd448d12b286c958af0871b8bc540 --- /dev/null +++ b/data/src/elevenlabs/flows_custom.py @@ -0,0 +1,793 @@ +import asyncio +import email.utils +import math +import time +import typing +from random import random + +from elevenlabs.core.http_response import AsyncHttpResponse, HttpResponse +from elevenlabs.core.request_options import RequestOptions +from elevenlabs.flows.client import AsyncFlowsClient as AutogeneratedAsyncFlowsClient +from elevenlabs.flows.client import FlowsClient as AutogeneratedFlowsClient +from elevenlabs.flows.image.client import AsyncImageClient as AutogeneratedAsyncImageClient +from elevenlabs.flows.image.client import ImageClient as AutogeneratedImageClient +from elevenlabs.flows.templates.client import AsyncTemplatesClient as AutogeneratedAsyncTemplatesClient +from elevenlabs.flows.templates.client import TemplatesClient as AutogeneratedTemplatesClient +from elevenlabs.flows.templates.runs.client import AsyncRunsClient as AutogeneratedAsyncRunsClient +from elevenlabs.flows.templates.runs.client import RunsClient as AutogeneratedRunsClient +from elevenlabs.flows.text_to_speech.client import AsyncTextToSpeechClient as AutogeneratedAsyncTextToSpeechClient +from elevenlabs.flows.text_to_speech.client import TextToSpeechClient as AutogeneratedTextToSpeechClient +from elevenlabs.flows.video.client import AsyncVideoClient as AutogeneratedAsyncVideoClient +from elevenlabs.flows.video.client import VideoClient as AutogeneratedVideoClient +from elevenlabs.types.image_generation_request import ImageGenerationRequest +from elevenlabs.types.media_generation_response import ( + MediaGenerationResponse_Completed, + MediaGenerationResponse_Failed, +) +from elevenlabs.types.template_run_input import TemplateRunInput +from elevenlabs.types.template_run_response import TemplateRunResponse +from elevenlabs.types.text_to_speech_generation_request import TextToSpeechGenerationRequest +from elevenlabs.types.video_generation_request import VideoGenerationRequest +from elevenlabs.types.webhook_target import WebhookTarget + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + +# Matches the server's shortest `Retry-After` (3s for image, audio and text), so the SDK polls no faster +# than the server would pace it when the header is missing. +DEFAULT_MIN_POLL_INTERVAL_SECONDS = 3.0 + +# Below this, a missing server hint would turn the wait into a tight loop of status checks. +_SMALLEST_MIN_POLL_INTERVAL_SECONDS = 0.5 + +# Spreads out clients that started together so their status checks don't arrive in lockstep. +_POLL_JITTER = 0.2 + +_TERMINAL_STATUSES = frozenset({"completed", "failed"}) + +T = typing.TypeVar("T") + +TerminalMediaGenerationResponse = typing.Union[MediaGenerationResponse_Completed, MediaGenerationResponse_Failed] +"""What `create_and_wait` returns for a generation: always `completed` or `failed`, never in progress.""" + + +class FlowsWaitTimeoutError(Exception): + """ + Raised by `create_and_wait` when a generation or template run is still unfinished after `wait_timeout_in_seconds` seconds. + + The work keeps running on the server. Resume waiting by calling `get` with `id` + (and `template_id` for a template run), or let a webhook deliver the result. + """ + + def __init__( + self, + *, + id: str, + wait_timeout_in_seconds: float, + last_response: typing.Any, + template_id: typing.Optional[str] = None, + ) -> None: + self.id = id + self.template_id = template_id + self.wait_timeout_in_seconds = wait_timeout_in_seconds + self.last_response = last_response + status = getattr(last_response, "status", None) + if template_id is not None: + message = ( + f"Template run {id} of template {template_id} is still {status} after {wait_timeout_in_seconds}s; " + "call `runs.get` with `template_id` and `id` to keep waiting" + ) + else: + message = f"Generation {id} is still {status} after {wait_timeout_in_seconds}s; call `get` with this id to keep waiting" + super().__init__(message) + + +def _check_wait_options(wait_timeout_in_seconds: typing.Optional[float], min_interval: float) -> None: + # NaN passes every `<` check, and an infinite interval would never poll, so both are rejected explicitly. + if not math.isfinite(min_interval) or min_interval < _SMALLEST_MIN_POLL_INTERVAL_SECONDS: + raise ValueError( + f"min_poll_interval_in_seconds must be a finite number of at least {_SMALLEST_MIN_POLL_INTERVAL_SECONDS}s, got {min_interval}" + ) + # Written as `not >= 0` so NaN fails too: a NaN deadline never compares as passed, so the wait would + # silently ignore the timeout. 0 times out straight after the create; None or inf waits indefinitely. + if wait_timeout_in_seconds is not None and not wait_timeout_in_seconds >= 0: + raise ValueError(f"wait_timeout_in_seconds must be at least 0s, got {wait_timeout_in_seconds}") + + +def _poll_request_options(request_options: typing.Optional[RequestOptions]) -> typing.Optional[RequestOptions]: + """The caller's options for the status GETs: everything except body parameters, which only the create takes.""" + if request_options is None or "additional_body_parameters" not in request_options: + return request_options + return typing.cast(RequestOptions, {k: v for k, v in request_options.items() if k != "additional_body_parameters"}) + + +def _parse_retry_after(headers: typing.Mapping[str, str]) -> typing.Optional[float]: + """ + Seconds from a `Retry-After` header, given as whole seconds or an HTTP date (RFC 9110), or None if absent + or unparseable. Kept here rather than imported from the generated `core.http_client`, whose private + helpers can change on any regeneration. + """ + value = next((v for k, v in headers.items() if k.lower() == "retry-after"), None) + if value is None: + return None + value = value.strip() + if value.isdigit(): + return float(value) + try: + retry_date = email.utils.parsedate_to_datetime(value) + except (TypeError, ValueError): + return None + if retry_date is None: # Python < 3.10 returns None instead of raising + return None + return max(retry_date.timestamp() - time.time(), 0.0) + + +def _poll_delay(headers: typing.Mapping[str, str], min_interval: float) -> float: + """Seconds to wait before the next GET: the server's `Retry-After`, never below `min_interval`, plus 0-20% jitter.""" + retry_after = _parse_retry_after(headers) + delay = max(retry_after if retry_after is not None else min_interval, min_interval) + return delay * (1 + random() * _POLL_JITTER) + + +def _is_terminal(response: typing.Any) -> bool: + return getattr(response, "status", None) in _TERMINAL_STATUSES + + +def _wait( + *, + id: str, + first_response: typing.Any, + first_headers: typing.Mapping[str, str], + get: typing.Callable[[], HttpResponse[T]], + started_at: float, + wait_timeout_in_seconds: typing.Optional[float], + min_interval: float, + template_id: typing.Optional[str] = None, +) -> T: + response: typing.Any = first_response + headers = first_headers + while not _is_terminal(response): + delay = _poll_delay(headers, min_interval) + if wait_timeout_in_seconds is not None: + # The last sleep ends on the deadline; the GET after it takes time, so the next pass raises. + remaining = started_at + wait_timeout_in_seconds - time.monotonic() + if remaining <= 0: + raise FlowsWaitTimeoutError( + id=id, + wait_timeout_in_seconds=wait_timeout_in_seconds, + last_response=response, + template_id=template_id, + ) + delay = min(delay, remaining) + time.sleep(delay) + raw = get() + response, headers = raw.data, raw.headers + return typing.cast(T, response) + + +async def _async_wait( + *, + id: str, + first_response: typing.Any, + first_headers: typing.Mapping[str, str], + get: typing.Callable[[], typing.Awaitable[AsyncHttpResponse[T]]], + started_at: float, + wait_timeout_in_seconds: typing.Optional[float], + min_interval: float, + template_id: typing.Optional[str] = None, +) -> T: + response: typing.Any = first_response + headers = first_headers + while not _is_terminal(response): + delay = _poll_delay(headers, min_interval) + if wait_timeout_in_seconds is not None: + # The last sleep ends on the deadline; the GET after it takes time, so the next pass raises. + remaining = started_at + wait_timeout_in_seconds - time.monotonic() + if remaining <= 0: + raise FlowsWaitTimeoutError( + id=id, + wait_timeout_in_seconds=wait_timeout_in_seconds, + last_response=response, + template_id=template_id, + ) + delay = min(delay, remaining) + await asyncio.sleep(delay) + raw = await get() + response, headers = raw.data, raw.headers + return typing.cast(T, response) + + +class ImageClient(AutogeneratedImageClient): + def create_and_wait( + self, + *, + request: ImageGenerationRequest, + wait_timeout_in_seconds: typing.Optional[float] = None, + min_poll_interval_in_seconds: float = DEFAULT_MIN_POLL_INTERVAL_SECONDS, + request_options: typing.Optional[RequestOptions] = None, + ) -> TerminalMediaGenerationResponse: + """ + Start an image generation and wait until it is `completed` or `failed`, then return the final generation. + + Between status checks this waits as long as the server suggests, never less than `min_poll_interval_in_seconds`. + This is meant for scripts and quickstarts: in production, set `webhook` on the request passed to `create` + and handle the webhook event instead of holding a process open. + + A `failed` generation is returned, not raised; check `status` on the result. + + Parameters + ---------- + request : ImageGenerationRequest + + wait_timeout_in_seconds : typing.Optional[float] + Seconds to wait in total before raising `FlowsWaitTimeoutError`, which carries the generation `id` + so you can resume with `get`. Waits indefinitely when omitted or `float("inf")`; must be at least 0 + when set. Not to be confused with the client's `timeout` or `timeout_in_seconds` in + `request_options`, which limit each HTTP request. + + min_poll_interval_in_seconds : float + The shortest wait between status checks, in seconds, and the wait used when the server suggests none. + Must be at least 0.5. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration, applied to the create call and to every status check, except + `additional_body_parameters`, which only the create call gets. `timeout_in_seconds` and + `max_retries` apply to each request on its own; `wait_timeout_in_seconds` bounds the whole wait. + + Returns + ------- + TerminalMediaGenerationResponse + The generation in its terminal state: `MediaGenerationResponse_Completed` or `MediaGenerationResponse_Failed`. + """ + _check_wait_options(wait_timeout_in_seconds, min_poll_interval_in_seconds) + started_at = time.monotonic() + created = self.with_raw_response.create(request=request, request_options=request_options) + generation_id = created.data.id + poll_options = _poll_request_options(request_options) + return typing.cast( + TerminalMediaGenerationResponse, + _wait( + id=generation_id, + first_response=created.data, + first_headers=created.headers, + get=lambda: self.with_raw_response.get(generation_id, request_options=poll_options), + started_at=started_at, + wait_timeout_in_seconds=wait_timeout_in_seconds, + min_interval=min_poll_interval_in_seconds, + ), + ) + + +class AsyncImageClient(AutogeneratedAsyncImageClient): + async def create_and_wait( + self, + *, + request: ImageGenerationRequest, + wait_timeout_in_seconds: typing.Optional[float] = None, + min_poll_interval_in_seconds: float = DEFAULT_MIN_POLL_INTERVAL_SECONDS, + request_options: typing.Optional[RequestOptions] = None, + ) -> TerminalMediaGenerationResponse: + """ + Start an image generation and wait until it is `completed` or `failed`, then return the final generation. + + Between status checks this waits as long as the server suggests, never less than `min_poll_interval_in_seconds`. + This is meant for scripts and quickstarts: in production, set `webhook` on the request passed to `create` + and handle the webhook event instead of holding a process open. + + A `failed` generation is returned, not raised; check `status` on the result. + + Parameters + ---------- + request : ImageGenerationRequest + + wait_timeout_in_seconds : typing.Optional[float] + Seconds to wait in total before raising `FlowsWaitTimeoutError`, which carries the generation `id` + so you can resume with `get`. Waits indefinitely when omitted or `float("inf")`; must be at least 0 + when set. Not to be confused with the client's `timeout` or `timeout_in_seconds` in + `request_options`, which limit each HTTP request. + + min_poll_interval_in_seconds : float + The shortest wait between status checks, in seconds, and the wait used when the server suggests none. + Must be at least 0.5. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration, applied to the create call and to every status check, except + `additional_body_parameters`, which only the create call gets. `timeout_in_seconds` and + `max_retries` apply to each request on its own; `wait_timeout_in_seconds` bounds the whole wait. + + Returns + ------- + TerminalMediaGenerationResponse + The generation in its terminal state: `MediaGenerationResponse_Completed` or `MediaGenerationResponse_Failed`. + """ + _check_wait_options(wait_timeout_in_seconds, min_poll_interval_in_seconds) + started_at = time.monotonic() + created = await self.with_raw_response.create(request=request, request_options=request_options) + generation_id = created.data.id + poll_options = _poll_request_options(request_options) + return typing.cast( + TerminalMediaGenerationResponse, + await _async_wait( + id=generation_id, + first_response=created.data, + first_headers=created.headers, + get=lambda: self.with_raw_response.get(generation_id, request_options=poll_options), + started_at=started_at, + wait_timeout_in_seconds=wait_timeout_in_seconds, + min_interval=min_poll_interval_in_seconds, + ), + ) + + +class VideoClient(AutogeneratedVideoClient): + def create_and_wait( + self, + *, + request: VideoGenerationRequest, + wait_timeout_in_seconds: typing.Optional[float] = None, + min_poll_interval_in_seconds: float = DEFAULT_MIN_POLL_INTERVAL_SECONDS, + request_options: typing.Optional[RequestOptions] = None, + ) -> TerminalMediaGenerationResponse: + """ + Start a video generation and wait until it is `completed` or `failed`, then return the final generation. + + Between status checks this waits as long as the server suggests, never less than `min_poll_interval_in_seconds`. + This is meant for scripts and quickstarts: in production, set `webhook` on the request passed to `create` + and handle the webhook event instead of holding a process open. + + A `failed` generation is returned, not raised; check `status` on the result. + + Parameters + ---------- + request : VideoGenerationRequest + + wait_timeout_in_seconds : typing.Optional[float] + Seconds to wait in total before raising `FlowsWaitTimeoutError`, which carries the generation `id` + so you can resume with `get`. Waits indefinitely when omitted or `float("inf")`; must be at least 0 + when set. Not to be confused with the client's `timeout` or `timeout_in_seconds` in + `request_options`, which limit each HTTP request. + + min_poll_interval_in_seconds : float + The shortest wait between status checks, in seconds, and the wait used when the server suggests none. + Must be at least 0.5. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration, applied to the create call and to every status check, except + `additional_body_parameters`, which only the create call gets. `timeout_in_seconds` and + `max_retries` apply to each request on its own; `wait_timeout_in_seconds` bounds the whole wait. + + Returns + ------- + TerminalMediaGenerationResponse + The generation in its terminal state: `MediaGenerationResponse_Completed` or `MediaGenerationResponse_Failed`. + """ + _check_wait_options(wait_timeout_in_seconds, min_poll_interval_in_seconds) + started_at = time.monotonic() + created = self.with_raw_response.create(request=request, request_options=request_options) + generation_id = created.data.id + poll_options = _poll_request_options(request_options) + return typing.cast( + TerminalMediaGenerationResponse, + _wait( + id=generation_id, + first_response=created.data, + first_headers=created.headers, + get=lambda: self.with_raw_response.get(generation_id, request_options=poll_options), + started_at=started_at, + wait_timeout_in_seconds=wait_timeout_in_seconds, + min_interval=min_poll_interval_in_seconds, + ), + ) + + +class AsyncVideoClient(AutogeneratedAsyncVideoClient): + async def create_and_wait( + self, + *, + request: VideoGenerationRequest, + wait_timeout_in_seconds: typing.Optional[float] = None, + min_poll_interval_in_seconds: float = DEFAULT_MIN_POLL_INTERVAL_SECONDS, + request_options: typing.Optional[RequestOptions] = None, + ) -> TerminalMediaGenerationResponse: + """ + Start a video generation and wait until it is `completed` or `failed`, then return the final generation. + + Between status checks this waits as long as the server suggests, never less than `min_poll_interval_in_seconds`. + This is meant for scripts and quickstarts: in production, set `webhook` on the request passed to `create` + and handle the webhook event instead of holding a process open. + + A `failed` generation is returned, not raised; check `status` on the result. + + Parameters + ---------- + request : VideoGenerationRequest + + wait_timeout_in_seconds : typing.Optional[float] + Seconds to wait in total before raising `FlowsWaitTimeoutError`, which carries the generation `id` + so you can resume with `get`. Waits indefinitely when omitted or `float("inf")`; must be at least 0 + when set. Not to be confused with the client's `timeout` or `timeout_in_seconds` in + `request_options`, which limit each HTTP request. + + min_poll_interval_in_seconds : float + The shortest wait between status checks, in seconds, and the wait used when the server suggests none. + Must be at least 0.5. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration, applied to the create call and to every status check, except + `additional_body_parameters`, which only the create call gets. `timeout_in_seconds` and + `max_retries` apply to each request on its own; `wait_timeout_in_seconds` bounds the whole wait. + + Returns + ------- + TerminalMediaGenerationResponse + The generation in its terminal state: `MediaGenerationResponse_Completed` or `MediaGenerationResponse_Failed`. + """ + _check_wait_options(wait_timeout_in_seconds, min_poll_interval_in_seconds) + started_at = time.monotonic() + created = await self.with_raw_response.create(request=request, request_options=request_options) + generation_id = created.data.id + poll_options = _poll_request_options(request_options) + return typing.cast( + TerminalMediaGenerationResponse, + await _async_wait( + id=generation_id, + first_response=created.data, + first_headers=created.headers, + get=lambda: self.with_raw_response.get(generation_id, request_options=poll_options), + started_at=started_at, + wait_timeout_in_seconds=wait_timeout_in_seconds, + min_interval=min_poll_interval_in_seconds, + ), + ) + + +class TextToSpeechClient(AutogeneratedTextToSpeechClient): + def create_and_wait( + self, + *, + request: TextToSpeechGenerationRequest, + wait_timeout_in_seconds: typing.Optional[float] = None, + min_poll_interval_in_seconds: float = DEFAULT_MIN_POLL_INTERVAL_SECONDS, + request_options: typing.Optional[RequestOptions] = None, + ) -> TerminalMediaGenerationResponse: + """ + Start a text-to-speech generation and wait until it is `completed` or `failed`, then return the final generation. + + Between status checks this waits as long as the server suggests, never less than `min_poll_interval_in_seconds`. + This is meant for scripts and quickstarts: in production, set `webhook` on the request passed to `create` + and handle the webhook event instead of holding a process open. + + A `failed` generation is returned, not raised; check `status` on the result. + + Charged per character via text-to-speech billing. Use this over `/v1/text-to-speech` for the asynchronous generation lifecycle or for models not offered there; for direct, synchronous speech synthesis, prefer `/v1/text-to-speech`. + + Parameters + ---------- + request : TextToSpeechGenerationRequest + + wait_timeout_in_seconds : typing.Optional[float] + Seconds to wait in total before raising `FlowsWaitTimeoutError`, which carries the generation `id` + so you can resume with `get`. Waits indefinitely when omitted or `float("inf")`; must be at least 0 + when set. Not to be confused with the client's `timeout` or `timeout_in_seconds` in + `request_options`, which limit each HTTP request. + + min_poll_interval_in_seconds : float + The shortest wait between status checks, in seconds, and the wait used when the server suggests none. + Must be at least 0.5. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration, applied to the create call and to every status check, except + `additional_body_parameters`, which only the create call gets. `timeout_in_seconds` and + `max_retries` apply to each request on its own; `wait_timeout_in_seconds` bounds the whole wait. + + Returns + ------- + TerminalMediaGenerationResponse + The generation in its terminal state: `MediaGenerationResponse_Completed` or `MediaGenerationResponse_Failed`. + """ + _check_wait_options(wait_timeout_in_seconds, min_poll_interval_in_seconds) + started_at = time.monotonic() + created = self.with_raw_response.create(request=request, request_options=request_options) + generation_id = created.data.id + poll_options = _poll_request_options(request_options) + return typing.cast( + TerminalMediaGenerationResponse, + _wait( + id=generation_id, + first_response=created.data, + first_headers=created.headers, + get=lambda: self.with_raw_response.get(generation_id, request_options=poll_options), + started_at=started_at, + wait_timeout_in_seconds=wait_timeout_in_seconds, + min_interval=min_poll_interval_in_seconds, + ), + ) + + +class AsyncTextToSpeechClient(AutogeneratedAsyncTextToSpeechClient): + async def create_and_wait( + self, + *, + request: TextToSpeechGenerationRequest, + wait_timeout_in_seconds: typing.Optional[float] = None, + min_poll_interval_in_seconds: float = DEFAULT_MIN_POLL_INTERVAL_SECONDS, + request_options: typing.Optional[RequestOptions] = None, + ) -> TerminalMediaGenerationResponse: + """ + Start a text-to-speech generation and wait until it is `completed` or `failed`, then return the final generation. + + Between status checks this waits as long as the server suggests, never less than `min_poll_interval_in_seconds`. + This is meant for scripts and quickstarts: in production, set `webhook` on the request passed to `create` + and handle the webhook event instead of holding a process open. + + A `failed` generation is returned, not raised; check `status` on the result. + + Charged per character via text-to-speech billing. Use this over `/v1/text-to-speech` for the asynchronous generation lifecycle or for models not offered there; for direct, synchronous speech synthesis, prefer `/v1/text-to-speech`. + + Parameters + ---------- + request : TextToSpeechGenerationRequest + + wait_timeout_in_seconds : typing.Optional[float] + Seconds to wait in total before raising `FlowsWaitTimeoutError`, which carries the generation `id` + so you can resume with `get`. Waits indefinitely when omitted or `float("inf")`; must be at least 0 + when set. Not to be confused with the client's `timeout` or `timeout_in_seconds` in + `request_options`, which limit each HTTP request. + + min_poll_interval_in_seconds : float + The shortest wait between status checks, in seconds, and the wait used when the server suggests none. + Must be at least 0.5. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration, applied to the create call and to every status check, except + `additional_body_parameters`, which only the create call gets. `timeout_in_seconds` and + `max_retries` apply to each request on its own; `wait_timeout_in_seconds` bounds the whole wait. + + Returns + ------- + TerminalMediaGenerationResponse + The generation in its terminal state: `MediaGenerationResponse_Completed` or `MediaGenerationResponse_Failed`. + """ + _check_wait_options(wait_timeout_in_seconds, min_poll_interval_in_seconds) + started_at = time.monotonic() + created = await self.with_raw_response.create(request=request, request_options=request_options) + generation_id = created.data.id + poll_options = _poll_request_options(request_options) + return typing.cast( + TerminalMediaGenerationResponse, + await _async_wait( + id=generation_id, + first_response=created.data, + first_headers=created.headers, + get=lambda: self.with_raw_response.get(generation_id, request_options=poll_options), + started_at=started_at, + wait_timeout_in_seconds=wait_timeout_in_seconds, + min_interval=min_poll_interval_in_seconds, + ), + ) + + +class RunsClient(AutogeneratedRunsClient): + def create_and_wait( + self, + template_id: str, + *, + inputs: typing.Dict[str, TemplateRunInput], + version_id: typing.Optional[str] = OMIT, + webhook: typing.Optional[WebhookTarget] = OMIT, + wait_timeout_in_seconds: typing.Optional[float] = None, + min_poll_interval_in_seconds: float = DEFAULT_MIN_POLL_INTERVAL_SECONDS, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateRunResponse: + """ + Start a run of a flows template and wait until its `status` is `completed` or `failed`, then return the final run. + + Between status checks this waits as long as the server suggests, never less than `min_poll_interval_in_seconds`. + This is meant for scripts and quickstarts: in production, pass `webhook` to `create` and handle the + `flows_template_run` webhook instead of holding a process open. + + A `failed` run is returned, not raised; check `status` on the result and on each output. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + inputs : typing.Dict[str, TemplateRunInput] + Input values keyed by input port id. Every input port of the version being run must be given; a missing or unknown id is rejected. Pass `{}` for a template with no inputs. + + version_id : typing.Optional[str] + The template snapshot to run. Pass a specific version id to pin that snapshot, or `latest` (the default when omitted) to run the template's most recently published version. Only published versions can be pinned, except by the template's owner, who may also pin an unpublished saved snapshot to try it out before publishing. The live draft is never run through this API. + + webhook : typing.Optional[WebhookTarget] + Include to send the run's result to the workspace's configured flows webhooks once the run's `status` reaches `completed` or `failed`. One event for the whole run: the `flows_template_run` event's `data` matches the terminal response of `GET /v1/flows/templates/{template_id}/runs/{run_id}`. + + wait_timeout_in_seconds : typing.Optional[float] + Seconds to wait in total before raising `FlowsWaitTimeoutError`, which carries the run `id` and `template_id` + so you can resume with `get`. Waits indefinitely when omitted or `float("inf")`; must be at least 0 + when set. Not to be confused with the client's `timeout` or `timeout_in_seconds` in + `request_options`, which limit each HTTP request. + + min_poll_interval_in_seconds : float + The shortest wait between status checks, in seconds, and the wait used when the server suggests none. + Must be at least 0.5. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration, applied to the create call and to every status check, except + `additional_body_parameters`, which only the create call gets. `timeout_in_seconds` and + `max_retries` apply to each request on its own; `wait_timeout_in_seconds` bounds the whole wait. + + Returns + ------- + TemplateRunResponse + The run in its terminal state. + """ + _check_wait_options(wait_timeout_in_seconds, min_poll_interval_in_seconds) + started_at = time.monotonic() + created = self.with_raw_response.create( + template_id, inputs=inputs, version_id=version_id, webhook=webhook, request_options=request_options + ) + run_id = created.data.id + poll_options = _poll_request_options(request_options) + return _wait( + id=run_id, + template_id=template_id, + first_response=created.data, + first_headers=created.headers, + get=lambda: self.with_raw_response.get(template_id, run_id, request_options=poll_options), + started_at=started_at, + wait_timeout_in_seconds=wait_timeout_in_seconds, + min_interval=min_poll_interval_in_seconds, + ) + + +class AsyncRunsClient(AutogeneratedAsyncRunsClient): + async def create_and_wait( + self, + template_id: str, + *, + inputs: typing.Dict[str, TemplateRunInput], + version_id: typing.Optional[str] = OMIT, + webhook: typing.Optional[WebhookTarget] = OMIT, + wait_timeout_in_seconds: typing.Optional[float] = None, + min_poll_interval_in_seconds: float = DEFAULT_MIN_POLL_INTERVAL_SECONDS, + request_options: typing.Optional[RequestOptions] = None, + ) -> TemplateRunResponse: + """ + Start a run of a flows template and wait until its `status` is `completed` or `failed`, then return the final run. + + Between status checks this waits as long as the server suggests, never less than `min_poll_interval_in_seconds`. + This is meant for scripts and quickstarts: in production, pass `webhook` to `create` and handle the + `flows_template_run` webhook instead of holding a process open. + + A `failed` run is returned, not raised; check `status` on the result and on each output. + + Parameters + ---------- + template_id : str + The ID of the template, as shown in the ElevenLabs app or by `GET /v1/flows/templates`. + + inputs : typing.Dict[str, TemplateRunInput] + Input values keyed by input port id. Every input port of the version being run must be given; a missing or unknown id is rejected. Pass `{}` for a template with no inputs. + + version_id : typing.Optional[str] + The template snapshot to run. Pass a specific version id to pin that snapshot, or `latest` (the default when omitted) to run the template's most recently published version. Only published versions can be pinned, except by the template's owner, who may also pin an unpublished saved snapshot to try it out before publishing. The live draft is never run through this API. + + webhook : typing.Optional[WebhookTarget] + Include to send the run's result to the workspace's configured flows webhooks once the run's `status` reaches `completed` or `failed`. One event for the whole run: the `flows_template_run` event's `data` matches the terminal response of `GET /v1/flows/templates/{template_id}/runs/{run_id}`. + + wait_timeout_in_seconds : typing.Optional[float] + Seconds to wait in total before raising `FlowsWaitTimeoutError`, which carries the run `id` and `template_id` + so you can resume with `get`. Waits indefinitely when omitted or `float("inf")`; must be at least 0 + when set. Not to be confused with the client's `timeout` or `timeout_in_seconds` in + `request_options`, which limit each HTTP request. + + min_poll_interval_in_seconds : float + The shortest wait between status checks, in seconds, and the wait used when the server suggests none. + Must be at least 0.5. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration, applied to the create call and to every status check, except + `additional_body_parameters`, which only the create call gets. `timeout_in_seconds` and + `max_retries` apply to each request on its own; `wait_timeout_in_seconds` bounds the whole wait. + + Returns + ------- + TemplateRunResponse + The run in its terminal state. + """ + _check_wait_options(wait_timeout_in_seconds, min_poll_interval_in_seconds) + started_at = time.monotonic() + created = await self.with_raw_response.create( + template_id, inputs=inputs, version_id=version_id, webhook=webhook, request_options=request_options + ) + run_id = created.data.id + poll_options = _poll_request_options(request_options) + return await _async_wait( + id=run_id, + template_id=template_id, + first_response=created.data, + first_headers=created.headers, + get=lambda: self.with_raw_response.get(template_id, run_id, request_options=poll_options), + started_at=started_at, + wait_timeout_in_seconds=wait_timeout_in_seconds, + min_interval=min_poll_interval_in_seconds, + ) + + +class TemplatesClient(AutogeneratedTemplatesClient): + @property + def runs(self) -> RunsClient: + if self._runs is None: + self._runs = RunsClient(client_wrapper=self._client_wrapper) + return typing.cast(RunsClient, self._runs) + + +class AsyncTemplatesClient(AutogeneratedAsyncTemplatesClient): + @property + def runs(self) -> AsyncRunsClient: + if self._runs is None: + self._runs = AsyncRunsClient(client_wrapper=self._client_wrapper) + return typing.cast(AsyncRunsClient, self._runs) + + +class FlowsClient(AutogeneratedFlowsClient): + """ + Extends the autogenerated flows client with `create_and_wait` helpers on + `image`, `video`, `text_to_speech` and `templates.runs`. + """ + + @property + def video(self) -> VideoClient: + if self._video is None: + self._video = VideoClient(client_wrapper=self._client_wrapper) + return typing.cast(VideoClient, self._video) + + @property + def image(self) -> ImageClient: + if self._image is None: + self._image = ImageClient(client_wrapper=self._client_wrapper) + return typing.cast(ImageClient, self._image) + + @property + def text_to_speech(self) -> TextToSpeechClient: + if self._text_to_speech is None: + self._text_to_speech = TextToSpeechClient(client_wrapper=self._client_wrapper) + return typing.cast(TextToSpeechClient, self._text_to_speech) + + @property + def templates(self) -> TemplatesClient: + if self._templates is None: + self._templates = TemplatesClient(client_wrapper=self._client_wrapper) + return typing.cast(TemplatesClient, self._templates) + + +class AsyncFlowsClient(AutogeneratedAsyncFlowsClient): + """ + Extends the autogenerated async flows client with `create_and_wait` helpers on + `image`, `video`, `text_to_speech` and `templates.runs`. + """ + + @property + def video(self) -> AsyncVideoClient: + if self._video is None: + self._video = AsyncVideoClient(client_wrapper=self._client_wrapper) + return typing.cast(AsyncVideoClient, self._video) + + @property + def image(self) -> AsyncImageClient: + if self._image is None: + self._image = AsyncImageClient(client_wrapper=self._client_wrapper) + return typing.cast(AsyncImageClient, self._image) + + @property + def text_to_speech(self) -> AsyncTextToSpeechClient: + if self._text_to_speech is None: + self._text_to_speech = AsyncTextToSpeechClient(client_wrapper=self._client_wrapper) + return typing.cast(AsyncTextToSpeechClient, self._text_to_speech) + + @property + def templates(self) -> AsyncTemplatesClient: + if self._templates is None: + self._templates = AsyncTemplatesClient(client_wrapper=self._client_wrapper) + return typing.cast(AsyncTemplatesClient, self._templates) diff --git a/data/src/elevenlabs/forced_alignment/__init__.py b/data/src/elevenlabs/forced_alignment/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/forced_alignment/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/forced_alignment/client.py b/data/src/elevenlabs/forced_alignment/client.py new file mode 100644 index 0000000000000000000000000000000000000000..325d2ad70c5912a40261157b9f8b9d67190fa944 --- /dev/null +++ b/data/src/elevenlabs/forced_alignment/client.py @@ -0,0 +1,124 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.forced_alignment_response_model import ForcedAlignmentResponseModel +from .raw_client import AsyncRawForcedAlignmentClient, RawForcedAlignmentClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ForcedAlignmentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawForcedAlignmentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawForcedAlignmentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawForcedAlignmentClient + """ + return self._raw_client + + def create( + self, *, file: core.File, text: str, request_options: typing.Optional[RequestOptions] = None + ) -> ForcedAlignmentResponseModel: + """ + Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + text : str + The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ForcedAlignmentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.forced_alignment.create( + text="text", + ) + """ + _response = self._raw_client.create(file=file, text=text, request_options=request_options) + return _response.data + + +class AsyncForcedAlignmentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawForcedAlignmentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawForcedAlignmentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawForcedAlignmentClient + """ + return self._raw_client + + async def create( + self, *, file: core.File, text: str, request_options: typing.Optional[RequestOptions] = None + ) -> ForcedAlignmentResponseModel: + """ + Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + text : str + The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ForcedAlignmentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.forced_alignment.create( + text="text", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(file=file, text=text, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/forced_alignment/raw_client.py b/data/src/elevenlabs/forced_alignment/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8a4f3e6b7e8072017d6808378497a9fa0d3543d6 --- /dev/null +++ b/data/src/elevenlabs/forced_alignment/raw_client.py @@ -0,0 +1,158 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.forced_alignment_response_model import ForcedAlignmentResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawForcedAlignmentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, *, file: core.File, text: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ForcedAlignmentResponseModel]: + """ + Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + text : str + The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ForcedAlignmentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/forced-alignment", + method="POST", + data={ + "text": text, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ForcedAlignmentResponseModel, + construct_type( + type_=ForcedAlignmentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawForcedAlignmentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, *, file: core.File, text: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ForcedAlignmentResponseModel]: + """ + Force align an audio file to text. Use this endpoint to get the timing information for each character and word in an audio file based on a provided text transcript. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + text : str + The text to align with the audio. The input text can be in any format, however diarization is not supported at this time. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ForcedAlignmentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/forced-alignment", + method="POST", + data={ + "text": text, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ForcedAlignmentResponseModel, + construct_type( + type_=ForcedAlignmentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/history/__init__.py b/data/src/elevenlabs/history/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4d6d3a9f9a0e44a32ff4616b7c44266120889817 --- /dev/null +++ b/data/src/elevenlabs/history/__init__.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import HistoryListRequestSortDirection, HistoryListRequestSource +_dynamic_imports: typing.Dict[str, str] = { + "HistoryListRequestSortDirection": ".types", + "HistoryListRequestSource": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["HistoryListRequestSortDirection", "HistoryListRequestSource"] diff --git a/data/src/elevenlabs/history/client.py b/data/src/elevenlabs/history/client.py new file mode 100644 index 0000000000000000000000000000000000000000..bfdad2276d6b87553d84100f1bf31301b2a40be9 --- /dev/null +++ b/data/src/elevenlabs/history/client.py @@ -0,0 +1,545 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.delete_history_item_response import DeleteHistoryItemResponse +from ..types.get_speech_history_response import GetSpeechHistoryResponse +from ..types.speech_history_item_response import SpeechHistoryItemResponse +from .raw_client import AsyncRawHistoryClient, RawHistoryClient +from .types.history_list_request_sort_direction import HistoryListRequestSortDirection +from .types.history_list_request_source import HistoryListRequestSource + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class HistoryClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawHistoryClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawHistoryClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawHistoryClient + """ + return self._raw_client + + def list( + self, + *, + page_size: typing.Optional[int] = None, + start_after_history_item_id: typing.Optional[str] = None, + voice_id: typing.Optional[str] = None, + model_id: typing.Optional[str] = None, + date_before_unix: typing.Optional[int] = None, + date_after_unix: typing.Optional[int] = None, + sort_direction: typing.Optional[HistoryListRequestSortDirection] = None, + search: typing.Optional[str] = None, + source: typing.Optional[HistoryListRequestSource] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetSpeechHistoryResponse: + """ + Returns a list of your generated audio (e.g. text to speech, speech to speech, Studio, dubbing). Music and SFX generations are not included and cannot currently be retrieved via the API. + + Parameters + ---------- + page_size : typing.Optional[int] + How many history items to return at maximum. Can not exceed 1000, defaults to 100. + + start_after_history_item_id : typing.Optional[str] + After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. + + voice_id : typing.Optional[str] + ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + model_id : typing.Optional[str] + Search term used for filtering history items. If provided, source becomes required. + + date_before_unix : typing.Optional[int] + Unix timestamp to filter history items before this date (exclusive). + + date_after_unix : typing.Optional[int] + Unix timestamp to filter history items after this date (inclusive). + + sort_direction : typing.Optional[HistoryListRequestSortDirection] + Sort direction for the results. + + search : typing.Optional[str] + search term used for filtering + + source : typing.Optional[HistoryListRequestSource] + Source of the generated history item + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetSpeechHistoryResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.list( + page_size=1, + start_after_history_item_id="start_after_history_item_id", + voice_id="voice_id", + model_id="model_id", + date_before_unix=1, + date_after_unix=1, + sort_direction="asc", + search="search", + source="TTS", + ) + """ + _response = self._raw_client.list( + page_size=page_size, + start_after_history_item_id=start_after_history_item_id, + voice_id=voice_id, + model_id=model_id, + date_before_unix=date_before_unix, + date_after_unix=date_after_unix, + sort_direction=sort_direction, + search=search, + source=source, + request_options=request_options, + ) + return _response.data + + def get( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SpeechHistoryItemResponse: + """ + Retrieves a history item. + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechHistoryItemResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.get( + history_item_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.get(history_item_id, request_options=request_options) + return _response.data + + def delete( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteHistoryItemResponse: + """ + Delete a history item by its ID + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteHistoryItemResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.delete( + history_item_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.delete(history_item_id, request_options=request_options) + return _response.data + + def get_audio( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Returns the audio of an history item. + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The audio file of the history item. + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.get_audio( + history_item_id="history_item_id", + ) + """ + with self._raw_client.get_audio(history_item_id, request_options=request_options) as r: + yield from r.data + + def download( + self, + *, + history_item_ids: typing.Sequence[str], + output_format: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. + + Parameters + ---------- + history_item_ids : typing.Sequence[str] + A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. + + output_format : typing.Optional[str] + Output format to transcode the audio file, can be wav or default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The requested audio file, or a zip file containing multiple audio files when multiple history items are requested. + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.history.download( + history_item_ids=["history_item_ids", "history_item_ids"], + ) + """ + with self._raw_client.download( + history_item_ids=history_item_ids, output_format=output_format, request_options=request_options + ) as r: + yield from r.data + + +class AsyncHistoryClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawHistoryClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawHistoryClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawHistoryClient + """ + return self._raw_client + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + start_after_history_item_id: typing.Optional[str] = None, + voice_id: typing.Optional[str] = None, + model_id: typing.Optional[str] = None, + date_before_unix: typing.Optional[int] = None, + date_after_unix: typing.Optional[int] = None, + sort_direction: typing.Optional[HistoryListRequestSortDirection] = None, + search: typing.Optional[str] = None, + source: typing.Optional[HistoryListRequestSource] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetSpeechHistoryResponse: + """ + Returns a list of your generated audio (e.g. text to speech, speech to speech, Studio, dubbing). Music and SFX generations are not included and cannot currently be retrieved via the API. + + Parameters + ---------- + page_size : typing.Optional[int] + How many history items to return at maximum. Can not exceed 1000, defaults to 100. + + start_after_history_item_id : typing.Optional[str] + After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. + + voice_id : typing.Optional[str] + ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + model_id : typing.Optional[str] + Search term used for filtering history items. If provided, source becomes required. + + date_before_unix : typing.Optional[int] + Unix timestamp to filter history items before this date (exclusive). + + date_after_unix : typing.Optional[int] + Unix timestamp to filter history items after this date (inclusive). + + sort_direction : typing.Optional[HistoryListRequestSortDirection] + Sort direction for the results. + + search : typing.Optional[str] + search term used for filtering + + source : typing.Optional[HistoryListRequestSource] + Source of the generated history item + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetSpeechHistoryResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.history.list( + page_size=1, + start_after_history_item_id="start_after_history_item_id", + voice_id="voice_id", + model_id="model_id", + date_before_unix=1, + date_after_unix=1, + sort_direction="asc", + search="search", + source="TTS", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + page_size=page_size, + start_after_history_item_id=start_after_history_item_id, + voice_id=voice_id, + model_id=model_id, + date_before_unix=date_before_unix, + date_after_unix=date_after_unix, + sort_direction=sort_direction, + search=search, + source=source, + request_options=request_options, + ) + return _response.data + + async def get( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SpeechHistoryItemResponse: + """ + Retrieves a history item. + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechHistoryItemResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.history.get( + history_item_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(history_item_id, request_options=request_options) + return _response.data + + async def delete( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteHistoryItemResponse: + """ + Delete a history item by its ID + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteHistoryItemResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.history.delete( + history_item_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(history_item_id, request_options=request_options) + return _response.data + + async def get_audio( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Returns the audio of an history item. + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The audio file of the history item. + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.history.get_audio( + history_item_id="history_item_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.get_audio(history_item_id, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk + + async def download( + self, + *, + history_item_ids: typing.Sequence[str], + output_format: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. + + Parameters + ---------- + history_item_ids : typing.Sequence[str] + A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. + + output_format : typing.Optional[str] + Output format to transcode the audio file, can be wav or default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The requested audio file, or a zip file containing multiple audio files when multiple history items are requested. + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.history.download( + history_item_ids=["history_item_ids", "history_item_ids"], + ) + + + asyncio.run(main()) + """ + async with self._raw_client.download( + history_item_ids=history_item_ids, output_format=output_format, request_options=request_options + ) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/history/raw_client.py b/data/src/elevenlabs/history/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d8daceee7d2c85a765c2f0c8d63c4ecdc087975c --- /dev/null +++ b/data/src/elevenlabs/history/raw_client.py @@ -0,0 +1,748 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.bad_request_error import BadRequestError +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.delete_history_item_response import DeleteHistoryItemResponse +from ..types.get_speech_history_response import GetSpeechHistoryResponse +from ..types.speech_history_item_response import SpeechHistoryItemResponse +from .types.history_list_request_sort_direction import HistoryListRequestSortDirection +from .types.history_list_request_source import HistoryListRequestSource +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawHistoryClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + page_size: typing.Optional[int] = None, + start_after_history_item_id: typing.Optional[str] = None, + voice_id: typing.Optional[str] = None, + model_id: typing.Optional[str] = None, + date_before_unix: typing.Optional[int] = None, + date_after_unix: typing.Optional[int] = None, + sort_direction: typing.Optional[HistoryListRequestSortDirection] = None, + search: typing.Optional[str] = None, + source: typing.Optional[HistoryListRequestSource] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetSpeechHistoryResponse]: + """ + Returns a list of your generated audio (e.g. text to speech, speech to speech, Studio, dubbing). Music and SFX generations are not included and cannot currently be retrieved via the API. + + Parameters + ---------- + page_size : typing.Optional[int] + How many history items to return at maximum. Can not exceed 1000, defaults to 100. + + start_after_history_item_id : typing.Optional[str] + After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. + + voice_id : typing.Optional[str] + ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + model_id : typing.Optional[str] + Search term used for filtering history items. If provided, source becomes required. + + date_before_unix : typing.Optional[int] + Unix timestamp to filter history items before this date (exclusive). + + date_after_unix : typing.Optional[int] + Unix timestamp to filter history items after this date (inclusive). + + sort_direction : typing.Optional[HistoryListRequestSortDirection] + Sort direction for the results. + + search : typing.Optional[str] + search term used for filtering + + source : typing.Optional[HistoryListRequestSource] + Source of the generated history item + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetSpeechHistoryResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/history", + method="GET", + params={ + "page_size": page_size, + "start_after_history_item_id": start_after_history_item_id, + "voice_id": voice_id, + "model_id": model_id, + "date_before_unix": date_before_unix, + "date_after_unix": date_after_unix, + "sort_direction": sort_direction, + "search": search, + "source": source, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetSpeechHistoryResponse, + construct_type( + type_=GetSpeechHistoryResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SpeechHistoryItemResponse]: + """ + Retrieves a history item. + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeechHistoryItemResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/history/{jsonable_encoder(history_item_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechHistoryItemResponse, + construct_type( + type_=SpeechHistoryItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteHistoryItemResponse]: + """ + Delete a history item by its ID + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteHistoryItemResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/history/{jsonable_encoder(history_item_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteHistoryItemResponse, + construct_type( + type_=DeleteHistoryItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def get_audio( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Returns the audio of an history item. + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The audio file of the history item. + """ + with self._client_wrapper.httpx_client.stream( + f"v1/history/{jsonable_encoder(history_item_id)}/audio", + method="GET", + request_options=request_options, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def download( + self, + *, + history_item_ids: typing.Sequence[str], + output_format: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. + + Parameters + ---------- + history_item_ids : typing.Sequence[str] + A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. + + output_format : typing.Optional[str] + Output format to transcode the audio file, can be wav or default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The requested audio file, or a zip file containing multiple audio files when multiple history items are requested. + """ + with self._client_wrapper.httpx_client.stream( + "v1/history/download", + method="POST", + json={ + "history_item_ids": history_item_ids, + "output_format": output_format, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawHistoryClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + start_after_history_item_id: typing.Optional[str] = None, + voice_id: typing.Optional[str] = None, + model_id: typing.Optional[str] = None, + date_before_unix: typing.Optional[int] = None, + date_after_unix: typing.Optional[int] = None, + sort_direction: typing.Optional[HistoryListRequestSortDirection] = None, + search: typing.Optional[str] = None, + source: typing.Optional[HistoryListRequestSource] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetSpeechHistoryResponse]: + """ + Returns a list of your generated audio (e.g. text to speech, speech to speech, Studio, dubbing). Music and SFX generations are not included and cannot currently be retrieved via the API. + + Parameters + ---------- + page_size : typing.Optional[int] + How many history items to return at maximum. Can not exceed 1000, defaults to 100. + + start_after_history_item_id : typing.Optional[str] + After which ID to start fetching, use this parameter to paginate across a large collection of history items. In case this parameter is not provided history items will be fetched starting from the most recently created one ordered descending by their creation date. + + voice_id : typing.Optional[str] + ID of the voice to be filtered for. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + model_id : typing.Optional[str] + Search term used for filtering history items. If provided, source becomes required. + + date_before_unix : typing.Optional[int] + Unix timestamp to filter history items before this date (exclusive). + + date_after_unix : typing.Optional[int] + Unix timestamp to filter history items after this date (inclusive). + + sort_direction : typing.Optional[HistoryListRequestSortDirection] + Sort direction for the results. + + search : typing.Optional[str] + search term used for filtering + + source : typing.Optional[HistoryListRequestSource] + Source of the generated history item + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetSpeechHistoryResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/history", + method="GET", + params={ + "page_size": page_size, + "start_after_history_item_id": start_after_history_item_id, + "voice_id": voice_id, + "model_id": model_id, + "date_before_unix": date_before_unix, + "date_after_unix": date_after_unix, + "sort_direction": sort_direction, + "search": search, + "source": source, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetSpeechHistoryResponse, + construct_type( + type_=GetSpeechHistoryResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SpeechHistoryItemResponse]: + """ + Retrieves a history item. + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeechHistoryItemResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/history/{jsonable_encoder(history_item_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechHistoryItemResponse, + construct_type( + type_=SpeechHistoryItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteHistoryItemResponse]: + """ + Delete a history item by its ID + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteHistoryItemResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/history/{jsonable_encoder(history_item_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteHistoryItemResponse, + construct_type( + type_=DeleteHistoryItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def get_audio( + self, history_item_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Returns the audio of an history item. + + Parameters + ---------- + history_item_id : str + ID of the history item to be used. You can use the [Get generated items](/docs/api-reference/history/list) endpoint to retrieve a list of history items. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The audio file of the history item. + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/history/{jsonable_encoder(history_item_id)}/audio", + method="GET", + request_options=request_options, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def download( + self, + *, + history_item_ids: typing.Sequence[str], + output_format: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Download one or more history items. If one history item ID is provided, we will return a single audio file. If more than one history item IDs are provided, we will provide the history items packed into a .zip file. + + Parameters + ---------- + history_item_ids : typing.Sequence[str] + A list of history items to download, you can get IDs of history items and other metadata using the GET https://api.elevenlabs.io/v1/history endpoint. + + output_format : typing.Optional[str] + Output format to transcode the audio file, can be wav or default. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The requested audio file, or a zip file containing multiple audio files when multiple history items are requested. + """ + async with self._client_wrapper.httpx_client.stream( + "v1/history/download", + method="POST", + json={ + "history_item_ids": history_item_ids, + "output_format": output_format, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 400: + raise BadRequestError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/history/types/__init__.py b/data/src/elevenlabs/history/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9cde94e86bee73eb6b8aedb093d8d91a669c6d9c --- /dev/null +++ b/data/src/elevenlabs/history/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .history_list_request_sort_direction import HistoryListRequestSortDirection + from .history_list_request_source import HistoryListRequestSource +_dynamic_imports: typing.Dict[str, str] = { + "HistoryListRequestSortDirection": ".history_list_request_sort_direction", + "HistoryListRequestSource": ".history_list_request_source", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["HistoryListRequestSortDirection", "HistoryListRequestSource"] diff --git a/data/src/elevenlabs/history/types/history_list_request_sort_direction.py b/data/src/elevenlabs/history/types/history_list_request_sort_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..7569de5f8ab68e95f648a8f077135eb250534182 --- /dev/null +++ b/data/src/elevenlabs/history/types/history_list_request_sort_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +HistoryListRequestSortDirection = typing.Union[typing.Literal["asc", "desc"], typing.Any] diff --git a/data/src/elevenlabs/history/types/history_list_request_source.py b/data/src/elevenlabs/history/types/history_list_request_source.py new file mode 100644 index 0000000000000000000000000000000000000000..4db5bfdd2aedad20c8b50f5ac7a7aa9905e342a1 --- /dev/null +++ b/data/src/elevenlabs/history/types/history_list_request_source.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +HistoryListRequestSource = typing.Union[typing.Literal["TTS", "STS", "Flows"], typing.Any] diff --git a/data/src/elevenlabs/models/__init__.py b/data/src/elevenlabs/models/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/models/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/models/client.py b/data/src/elevenlabs/models/client.py new file mode 100644 index 0000000000000000000000000000000000000000..1ac846ae663643657db79cb585c7cbbeadaed188 --- /dev/null +++ b/data/src/elevenlabs/models/client.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.model import Model +from .raw_client import AsyncRawModelsClient, RawModelsClient + + +class ModelsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawModelsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawModelsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawModelsClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Model]: + """ + Gets a list of available models. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[Model] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.models.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + +class AsyncModelsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawModelsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawModelsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawModelsClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Model]: + """ + Gets a list of available models. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[Model] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.models.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/models/raw_client.py b/data/src/elevenlabs/models/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..1e7145f82a12f3a6f3e8a8de5c3d58fa16bbf196 --- /dev/null +++ b/data/src/elevenlabs/models/raw_client.py @@ -0,0 +1,124 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.model import Model +from pydantic import ValidationError + + +class RawModelsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[typing.List[Model]]: + """ + Gets a list of available models. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.List[Model]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/models", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[Model], + construct_type( + type_=typing.List[Model], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawModelsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.List[Model]]: + """ + Gets a list of available models. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.List[Model]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/models", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[Model], + construct_type( + type_=typing.List[Model], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/music/__init__.py b/data/src/elevenlabs/music/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2503740ad28d1bb0a566b3dce7dd91546235608d --- /dev/null +++ b/data/src/elevenlabs/music/__init__.py @@ -0,0 +1,94 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + BodyComposeMusicV1MusicPostCompositionPlan, + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, + BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, + MusicComposeDetailedRequestOutputFormat, + MusicComposeDetailedStreamRequestOutputFormat, + MusicComposeRequestOutputFormat, + MusicSeparateStemsRequestStemVariationId, + MusicStreamRequestOutputFormat, + MusicUploadRequestExtractCompositionPlan, + ) + from . import composition_plan, finetunes + from .composition_plan import ( + BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan, + CompositionPlanCreateResponse, + ) + from .finetunes import ( + FinetunesCreateRequestVisibility, + FinetunesListRequestSort, + FinetunesListRequestSortDirection, + UpdateMusicFinetuneRequestModelVisibility, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyComposeMusicV1MusicPostCompositionPlan": ".types", + "BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan": ".types", + "BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan": ".composition_plan", + "BodyStreamComposedMusicV1MusicStreamPostCompositionPlan": ".types", + "BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan": ".types", + "CompositionPlanCreateResponse": ".composition_plan", + "FinetunesCreateRequestVisibility": ".finetunes", + "FinetunesListRequestSort": ".finetunes", + "FinetunesListRequestSortDirection": ".finetunes", + "MusicComposeDetailedRequestOutputFormat": ".types", + "MusicComposeDetailedStreamRequestOutputFormat": ".types", + "MusicComposeRequestOutputFormat": ".types", + "MusicSeparateStemsRequestStemVariationId": ".types", + "MusicStreamRequestOutputFormat": ".types", + "MusicUploadRequestExtractCompositionPlan": ".types", + "UpdateMusicFinetuneRequestModelVisibility": ".finetunes", + "composition_plan": ".composition_plan", + "finetunes": ".finetunes", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyComposeMusicV1MusicPostCompositionPlan", + "BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan", + "BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan", + "BodyStreamComposedMusicV1MusicStreamPostCompositionPlan", + "BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan", + "CompositionPlanCreateResponse", + "FinetunesCreateRequestVisibility", + "FinetunesListRequestSort", + "FinetunesListRequestSortDirection", + "MusicComposeDetailedRequestOutputFormat", + "MusicComposeDetailedStreamRequestOutputFormat", + "MusicComposeRequestOutputFormat", + "MusicSeparateStemsRequestStemVariationId", + "MusicStreamRequestOutputFormat", + "MusicUploadRequestExtractCompositionPlan", + "UpdateMusicFinetuneRequestModelVisibility", + "composition_plan", + "finetunes", +] diff --git a/data/src/elevenlabs/music/client.py b/data/src/elevenlabs/music/client.py new file mode 100644 index 0000000000000000000000000000000000000000..de90d0b5a41ffe967deb01c27cf53649b7533819 --- /dev/null +++ b/data/src/elevenlabs/music/client.py @@ -0,0 +1,1251 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.allowed_output_formats import AllowedOutputFormats +from ..types.music_model_id import MusicModelId +from ..types.music_upload_response import MusicUploadResponse +from .raw_client import AsyncRawMusicClient, RawMusicClient +from .types.body_compose_music_v_1_music_post_composition_plan import BodyComposeMusicV1MusicPostCompositionPlan +from .types.body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan import ( + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, +) +from .types.body_stream_composed_music_v_1_music_stream_post_composition_plan import ( + BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, +) +from .types.body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_composition_plan import ( + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, +) +from .types.music_compose_detailed_request_output_format import MusicComposeDetailedRequestOutputFormat +from .types.music_compose_detailed_stream_request_output_format import MusicComposeDetailedStreamRequestOutputFormat +from .types.music_compose_request_output_format import MusicComposeRequestOutputFormat +from .types.music_separate_stems_request_stem_variation_id import MusicSeparateStemsRequestStemVariationId +from .types.music_stream_request_output_format import MusicStreamRequestOutputFormat +from .types.music_upload_request_extract_composition_plan import MusicUploadRequestExtractCompositionPlan + +if typing.TYPE_CHECKING: + from .composition_plan.client import AsyncCompositionPlanClient, CompositionPlanClient + from .finetunes.client import AsyncFinetunesClient, FinetunesClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class MusicClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawMusicClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._composition_plan: typing.Optional[CompositionPlanClient] = None + self._finetunes: typing.Optional[FinetunesClient] = None + + @property + def with_raw_response(self) -> RawMusicClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawMusicClient + """ + return self._raw_client + + def video_to_music( + self, + *, + videos: typing.List[core.File], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + description: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + add_sfx: typing.Optional[bool] = OMIT, + separate_tracks: typing.Optional[bool] = OMIT, + use_audio_as_reference: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Generate background music from one or more video files. Videos are combined in order. Optional description and style tags influence the generated music. + + Parameters + ---------- + videos : typing.List[core.File] + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + description : typing.Optional[str] + Optional text description of the music you want. A maximum of 4100 characters is allowed. + + tags : typing.Optional[typing.List[str]] + Optional list of style tags (e.g. ['upbeat', 'cinematic']). A maximum of 10 tags is allowed. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + add_sfx : typing.Optional[bool] + When true, incorporate SFX cues from the video. + + separate_tracks : typing.Optional[bool] + When true, return a ZIP with separate music and SFX audio tracks instead of a single mixed file. Use this for more flexibility to layer the tracks. + + use_audio_as_reference : typing.Optional[bool] + When true, analyze the video's audio track and use its genres, BPM, instrumentation, mood, and arc as reference characteristics for music generation. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Generated audio file matching the video. Content-Type and file extension depend on the output_format parameter (default mp3). + """ + with self._raw_client.video_to_music( + videos=videos, + output_format=output_format, + enable_logging=enable_logging, + description=description, + tags=tags, + model_id=model_id, + add_sfx=add_sfx, + separate_tracks=separate_tracks, + use_audio_as_reference=use_audio_as_reference, + sign_with_c_2_pa=sign_with_c_2_pa, + request_options=request_options, + ) as r: + yield from r.data + + def compose( + self, + *, + output_format: typing.Optional[MusicComposeRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The generated audio file in the format specified + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.compose() + """ + with self._raw_client.compose( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + seed=seed, + force_instrumental=force_instrumental, + finetune_id=finetune_id, + respect_sections_durations=respect_sections_durations, + store_for_inpainting=store_for_inpainting, + sign_with_c_2_pa=sign_with_c_2_pa, + request_options=request_options, + ) as r: + yield from r.data + + def compose_detailed( + self, + *, + output_format: typing.Optional[MusicComposeDetailedRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the generated song. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Multipart/mixed response with JSON metadata and binary audio file + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.compose_detailed() + """ + with self._raw_client.compose_detailed( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + seed=seed, + force_instrumental=force_instrumental, + finetune_id=finetune_id, + respect_sections_durations=respect_sections_durations, + store_for_inpainting=store_for_inpainting, + with_timestamps=with_timestamps, + with_waveform_visual=with_waveform_visual, + sign_with_c_2_pa=sign_with_c_2_pa, + request_options=request_options, + ) as r: + yield from r.data + + def compose_detailed_stream( + self, + *, + output_format: typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[str]: + """ + Stream a song and its detailed metadata using Server-Sent Events (SSE). + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the generated song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[str] + Server-Sent Events for composition plan, song metadata, audio chunks with optional word timestamps and visual waveform, and completion. + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + response = client.music.compose_detailed_stream( + output_format="auto", + enable_logging=True, + ) + for chunk in response: + yield chunk + """ + with self._raw_client.compose_detailed_stream( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + seed=seed, + force_instrumental=force_instrumental, + finetune_id=finetune_id, + store_for_inpainting=store_for_inpainting, + with_timestamps=with_timestamps, + with_waveform_visual=with_waveform_visual, + request_options=request_options, + ) as r: + yield from r.data + + def stream( + self, + *, + output_format: typing.Optional[MusicStreamRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Stream a composed song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Streaming audio data in the format specified + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.stream() + """ + with self._raw_client.stream( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + seed=seed, + force_instrumental=force_instrumental, + finetune_id=finetune_id, + store_for_inpainting=store_for_inpainting, + request_options=request_options, + ) as r: + yield from r.data + + def upload( + self, + *, + file: core.File, + extract_composition_plan: typing.Optional[MusicUploadRequestExtractCompositionPlan] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> MusicUploadResponse: + """ + Upload a music file to be later used for inpainting. Price for uploading is the same as the one for song generation. All uploaded content gets inspected for copyright infringement. If copyrighted content is detected, half of the request cost is still charged. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + extract_composition_plan : typing.Optional[MusicUploadRequestExtractCompositionPlan] + Whether to generate and return the composition plan for the uploaded song. Pass a model id (`music_v1`, `music_v2` or `music_v2_5`) to control which composition plan format is returned. Passing `true`/`false` is deprecated; `true` defaults to the `music_v1` plan format. Enabling this will increase the latency. + + with_timestamps : typing.Optional[bool] + Whether to transcribe the uploaded song and return word-level timestamps. If True, the response will include words_timestamps but will increase the latency. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the uploaded song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicUploadResponse + Successfully uploaded music file with optional composition plan + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.upload() + """ + _response = self._raw_client.upload( + file=file, + extract_composition_plan=extract_composition_plan, + with_timestamps=with_timestamps, + with_waveform_visual=with_waveform_visual, + request_options=request_options, + ) + return _response.data + + def separate_stems( + self, + *, + file: core.File, + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + stem_variation_id: typing.Optional[MusicSeparateStemsRequestStemVariationId] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Separate an audio file into individual stems. This endpoint might have high latency, depending on the length of the audio file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + stem_variation_id : typing.Optional[MusicSeparateStemsRequestStemVariationId] + The id of the stem variation to use. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + ZIP archive containing separated audio stems. Each stem is provided as a separate audio file in the requested output format. + """ + with self._raw_client.separate_stems( + file=file, + output_format=output_format, + enable_logging=enable_logging, + stem_variation_id=stem_variation_id, + sign_with_c_2_pa=sign_with_c_2_pa, + request_options=request_options, + ) as r: + yield from r.data + + @property + def composition_plan(self): + if self._composition_plan is None: + from .composition_plan.client import CompositionPlanClient # noqa: E402 + + self._composition_plan = CompositionPlanClient(client_wrapper=self._client_wrapper) + return self._composition_plan + + @property + def finetunes(self): + if self._finetunes is None: + from .finetunes.client import FinetunesClient # noqa: E402 + + self._finetunes = FinetunesClient(client_wrapper=self._client_wrapper) + return self._finetunes + + +class AsyncMusicClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawMusicClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._composition_plan: typing.Optional[AsyncCompositionPlanClient] = None + self._finetunes: typing.Optional[AsyncFinetunesClient] = None + + @property + def with_raw_response(self) -> AsyncRawMusicClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawMusicClient + """ + return self._raw_client + + async def video_to_music( + self, + *, + videos: typing.List[core.File], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + description: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + add_sfx: typing.Optional[bool] = OMIT, + separate_tracks: typing.Optional[bool] = OMIT, + use_audio_as_reference: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Generate background music from one or more video files. Videos are combined in order. Optional description and style tags influence the generated music. + + Parameters + ---------- + videos : typing.List[core.File] + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + description : typing.Optional[str] + Optional text description of the music you want. A maximum of 4100 characters is allowed. + + tags : typing.Optional[typing.List[str]] + Optional list of style tags (e.g. ['upbeat', 'cinematic']). A maximum of 10 tags is allowed. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + add_sfx : typing.Optional[bool] + When true, incorporate SFX cues from the video. + + separate_tracks : typing.Optional[bool] + When true, return a ZIP with separate music and SFX audio tracks instead of a single mixed file. Use this for more flexibility to layer the tracks. + + use_audio_as_reference : typing.Optional[bool] + When true, analyze the video's audio track and use its genres, BPM, instrumentation, mood, and arc as reference characteristics for music generation. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Generated audio file matching the video. Content-Type and file extension depend on the output_format parameter (default mp3). + """ + async with self._raw_client.video_to_music( + videos=videos, + output_format=output_format, + enable_logging=enable_logging, + description=description, + tags=tags, + model_id=model_id, + add_sfx=add_sfx, + separate_tracks=separate_tracks, + use_audio_as_reference=use_audio_as_reference, + sign_with_c_2_pa=sign_with_c_2_pa, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def compose( + self, + *, + output_format: typing.Optional[MusicComposeRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The generated audio file in the format specified + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.compose() + + + asyncio.run(main()) + """ + async with self._raw_client.compose( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + seed=seed, + force_instrumental=force_instrumental, + finetune_id=finetune_id, + respect_sections_durations=respect_sections_durations, + store_for_inpainting=store_for_inpainting, + sign_with_c_2_pa=sign_with_c_2_pa, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def compose_detailed( + self, + *, + output_format: typing.Optional[MusicComposeDetailedRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the generated song. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Multipart/mixed response with JSON metadata and binary audio file + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.compose_detailed() + + + asyncio.run(main()) + """ + async with self._raw_client.compose_detailed( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + seed=seed, + force_instrumental=force_instrumental, + finetune_id=finetune_id, + respect_sections_durations=respect_sections_durations, + store_for_inpainting=store_for_inpainting, + with_timestamps=with_timestamps, + with_waveform_visual=with_waveform_visual, + sign_with_c_2_pa=sign_with_c_2_pa, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def compose_detailed_stream( + self, + *, + output_format: typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[str]: + """ + Stream a song and its detailed metadata using Server-Sent Events (SSE). + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the generated song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[str] + Server-Sent Events for composition plan, song metadata, audio chunks with optional word timestamps and visual waveform, and completion. + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + response = await client.music.compose_detailed_stream( + output_format="auto", + enable_logging=True, + ) + async for chunk in response: + yield chunk + + + asyncio.run(main()) + """ + async with self._raw_client.compose_detailed_stream( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + seed=seed, + force_instrumental=force_instrumental, + finetune_id=finetune_id, + store_for_inpainting=store_for_inpainting, + with_timestamps=with_timestamps, + with_waveform_visual=with_waveform_visual, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def stream( + self, + *, + output_format: typing.Optional[MusicStreamRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Stream a composed song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Streaming audio data in the format specified + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.stream() + + + asyncio.run(main()) + """ + async with self._raw_client.stream( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + seed=seed, + force_instrumental=force_instrumental, + finetune_id=finetune_id, + store_for_inpainting=store_for_inpainting, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def upload( + self, + *, + file: core.File, + extract_composition_plan: typing.Optional[MusicUploadRequestExtractCompositionPlan] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> MusicUploadResponse: + """ + Upload a music file to be later used for inpainting. Price for uploading is the same as the one for song generation. All uploaded content gets inspected for copyright infringement. If copyrighted content is detected, half of the request cost is still charged. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + extract_composition_plan : typing.Optional[MusicUploadRequestExtractCompositionPlan] + Whether to generate and return the composition plan for the uploaded song. Pass a model id (`music_v1`, `music_v2` or `music_v2_5`) to control which composition plan format is returned. Passing `true`/`false` is deprecated; `true` defaults to the `music_v1` plan format. Enabling this will increase the latency. + + with_timestamps : typing.Optional[bool] + Whether to transcribe the uploaded song and return word-level timestamps. If True, the response will include words_timestamps but will increase the latency. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the uploaded song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicUploadResponse + Successfully uploaded music file with optional composition plan + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.upload() + + + asyncio.run(main()) + """ + _response = await self._raw_client.upload( + file=file, + extract_composition_plan=extract_composition_plan, + with_timestamps=with_timestamps, + with_waveform_visual=with_waveform_visual, + request_options=request_options, + ) + return _response.data + + async def separate_stems( + self, + *, + file: core.File, + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + stem_variation_id: typing.Optional[MusicSeparateStemsRequestStemVariationId] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Separate an audio file into individual stems. This endpoint might have high latency, depending on the length of the audio file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + stem_variation_id : typing.Optional[MusicSeparateStemsRequestStemVariationId] + The id of the stem variation to use. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + ZIP archive containing separated audio stems. Each stem is provided as a separate audio file in the requested output format. + """ + async with self._raw_client.separate_stems( + file=file, + output_format=output_format, + enable_logging=enable_logging, + stem_variation_id=stem_variation_id, + sign_with_c_2_pa=sign_with_c_2_pa, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + @property + def composition_plan(self): + if self._composition_plan is None: + from .composition_plan.client import AsyncCompositionPlanClient # noqa: E402 + + self._composition_plan = AsyncCompositionPlanClient(client_wrapper=self._client_wrapper) + return self._composition_plan + + @property + def finetunes(self): + if self._finetunes is None: + from .finetunes.client import AsyncFinetunesClient # noqa: E402 + + self._finetunes = AsyncFinetunesClient(client_wrapper=self._client_wrapper) + return self._finetunes diff --git a/data/src/elevenlabs/music/composition_plan/__init__.py b/data/src/elevenlabs/music/composition_plan/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cd000f1f60f1739a2057a39804d849211e55c80f --- /dev/null +++ b/data/src/elevenlabs/music/composition_plan/__init__.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan, CompositionPlanCreateResponse +_dynamic_imports: typing.Dict[str, str] = { + "BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan": ".types", + "CompositionPlanCreateResponse": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan", "CompositionPlanCreateResponse"] diff --git a/data/src/elevenlabs/music/composition_plan/client.py b/data/src/elevenlabs/music/composition_plan/client.py new file mode 100644 index 0000000000000000000000000000000000000000..5ca61f18f34c2101735cf62d22174d3df6cd6e22 --- /dev/null +++ b/data/src/elevenlabs/music/composition_plan/client.py @@ -0,0 +1,179 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.music_model_id import MusicModelId +from .raw_client import AsyncRawCompositionPlanClient, RawCompositionPlanClient +from .types.body_generate_composition_plan_v_1_music_plan_post_source_composition_plan import ( + BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan, +) +from .types.composition_plan_create_response import CompositionPlanCreateResponse + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class CompositionPlanClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawCompositionPlanClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawCompositionPlanClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawCompositionPlanClient + """ + return self._raw_client + + def create( + self, + *, + prompt: str, + enable_logging: typing.Optional[bool] = None, + music_length_ms: typing.Optional[int] = OMIT, + source_composition_plan: typing.Optional[ + BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan + ] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CompositionPlanCreateResponse: + """ + Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier. + + Parameters + ---------- + prompt : str + A simple text prompt to compose a plan from. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + music_length_ms : typing.Optional[int] + The length of the composition plan to generate in milliseconds. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + source_composition_plan : typing.Optional[BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan] + An optional composition plan to use as a source for the new composition plan. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CompositionPlanCreateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.composition_plan.create( + enable_logging=True, + prompt="prompt", + ) + """ + _response = self._raw_client.create( + prompt=prompt, + enable_logging=enable_logging, + music_length_ms=music_length_ms, + source_composition_plan=source_composition_plan, + model_id=model_id, + request_options=request_options, + ) + return _response.data + + +class AsyncCompositionPlanClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawCompositionPlanClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawCompositionPlanClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawCompositionPlanClient + """ + return self._raw_client + + async def create( + self, + *, + prompt: str, + enable_logging: typing.Optional[bool] = None, + music_length_ms: typing.Optional[int] = OMIT, + source_composition_plan: typing.Optional[ + BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan + ] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CompositionPlanCreateResponse: + """ + Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier. + + Parameters + ---------- + prompt : str + A simple text prompt to compose a plan from. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + music_length_ms : typing.Optional[int] + The length of the composition plan to generate in milliseconds. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + source_composition_plan : typing.Optional[BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan] + An optional composition plan to use as a source for the new composition plan. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CompositionPlanCreateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.composition_plan.create( + enable_logging=True, + prompt="prompt", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + prompt=prompt, + enable_logging=enable_logging, + music_length_ms=music_length_ms, + source_composition_plan=source_composition_plan, + model_id=model_id, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/music/composition_plan/raw_client.py b/data/src/elevenlabs/music/composition_plan/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..1a8bd2c24cd8a4453b8295fa427933925670400e --- /dev/null +++ b/data/src/elevenlabs/music/composition_plan/raw_client.py @@ -0,0 +1,216 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.music_model_id import MusicModelId +from .types.body_generate_composition_plan_v_1_music_plan_post_source_composition_plan import ( + BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan, +) +from .types.composition_plan_create_response import CompositionPlanCreateResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawCompositionPlanClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + prompt: str, + enable_logging: typing.Optional[bool] = None, + music_length_ms: typing.Optional[int] = OMIT, + source_composition_plan: typing.Optional[ + BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan + ] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CompositionPlanCreateResponse]: + """ + Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier. + + Parameters + ---------- + prompt : str + A simple text prompt to compose a plan from. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + music_length_ms : typing.Optional[int] + The length of the composition plan to generate in milliseconds. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + source_composition_plan : typing.Optional[BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan] + An optional composition plan to use as a source for the new composition plan. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CompositionPlanCreateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/music/plan", + method="POST", + params={ + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "music_length_ms": music_length_ms, + "source_composition_plan": convert_and_respect_annotation_metadata( + object_=source_composition_plan, + annotation=BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan, + direction="write", + ), + "model_id": model_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CompositionPlanCreateResponse, + construct_type( + type_=CompositionPlanCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawCompositionPlanClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + prompt: str, + enable_logging: typing.Optional[bool] = None, + music_length_ms: typing.Optional[int] = OMIT, + source_composition_plan: typing.Optional[ + BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan + ] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CompositionPlanCreateResponse]: + """ + Create a composition plan for music generation. Usage of this endpoint does not cost any credits but is subject to rate limiting depending on your tier. + + Parameters + ---------- + prompt : str + A simple text prompt to compose a plan from. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + music_length_ms : typing.Optional[int] + The length of the composition plan to generate in milliseconds. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + source_composition_plan : typing.Optional[BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan] + An optional composition plan to use as a source for the new composition plan. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CompositionPlanCreateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/music/plan", + method="POST", + params={ + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "music_length_ms": music_length_ms, + "source_composition_plan": convert_and_respect_annotation_metadata( + object_=source_composition_plan, + annotation=BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan, + direction="write", + ), + "model_id": model_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CompositionPlanCreateResponse, + construct_type( + type_=CompositionPlanCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/music/composition_plan/types/__init__.py b/data/src/elevenlabs/music/composition_plan/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..279eebfe137f428721d2df9bbacc7e9ea679daaa --- /dev/null +++ b/data/src/elevenlabs/music/composition_plan/types/__init__.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_generate_composition_plan_v_1_music_plan_post_source_composition_plan import ( + BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan, + ) + from .composition_plan_create_response import CompositionPlanCreateResponse +_dynamic_imports: typing.Dict[str, str] = { + "BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan": ".body_generate_composition_plan_v_1_music_plan_post_source_composition_plan", + "CompositionPlanCreateResponse": ".composition_plan_create_response", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan", "CompositionPlanCreateResponse"] diff --git a/data/src/elevenlabs/music/composition_plan/types/body_generate_composition_plan_v_1_music_plan_post_source_composition_plan.py b/data/src/elevenlabs/music/composition_plan/types/body_generate_composition_plan_v_1_music_plan_post_source_composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..7046089bdbe8a539a2f7db5440f44a5c3c5a488d --- /dev/null +++ b/data/src/elevenlabs/music/composition_plan/types/body_generate_composition_plan_v_1_music_plan_post_source_composition_plan.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.composition_plan import CompositionPlan +from ....types.music_prompt import MusicPrompt + +BodyGenerateCompositionPlanV1MusicPlanPostSourceCompositionPlan = typing.Union[MusicPrompt, CompositionPlan] diff --git a/data/src/elevenlabs/music/composition_plan/types/composition_plan_create_response.py b/data/src/elevenlabs/music/composition_plan/types/composition_plan_create_response.py new file mode 100644 index 0000000000000000000000000000000000000000..43dfdadea85e283d2a35d1806bab3fca98d8df26 --- /dev/null +++ b/data/src/elevenlabs/music/composition_plan/types/composition_plan_create_response.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.composition_plan import CompositionPlan +from ....types.music_prompt import MusicPrompt + +CompositionPlanCreateResponse = typing.Union[MusicPrompt, CompositionPlan] diff --git a/data/src/elevenlabs/music/finetunes/__init__.py b/data/src/elevenlabs/music/finetunes/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..02882ffc6e293592616ad51ddc6e520f6bb09de9 --- /dev/null +++ b/data/src/elevenlabs/music/finetunes/__init__.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + FinetunesCreateRequestVisibility, + FinetunesListRequestSort, + FinetunesListRequestSortDirection, + UpdateMusicFinetuneRequestModelVisibility, + ) +_dynamic_imports: typing.Dict[str, str] = { + "FinetunesCreateRequestVisibility": ".types", + "FinetunesListRequestSort": ".types", + "FinetunesListRequestSortDirection": ".types", + "UpdateMusicFinetuneRequestModelVisibility": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "FinetunesCreateRequestVisibility", + "FinetunesListRequestSort", + "FinetunesListRequestSortDirection", + "UpdateMusicFinetuneRequestModelVisibility", +] diff --git a/data/src/elevenlabs/music/finetunes/client.py b/data/src/elevenlabs/music/finetunes/client.py new file mode 100644 index 0000000000000000000000000000000000000000..80d609c469ddf197f37f0985f4ca1222ea9e6926 --- /dev/null +++ b/data/src/elevenlabs/music/finetunes/client.py @@ -0,0 +1,604 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ... import core +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.finetune_created_by import FinetuneCreatedBy +from ...types.finetune_visibility import FinetuneVisibility +from ...types.music_finetune_page_response_model import MusicFinetunePageResponseModel +from ...types.music_finetune_response_model import MusicFinetuneResponseModel +from ...types.music_model_id import MusicModelId +from .raw_client import AsyncRawFinetunesClient, RawFinetunesClient +from .types.finetunes_create_request_visibility import FinetunesCreateRequestVisibility +from .types.finetunes_list_request_sort import FinetunesListRequestSort +from .types.finetunes_list_request_sort_direction import FinetunesListRequestSortDirection +from .types.update_music_finetune_request_model_visibility import UpdateMusicFinetuneRequestModelVisibility + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class FinetunesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawFinetunesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawFinetunesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawFinetunesClient + """ + return self._raw_client + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + visibility: typing.Optional[FinetuneVisibility] = None, + created_by: typing.Optional[FinetuneCreatedBy] = None, + sort: typing.Optional[FinetunesListRequestSort] = None, + sort_direction: typing.Optional[FinetunesListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MusicFinetunePageResponseModel: + """ + List music finetunes accessible to you (your own, workspace-shared, and ElevenLabs-curated), with optional filtering, sorting, and cursor pagination. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching the next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many finetunes to return. Max 150, default 50. + + visibility : typing.Optional[FinetuneVisibility] + Filter by visibility. 'private' returns private finetunes; 'workspace' returns workspace-shared finetunes; 'public' returns public finetunes, which are currently ElevenLabs curated finetunes. Omit to return all accessible finetunes. + + created_by : typing.Optional[FinetuneCreatedBy] + Filter by creator. 'self' returns finetunes you created; 'workspace' returns finetunes created by workspace teammates; 'elevenlabs' returns ElevenLabs curated finetunes. Omit to return finetunes from all creators. + + sort : typing.Optional[FinetunesListRequestSort] + Sort by field (created_at or name) + + sort_direction : typing.Optional[FinetunesListRequestSortDirection] + Sort direction (asc or desc) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetunePageResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.finetunes.list( + cursor="cursor", + page_size=1, + visibility="private", + created_by="self", + sort="created_at", + sort_direction="asc", + ) + """ + _response = self._raw_client.list( + cursor=cursor, + page_size=page_size, + visibility=visibility, + created_by=created_by, + sort=sort, + sort_direction=sort_direction, + request_options=request_options, + ) + return _response.data + + def create( + self, + *, + name: str, + primary_genre: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + visibility: typing.Optional[FinetunesCreateRequestVisibility] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> MusicFinetuneResponseModel: + """ + Create a new music finetune + + Parameters + ---------- + name : str + Name for the finetune (5-200 characters). + + primary_genre : str + Primary musical genre of the finetune. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + tags : typing.Optional[typing.List[str]] + Tags to associate with the finetune. + + visibility : typing.Optional[FinetunesCreateRequestVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + model_id : typing.Optional[MusicModelId] + The model to create a finetune for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetuneResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.finetunes.create( + name="name", + primary_genre="primary_genre", + ) + """ + _response = self._raw_client.create( + name=name, + primary_genre=primary_genre, + files=files, + tags=tags, + visibility=visibility, + model_id=model_id, + request_options=request_options, + ) + return _response.data + + def get( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MusicFinetuneResponseModel: + """ + Get a music finetune. + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetuneResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.finetunes.get( + finetune_id="finetune_id", + ) + """ + _response = self._raw_client.get(finetune_id, request_options=request_options) + return _response.data + + def delete( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MusicFinetuneResponseModel: + """ + Delete a music finetune + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetuneResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.finetunes.delete( + finetune_id="finetune_id", + ) + """ + _response = self._raw_client.delete(finetune_id, request_options=request_options) + return _response.data + + def update( + self, + finetune_id: str, + *, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + primary_genre: typing.Optional[str] = OMIT, + visibility: typing.Optional[UpdateMusicFinetuneRequestModelVisibility] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> MusicFinetuneResponseModel: + """ + Update a music finetune. + + Parameters + ---------- + finetune_id : str + + name : typing.Optional[str] + Updated name for the finetune. + + tags : typing.Optional[typing.Sequence[str]] + Replacement set of tags. + + primary_genre : typing.Optional[str] + Updated primary musical genre. + + visibility : typing.Optional[UpdateMusicFinetuneRequestModelVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetuneResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.music.finetunes.update( + finetune_id="finetune_id", + ) + """ + _response = self._raw_client.update( + finetune_id, + name=name, + tags=tags, + primary_genre=primary_genre, + visibility=visibility, + request_options=request_options, + ) + return _response.data + + +class AsyncFinetunesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawFinetunesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawFinetunesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawFinetunesClient + """ + return self._raw_client + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + visibility: typing.Optional[FinetuneVisibility] = None, + created_by: typing.Optional[FinetuneCreatedBy] = None, + sort: typing.Optional[FinetunesListRequestSort] = None, + sort_direction: typing.Optional[FinetunesListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> MusicFinetunePageResponseModel: + """ + List music finetunes accessible to you (your own, workspace-shared, and ElevenLabs-curated), with optional filtering, sorting, and cursor pagination. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching the next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many finetunes to return. Max 150, default 50. + + visibility : typing.Optional[FinetuneVisibility] + Filter by visibility. 'private' returns private finetunes; 'workspace' returns workspace-shared finetunes; 'public' returns public finetunes, which are currently ElevenLabs curated finetunes. Omit to return all accessible finetunes. + + created_by : typing.Optional[FinetuneCreatedBy] + Filter by creator. 'self' returns finetunes you created; 'workspace' returns finetunes created by workspace teammates; 'elevenlabs' returns ElevenLabs curated finetunes. Omit to return finetunes from all creators. + + sort : typing.Optional[FinetunesListRequestSort] + Sort by field (created_at or name) + + sort_direction : typing.Optional[FinetunesListRequestSortDirection] + Sort direction (asc or desc) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetunePageResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.finetunes.list( + cursor="cursor", + page_size=1, + visibility="private", + created_by="self", + sort="created_at", + sort_direction="asc", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, + page_size=page_size, + visibility=visibility, + created_by=created_by, + sort=sort, + sort_direction=sort_direction, + request_options=request_options, + ) + return _response.data + + async def create( + self, + *, + name: str, + primary_genre: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + visibility: typing.Optional[FinetunesCreateRequestVisibility] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> MusicFinetuneResponseModel: + """ + Create a new music finetune + + Parameters + ---------- + name : str + Name for the finetune (5-200 characters). + + primary_genre : str + Primary musical genre of the finetune. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + tags : typing.Optional[typing.List[str]] + Tags to associate with the finetune. + + visibility : typing.Optional[FinetunesCreateRequestVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + model_id : typing.Optional[MusicModelId] + The model to create a finetune for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetuneResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.finetunes.create( + name="name", + primary_genre="primary_genre", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + name=name, + primary_genre=primary_genre, + files=files, + tags=tags, + visibility=visibility, + model_id=model_id, + request_options=request_options, + ) + return _response.data + + async def get( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MusicFinetuneResponseModel: + """ + Get a music finetune. + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetuneResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.finetunes.get( + finetune_id="finetune_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(finetune_id, request_options=request_options) + return _response.data + + async def delete( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> MusicFinetuneResponseModel: + """ + Delete a music finetune + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetuneResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.finetunes.delete( + finetune_id="finetune_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(finetune_id, request_options=request_options) + return _response.data + + async def update( + self, + finetune_id: str, + *, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + primary_genre: typing.Optional[str] = OMIT, + visibility: typing.Optional[UpdateMusicFinetuneRequestModelVisibility] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> MusicFinetuneResponseModel: + """ + Update a music finetune. + + Parameters + ---------- + finetune_id : str + + name : typing.Optional[str] + Updated name for the finetune. + + tags : typing.Optional[typing.Sequence[str]] + Replacement set of tags. + + primary_genre : typing.Optional[str] + Updated primary musical genre. + + visibility : typing.Optional[UpdateMusicFinetuneRequestModelVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MusicFinetuneResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.music.finetunes.update( + finetune_id="finetune_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + finetune_id, + name=name, + tags=tags, + primary_genre=primary_genre, + visibility=visibility, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/music/finetunes/raw_client.py b/data/src/elevenlabs/music/finetunes/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..022b0763512c19491abadb25d5a700e9bd91177a --- /dev/null +++ b/data/src/elevenlabs/music/finetunes/raw_client.py @@ -0,0 +1,939 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ... import core +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.forbidden_error import ForbiddenError +from ...errors.not_found_error import NotFoundError +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.finetune_created_by import FinetuneCreatedBy +from ...types.finetune_visibility import FinetuneVisibility +from ...types.music_finetune_page_response_model import MusicFinetunePageResponseModel +from ...types.music_finetune_response_model import MusicFinetuneResponseModel +from ...types.music_model_id import MusicModelId +from .types.finetunes_create_request_visibility import FinetunesCreateRequestVisibility +from .types.finetunes_list_request_sort import FinetunesListRequestSort +from .types.finetunes_list_request_sort_direction import FinetunesListRequestSortDirection +from .types.update_music_finetune_request_model_visibility import UpdateMusicFinetuneRequestModelVisibility +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawFinetunesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + visibility: typing.Optional[FinetuneVisibility] = None, + created_by: typing.Optional[FinetuneCreatedBy] = None, + sort: typing.Optional[FinetunesListRequestSort] = None, + sort_direction: typing.Optional[FinetunesListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MusicFinetunePageResponseModel]: + """ + List music finetunes accessible to you (your own, workspace-shared, and ElevenLabs-curated), with optional filtering, sorting, and cursor pagination. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching the next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many finetunes to return. Max 150, default 50. + + visibility : typing.Optional[FinetuneVisibility] + Filter by visibility. 'private' returns private finetunes; 'workspace' returns workspace-shared finetunes; 'public' returns public finetunes, which are currently ElevenLabs curated finetunes. Omit to return all accessible finetunes. + + created_by : typing.Optional[FinetuneCreatedBy] + Filter by creator. 'self' returns finetunes you created; 'workspace' returns finetunes created by workspace teammates; 'elevenlabs' returns ElevenLabs curated finetunes. Omit to return finetunes from all creators. + + sort : typing.Optional[FinetunesListRequestSort] + Sort by field (created_at or name) + + sort_direction : typing.Optional[FinetunesListRequestSortDirection] + Sort direction (asc or desc) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetunePageResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/music/finetunes", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "visibility": visibility, + "created_by": created_by, + "sort": sort, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetunePageResponseModel, + construct_type( + type_=MusicFinetunePageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + name: str, + primary_genre: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + visibility: typing.Optional[FinetunesCreateRequestVisibility] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MusicFinetuneResponseModel]: + """ + Create a new music finetune + + Parameters + ---------- + name : str + Name for the finetune (5-200 characters). + + primary_genre : str + Primary musical genre of the finetune. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + tags : typing.Optional[typing.List[str]] + Tags to associate with the finetune. + + visibility : typing.Optional[FinetunesCreateRequestVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + model_id : typing.Optional[MusicModelId] + The model to create a finetune for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/music/finetunes", + method="POST", + data={ + "name": name, + "primary_genre": primary_genre, + "tags": tags, + "visibility": visibility, + "model_id": model_id, + }, + files={ + **({"files": files} if files is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MusicFinetuneResponseModel]: + """ + Get a music finetune. + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[MusicFinetuneResponseModel]: + """ + Delete a music finetune + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + finetune_id: str, + *, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + primary_genre: typing.Optional[str] = OMIT, + visibility: typing.Optional[UpdateMusicFinetuneRequestModelVisibility] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MusicFinetuneResponseModel]: + """ + Update a music finetune. + + Parameters + ---------- + finetune_id : str + + name : typing.Optional[str] + Updated name for the finetune. + + tags : typing.Optional[typing.Sequence[str]] + Replacement set of tags. + + primary_genre : typing.Optional[str] + Updated primary musical genre. + + visibility : typing.Optional[UpdateMusicFinetuneRequestModelVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="PATCH", + json={ + "name": name, + "tags": tags, + "primary_genre": primary_genre, + "visibility": visibility, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawFinetunesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + visibility: typing.Optional[FinetuneVisibility] = None, + created_by: typing.Optional[FinetuneCreatedBy] = None, + sort: typing.Optional[FinetunesListRequestSort] = None, + sort_direction: typing.Optional[FinetunesListRequestSortDirection] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MusicFinetunePageResponseModel]: + """ + List music finetunes accessible to you (your own, workspace-shared, and ElevenLabs-curated), with optional filtering, sorting, and cursor pagination. + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching the next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many finetunes to return. Max 150, default 50. + + visibility : typing.Optional[FinetuneVisibility] + Filter by visibility. 'private' returns private finetunes; 'workspace' returns workspace-shared finetunes; 'public' returns public finetunes, which are currently ElevenLabs curated finetunes. Omit to return all accessible finetunes. + + created_by : typing.Optional[FinetuneCreatedBy] + Filter by creator. 'self' returns finetunes you created; 'workspace' returns finetunes created by workspace teammates; 'elevenlabs' returns ElevenLabs curated finetunes. Omit to return finetunes from all creators. + + sort : typing.Optional[FinetunesListRequestSort] + Sort by field (created_at or name) + + sort_direction : typing.Optional[FinetunesListRequestSortDirection] + Sort direction (asc or desc) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetunePageResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/music/finetunes", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "visibility": visibility, + "created_by": created_by, + "sort": sort, + "sort_direction": sort_direction, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetunePageResponseModel, + construct_type( + type_=MusicFinetunePageResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + name: str, + primary_genre: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + visibility: typing.Optional[FinetunesCreateRequestVisibility] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MusicFinetuneResponseModel]: + """ + Create a new music finetune + + Parameters + ---------- + name : str + Name for the finetune (5-200 characters). + + primary_genre : str + Primary musical genre of the finetune. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + tags : typing.Optional[typing.List[str]] + Tags to associate with the finetune. + + visibility : typing.Optional[FinetunesCreateRequestVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + model_id : typing.Optional[MusicModelId] + The model to create a finetune for. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/music/finetunes", + method="POST", + data={ + "name": name, + "primary_genre": primary_genre, + "tags": tags, + "visibility": visibility, + "model_id": model_id, + }, + files={ + **({"files": files} if files is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MusicFinetuneResponseModel]: + """ + Get a music finetune. + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, finetune_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[MusicFinetuneResponseModel]: + """ + Delete a music finetune + + Parameters + ---------- + finetune_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + finetune_id: str, + *, + name: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + primary_genre: typing.Optional[str] = OMIT, + visibility: typing.Optional[UpdateMusicFinetuneRequestModelVisibility] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MusicFinetuneResponseModel]: + """ + Update a music finetune. + + Parameters + ---------- + finetune_id : str + + name : typing.Optional[str] + Updated name for the finetune. + + tags : typing.Optional[typing.Sequence[str]] + Replacement set of tags. + + primary_genre : typing.Optional[str] + Updated primary musical genre. + + visibility : typing.Optional[UpdateMusicFinetuneRequestModelVisibility] + Finetune visibility. Only 'private' and 'workspace' can be set. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicFinetuneResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/music/finetunes/{jsonable_encoder(finetune_id)}", + method="PATCH", + json={ + "name": name, + "tags": tags, + "primary_genre": primary_genre, + "visibility": visibility, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicFinetuneResponseModel, + construct_type( + type_=MusicFinetuneResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/music/finetunes/types/__init__.py b/data/src/elevenlabs/music/finetunes/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ddc358d3e6f41df1c48d2baa22f18bcc91e50848 --- /dev/null +++ b/data/src/elevenlabs/music/finetunes/types/__init__.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .finetunes_create_request_visibility import FinetunesCreateRequestVisibility + from .finetunes_list_request_sort import FinetunesListRequestSort + from .finetunes_list_request_sort_direction import FinetunesListRequestSortDirection + from .update_music_finetune_request_model_visibility import UpdateMusicFinetuneRequestModelVisibility +_dynamic_imports: typing.Dict[str, str] = { + "FinetunesCreateRequestVisibility": ".finetunes_create_request_visibility", + "FinetunesListRequestSort": ".finetunes_list_request_sort", + "FinetunesListRequestSortDirection": ".finetunes_list_request_sort_direction", + "UpdateMusicFinetuneRequestModelVisibility": ".update_music_finetune_request_model_visibility", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "FinetunesCreateRequestVisibility", + "FinetunesListRequestSort", + "FinetunesListRequestSortDirection", + "UpdateMusicFinetuneRequestModelVisibility", +] diff --git a/data/src/elevenlabs/music/finetunes/types/finetunes_create_request_visibility.py b/data/src/elevenlabs/music/finetunes/types/finetunes_create_request_visibility.py new file mode 100644 index 0000000000000000000000000000000000000000..193067df5affa27b495a6e5d7c3704959c2dea9f --- /dev/null +++ b/data/src/elevenlabs/music/finetunes/types/finetunes_create_request_visibility.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FinetunesCreateRequestVisibility = typing.Union[typing.Literal["private", "workspace"], typing.Any] diff --git a/data/src/elevenlabs/music/finetunes/types/finetunes_list_request_sort.py b/data/src/elevenlabs/music/finetunes/types/finetunes_list_request_sort.py new file mode 100644 index 0000000000000000000000000000000000000000..3dd46bbfe66cb94df95b0685efe06cfc01e54d66 --- /dev/null +++ b/data/src/elevenlabs/music/finetunes/types/finetunes_list_request_sort.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FinetunesListRequestSort = typing.Union[typing.Literal["created_at", "name"], typing.Any] diff --git a/data/src/elevenlabs/music/finetunes/types/finetunes_list_request_sort_direction.py b/data/src/elevenlabs/music/finetunes/types/finetunes_list_request_sort_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..579b55e137354d51712df146752ea1feaca7e861 --- /dev/null +++ b/data/src/elevenlabs/music/finetunes/types/finetunes_list_request_sort_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FinetunesListRequestSortDirection = typing.Union[typing.Literal["asc", "desc"], typing.Any] diff --git a/data/src/elevenlabs/music/finetunes/types/update_music_finetune_request_model_visibility.py b/data/src/elevenlabs/music/finetunes/types/update_music_finetune_request_model_visibility.py new file mode 100644 index 0000000000000000000000000000000000000000..ff4b2bdd9cfff200a89794899fac49c06f2059b2 --- /dev/null +++ b/data/src/elevenlabs/music/finetunes/types/update_music_finetune_request_model_visibility.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateMusicFinetuneRequestModelVisibility = typing.Union[typing.Literal["private", "workspace"], typing.Any] diff --git a/data/src/elevenlabs/music/raw_client.py b/data/src/elevenlabs/music/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b688f9aa4dac1409fc0325daae50431dafa0f2b3 --- /dev/null +++ b/data/src/elevenlabs/music/raw_client.py @@ -0,0 +1,1745 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import json +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.forbidden_error import ForbiddenError +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.allowed_output_formats import AllowedOutputFormats +from ..types.music_model_id import MusicModelId +from ..types.music_upload_response import MusicUploadResponse +from .types.body_compose_music_v_1_music_post_composition_plan import BodyComposeMusicV1MusicPostCompositionPlan +from .types.body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan import ( + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, +) +from .types.body_stream_composed_music_v_1_music_stream_post_composition_plan import ( + BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, +) +from .types.body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_composition_plan import ( + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, +) +from .types.music_compose_detailed_request_output_format import MusicComposeDetailedRequestOutputFormat +from .types.music_compose_detailed_stream_request_output_format import MusicComposeDetailedStreamRequestOutputFormat +from .types.music_compose_request_output_format import MusicComposeRequestOutputFormat +from .types.music_separate_stems_request_stem_variation_id import MusicSeparateStemsRequestStemVariationId +from .types.music_stream_request_output_format import MusicStreamRequestOutputFormat +from .types.music_upload_request_extract_composition_plan import MusicUploadRequestExtractCompositionPlan +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawMusicClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def video_to_music( + self, + *, + videos: typing.List[core.File], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + description: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + add_sfx: typing.Optional[bool] = OMIT, + separate_tracks: typing.Optional[bool] = OMIT, + use_audio_as_reference: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Generate background music from one or more video files. Videos are combined in order. Optional description and style tags influence the generated music. + + Parameters + ---------- + videos : typing.List[core.File] + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + description : typing.Optional[str] + Optional text description of the music you want. A maximum of 4100 characters is allowed. + + tags : typing.Optional[typing.List[str]] + Optional list of style tags (e.g. ['upbeat', 'cinematic']). A maximum of 10 tags is allowed. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + add_sfx : typing.Optional[bool] + When true, incorporate SFX cues from the video. + + separate_tracks : typing.Optional[bool] + When true, return a ZIP with separate music and SFX audio tracks instead of a single mixed file. Use this for more flexibility to layer the tracks. + + use_audio_as_reference : typing.Optional[bool] + When true, analyze the video's audio track and use its genres, BPM, instrumentation, mood, and arc as reference characteristics for music generation. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Generated audio file matching the video. Content-Type and file extension depend on the output_format parameter (default mp3). + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/video-to-music", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + data={ + "description": description, + "tags": tags, + "model_id": model_id, + "add_sfx": add_sfx, + "separate_tracks": separate_tracks, + "use_audio_as_reference": use_audio_as_reference, + "sign_with_c2pa": sign_with_c_2_pa, + }, + files={ + "videos": videos, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def compose( + self, + *, + output_format: typing.Optional[MusicComposeRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The generated audio file in the format specified + """ + with self._client_wrapper.httpx_client.stream( + "v1/music", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, annotation=BodyComposeMusicV1MusicPostCompositionPlan, direction="write" + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "respect_sections_durations": respect_sections_durations, + "store_for_inpainting": store_for_inpainting, + "sign_with_c2pa": sign_with_c_2_pa, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def compose_detailed( + self, + *, + output_format: typing.Optional[MusicComposeDetailedRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the generated song. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Multipart/mixed response with JSON metadata and binary audio file + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/detailed", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "respect_sections_durations": respect_sections_durations, + "store_for_inpainting": store_for_inpainting, + "with_timestamps": with_timestamps, + "with_waveform_visual": with_waveform_visual, + "sign_with_c2pa": sign_with_c_2_pa, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def compose_detailed_stream( + self, + *, + output_format: typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[str]]]: + """ + Stream a song and its detailed metadata using Server-Sent Events (SSE). + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the generated song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[HttpResponse[typing.Iterator[str]]] + Server-Sent Events for composition plan, song metadata, audio chunks with optional word timestamps and visual waveform, and completion. + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/detailed/stream", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "store_for_inpainting": store_for_inpainting, + "with_timestamps": with_timestamps, + "with_waveform_visual": with_waveform_visual, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[str]]: + try: + if 200 <= _response.status_code < 300: + + def _iter(): + for _text in _response.iter_lines(): + try: + if len(_text) == 0: + continue + yield typing.cast( + str, + construct_type( + type_=str, # type: ignore + object_=json.loads(_text), + ), + ) + except Exception: + pass + return + + return HttpResponse(response=_response, data=_iter()) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def stream( + self, + *, + output_format: typing.Optional[MusicStreamRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Stream a composed song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Streaming audio data in the format specified + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/stream", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "store_for_inpainting": store_for_inpainting, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + def upload( + self, + *, + file: core.File, + extract_composition_plan: typing.Optional[MusicUploadRequestExtractCompositionPlan] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[MusicUploadResponse]: + """ + Upload a music file to be later used for inpainting. Price for uploading is the same as the one for song generation. All uploaded content gets inspected for copyright infringement. If copyrighted content is detected, half of the request cost is still charged. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + extract_composition_plan : typing.Optional[MusicUploadRequestExtractCompositionPlan] + Whether to generate and return the composition plan for the uploaded song. Pass a model id (`music_v1`, `music_v2` or `music_v2_5`) to control which composition plan format is returned. Passing `true`/`false` is deprecated; `true` defaults to the `music_v1` plan format. Enabling this will increase the latency. + + with_timestamps : typing.Optional[bool] + Whether to transcribe the uploaded song and return word-level timestamps. If True, the response will include words_timestamps but will increase the latency. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the uploaded song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[MusicUploadResponse] + Successfully uploaded music file with optional composition plan + """ + _response = self._client_wrapper.httpx_client.request( + "v1/music/upload", + method="POST", + data={ + "extract_composition_plan": extract_composition_plan, + "with_timestamps": with_timestamps, + "with_waveform_visual": with_waveform_visual, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicUploadResponse, + construct_type( + type_=MusicUploadResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def separate_stems( + self, + *, + file: core.File, + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + stem_variation_id: typing.Optional[MusicSeparateStemsRequestStemVariationId] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Separate an audio file into individual stems. This endpoint might have high latency, depending on the length of the audio file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + stem_variation_id : typing.Optional[MusicSeparateStemsRequestStemVariationId] + The id of the stem variation to use. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + ZIP archive containing separated audio stems. Each stem is provided as a separate audio file in the requested output format. + """ + with self._client_wrapper.httpx_client.stream( + "v1/music/stem-separation", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + data={ + "stem_variation_id": stem_variation_id, + "sign_with_c2pa": sign_with_c_2_pa, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawMusicClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def video_to_music( + self, + *, + videos: typing.List[core.File], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + description: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.List[str]] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + add_sfx: typing.Optional[bool] = OMIT, + separate_tracks: typing.Optional[bool] = OMIT, + use_audio_as_reference: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Generate background music from one or more video files. Videos are combined in order. Optional description and style tags influence the generated music. + + Parameters + ---------- + videos : typing.List[core.File] + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + description : typing.Optional[str] + Optional text description of the music you want. A maximum of 4100 characters is allowed. + + tags : typing.Optional[typing.List[str]] + Optional list of style tags (e.g. ['upbeat', 'cinematic']). A maximum of 10 tags is allowed. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + add_sfx : typing.Optional[bool] + When true, incorporate SFX cues from the video. + + separate_tracks : typing.Optional[bool] + When true, return a ZIP with separate music and SFX audio tracks instead of a single mixed file. Use this for more flexibility to layer the tracks. + + use_audio_as_reference : typing.Optional[bool] + When true, analyze the video's audio track and use its genres, BPM, instrumentation, mood, and arc as reference characteristics for music generation. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Generated audio file matching the video. Content-Type and file extension depend on the output_format parameter (default mp3). + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/video-to-music", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + data={ + "description": description, + "tags": tags, + "model_id": model_id, + "add_sfx": add_sfx, + "separate_tracks": separate_tracks, + "use_audio_as_reference": use_audio_as_reference, + "sign_with_c2pa": sign_with_c_2_pa, + }, + files={ + "videos": videos, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 403: + raise ForbiddenError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def compose( + self, + *, + output_format: typing.Optional[MusicComposeRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicV1MusicPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The generated audio file in the format specified + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, annotation=BodyComposeMusicV1MusicPostCompositionPlan, direction="write" + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "respect_sections_durations": respect_sections_durations, + "store_for_inpainting": store_for_inpainting, + "sign_with_c2pa": sign_with_c_2_pa, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def compose_detailed( + self, + *, + output_format: typing.Optional[MusicComposeDetailedRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + respect_sections_durations: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Compose a song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + respect_sections_durations : typing.Optional[bool] + Controls how strictly section durations in the `composition_plan` are enforced. Only used with `composition_plan` and only applies to `music_v1`; for `music_v2` and `music_v2_5` section durations are always enforced and this is ignored. When false for `music_v1`, the model may adjust individual section durations for better quality and latency, while preserving the total song duration from the plan. + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the generated song. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Multipart/mixed response with JSON metadata and binary audio file + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/detailed", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "respect_sections_durations": respect_sections_durations, + "store_for_inpainting": store_for_inpainting, + "with_timestamps": with_timestamps, + "with_waveform_visual": with_waveform_visual, + "sign_with_c2pa": sign_with_c_2_pa, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def compose_detailed_stream( + self, + *, + output_format: typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[str]]]: + """ + Stream a song and its detailed metadata using Server-Sent Events (SSE). + + Parameters + ---------- + output_format : typing.Optional[MusicComposeDetailedStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + with_timestamps : typing.Optional[bool] + Whether to return the timestamps of the words in the generated song. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the generated song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[str]]] + Server-Sent Events for composition plan, song metadata, audio chunks with optional word timestamps and visual waveform, and completion. + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/detailed/stream", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "store_for_inpainting": store_for_inpainting, + "with_timestamps": with_timestamps, + "with_waveform_visual": with_waveform_visual, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[str]]: + try: + if 200 <= _response.status_code < 300: + + async def _iter(): + async for _text in _response.aiter_lines(): + try: + if len(_text) == 0: + continue + yield typing.cast( + str, + construct_type( + type_=str, # type: ignore + object_=json.loads(_text), + ), + ) + except Exception: + pass + return + + return AsyncHttpResponse(response=_response, data=_iter()) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def stream( + self, + *, + output_format: typing.Optional[MusicStreamRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + seed: typing.Optional[int] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + finetune_id: typing.Optional[str] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Stream a composed song from a prompt or a composition plan. + + Parameters + ---------- + output_format : typing.Optional[MusicStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. Use "auto" (the default) to let the API pick the best format for the selected model: mp3_44100_128 for v1 models and mp3_48000_192 for v2 models. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + prompt : typing.Optional[str] + A simple text prompt to generate a song from. Cannot be used in conjunction with `composition_plan`. + + composition_plan : typing.Optional[BodyStreamComposedMusicV1MusicStreamPostCompositionPlan] + A detailed composition plan to guide music generation. Cannot be used in conjunction with `prompt`. + + music_length_ms : typing.Optional[int] + The length of the song to generate in milliseconds. Used only in conjunction with `prompt`. Must be between 3000ms and 600000ms. Optional - if not provided, the model will choose a length based on the prompt. + + model_id : typing.Optional[MusicModelId] + The model to use for the generation. + + seed : typing.Optional[int] + Random seed to initialize the music generation process. Providing the same seed with the same parameters can help achieve more consistent results, but exact reproducibility is not guaranteed and outputs may change across system updates. Cannot be used in conjunction with prompt. + + force_instrumental : typing.Optional[bool] + If true, guarantees that the generated song will be instrumental. If false, the song may or may not be instrumental depending on the `prompt`. Can only be used with `prompt`. + + finetune_id : typing.Optional[str] + The ID of the finetune to use for the generation + + store_for_inpainting : typing.Optional[bool] + Whether to store the generated song for inpainting. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Streaming audio data in the format specified + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/stream", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "prompt": prompt, + "composition_plan": convert_and_respect_annotation_metadata( + object_=composition_plan, + annotation=BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, + direction="write", + ), + "music_length_ms": music_length_ms, + "model_id": model_id, + "seed": seed, + "force_instrumental": force_instrumental, + "finetune_id": finetune_id, + "store_for_inpainting": store_for_inpainting, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + async def upload( + self, + *, + file: core.File, + extract_composition_plan: typing.Optional[MusicUploadRequestExtractCompositionPlan] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + with_waveform_visual: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[MusicUploadResponse]: + """ + Upload a music file to be later used for inpainting. Price for uploading is the same as the one for song generation. All uploaded content gets inspected for copyright infringement. If copyrighted content is detected, half of the request cost is still charged. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + extract_composition_plan : typing.Optional[MusicUploadRequestExtractCompositionPlan] + Whether to generate and return the composition plan for the uploaded song. Pass a model id (`music_v1`, `music_v2` or `music_v2_5`) to control which composition plan format is returned. Passing `true`/`false` is deprecated; `true` defaults to the `music_v1` plan format. Enabling this will increase the latency. + + with_timestamps : typing.Optional[bool] + Whether to transcribe the uploaded song and return word-level timestamps. If True, the response will include words_timestamps but will increase the latency. + + with_waveform_visual : typing.Optional[bool] + Whether to return the visual waveform of the uploaded song. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[MusicUploadResponse] + Successfully uploaded music file with optional composition plan + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/music/upload", + method="POST", + data={ + "extract_composition_plan": extract_composition_plan, + "with_timestamps": with_timestamps, + "with_waveform_visual": with_waveform_visual, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + MusicUploadResponse, + construct_type( + type_=MusicUploadResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def separate_stems( + self, + *, + file: core.File, + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + stem_variation_id: typing.Optional[MusicSeparateStemsRequestStemVariationId] = OMIT, + sign_with_c_2_pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Separate an audio file into individual stems. This endpoint might have high latency, depending on the length of the audio file. + + Parameters + ---------- + file : core.File + See core.File for more documentation + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + stem_variation_id : typing.Optional[MusicSeparateStemsRequestStemVariationId] + The id of the stem variation to use. + + sign_with_c_2_pa : typing.Optional[bool] + Whether to sign the generated song with C2PA. Applicable only for mp3 files. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + ZIP archive containing separated audio stems. Each stem is provided as a separate audio file in the requested output format. + """ + async with self._client_wrapper.httpx_client.stream( + "v1/music/stem-separation", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + data={ + "stem_variation_id": stem_variation_id, + "sign_with_c2pa": sign_with_c_2_pa, + }, + files={ + "file": file, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/music/types/__init__.py b/data/src/elevenlabs/music/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..191b8a24da18a48c56850dbac99f4a2f86414fb0 --- /dev/null +++ b/data/src/elevenlabs/music/types/__init__.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_compose_music_v_1_music_post_composition_plan import BodyComposeMusicV1MusicPostCompositionPlan + from .body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan import ( + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, + ) + from .body_stream_composed_music_v_1_music_stream_post_composition_plan import ( + BodyStreamComposedMusicV1MusicStreamPostCompositionPlan, + ) + from .body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_composition_plan import ( + BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan, + ) + from .music_compose_detailed_request_output_format import MusicComposeDetailedRequestOutputFormat + from .music_compose_detailed_stream_request_output_format import MusicComposeDetailedStreamRequestOutputFormat + from .music_compose_request_output_format import MusicComposeRequestOutputFormat + from .music_separate_stems_request_stem_variation_id import MusicSeparateStemsRequestStemVariationId + from .music_stream_request_output_format import MusicStreamRequestOutputFormat + from .music_upload_request_extract_composition_plan import MusicUploadRequestExtractCompositionPlan +_dynamic_imports: typing.Dict[str, str] = { + "BodyComposeMusicV1MusicPostCompositionPlan": ".body_compose_music_v_1_music_post_composition_plan", + "BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan": ".body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan", + "BodyStreamComposedMusicV1MusicStreamPostCompositionPlan": ".body_stream_composed_music_v_1_music_stream_post_composition_plan", + "BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan": ".body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_composition_plan", + "MusicComposeDetailedRequestOutputFormat": ".music_compose_detailed_request_output_format", + "MusicComposeDetailedStreamRequestOutputFormat": ".music_compose_detailed_stream_request_output_format", + "MusicComposeRequestOutputFormat": ".music_compose_request_output_format", + "MusicSeparateStemsRequestStemVariationId": ".music_separate_stems_request_stem_variation_id", + "MusicStreamRequestOutputFormat": ".music_stream_request_output_format", + "MusicUploadRequestExtractCompositionPlan": ".music_upload_request_extract_composition_plan", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyComposeMusicV1MusicPostCompositionPlan", + "BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan", + "BodyStreamComposedMusicV1MusicStreamPostCompositionPlan", + "BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan", + "MusicComposeDetailedRequestOutputFormat", + "MusicComposeDetailedStreamRequestOutputFormat", + "MusicComposeRequestOutputFormat", + "MusicSeparateStemsRequestStemVariationId", + "MusicStreamRequestOutputFormat", + "MusicUploadRequestExtractCompositionPlan", +] diff --git a/data/src/elevenlabs/music/types/body_compose_music_v_1_music_post_composition_plan.py b/data/src/elevenlabs/music/types/body_compose_music_v_1_music_post_composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..8807925b9e71e5fbc56d89cd8c4e6ad13e7ab341 --- /dev/null +++ b/data/src/elevenlabs/music/types/body_compose_music_v_1_music_post_composition_plan.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.composition_plan import CompositionPlan +from ...types.music_prompt import MusicPrompt + +BodyComposeMusicV1MusicPostCompositionPlan = typing.Union[MusicPrompt, CompositionPlan] diff --git a/data/src/elevenlabs/music/types/body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan.py b/data/src/elevenlabs/music/types/body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..ab9caaee8e7e5c7d3a9f2099f3b9af0b1a33d4d8 --- /dev/null +++ b/data/src/elevenlabs/music/types/body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.composition_plan import CompositionPlan +from ...types.music_prompt import MusicPrompt + +BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan = typing.Union[MusicPrompt, CompositionPlan] diff --git a/data/src/elevenlabs/music/types/body_stream_composed_music_v_1_music_stream_post_composition_plan.py b/data/src/elevenlabs/music/types/body_stream_composed_music_v_1_music_stream_post_composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..7fe34f9cd8157f0b76b3de8f2c95b75b868713fc --- /dev/null +++ b/data/src/elevenlabs/music/types/body_stream_composed_music_v_1_music_stream_post_composition_plan.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.composition_plan import CompositionPlan +from ...types.music_prompt import MusicPrompt + +BodyStreamComposedMusicV1MusicStreamPostCompositionPlan = typing.Union[MusicPrompt, CompositionPlan] diff --git a/data/src/elevenlabs/music/types/body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_composition_plan.py b/data/src/elevenlabs/music/types/body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..c778944237bd99ad756dca556bcd851ebedd4eb5 --- /dev/null +++ b/data/src/elevenlabs/music/types/body_stream_composed_music_with_a_detailed_response_v_1_music_detailed_stream_post_composition_plan.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.composition_plan import CompositionPlan +from ...types.music_prompt import MusicPrompt + +BodyStreamComposedMusicWithADetailedResponseV1MusicDetailedStreamPostCompositionPlan = typing.Union[ + MusicPrompt, CompositionPlan +] diff --git a/data/src/elevenlabs/music/types/music_compose_detailed_request_output_format.py b/data/src/elevenlabs/music/types/music_compose_detailed_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..953af6c9a8be8fc0550421270e574ef8bfcc4170 --- /dev/null +++ b/data/src/elevenlabs/music/types/music_compose_detailed_request_output_format.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicComposeDetailedRequestOutputFormat = typing.Union[ + typing.Literal[ + "auto", + "mp3_48000_128", + "mp3_48000_192", + "mp3_48000_240", + "mp3_48000_320", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/music/types/music_compose_detailed_stream_request_output_format.py b/data/src/elevenlabs/music/types/music_compose_detailed_stream_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..ac7ec075bbbe04cc8a8c8102e5bdc5126e6f0eb4 --- /dev/null +++ b/data/src/elevenlabs/music/types/music_compose_detailed_stream_request_output_format.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicComposeDetailedStreamRequestOutputFormat = typing.Union[ + typing.Literal[ + "auto", + "mp3_48000_128", + "mp3_48000_192", + "mp3_48000_240", + "mp3_48000_320", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/music/types/music_compose_request_output_format.py b/data/src/elevenlabs/music/types/music_compose_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..17d2714799b271fef46c8fca6b2c8be287ebc115 --- /dev/null +++ b/data/src/elevenlabs/music/types/music_compose_request_output_format.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicComposeRequestOutputFormat = typing.Union[ + typing.Literal[ + "auto", + "mp3_48000_128", + "mp3_48000_192", + "mp3_48000_240", + "mp3_48000_320", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/music/types/music_separate_stems_request_stem_variation_id.py b/data/src/elevenlabs/music/types/music_separate_stems_request_stem_variation_id.py new file mode 100644 index 0000000000000000000000000000000000000000..33fdb8d37fa40824d6c182adf9f7c41070579211 --- /dev/null +++ b/data/src/elevenlabs/music/types/music_separate_stems_request_stem_variation_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicSeparateStemsRequestStemVariationId = typing.Union[typing.Literal["two_stems_v1", "six_stems_v1"], typing.Any] diff --git a/data/src/elevenlabs/music/types/music_stream_request_output_format.py b/data/src/elevenlabs/music/types/music_stream_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..5523fbb33ae10add435977e41ea6cfc4db7e33ca --- /dev/null +++ b/data/src/elevenlabs/music/types/music_stream_request_output_format.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicStreamRequestOutputFormat = typing.Union[ + typing.Literal[ + "auto", + "mp3_48000_128", + "mp3_48000_192", + "mp3_48000_240", + "mp3_48000_320", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/music/types/music_upload_request_extract_composition_plan.py b/data/src/elevenlabs/music/types/music_upload_request_extract_composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..40c5f24d3c3ee01d9dd6847077930b4b55da67ab --- /dev/null +++ b/data/src/elevenlabs/music/types/music_upload_request_extract_composition_plan.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.music_model_id import MusicModelId + +MusicUploadRequestExtractCompositionPlan = typing.Union[bool, MusicModelId] diff --git a/data/src/elevenlabs/music_custom.py b/data/src/elevenlabs/music_custom.py new file mode 100644 index 0000000000000000000000000000000000000000..5a4c42e94d55efedb865a32b2002c1cc7e6f196e --- /dev/null +++ b/data/src/elevenlabs/music_custom.py @@ -0,0 +1,311 @@ +import json +import logging +import re +import typing +from dataclasses import dataclass + +from elevenlabs.core.request_options import RequestOptions +from elevenlabs.music.client import AsyncMusicClient as AutogeneratedAsyncMusicClient +from elevenlabs.music.client import MusicClient as AutogeneratedMusicClient +from elevenlabs.types.allowed_output_formats import AllowedOutputFormats +from elevenlabs.music.types.body_compose_music_with_a_detailed_response_v_1_music_detailed_post_composition_plan import ( + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan, +) +from elevenlabs.types.music_model_id import MusicModelId + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + +logger = logging.getLogger(__name__) + + +def _find_audio_start(data: bytes, start: int) -> int: + """Find the blank line separating headers from body, returning the index of the body start.""" + crlf_pos = data.find(b"\r\n\r\n", start) + if crlf_pos != -1: + return crlf_pos + 4 + + lf_pos = data.find(b"\n\n", start) + if lf_pos != -1: + return lf_pos + 2 + + raise ValueError("Could not find header/body separator in audio part") + + +@dataclass +class SongMetadata: + title: str + description: str + genres: typing.List[str] + languages: typing.List[str] + is_explicit: bool + + +@dataclass +class MultipartResponse: + json: typing.Dict[str, typing.Any] # Contains compositionPlan and songMetadata + audio: bytes + filename: str + song_id: typing.Optional[str] = None + + +class MusicClient(AutogeneratedMusicClient): + """ + A client to handle ElevenLabs music-related functionality + Extends the autogenerated client to include custom music methods + """ + + def compose_detailed( # type: ignore[override] + self, + *, + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + sign_with_c2pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + **kwargs: typing.Any, + ) -> MultipartResponse: + """ + Compose a song from a prompt or a composition plan with detailed response parsing. + This method calls the original compose_detailed and then parses the stream response. + + Returns a MultipartResponse containing parsed JSON metadata, audio bytes, filename, + and song_id (if store_for_inpainting was True). + """ + # Use the raw client directly to access response headers (for song_id) + with self._raw_client.compose_detailed( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + force_instrumental=force_instrumental, + store_for_inpainting=store_for_inpainting, + with_timestamps=with_timestamps, + sign_with_c_2_pa=sign_with_c2pa, + request_options=request_options, + ) as r: + result = self._parse_multipart(r.data) + result.song_id = r.headers.get("song-id") + return result + + def _parse_multipart(self, stream: typing.Iterator[bytes]) -> MultipartResponse: + """ + Reads a byte stream containing multipart data and parses it into JSON and audio parts. + + Args: + stream: Iterator of bytes from ElevenLabs music API response + + Returns: + MultipartResponse containing parsed JSON metadata, audio bytes, and filename + """ + # Collect all chunks into a single bytes object + chunks = [] + for chunk in stream: + chunks.append(chunk) + + # Combine all chunks into a single buffer + response_bytes = b''.join(chunks) + + # Parse the multipart content + response_text = response_bytes.decode('utf-8', errors='ignore') + lines = response_text.split('\n') + + if not lines: + raise ValueError("Empty response from music API") + + boundary = lines[0].strip() + + # Find the JSON part (should be early in the response) + json_data = None + filename = 'generated_music.mp3' + + # Parse JSON from the text representation + for i in range(min(10, len(lines))): + if 'Content-Type: application/json' in lines[i] and i + 2 < len(lines): + json_line = lines[i + 2] + if json_line.strip() and json_line.startswith('{'): + try: + json_data = json.loads(json_line) + except json.JSONDecodeError as e: + logger.error(f'Failed to parse composition plan JSON: {e}') + break + + # Extract filename from headers + for i in range(min(20, len(lines))): + if 'filename=' in lines[i]: + match = re.search(r'filename="([^"]+)"', lines[i]) + if match: + filename = match.group(1) + break + + # Find where the audio data starts (after the second boundary and headers) + boundary_bytes = boundary.encode('utf-8') + first_boundary = -1 + second_boundary = -1 + + for i in range(len(response_bytes) - len(boundary_bytes) + 1): + if response_bytes[i:i + len(boundary_bytes)] == boundary_bytes: + if first_boundary == -1: + first_boundary = i + elif second_boundary == -1: + second_boundary = i + break + + if second_boundary == -1: + raise ValueError('Could not find audio part boundary') + + # Find the start of audio data (after headers and empty line) + audio_start = _find_audio_start(response_bytes, second_boundary + len(boundary_bytes)) + + # Audio goes until the end (or until we find another boundary) + audio_buffer = response_bytes[audio_start:] + + if not json_data: + raise ValueError('Could not parse JSON data') + + return MultipartResponse( + json=json_data, + audio=audio_buffer, + filename=filename + ) + + +class AsyncMusicClient(AutogeneratedAsyncMusicClient): + """ + An async client to handle ElevenLabs music-related functionality + Extends the autogenerated async client to include custom music methods + """ + + async def compose_detailed( # type: ignore[override] + self, + *, + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + prompt: typing.Optional[str] = OMIT, + composition_plan: typing.Optional[ + BodyComposeMusicWithADetailedResponseV1MusicDetailedPostCompositionPlan + ] = OMIT, + music_length_ms: typing.Optional[int] = OMIT, + model_id: typing.Optional[MusicModelId] = OMIT, + force_instrumental: typing.Optional[bool] = OMIT, + store_for_inpainting: typing.Optional[bool] = OMIT, + with_timestamps: typing.Optional[bool] = OMIT, + sign_with_c2pa: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + **kwargs: typing.Any, + ) -> MultipartResponse: + """ + Compose a song from a prompt or a composition plan with detailed response parsing. + This method calls the original compose_detailed and then parses the stream response. + + Returns a MultipartResponse containing parsed JSON metadata, audio bytes, filename, + and song_id (if store_for_inpainting was True). + """ + # Use the raw client directly to access response headers (for song_id) + async with self._raw_client.compose_detailed( + output_format=output_format, + enable_logging=enable_logging, + prompt=prompt, + composition_plan=composition_plan, + music_length_ms=music_length_ms, + model_id=model_id, + force_instrumental=force_instrumental, + store_for_inpainting=store_for_inpainting, + with_timestamps=with_timestamps, + sign_with_c_2_pa=sign_with_c2pa, + request_options=request_options, + ) as r: + result = await self._parse_multipart_async(r.data) + result.song_id = r.headers.get("song-id") + return result + + async def _parse_multipart_async(self, stream: typing.AsyncIterator[bytes]) -> MultipartResponse: + """ + Reads an async byte stream containing multipart data and parses it into JSON and audio parts. + + Args: + stream: AsyncIterator of bytes from ElevenLabs music API response + + Returns: + MultipartResponse containing parsed JSON metadata, audio bytes, and filename + """ + # Collect all chunks into a single bytes object + chunks = [] + async for chunk in stream: + chunks.append(chunk) + + # Combine all chunks into a single buffer + response_bytes = b''.join(chunks) + + # Parse the multipart content + response_text = response_bytes.decode('utf-8', errors='ignore') + lines = response_text.split('\n') + + if not lines: + raise ValueError("Empty response from music API") + + boundary = lines[0].strip() + + # Find the JSON part (should be early in the response) + json_data = None + filename = 'generated_music.mp3' + + # Parse JSON from the text representation + for i in range(min(10, len(lines))): + if 'Content-Type: application/json' in lines[i] and i + 2 < len(lines): + json_line = lines[i + 2] + if json_line.strip() and json_line.startswith('{'): + try: + json_data = json.loads(json_line) + except json.JSONDecodeError as e: + logger.error(f'Failed to parse JSON: {e}') + break + + # Extract filename from headers + for i in range(min(20, len(lines))): + if 'filename=' in lines[i]: + match = re.search(r'filename="([^"]+)"', lines[i]) + if match: + filename = match.group(1) + break + + # Find where the audio data starts (after the second boundary and headers) + boundary_bytes = boundary.encode('utf-8') + first_boundary = -1 + second_boundary = -1 + + for i in range(len(response_bytes) - len(boundary_bytes) + 1): + if response_bytes[i:i + len(boundary_bytes)] == boundary_bytes: + if first_boundary == -1: + first_boundary = i + elif second_boundary == -1: + second_boundary = i + break + + if second_boundary == -1: + raise ValueError('Could not find audio part boundary') + + # Find the start of audio data (after headers and empty line) + audio_start = _find_audio_start(response_bytes, second_boundary + len(boundary_bytes)) + + # Audio goes until the end (or until we find another boundary) + audio_buffer = response_bytes[audio_start:] + + if not json_data: + raise ValueError('Could not parse JSON data') + + return MultipartResponse( + json=json_data, + audio=audio_buffer, + filename=filename + ) \ No newline at end of file diff --git a/data/src/elevenlabs/play.py b/data/src/elevenlabs/play.py new file mode 100644 index 0000000000000000000000000000000000000000..3923e7ae50c7a898bd5c5bd239d263e5ed09d0d4 --- /dev/null +++ b/data/src/elevenlabs/play.py @@ -0,0 +1,105 @@ +import shutil +import subprocess +from typing import Iterable, Iterator, Union + + +def is_installed(lib_name: str) -> bool: + lib = shutil.which(lib_name) + if lib is None: + return False + return True + + +def play( + audio: Union[bytes, Iterable[bytes]], + notebook: bool = False, + use_ffmpeg: bool = True +) -> None: + if not isinstance(audio, (bytes, bytearray)): + audio = b"".join(audio) + if notebook: + try: + from IPython.display import Audio, display # type: ignore + except ModuleNotFoundError: + message = ( + "`pip install ipython` required when `notebook=True` " + ) + raise ValueError(message) + + display(Audio(audio, rate=44100, autoplay=True)) + elif use_ffmpeg: + if not is_installed("ffplay"): + message = ( + "ffplay from ffmpeg not found, necessary to play audio. " + "On mac you can install it with 'brew install ffmpeg'. " + "On linux and windows you can install it from https://ffmpeg.org/" + ) + raise ValueError(message) + args = ["ffplay", "-autoexit", "-", "-nodisp"] + proc = subprocess.Popen( + args=args, + stdout=subprocess.PIPE, + stdin=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + out, err = proc.communicate(input=audio) + if proc.returncode != 0: + # ffplay can be on PATH and still fail to play anything, e.g. a + # build missing a shared library or an unusable audio device. + # Without this check that failure was silent. + detail = err.decode(errors="replace").strip() + message = f"ffplay exited with status {proc.returncode} and did not play the audio." + if detail: + message += f" Its error output was:\n{detail[-2000:]}" + raise ValueError(message) + else: + try: + import io + + import sounddevice as sd # type: ignore + import soundfile as sf # type: ignore + except ModuleNotFoundError: + message = ( + "`pip install sounddevice soundfile` required when `use_ffmpeg=False` " + ) + raise ValueError(message) + sd.play(*sf.read(io.BytesIO(audio))) + sd.wait() + + +def save(audio: Union[bytes, Iterable[bytes]], filename: str) -> None: + if not isinstance(audio, (bytes, bytearray)): + audio = b"".join(audio) + with open(filename, "wb") as f: + f.write(audio) + + +def stream(audio_stream: Iterator[bytes]) -> bytes: + if not is_installed("mpv"): + message = ( + "mpv not found, necessary to stream audio. " + "On mac you can install it with 'brew install mpv'. " + "On linux and windows you can install it from https://mpv.io/" + ) + raise ValueError(message) + + mpv_command = ["mpv", "--no-cache", "--no-terminal", "--", "fd://0"] + mpv_process = subprocess.Popen( + mpv_command, + stdin=subprocess.PIPE, + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + ) + + audio = b"" + + for chunk in audio_stream: + if chunk is not None: + mpv_process.stdin.write(chunk) # type: ignore + mpv_process.stdin.flush() # type: ignore + audio += chunk + if mpv_process.stdin: + mpv_process.stdin.close() + mpv_process.wait() + + return audio diff --git a/data/src/elevenlabs/productions/__init__.py b/data/src/elevenlabs/productions/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..60c065b3f240875ab4ba59eee38410b64dca682b --- /dev/null +++ b/data/src/elevenlabs/productions/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import orders +_dynamic_imports: typing.Dict[str, str] = {"orders": ".orders"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["orders"] diff --git a/data/src/elevenlabs/productions/client.py b/data/src/elevenlabs/productions/client.py new file mode 100644 index 0000000000000000000000000000000000000000..16b549416d9fe3c1c234dd111bc3bc4ee32e1bf8 --- /dev/null +++ b/data/src/elevenlabs/productions/client.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .raw_client import AsyncRawProductionsClient, RawProductionsClient + +if typing.TYPE_CHECKING: + from .orders.client import AsyncOrdersClient, OrdersClient + + +class ProductionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawProductionsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._orders: typing.Optional[OrdersClient] = None + + @property + def with_raw_response(self) -> RawProductionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawProductionsClient + """ + return self._raw_client + + @property + def orders(self): + if self._orders is None: + from .orders.client import OrdersClient # noqa: E402 + + self._orders = OrdersClient(client_wrapper=self._client_wrapper) + return self._orders + + +class AsyncProductionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawProductionsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._orders: typing.Optional[AsyncOrdersClient] = None + + @property + def with_raw_response(self) -> AsyncRawProductionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawProductionsClient + """ + return self._raw_client + + @property + def orders(self): + if self._orders is None: + from .orders.client import AsyncOrdersClient # noqa: E402 + + self._orders = AsyncOrdersClient(client_wrapper=self._client_wrapper) + return self._orders diff --git a/data/src/elevenlabs/productions/orders/__init__.py b/data/src/elevenlabs/productions/orders/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..18d42c989d77daceaa866aadce7d5b652fa9847e --- /dev/null +++ b/data/src/elevenlabs/productions/orders/__init__.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import deliverables, items, languages, media +_dynamic_imports: typing.Dict[str, str] = { + "deliverables": ".deliverables", + "items": ".items", + "languages": ".languages", + "media": ".media", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["deliverables", "items", "languages", "media"] diff --git a/data/src/elevenlabs/productions/orders/client.py b/data/src/elevenlabs/productions/orders/client.py new file mode 100644 index 0000000000000000000000000000000000000000..3a502a63940acb9308fd2e34bf77a9726e5b2ff0 --- /dev/null +++ b/data/src/elevenlabs/productions/orders/client.py @@ -0,0 +1,596 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.create_order_request import CreateOrderRequest +from ...types.create_order_response import CreateOrderResponse +from ...types.list_orders_response import ListOrdersResponse +from ...types.order_id import OrderId +from ...types.order_response import OrderResponse +from ...types.order_state import OrderState +from ...types.submit_order_response import SubmitOrderResponse +from ...types.update_order_request import UpdateOrderRequest +from ...types.update_order_response import UpdateOrderResponse +from .raw_client import AsyncRawOrdersClient, RawOrdersClient + +if typing.TYPE_CHECKING: + from .deliverables.client import AsyncDeliverablesClient, DeliverablesClient + from .items.client import AsyncItemsClient, ItemsClient + from .languages.client import AsyncLanguagesClient, LanguagesClient + from .media.client import AsyncMediaClient, MediaClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class OrdersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawOrdersClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._media: typing.Optional[MediaClient] = None + self._items: typing.Optional[ItemsClient] = None + self._deliverables: typing.Optional[DeliverablesClient] = None + self._languages: typing.Optional[LanguagesClient] = None + + @property + def with_raw_response(self) -> RawOrdersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawOrdersClient + """ + return self._raw_client + + def list( + self, + *, + page_size: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + status: typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]] = None, + start_date: typing.Optional[dt.datetime] = None, + end_date: typing.Optional[dt.datetime] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListOrdersResponse: + """ + Lists Productions orders in the workspace. Supports filtering by status and date range, with pagination. + + Parameters + ---------- + page_size : typing.Optional[int] + Maximum number of orders to return per page. + + offset : typing.Optional[int] + Number of orders to skip for pagination. + + status : typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]] + Filter orders by one or more statuses. + + start_date : typing.Optional[dt.datetime] + Filter orders created on or after this date. + + end_date : typing.Optional[dt.datetime] + Filter orders created on or before this date. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListOrdersResponse + Successful Response + + Examples + -------- + import datetime + + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.list( + page_size=1, + offset=1, + status=["open"], + start_date=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + end_date=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + ) + """ + _response = self._raw_client.list( + page_size=page_size, + offset=offset, + status=status, + start_date=start_date, + end_date=end_date, + request_options=request_options, + ) + return _response.data + + def create( + self, + *, + request: typing.Optional[CreateOrderRequest] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateOrderResponse: + """ + Creates a new Productions order in the workspace. The order starts in the open state and can be configured with items before submission. + + Parameters + ---------- + request : typing.Optional[CreateOrderRequest] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateOrderResponse + Successful Response + + Examples + -------- + from elevenlabs import CreateOrderRequest, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.create( + request=CreateOrderRequest( + sandbox=False, + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def get(self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None) -> OrderResponse: + """ + Retrieves full details for a Productions order. + + Quote and pricing information may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until it is ready. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + OrderResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.get( + order_id="order_id", + ) + """ + _response = self._raw_client.get(order_id, request_options=request_options) + return _response.data + + def update( + self, order_id: OrderId, *, request: UpdateOrderRequest, request_options: typing.Optional[RequestOptions] = None + ) -> UpdateOrderResponse: + """ + Updates an open order. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request : UpdateOrderRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateOrderResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, UpdateOrderRequest + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.update( + order_id="order_id", + request=UpdateOrderRequest( + name="Spanish Dubs", + ), + ) + """ + _response = self._raw_client.update(order_id, request=request, request_options=request_options) + return _response.data + + def submit( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> SubmitOrderResponse: + """ + Submits an open order for processing. The order must have at least one item. Once submitted, items can no longer be modified. + + Upon submission, the workspace will be charged for the order. The quote is based on information extracted from the uploaded media, such as its duration. The quote may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until the quote is ready. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubmitOrderResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.submit( + order_id="order_id", + ) + """ + _response = self._raw_client.submit(order_id, request_options=request_options) + return _response.data + + @property + def media(self): + if self._media is None: + from .media.client import MediaClient # noqa: E402 + + self._media = MediaClient(client_wrapper=self._client_wrapper) + return self._media + + @property + def items(self): + if self._items is None: + from .items.client import ItemsClient # noqa: E402 + + self._items = ItemsClient(client_wrapper=self._client_wrapper) + return self._items + + @property + def deliverables(self): + if self._deliverables is None: + from .deliverables.client import DeliverablesClient # noqa: E402 + + self._deliverables = DeliverablesClient(client_wrapper=self._client_wrapper) + return self._deliverables + + @property + def languages(self): + if self._languages is None: + from .languages.client import LanguagesClient # noqa: E402 + + self._languages = LanguagesClient(client_wrapper=self._client_wrapper) + return self._languages + + +class AsyncOrdersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawOrdersClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._media: typing.Optional[AsyncMediaClient] = None + self._items: typing.Optional[AsyncItemsClient] = None + self._deliverables: typing.Optional[AsyncDeliverablesClient] = None + self._languages: typing.Optional[AsyncLanguagesClient] = None + + @property + def with_raw_response(self) -> AsyncRawOrdersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawOrdersClient + """ + return self._raw_client + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + status: typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]] = None, + start_date: typing.Optional[dt.datetime] = None, + end_date: typing.Optional[dt.datetime] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListOrdersResponse: + """ + Lists Productions orders in the workspace. Supports filtering by status and date range, with pagination. + + Parameters + ---------- + page_size : typing.Optional[int] + Maximum number of orders to return per page. + + offset : typing.Optional[int] + Number of orders to skip for pagination. + + status : typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]] + Filter orders by one or more statuses. + + start_date : typing.Optional[dt.datetime] + Filter orders created on or after this date. + + end_date : typing.Optional[dt.datetime] + Filter orders created on or before this date. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListOrdersResponse + Successful Response + + Examples + -------- + import asyncio + import datetime + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.list( + page_size=1, + offset=1, + status=["open"], + start_date=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + end_date=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + page_size=page_size, + offset=offset, + status=status, + start_date=start_date, + end_date=end_date, + request_options=request_options, + ) + return _response.data + + async def create( + self, + *, + request: typing.Optional[CreateOrderRequest] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateOrderResponse: + """ + Creates a new Productions order in the workspace. The order starts in the open state and can be configured with items before submission. + + Parameters + ---------- + request : typing.Optional[CreateOrderRequest] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateOrderResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, CreateOrderRequest + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.create( + request=CreateOrderRequest( + sandbox=False, + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def get(self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None) -> OrderResponse: + """ + Retrieves full details for a Productions order. + + Quote and pricing information may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until it is ready. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + OrderResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.get( + order_id="order_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(order_id, request_options=request_options) + return _response.data + + async def update( + self, order_id: OrderId, *, request: UpdateOrderRequest, request_options: typing.Optional[RequestOptions] = None + ) -> UpdateOrderResponse: + """ + Updates an open order. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request : UpdateOrderRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateOrderResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, UpdateOrderRequest + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.update( + order_id="order_id", + request=UpdateOrderRequest( + name="Spanish Dubs", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(order_id, request=request, request_options=request_options) + return _response.data + + async def submit( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> SubmitOrderResponse: + """ + Submits an open order for processing. The order must have at least one item. Once submitted, items can no longer be modified. + + Upon submission, the workspace will be charged for the order. The quote is based on information extracted from the uploaded media, such as its duration. The quote may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until the quote is ready. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubmitOrderResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.submit( + order_id="order_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.submit(order_id, request_options=request_options) + return _response.data + + @property + def media(self): + if self._media is None: + from .media.client import AsyncMediaClient # noqa: E402 + + self._media = AsyncMediaClient(client_wrapper=self._client_wrapper) + return self._media + + @property + def items(self): + if self._items is None: + from .items.client import AsyncItemsClient # noqa: E402 + + self._items = AsyncItemsClient(client_wrapper=self._client_wrapper) + return self._items + + @property + def deliverables(self): + if self._deliverables is None: + from .deliverables.client import AsyncDeliverablesClient # noqa: E402 + + self._deliverables = AsyncDeliverablesClient(client_wrapper=self._client_wrapper) + return self._deliverables + + @property + def languages(self): + if self._languages is None: + from .languages.client import AsyncLanguagesClient # noqa: E402 + + self._languages = AsyncLanguagesClient(client_wrapper=self._client_wrapper) + return self._languages diff --git a/data/src/elevenlabs/productions/orders/deliverables/__init__.py b/data/src/elevenlabs/productions/orders/deliverables/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/productions/orders/deliverables/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/productions/orders/deliverables/client.py b/data/src/elevenlabs/productions/orders/deliverables/client.py new file mode 100644 index 0000000000000000000000000000000000000000..2b0bf9463968dfdb9d96921fedbf3f8abf45389b --- /dev/null +++ b/data/src/elevenlabs/productions/orders/deliverables/client.py @@ -0,0 +1,115 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.order_deliverables_response import OrderDeliverablesResponse +from ....types.order_id import OrderId +from .raw_client import AsyncRawDeliverablesClient, RawDeliverablesClient + + +class DeliverablesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawDeliverablesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawDeliverablesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawDeliverablesClient + """ + return self._raw_client + + def list( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> OrderDeliverablesResponse: + """ + Retrieves the delivered files for a completed order. Returns an empty list if the order is not yet completed. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + OrderDeliverablesResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.deliverables.list( + order_id="order_id", + ) + """ + _response = self._raw_client.list(order_id, request_options=request_options) + return _response.data + + +class AsyncDeliverablesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawDeliverablesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawDeliverablesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawDeliverablesClient + """ + return self._raw_client + + async def list( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> OrderDeliverablesResponse: + """ + Retrieves the delivered files for a completed order. Returns an empty list if the order is not yet completed. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + OrderDeliverablesResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.deliverables.list( + order_id="order_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(order_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/productions/orders/deliverables/raw_client.py b/data/src/elevenlabs/productions/orders/deliverables/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..ff41630ce55780f1172f985054ee6b94fecd8baf --- /dev/null +++ b/data/src/elevenlabs/productions/orders/deliverables/raw_client.py @@ -0,0 +1,134 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.order_deliverables_response import OrderDeliverablesResponse +from ....types.order_id import OrderId +from pydantic import ValidationError + + +class RawDeliverablesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[OrderDeliverablesResponse]: + """ + Retrieves the delivered files for a completed order. Returns an empty list if the order is not yet completed. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[OrderDeliverablesResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/deliverables", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + OrderDeliverablesResponse, + construct_type( + type_=OrderDeliverablesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawDeliverablesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[OrderDeliverablesResponse]: + """ + Retrieves the delivered files for a completed order. Returns an empty list if the order is not yet completed. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[OrderDeliverablesResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/deliverables", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + OrderDeliverablesResponse, + construct_type( + type_=OrderDeliverablesResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/productions/orders/items/__init__.py b/data/src/elevenlabs/productions/orders/items/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/productions/orders/items/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/productions/orders/items/client.py b/data/src/elevenlabs/productions/orders/items/client.py new file mode 100644 index 0000000000000000000000000000000000000000..887d7dce1bc841e964fab2a44c9e0f2026d8005e --- /dev/null +++ b/data/src/elevenlabs/productions/orders/items/client.py @@ -0,0 +1,245 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.item_id import ItemId +from ....types.order_id import OrderId +from ....types.remove_order_item_response import RemoveOrderItemResponse +from ....types.upsert_order_item_request import UpsertOrderItemRequest +from ....types.upsert_order_item_response import UpsertOrderItemResponse +from .raw_client import AsyncRawItemsClient, RawItemsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ItemsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawItemsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawItemsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawItemsClient + """ + return self._raw_client + + def upsert( + self, + order_id: OrderId, + *, + request: UpsertOrderItemRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpsertOrderItemResponse: + """ + Adds or updates an order item on an open order. Returns the item ID and the quoted price. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request : UpsertOrderItemRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpsertOrderItemResponse + Successful Response + + Examples + -------- + from elevenlabs import ( + ElevenLabs, + OrderItemRequestInput_Dub, + UpsertOrderItemRequest, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.items.upsert( + order_id="order_id", + request=UpsertOrderItemRequest( + item=OrderItemRequestInput_Dub( + media_id="prodmedia_01jgatk6h0fwxrtbjade61yqhx", + source_language="en", + destination_languages=["hi", "fr-FR", "de"], + include_captions=True, + include_source_captions=False, + instructions="Voices don't need to match the originals, prioritize native-sounding voices", + captions_sdh=False, + ), + ), + ) + """ + _response = self._raw_client.upsert(order_id, request=request, request_options=request_options) + return _response.data + + def remove( + self, order_id: OrderId, item_id: ItemId, *, request_options: typing.Optional[RequestOptions] = None + ) -> RemoveOrderItemResponse: + """ + Removes an order item from an open order. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + item_id : ItemId + The ID of the order item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RemoveOrderItemResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.items.remove( + order_id="order_id", + item_id="item_id", + ) + """ + _response = self._raw_client.remove(order_id, item_id, request_options=request_options) + return _response.data + + +class AsyncItemsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawItemsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawItemsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawItemsClient + """ + return self._raw_client + + async def upsert( + self, + order_id: OrderId, + *, + request: UpsertOrderItemRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpsertOrderItemResponse: + """ + Adds or updates an order item on an open order. Returns the item ID and the quoted price. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request : UpsertOrderItemRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpsertOrderItemResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AsyncElevenLabs, + OrderItemRequestInput_Dub, + UpsertOrderItemRequest, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.items.upsert( + order_id="order_id", + request=UpsertOrderItemRequest( + item=OrderItemRequestInput_Dub( + media_id="prodmedia_01jgatk6h0fwxrtbjade61yqhx", + source_language="en", + destination_languages=["hi", "fr-FR", "de"], + include_captions=True, + include_source_captions=False, + instructions="Voices don't need to match the originals, prioritize native-sounding voices", + captions_sdh=False, + ), + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.upsert(order_id, request=request, request_options=request_options) + return _response.data + + async def remove( + self, order_id: OrderId, item_id: ItemId, *, request_options: typing.Optional[RequestOptions] = None + ) -> RemoveOrderItemResponse: + """ + Removes an order item from an open order. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + item_id : ItemId + The ID of the order item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RemoveOrderItemResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.items.remove( + order_id="order_id", + item_id="item_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.remove(order_id, item_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/productions/orders/items/raw_client.py b/data/src/elevenlabs/productions/orders/items/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..675e0d998ee409075143b832a2e534879858a179 --- /dev/null +++ b/data/src/elevenlabs/productions/orders/items/raw_client.py @@ -0,0 +1,285 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.item_id import ItemId +from ....types.order_id import OrderId +from ....types.remove_order_item_response import RemoveOrderItemResponse +from ....types.upsert_order_item_request import UpsertOrderItemRequest +from ....types.upsert_order_item_response import UpsertOrderItemResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawItemsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def upsert( + self, + order_id: OrderId, + *, + request: UpsertOrderItemRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UpsertOrderItemResponse]: + """ + Adds or updates an order item on an open order. Returns the item ID and the quoted price. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request : UpsertOrderItemRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UpsertOrderItemResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/items", + method="POST", + json={ + "request": convert_and_respect_annotation_metadata( + object_=request, annotation=UpsertOrderItemRequest, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpsertOrderItemResponse, + construct_type( + type_=UpsertOrderItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def remove( + self, order_id: OrderId, item_id: ItemId, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[RemoveOrderItemResponse]: + """ + Removes an order item from an open order. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + item_id : ItemId + The ID of the order item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[RemoveOrderItemResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/items/{jsonable_encoder(item_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RemoveOrderItemResponse, + construct_type( + type_=RemoveOrderItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawItemsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def upsert( + self, + order_id: OrderId, + *, + request: UpsertOrderItemRequest, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UpsertOrderItemResponse]: + """ + Adds or updates an order item on an open order. Returns the item ID and the quoted price. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request : UpsertOrderItemRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UpsertOrderItemResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/items", + method="POST", + json={ + "request": convert_and_respect_annotation_metadata( + object_=request, annotation=UpsertOrderItemRequest, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpsertOrderItemResponse, + construct_type( + type_=UpsertOrderItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def remove( + self, order_id: OrderId, item_id: ItemId, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[RemoveOrderItemResponse]: + """ + Removes an order item from an open order. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + item_id : ItemId + The ID of the order item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RemoveOrderItemResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/items/{jsonable_encoder(item_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RemoveOrderItemResponse, + construct_type( + type_=RemoveOrderItemResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/productions/orders/languages/__init__.py b/data/src/elevenlabs/productions/orders/languages/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/productions/orders/languages/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/productions/orders/languages/client.py b/data/src/elevenlabs/productions/orders/languages/client.py new file mode 100644 index 0000000000000000000000000000000000000000..26949e9f6033292428dcbb3fe921b06eede826bd --- /dev/null +++ b/data/src/elevenlabs/productions/orders/languages/client.py @@ -0,0 +1,115 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.languages_response import LanguagesResponse +from ....types.order_item_kind import OrderItemKind +from .raw_client import AsyncRawLanguagesClient, RawLanguagesClient + + +class LanguagesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawLanguagesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawLanguagesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawLanguagesClient + """ + return self._raw_client + + def list( + self, order_item_kind: OrderItemKind, *, request_options: typing.Optional[RequestOptions] = None + ) -> LanguagesResponse: + """ + Returns the available languages for a given order item kind. + + Parameters + ---------- + order_item_kind : OrderItemKind + The kind of order item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LanguagesResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.languages.list( + order_item_kind="dub", + ) + """ + _response = self._raw_client.list(order_item_kind, request_options=request_options) + return _response.data + + +class AsyncLanguagesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawLanguagesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawLanguagesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawLanguagesClient + """ + return self._raw_client + + async def list( + self, order_item_kind: OrderItemKind, *, request_options: typing.Optional[RequestOptions] = None + ) -> LanguagesResponse: + """ + Returns the available languages for a given order item kind. + + Parameters + ---------- + order_item_kind : OrderItemKind + The kind of order item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + LanguagesResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.languages.list( + order_item_kind="dub", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(order_item_kind, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/productions/orders/languages/raw_client.py b/data/src/elevenlabs/productions/orders/languages/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..f28abff2cc511d6ffd58ea19611d91064b8f5d1e --- /dev/null +++ b/data/src/elevenlabs/productions/orders/languages/raw_client.py @@ -0,0 +1,134 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.languages_response import LanguagesResponse +from ....types.order_item_kind import OrderItemKind +from pydantic import ValidationError + + +class RawLanguagesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, order_item_kind: OrderItemKind, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[LanguagesResponse]: + """ + Returns the available languages for a given order item kind. + + Parameters + ---------- + order_item_kind : OrderItemKind + The kind of order item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[LanguagesResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/languages/{jsonable_encoder(order_item_kind)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LanguagesResponse, + construct_type( + type_=LanguagesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawLanguagesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, order_item_kind: OrderItemKind, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[LanguagesResponse]: + """ + Returns the available languages for a given order item kind. + + Parameters + ---------- + order_item_kind : OrderItemKind + The kind of order item. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[LanguagesResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/languages/{jsonable_encoder(order_item_kind)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + LanguagesResponse, + construct_type( + type_=LanguagesResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/productions/orders/media/__init__.py b/data/src/elevenlabs/productions/orders/media/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/productions/orders/media/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/productions/orders/media/client.py b/data/src/elevenlabs/productions/orders/media/client.py new file mode 100644 index 0000000000000000000000000000000000000000..2665582163e66a8eebd03fc833b91403844b0daa --- /dev/null +++ b/data/src/elevenlabs/productions/orders/media/client.py @@ -0,0 +1,267 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .... import core +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.media_id import MediaId +from ....types.order_id import OrderId +from ....types.order_media_response import OrderMediaResponse +from ....types.register_media_response import RegisterMediaResponse +from .raw_client import AsyncRawMediaClient, RawMediaClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class MediaClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawMediaClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawMediaClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawMediaClient + """ + return self._raw_client + + def register( + self, + order_id: OrderId, + *, + declared_language: str, + media: typing.Optional[core.File] = OMIT, + media_url: typing.Optional[str] = OMIT, + media_url_filename: typing.Optional[str] = OMIT, + media_url_content_type: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> RegisterMediaResponse: + """ + Registers a media file with an order, either by uploading it directly or by providing a URL to fetch it from. Exactly one of `media` or `media_url` must be provided. The registered media can then be referenced when adding order items. + + Parameters + ---------- + order_id : OrderId + The ID of the order to which this media will be attached. + + declared_language : str + The language code of the media content (e.g. 'en', 'es-ES'). Must be a supported source language for some order item kind. + + media : typing.Optional[core.File] + See core.File for more documentation + + media_url : typing.Optional[str] + A URL to fetch the media file from. Mutually exclusive with media. + + media_url_filename : typing.Optional[str] + The filename for URL-sourced media (e.g. 'example.mp4'). Required when using media_url. + + media_url_content_type : typing.Optional[str] + The MIME type for URL-sourced media (e.g. 'video/mp4'). Required when using media_url. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RegisterMediaResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.media.register( + order_id="order_id", + declared_language="declared_language", + ) + """ + _response = self._raw_client.register( + order_id, + declared_language=declared_language, + media=media, + media_url=media_url, + media_url_filename=media_url_filename, + media_url_content_type=media_url_content_type, + request_options=request_options, + ) + return _response.data + + def get( + self, order_id: OrderId, media_id: MediaId, *, request_options: typing.Optional[RequestOptions] = None + ) -> OrderMediaResponse: + """ + Retrieves metadata and a time-limited download URL for a previously uploaded media file. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + media_id : MediaId + The ID of the media file. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + OrderMediaResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.productions.orders.media.get( + order_id="order_id", + media_id="media_id", + ) + """ + _response = self._raw_client.get(order_id, media_id, request_options=request_options) + return _response.data + + +class AsyncMediaClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawMediaClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawMediaClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawMediaClient + """ + return self._raw_client + + async def register( + self, + order_id: OrderId, + *, + declared_language: str, + media: typing.Optional[core.File] = OMIT, + media_url: typing.Optional[str] = OMIT, + media_url_filename: typing.Optional[str] = OMIT, + media_url_content_type: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> RegisterMediaResponse: + """ + Registers a media file with an order, either by uploading it directly or by providing a URL to fetch it from. Exactly one of `media` or `media_url` must be provided. The registered media can then be referenced when adding order items. + + Parameters + ---------- + order_id : OrderId + The ID of the order to which this media will be attached. + + declared_language : str + The language code of the media content (e.g. 'en', 'es-ES'). Must be a supported source language for some order item kind. + + media : typing.Optional[core.File] + See core.File for more documentation + + media_url : typing.Optional[str] + A URL to fetch the media file from. Mutually exclusive with media. + + media_url_filename : typing.Optional[str] + The filename for URL-sourced media (e.g. 'example.mp4'). Required when using media_url. + + media_url_content_type : typing.Optional[str] + The MIME type for URL-sourced media (e.g. 'video/mp4'). Required when using media_url. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RegisterMediaResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.media.register( + order_id="order_id", + declared_language="declared_language", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.register( + order_id, + declared_language=declared_language, + media=media, + media_url=media_url, + media_url_filename=media_url_filename, + media_url_content_type=media_url_content_type, + request_options=request_options, + ) + return _response.data + + async def get( + self, order_id: OrderId, media_id: MediaId, *, request_options: typing.Optional[RequestOptions] = None + ) -> OrderMediaResponse: + """ + Retrieves metadata and a time-limited download URL for a previously uploaded media file. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + media_id : MediaId + The ID of the media file. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + OrderMediaResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.productions.orders.media.get( + order_id="order_id", + media_id="media_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(order_id, media_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/productions/orders/media/raw_client.py b/data/src/elevenlabs/productions/orders/media/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d9152dffc048b5ce4e3d11fed36ae793a64e80b0 --- /dev/null +++ b/data/src/elevenlabs/productions/orders/media/raw_client.py @@ -0,0 +1,322 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .... import core +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.media_id import MediaId +from ....types.order_id import OrderId +from ....types.order_media_response import OrderMediaResponse +from ....types.register_media_response import RegisterMediaResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawMediaClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def register( + self, + order_id: OrderId, + *, + declared_language: str, + media: typing.Optional[core.File] = OMIT, + media_url: typing.Optional[str] = OMIT, + media_url_filename: typing.Optional[str] = OMIT, + media_url_content_type: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[RegisterMediaResponse]: + """ + Registers a media file with an order, either by uploading it directly or by providing a URL to fetch it from. Exactly one of `media` or `media_url` must be provided. The registered media can then be referenced when adding order items. + + Parameters + ---------- + order_id : OrderId + The ID of the order to which this media will be attached. + + declared_language : str + The language code of the media content (e.g. 'en', 'es-ES'). Must be a supported source language for some order item kind. + + media : typing.Optional[core.File] + See core.File for more documentation + + media_url : typing.Optional[str] + A URL to fetch the media file from. Mutually exclusive with media. + + media_url_filename : typing.Optional[str] + The filename for URL-sourced media (e.g. 'example.mp4'). Required when using media_url. + + media_url_content_type : typing.Optional[str] + The MIME type for URL-sourced media (e.g. 'video/mp4'). Required when using media_url. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[RegisterMediaResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/media", + method="POST", + data={ + "declared_language": declared_language, + "media_url": media_url, + "media_url_filename": media_url_filename, + "media_url_content_type": media_url_content_type, + }, + files={ + **({"media": media} if media is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RegisterMediaResponse, + construct_type( + type_=RegisterMediaResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, order_id: OrderId, media_id: MediaId, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[OrderMediaResponse]: + """ + Retrieves metadata and a time-limited download URL for a previously uploaded media file. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + media_id : MediaId + The ID of the media file. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[OrderMediaResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/media/{jsonable_encoder(media_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + OrderMediaResponse, + construct_type( + type_=OrderMediaResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawMediaClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def register( + self, + order_id: OrderId, + *, + declared_language: str, + media: typing.Optional[core.File] = OMIT, + media_url: typing.Optional[str] = OMIT, + media_url_filename: typing.Optional[str] = OMIT, + media_url_content_type: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[RegisterMediaResponse]: + """ + Registers a media file with an order, either by uploading it directly or by providing a URL to fetch it from. Exactly one of `media` or `media_url` must be provided. The registered media can then be referenced when adding order items. + + Parameters + ---------- + order_id : OrderId + The ID of the order to which this media will be attached. + + declared_language : str + The language code of the media content (e.g. 'en', 'es-ES'). Must be a supported source language for some order item kind. + + media : typing.Optional[core.File] + See core.File for more documentation + + media_url : typing.Optional[str] + A URL to fetch the media file from. Mutually exclusive with media. + + media_url_filename : typing.Optional[str] + The filename for URL-sourced media (e.g. 'example.mp4'). Required when using media_url. + + media_url_content_type : typing.Optional[str] + The MIME type for URL-sourced media (e.g. 'video/mp4'). Required when using media_url. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RegisterMediaResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/media", + method="POST", + data={ + "declared_language": declared_language, + "media_url": media_url, + "media_url_filename": media_url_filename, + "media_url_content_type": media_url_content_type, + }, + files={ + **({"media": media} if media is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RegisterMediaResponse, + construct_type( + type_=RegisterMediaResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, order_id: OrderId, media_id: MediaId, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[OrderMediaResponse]: + """ + Retrieves metadata and a time-limited download URL for a previously uploaded media file. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + media_id : MediaId + The ID of the media file. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[OrderMediaResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/media/{jsonable_encoder(media_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + OrderMediaResponse, + construct_type( + type_=OrderMediaResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/productions/orders/raw_client.py b/data/src/elevenlabs/productions/orders/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..9ed31a830a7ea580b7b1785b3f59cb27bf2bbba0 --- /dev/null +++ b/data/src/elevenlabs/productions/orders/raw_client.py @@ -0,0 +1,673 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.datetime_utils import serialize_datetime +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.create_order_request import CreateOrderRequest +from ...types.create_order_response import CreateOrderResponse +from ...types.list_orders_response import ListOrdersResponse +from ...types.order_id import OrderId +from ...types.order_response import OrderResponse +from ...types.order_state import OrderState +from ...types.submit_order_response import SubmitOrderResponse +from ...types.update_order_request import UpdateOrderRequest +from ...types.update_order_response import UpdateOrderResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawOrdersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + page_size: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + status: typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]] = None, + start_date: typing.Optional[dt.datetime] = None, + end_date: typing.Optional[dt.datetime] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListOrdersResponse]: + """ + Lists Productions orders in the workspace. Supports filtering by status and date range, with pagination. + + Parameters + ---------- + page_size : typing.Optional[int] + Maximum number of orders to return per page. + + offset : typing.Optional[int] + Number of orders to skip for pagination. + + status : typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]] + Filter orders by one or more statuses. + + start_date : typing.Optional[dt.datetime] + Filter orders created on or after this date. + + end_date : typing.Optional[dt.datetime] + Filter orders created on or before this date. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListOrdersResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/productions/orders", + method="GET", + params={ + "page_size": page_size, + "offset": offset, + "status": status, + "start_date": serialize_datetime(start_date) if start_date is not None else None, + "end_date": serialize_datetime(end_date) if end_date is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListOrdersResponse, + construct_type( + type_=ListOrdersResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + request: typing.Optional[CreateOrderRequest] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateOrderResponse]: + """ + Creates a new Productions order in the workspace. The order starts in the open state and can be configured with items before submission. + + Parameters + ---------- + request : typing.Optional[CreateOrderRequest] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateOrderResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/productions/orders", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=CreateOrderRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateOrderResponse, + construct_type( + type_=CreateOrderResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[OrderResponse]: + """ + Retrieves full details for a Productions order. + + Quote and pricing information may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until it is ready. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[OrderResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + OrderResponse, + construct_type( + type_=OrderResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, order_id: OrderId, *, request: UpdateOrderRequest, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[UpdateOrderResponse]: + """ + Updates an open order. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request : UpdateOrderRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UpdateOrderResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}", + method="PATCH", + json={ + "request": convert_and_respect_annotation_metadata( + object_=request, annotation=UpdateOrderRequest, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateOrderResponse, + construct_type( + type_=UpdateOrderResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def submit( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SubmitOrderResponse]: + """ + Submits an open order for processing. The order must have at least one item. Once submitted, items can no longer be modified. + + Upon submission, the workspace will be charged for the order. The quote is based on information extracted from the uploaded media, such as its duration. The quote may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until the quote is ready. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SubmitOrderResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/submit", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubmitOrderResponse, + construct_type( + type_=SubmitOrderResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawOrdersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + offset: typing.Optional[int] = None, + status: typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]] = None, + start_date: typing.Optional[dt.datetime] = None, + end_date: typing.Optional[dt.datetime] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListOrdersResponse]: + """ + Lists Productions orders in the workspace. Supports filtering by status and date range, with pagination. + + Parameters + ---------- + page_size : typing.Optional[int] + Maximum number of orders to return per page. + + offset : typing.Optional[int] + Number of orders to skip for pagination. + + status : typing.Optional[typing.Union[OrderState, typing.Sequence[OrderState]]] + Filter orders by one or more statuses. + + start_date : typing.Optional[dt.datetime] + Filter orders created on or after this date. + + end_date : typing.Optional[dt.datetime] + Filter orders created on or before this date. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListOrdersResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/productions/orders", + method="GET", + params={ + "page_size": page_size, + "offset": offset, + "status": status, + "start_date": serialize_datetime(start_date) if start_date is not None else None, + "end_date": serialize_datetime(end_date) if end_date is not None else None, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListOrdersResponse, + construct_type( + type_=ListOrdersResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + request: typing.Optional[CreateOrderRequest] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateOrderResponse]: + """ + Creates a new Productions order in the workspace. The order starts in the open state and can be configured with items before submission. + + Parameters + ---------- + request : typing.Optional[CreateOrderRequest] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateOrderResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/productions/orders", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=CreateOrderRequest, direction="write" + ), + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateOrderResponse, + construct_type( + type_=CreateOrderResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[OrderResponse]: + """ + Retrieves full details for a Productions order. + + Quote and pricing information may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until it is ready. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[OrderResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + OrderResponse, + construct_type( + type_=OrderResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, order_id: OrderId, *, request: UpdateOrderRequest, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[UpdateOrderResponse]: + """ + Updates an open order. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request : UpdateOrderRequest + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UpdateOrderResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}", + method="PATCH", + json={ + "request": convert_and_respect_annotation_metadata( + object_=request, annotation=UpdateOrderRequest, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateOrderResponse, + construct_type( + type_=UpdateOrderResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def submit( + self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SubmitOrderResponse]: + """ + Submits an open order for processing. The order must have at least one item. Once submitted, items can no longer be modified. + + Upon submission, the workspace will be charged for the order. The quote is based on information extracted from the uploaded media, such as its duration. The quote may not be available immediately; if you wish to see the quote before submission, you may need to poll the order details until the quote is ready. + + Parameters + ---------- + order_id : OrderId + The ID of the order. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SubmitOrderResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/productions/orders/{jsonable_encoder(order_id)}/submit", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SubmitOrderResponse, + construct_type( + type_=SubmitOrderResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/productions/raw_client.py b/data/src/elevenlabs/productions/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d2aa8c8eb8e76cd59f75c3c72ee3cf000e3e3348 --- /dev/null +++ b/data/src/elevenlabs/productions/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawProductionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawProductionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/data/src/elevenlabs/pronunciation_dictionaries/__init__.py b/data/src/elevenlabs/pronunciation_dictionaries/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6329ad3523d50253697759903a1da7d2f3fffaeb --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/__init__.py @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + AddPronunciationDictionaryRequestWorkspaceAccess, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess, + PronunciationDictionariesListRequestSort, + ) + from . import rules + from .rules import ( + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem, + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias, + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme, + PronunciationDictionaryRule, + PronunciationDictionaryRule_Alias, + PronunciationDictionaryRule_Phoneme, + ) +_dynamic_imports: typing.Dict[str, str] = { + "AddPronunciationDictionaryRequestWorkspaceAccess": ".types", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem": ".types", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias": ".types", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme": ".types", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess": ".types", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem": ".rules", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias": ".rules", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme": ".rules", + "PronunciationDictionariesListRequestSort": ".types", + "PronunciationDictionaryRule": ".rules", + "PronunciationDictionaryRule_Alias": ".rules", + "PronunciationDictionaryRule_Phoneme": ".rules", + "rules": ".rules", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AddPronunciationDictionaryRequestWorkspaceAccess", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme", + "PronunciationDictionariesListRequestSort", + "PronunciationDictionaryRule", + "PronunciationDictionaryRule_Alias", + "PronunciationDictionaryRule_Phoneme", + "rules", +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/client.py b/data/src/elevenlabs/pronunciation_dictionaries/client.py new file mode 100644 index 0000000000000000000000000000000000000000..946712bde955f74b956077add2b69aa7f3405849 --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/client.py @@ -0,0 +1,738 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.add_pronunciation_dictionary_response_model import AddPronunciationDictionaryResponseModel +from ..types.get_pronunciation_dictionaries_metadata_response_model import ( + GetPronunciationDictionariesMetadataResponseModel, +) +from ..types.get_pronunciation_dictionary_metadata_response import GetPronunciationDictionaryMetadataResponse +from ..types.get_pronunciation_dictionary_with_rules_response_model import ( + GetPronunciationDictionaryWithRulesResponseModel, +) +from .raw_client import AsyncRawPronunciationDictionariesClient, RawPronunciationDictionariesClient +from .types.add_pronunciation_dictionary_request_workspace_access import ( + AddPronunciationDictionaryRequestWorkspaceAccess, +) +from .types.body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item import ( + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem, +) +from .types.body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_workspace_access import ( + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess, +) +from .types.pronunciation_dictionaries_list_request_sort import PronunciationDictionariesListRequestSort + +if typing.TYPE_CHECKING: + from .rules.client import AsyncRulesClient, RulesClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class PronunciationDictionariesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawPronunciationDictionariesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._rules: typing.Optional[RulesClient] = None + + @property + def with_raw_response(self) -> RawPronunciationDictionariesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawPronunciationDictionariesClient + """ + return self._raw_client + + def create_from_file( + self, + *, + name: str, + file: typing.Optional[core.File] = OMIT, + description: typing.Optional[str] = OMIT, + workspace_access: typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddPronunciationDictionaryResponseModel: + """ + Creates a new pronunciation dictionary from a lexicon .PLS file + + Parameters + ---------- + name : str + The name of the pronunciation dictionary, used for identification only. + + file : typing.Optional[core.File] + See core.File for more documentation + + description : typing.Optional[str] + A description of the pronunciation dictionary, used for identification only. + + workspace_access : typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess] + Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddPronunciationDictionaryResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.create_from_file( + name="name", + ) + """ + _response = self._raw_client.create_from_file( + name=name, + file=file, + description=description, + workspace_access=workspace_access, + request_options=request_options, + ) + return _response.data + + def create_from_rules( + self, + *, + rules: typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem], + name: str, + description: typing.Optional[str] = OMIT, + workspace_access: typing.Optional[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess + ] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddPronunciationDictionaryResponseModel: + """ + Creates a new pronunciation dictionary from provided rules. + + Parameters + ---------- + rules : typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + name : str + The name of the pronunciation dictionary, used for identification only. + + description : typing.Optional[str] + A description of the pronunciation dictionary, used for identification only. + + workspace_access : typing.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess] + Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddPronunciationDictionaryResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.pronunciation_dictionaries import ( + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.create_from_rules( + rules=[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias( + string_to_replace="Thailand", + case_sensitive=True, + word_boundaries=True, + alias="tie-land", + ) + ], + name="My Dictionary", + ) + """ + _response = self._raw_client.create_from_rules( + rules=rules, + name=name, + description=description, + workspace_access=workspace_access, + request_options=request_options, + ) + return _response.data + + def get( + self, pronunciation_dictionary_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetPronunciationDictionaryWithRulesResponseModel: + """ + Get metadata for a pronunciation dictionary + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetPronunciationDictionaryWithRulesResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.get( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get(pronunciation_dictionary_id, request_options=request_options) + return _response.data + + def update( + self, + pronunciation_dictionary_id: str, + *, + archived: typing.Optional[bool] = OMIT, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetPronunciationDictionaryMetadataResponse: + """ + Partially update the pronunciation dictionary without changing the version + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + archived : typing.Optional[bool] + Whether to archive the pronunciation dictionary. + + name : typing.Optional[str] + The name of the pronunciation dictionary, used for identification only. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetPronunciationDictionaryMetadataResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.update( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.update( + pronunciation_dictionary_id, archived=archived, name=name, request_options=request_options + ) + return _response.data + + def download( + self, dictionary_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Get a PLS file with a pronunciation dictionary version rules + + Parameters + ---------- + dictionary_id : str + The id of the pronunciation dictionary + + version_id : str + The id of the pronunciation dictionary version + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The PLS file containing pronunciation dictionary rules + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.download( + dictionary_id="dictionary_id", + version_id="version_id", + ) + """ + with self._raw_client.download(dictionary_id, version_id, request_options=request_options) as r: + yield from r.data + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + sort: typing.Optional[PronunciationDictionariesListRequestSort] = None, + sort_direction: typing.Optional[str] = None, + include_archived: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetPronunciationDictionariesMetadataResponseModel: + """ + Get a list of the pronunciation dictionaries you have access to and their metadata + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many pronunciation dictionaries to return at maximum. Can not exceed 100, defaults to 30. + + sort : typing.Optional[PronunciationDictionariesListRequestSort] + Which field to sort by, one of 'created_at_unix' or 'name'. + + sort_direction : typing.Optional[str] + Which direction to sort the voices in. 'ascending' or 'descending'. + + include_archived : typing.Optional[bool] + Whether to include archived pronunciation dictionaries in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetPronunciationDictionariesMetadataResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.list( + cursor="cursor", + page_size=1, + sort="creation_time_unix", + sort_direction="sort_direction", + include_archived=False, + ) + """ + _response = self._raw_client.list( + cursor=cursor, + page_size=page_size, + sort=sort, + sort_direction=sort_direction, + include_archived=include_archived, + request_options=request_options, + ) + return _response.data + + @property + def rules(self): + if self._rules is None: + from .rules.client import RulesClient # noqa: E402 + + self._rules = RulesClient(client_wrapper=self._client_wrapper) + return self._rules + + +class AsyncPronunciationDictionariesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawPronunciationDictionariesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._rules: typing.Optional[AsyncRulesClient] = None + + @property + def with_raw_response(self) -> AsyncRawPronunciationDictionariesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawPronunciationDictionariesClient + """ + return self._raw_client + + async def create_from_file( + self, + *, + name: str, + file: typing.Optional[core.File] = OMIT, + description: typing.Optional[str] = OMIT, + workspace_access: typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddPronunciationDictionaryResponseModel: + """ + Creates a new pronunciation dictionary from a lexicon .PLS file + + Parameters + ---------- + name : str + The name of the pronunciation dictionary, used for identification only. + + file : typing.Optional[core.File] + See core.File for more documentation + + description : typing.Optional[str] + A description of the pronunciation dictionary, used for identification only. + + workspace_access : typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess] + Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddPronunciationDictionaryResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.create_from_file( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_from_file( + name=name, + file=file, + description=description, + workspace_access=workspace_access, + request_options=request_options, + ) + return _response.data + + async def create_from_rules( + self, + *, + rules: typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem], + name: str, + description: typing.Optional[str] = OMIT, + workspace_access: typing.Optional[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess + ] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddPronunciationDictionaryResponseModel: + """ + Creates a new pronunciation dictionary from provided rules. + + Parameters + ---------- + rules : typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + name : str + The name of the pronunciation dictionary, used for identification only. + + description : typing.Optional[str] + A description of the pronunciation dictionary, used for identification only. + + workspace_access : typing.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess] + Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddPronunciationDictionaryResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.pronunciation_dictionaries import ( + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.create_from_rules( + rules=[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias( + string_to_replace="Thailand", + case_sensitive=True, + word_boundaries=True, + alias="tie-land", + ) + ], + name="My Dictionary", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_from_rules( + rules=rules, + name=name, + description=description, + workspace_access=workspace_access, + request_options=request_options, + ) + return _response.data + + async def get( + self, pronunciation_dictionary_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetPronunciationDictionaryWithRulesResponseModel: + """ + Get metadata for a pronunciation dictionary + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetPronunciationDictionaryWithRulesResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.get( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(pronunciation_dictionary_id, request_options=request_options) + return _response.data + + async def update( + self, + pronunciation_dictionary_id: str, + *, + archived: typing.Optional[bool] = OMIT, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetPronunciationDictionaryMetadataResponse: + """ + Partially update the pronunciation dictionary without changing the version + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + archived : typing.Optional[bool] + Whether to archive the pronunciation dictionary. + + name : typing.Optional[str] + The name of the pronunciation dictionary, used for identification only. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetPronunciationDictionaryMetadataResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.update( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + pronunciation_dictionary_id, archived=archived, name=name, request_options=request_options + ) + return _response.data + + async def download( + self, dictionary_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Get a PLS file with a pronunciation dictionary version rules + + Parameters + ---------- + dictionary_id : str + The id of the pronunciation dictionary + + version_id : str + The id of the pronunciation dictionary version + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The PLS file containing pronunciation dictionary rules + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.download( + dictionary_id="dictionary_id", + version_id="version_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.download(dictionary_id, version_id, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + sort: typing.Optional[PronunciationDictionariesListRequestSort] = None, + sort_direction: typing.Optional[str] = None, + include_archived: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetPronunciationDictionariesMetadataResponseModel: + """ + Get a list of the pronunciation dictionaries you have access to and their metadata + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many pronunciation dictionaries to return at maximum. Can not exceed 100, defaults to 30. + + sort : typing.Optional[PronunciationDictionariesListRequestSort] + Which field to sort by, one of 'created_at_unix' or 'name'. + + sort_direction : typing.Optional[str] + Which direction to sort the voices in. 'ascending' or 'descending'. + + include_archived : typing.Optional[bool] + Whether to include archived pronunciation dictionaries in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetPronunciationDictionariesMetadataResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.list( + cursor="cursor", + page_size=1, + sort="creation_time_unix", + sort_direction="sort_direction", + include_archived=False, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + cursor=cursor, + page_size=page_size, + sort=sort, + sort_direction=sort_direction, + include_archived=include_archived, + request_options=request_options, + ) + return _response.data + + @property + def rules(self): + if self._rules is None: + from .rules.client import AsyncRulesClient # noqa: E402 + + self._rules = AsyncRulesClient(client_wrapper=self._client_wrapper) + return self._rules diff --git a/data/src/elevenlabs/pronunciation_dictionaries/raw_client.py b/data/src/elevenlabs/pronunciation_dictionaries/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..1e10d7878de2472714118c68a522ffe82d7fbebc --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/raw_client.py @@ -0,0 +1,927 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.add_pronunciation_dictionary_response_model import AddPronunciationDictionaryResponseModel +from ..types.get_pronunciation_dictionaries_metadata_response_model import ( + GetPronunciationDictionariesMetadataResponseModel, +) +from ..types.get_pronunciation_dictionary_metadata_response import GetPronunciationDictionaryMetadataResponse +from ..types.get_pronunciation_dictionary_with_rules_response_model import ( + GetPronunciationDictionaryWithRulesResponseModel, +) +from .types.add_pronunciation_dictionary_request_workspace_access import ( + AddPronunciationDictionaryRequestWorkspaceAccess, +) +from .types.body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item import ( + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem, +) +from .types.body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_workspace_access import ( + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess, +) +from .types.pronunciation_dictionaries_list_request_sort import PronunciationDictionariesListRequestSort +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawPronunciationDictionariesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create_from_file( + self, + *, + name: str, + file: typing.Optional[core.File] = OMIT, + description: typing.Optional[str] = OMIT, + workspace_access: typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddPronunciationDictionaryResponseModel]: + """ + Creates a new pronunciation dictionary from a lexicon .PLS file + + Parameters + ---------- + name : str + The name of the pronunciation dictionary, used for identification only. + + file : typing.Optional[core.File] + See core.File for more documentation + + description : typing.Optional[str] + A description of the pronunciation dictionary, used for identification only. + + workspace_access : typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess] + Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddPronunciationDictionaryResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/pronunciation-dictionaries/add-from-file", + method="POST", + data={ + "name": name, + "description": description, + "workspace_access": workspace_access, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddPronunciationDictionaryResponseModel, + construct_type( + type_=AddPronunciationDictionaryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_from_rules( + self, + *, + rules: typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem], + name: str, + description: typing.Optional[str] = OMIT, + workspace_access: typing.Optional[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess + ] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddPronunciationDictionaryResponseModel]: + """ + Creates a new pronunciation dictionary from provided rules. + + Parameters + ---------- + rules : typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + name : str + The name of the pronunciation dictionary, used for identification only. + + description : typing.Optional[str] + A description of the pronunciation dictionary, used for identification only. + + workspace_access : typing.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess] + Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddPronunciationDictionaryResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/pronunciation-dictionaries/add-from-rules", + method="POST", + json={ + "rules": convert_and_respect_annotation_metadata( + object_=rules, + annotation=typing.Sequence[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem + ], + direction="write", + ), + "name": name, + "description": description, + "workspace_access": workspace_access, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddPronunciationDictionaryResponseModel, + construct_type( + type_=AddPronunciationDictionaryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, pronunciation_dictionary_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetPronunciationDictionaryWithRulesResponseModel]: + """ + Get metadata for a pronunciation dictionary + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetPronunciationDictionaryWithRulesResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetPronunciationDictionaryWithRulesResponseModel, + construct_type( + type_=GetPronunciationDictionaryWithRulesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + pronunciation_dictionary_id: str, + *, + archived: typing.Optional[bool] = OMIT, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetPronunciationDictionaryMetadataResponse]: + """ + Partially update the pronunciation dictionary without changing the version + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + archived : typing.Optional[bool] + Whether to archive the pronunciation dictionary. + + name : typing.Optional[str] + The name of the pronunciation dictionary, used for identification only. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetPronunciationDictionaryMetadataResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}", + method="PATCH", + json={ + "archived": archived, + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetPronunciationDictionaryMetadataResponse, + construct_type( + type_=GetPronunciationDictionaryMetadataResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def download( + self, dictionary_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Get a PLS file with a pronunciation dictionary version rules + + Parameters + ---------- + dictionary_id : str + The id of the pronunciation dictionary + + version_id : str + The id of the pronunciation dictionary version + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The PLS file containing pronunciation dictionary rules + """ + with self._client_wrapper.httpx_client.stream( + f"v1/pronunciation-dictionaries/{jsonable_encoder(dictionary_id)}/{jsonable_encoder(version_id)}/download", + method="GET", + request_options=request_options, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + sort: typing.Optional[PronunciationDictionariesListRequestSort] = None, + sort_direction: typing.Optional[str] = None, + include_archived: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetPronunciationDictionariesMetadataResponseModel]: + """ + Get a list of the pronunciation dictionaries you have access to and their metadata + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many pronunciation dictionaries to return at maximum. Can not exceed 100, defaults to 30. + + sort : typing.Optional[PronunciationDictionariesListRequestSort] + Which field to sort by, one of 'created_at_unix' or 'name'. + + sort_direction : typing.Optional[str] + Which direction to sort the voices in. 'ascending' or 'descending'. + + include_archived : typing.Optional[bool] + Whether to include archived pronunciation dictionaries in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetPronunciationDictionariesMetadataResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/pronunciation-dictionaries", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "sort": sort, + "sort_direction": sort_direction, + "include_archived": include_archived, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetPronunciationDictionariesMetadataResponseModel, + construct_type( + type_=GetPronunciationDictionariesMetadataResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawPronunciationDictionariesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create_from_file( + self, + *, + name: str, + file: typing.Optional[core.File] = OMIT, + description: typing.Optional[str] = OMIT, + workspace_access: typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddPronunciationDictionaryResponseModel]: + """ + Creates a new pronunciation dictionary from a lexicon .PLS file + + Parameters + ---------- + name : str + The name of the pronunciation dictionary, used for identification only. + + file : typing.Optional[core.File] + See core.File for more documentation + + description : typing.Optional[str] + A description of the pronunciation dictionary, used for identification only. + + workspace_access : typing.Optional[AddPronunciationDictionaryRequestWorkspaceAccess] + Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddPronunciationDictionaryResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/pronunciation-dictionaries/add-from-file", + method="POST", + data={ + "name": name, + "description": description, + "workspace_access": workspace_access, + }, + files={ + **({"file": file} if file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddPronunciationDictionaryResponseModel, + construct_type( + type_=AddPronunciationDictionaryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_from_rules( + self, + *, + rules: typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem], + name: str, + description: typing.Optional[str] = OMIT, + workspace_access: typing.Optional[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess + ] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddPronunciationDictionaryResponseModel]: + """ + Creates a new pronunciation dictionary from provided rules. + + Parameters + ---------- + rules : typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + name : str + The name of the pronunciation dictionary, used for identification only. + + description : typing.Optional[str] + A description of the pronunciation dictionary, used for identification only. + + workspace_access : typing.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess] + Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddPronunciationDictionaryResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/pronunciation-dictionaries/add-from-rules", + method="POST", + json={ + "rules": convert_and_respect_annotation_metadata( + object_=rules, + annotation=typing.Sequence[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem + ], + direction="write", + ), + "name": name, + "description": description, + "workspace_access": workspace_access, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddPronunciationDictionaryResponseModel, + construct_type( + type_=AddPronunciationDictionaryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, pronunciation_dictionary_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetPronunciationDictionaryWithRulesResponseModel]: + """ + Get metadata for a pronunciation dictionary + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetPronunciationDictionaryWithRulesResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetPronunciationDictionaryWithRulesResponseModel, + construct_type( + type_=GetPronunciationDictionaryWithRulesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + pronunciation_dictionary_id: str, + *, + archived: typing.Optional[bool] = OMIT, + name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetPronunciationDictionaryMetadataResponse]: + """ + Partially update the pronunciation dictionary without changing the version + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + archived : typing.Optional[bool] + Whether to archive the pronunciation dictionary. + + name : typing.Optional[str] + The name of the pronunciation dictionary, used for identification only. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetPronunciationDictionaryMetadataResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}", + method="PATCH", + json={ + "archived": archived, + "name": name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetPronunciationDictionaryMetadataResponse, + construct_type( + type_=GetPronunciationDictionaryMetadataResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def download( + self, dictionary_id: str, version_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Get a PLS file with a pronunciation dictionary version rules + + Parameters + ---------- + dictionary_id : str + The id of the pronunciation dictionary + + version_id : str + The id of the pronunciation dictionary version + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The PLS file containing pronunciation dictionary rules + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/pronunciation-dictionaries/{jsonable_encoder(dictionary_id)}/{jsonable_encoder(version_id)}/download", + method="GET", + request_options=request_options, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + async def list( + self, + *, + cursor: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + sort: typing.Optional[PronunciationDictionariesListRequestSort] = None, + sort_direction: typing.Optional[str] = None, + include_archived: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetPronunciationDictionariesMetadataResponseModel]: + """ + Get a list of the pronunciation dictionaries you have access to and their metadata + + Parameters + ---------- + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + page_size : typing.Optional[int] + How many pronunciation dictionaries to return at maximum. Can not exceed 100, defaults to 30. + + sort : typing.Optional[PronunciationDictionariesListRequestSort] + Which field to sort by, one of 'created_at_unix' or 'name'. + + sort_direction : typing.Optional[str] + Which direction to sort the voices in. 'ascending' or 'descending'. + + include_archived : typing.Optional[bool] + Whether to include archived pronunciation dictionaries in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetPronunciationDictionariesMetadataResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/pronunciation-dictionaries", + method="GET", + params={ + "cursor": cursor, + "page_size": page_size, + "sort": sort, + "sort_direction": sort_direction, + "include_archived": include_archived, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetPronunciationDictionariesMetadataResponseModel, + construct_type( + type_=GetPronunciationDictionariesMetadataResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/pronunciation_dictionaries/rules/__init__.py b/data/src/elevenlabs/pronunciation_dictionaries/rules/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..94c9bc122d0546a05e701d0a7db7b843e096d387 --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/rules/__init__.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem, + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias, + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme, + PronunciationDictionaryRule, + PronunciationDictionaryRule_Alias, + PronunciationDictionaryRule_Phoneme, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem": ".types", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias": ".types", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme": ".types", + "PronunciationDictionaryRule": ".types", + "PronunciationDictionaryRule_Alias": ".types", + "PronunciationDictionaryRule_Phoneme": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme", + "PronunciationDictionaryRule", + "PronunciationDictionaryRule_Alias", + "PronunciationDictionaryRule_Phoneme", +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/rules/client.py b/data/src/elevenlabs/pronunciation_dictionaries/rules/client.py new file mode 100644 index 0000000000000000000000000000000000000000..850f479df23dfc03fc88cd8927a34f44df6a4223 --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/rules/client.py @@ -0,0 +1,377 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.pronunciation_dictionary_rules_response_model import PronunciationDictionaryRulesResponseModel +from .raw_client import AsyncRawRulesClient, RawRulesClient +from .types.body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item import ( + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem, +) +from .types.pronunciation_dictionary_rule import PronunciationDictionaryRule + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RulesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawRulesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawRulesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawRulesClient + """ + return self._raw_client + + def set( + self, + pronunciation_dictionary_id: str, + *, + rules: typing.Sequence[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem + ], + request_options: typing.Optional[RequestOptions] = None, + ) -> PronunciationDictionaryRulesResponseModel: + """ + Replaces all existing rules on the pronunciation dictionary with the provided ones. + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rules : typing.Sequence[BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PronunciationDictionaryRulesResponseModel + Successfully set rules on the pronunciation dictionary + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.pronunciation_dictionaries.rules import ( + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.rules.set( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rules=[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias( + string_to_replace="Thailand", + case_sensitive=True, + word_boundaries=True, + alias="tie-land", + ) + ], + ) + """ + _response = self._raw_client.set(pronunciation_dictionary_id, rules=rules, request_options=request_options) + return _response.data + + def add( + self, + pronunciation_dictionary_id: str, + *, + rules: typing.Sequence[PronunciationDictionaryRule], + request_options: typing.Optional[RequestOptions] = None, + ) -> PronunciationDictionaryRulesResponseModel: + """ + Add rules to the pronunciation dictionary. If a rule with the same string_to_replace already exists, it will be replaced. + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rules : typing.Sequence[PronunciationDictionaryRule] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PronunciationDictionaryRulesResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.pronunciation_dictionaries.rules import ( + PronunciationDictionaryRule_Alias, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.rules.add( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rules=[ + PronunciationDictionaryRule_Alias( + string_to_replace="Thailand", + case_sensitive=True, + word_boundaries=True, + alias="tie-land", + ) + ], + ) + """ + _response = self._raw_client.add(pronunciation_dictionary_id, rules=rules, request_options=request_options) + return _response.data + + def remove( + self, + pronunciation_dictionary_id: str, + *, + rule_strings: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> PronunciationDictionaryRulesResponseModel: + """ + Remove rules from the pronunciation dictionary + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rule_strings : typing.Sequence[str] + List of strings to remove from the pronunciation dictionary. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PronunciationDictionaryRulesResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.pronunciation_dictionaries.rules.remove( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rule_strings=["rule_strings"], + ) + """ + _response = self._raw_client.remove( + pronunciation_dictionary_id, rule_strings=rule_strings, request_options=request_options + ) + return _response.data + + +class AsyncRulesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawRulesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawRulesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawRulesClient + """ + return self._raw_client + + async def set( + self, + pronunciation_dictionary_id: str, + *, + rules: typing.Sequence[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem + ], + request_options: typing.Optional[RequestOptions] = None, + ) -> PronunciationDictionaryRulesResponseModel: + """ + Replaces all existing rules on the pronunciation dictionary with the provided ones. + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rules : typing.Sequence[BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PronunciationDictionaryRulesResponseModel + Successfully set rules on the pronunciation dictionary + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.pronunciation_dictionaries.rules import ( + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.rules.set( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rules=[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias( + string_to_replace="Thailand", + case_sensitive=True, + word_boundaries=True, + alias="tie-land", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.set( + pronunciation_dictionary_id, rules=rules, request_options=request_options + ) + return _response.data + + async def add( + self, + pronunciation_dictionary_id: str, + *, + rules: typing.Sequence[PronunciationDictionaryRule], + request_options: typing.Optional[RequestOptions] = None, + ) -> PronunciationDictionaryRulesResponseModel: + """ + Add rules to the pronunciation dictionary. If a rule with the same string_to_replace already exists, it will be replaced. + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rules : typing.Sequence[PronunciationDictionaryRule] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PronunciationDictionaryRulesResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.pronunciation_dictionaries.rules import ( + PronunciationDictionaryRule_Alias, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.rules.add( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rules=[ + PronunciationDictionaryRule_Alias( + string_to_replace="Thailand", + case_sensitive=True, + word_boundaries=True, + alias="tie-land", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add( + pronunciation_dictionary_id, rules=rules, request_options=request_options + ) + return _response.data + + async def remove( + self, + pronunciation_dictionary_id: str, + *, + rule_strings: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> PronunciationDictionaryRulesResponseModel: + """ + Remove rules from the pronunciation dictionary + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rule_strings : typing.Sequence[str] + List of strings to remove from the pronunciation dictionary. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PronunciationDictionaryRulesResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.pronunciation_dictionaries.rules.remove( + pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM", + rule_strings=["rule_strings"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.remove( + pronunciation_dictionary_id, rule_strings=rule_strings, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/pronunciation_dictionaries/rules/raw_client.py b/data/src/elevenlabs/pronunciation_dictionaries/rules/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..bba374942a1315234a9865085e313dc068d635b3 --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/rules/raw_client.py @@ -0,0 +1,469 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.pronunciation_dictionary_rules_response_model import PronunciationDictionaryRulesResponseModel +from .types.body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item import ( + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem, +) +from .types.pronunciation_dictionary_rule import PronunciationDictionaryRule +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawRulesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def set( + self, + pronunciation_dictionary_id: str, + *, + rules: typing.Sequence[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem + ], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[PronunciationDictionaryRulesResponseModel]: + """ + Replaces all existing rules on the pronunciation dictionary with the provided ones. + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rules : typing.Sequence[BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PronunciationDictionaryRulesResponseModel] + Successfully set rules on the pronunciation dictionary + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}/set-rules", + method="POST", + json={ + "rules": convert_and_respect_annotation_metadata( + object_=rules, + annotation=typing.Sequence[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem + ], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PronunciationDictionaryRulesResponseModel, + construct_type( + type_=PronunciationDictionaryRulesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def add( + self, + pronunciation_dictionary_id: str, + *, + rules: typing.Sequence[PronunciationDictionaryRule], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[PronunciationDictionaryRulesResponseModel]: + """ + Add rules to the pronunciation dictionary. If a rule with the same string_to_replace already exists, it will be replaced. + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rules : typing.Sequence[PronunciationDictionaryRule] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PronunciationDictionaryRulesResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}/add-rules", + method="POST", + json={ + "rules": convert_and_respect_annotation_metadata( + object_=rules, annotation=typing.Sequence[PronunciationDictionaryRule], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PronunciationDictionaryRulesResponseModel, + construct_type( + type_=PronunciationDictionaryRulesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def remove( + self, + pronunciation_dictionary_id: str, + *, + rule_strings: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[PronunciationDictionaryRulesResponseModel]: + """ + Remove rules from the pronunciation dictionary + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rule_strings : typing.Sequence[str] + List of strings to remove from the pronunciation dictionary. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PronunciationDictionaryRulesResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}/remove-rules", + method="POST", + json={ + "rule_strings": rule_strings, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PronunciationDictionaryRulesResponseModel, + construct_type( + type_=PronunciationDictionaryRulesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawRulesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def set( + self, + pronunciation_dictionary_id: str, + *, + rules: typing.Sequence[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem + ], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[PronunciationDictionaryRulesResponseModel]: + """ + Replaces all existing rules on the pronunciation dictionary with the provided ones. + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rules : typing.Sequence[BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PronunciationDictionaryRulesResponseModel] + Successfully set rules on the pronunciation dictionary + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}/set-rules", + method="POST", + json={ + "rules": convert_and_respect_annotation_metadata( + object_=rules, + annotation=typing.Sequence[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem + ], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PronunciationDictionaryRulesResponseModel, + construct_type( + type_=PronunciationDictionaryRulesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def add( + self, + pronunciation_dictionary_id: str, + *, + rules: typing.Sequence[PronunciationDictionaryRule], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[PronunciationDictionaryRulesResponseModel]: + """ + Add rules to the pronunciation dictionary. If a rule with the same string_to_replace already exists, it will be replaced. + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rules : typing.Sequence[PronunciationDictionaryRule] + List of pronunciation rules. Rule can be either: + an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', } + or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' } + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PronunciationDictionaryRulesResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}/add-rules", + method="POST", + json={ + "rules": convert_and_respect_annotation_metadata( + object_=rules, annotation=typing.Sequence[PronunciationDictionaryRule], direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PronunciationDictionaryRulesResponseModel, + construct_type( + type_=PronunciationDictionaryRulesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def remove( + self, + pronunciation_dictionary_id: str, + *, + rule_strings: typing.Sequence[str], + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[PronunciationDictionaryRulesResponseModel]: + """ + Remove rules from the pronunciation dictionary + + Parameters + ---------- + pronunciation_dictionary_id : str + The id of the pronunciation dictionary + + rule_strings : typing.Sequence[str] + List of strings to remove from the pronunciation dictionary. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PronunciationDictionaryRulesResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/pronunciation-dictionaries/{jsonable_encoder(pronunciation_dictionary_id)}/remove-rules", + method="POST", + json={ + "rule_strings": rule_strings, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PronunciationDictionaryRulesResponseModel, + construct_type( + type_=PronunciationDictionaryRulesResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/pronunciation_dictionaries/rules/types/__init__.py b/data/src/elevenlabs/pronunciation_dictionaries/rules/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bac57ff4548f5867a1439cf15ac93926a4357a66 --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/rules/types/__init__.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item import ( + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem, + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias, + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme, + ) + from .pronunciation_dictionary_rule import ( + PronunciationDictionaryRule, + PronunciationDictionaryRule_Alias, + PronunciationDictionaryRule_Phoneme, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem": ".body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias": ".body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme": ".body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item", + "PronunciationDictionaryRule": ".pronunciation_dictionary_rule", + "PronunciationDictionaryRule_Alias": ".pronunciation_dictionary_rule", + "PronunciationDictionaryRule_Phoneme": ".pronunciation_dictionary_rule", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias", + "BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme", + "PronunciationDictionaryRule", + "PronunciationDictionaryRule_Alias", + "PronunciationDictionaryRule_Phoneme", +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/rules/types/body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item.py b/data/src/elevenlabs/pronunciation_dictionaries/rules/types/body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item.py new file mode 100644 index 0000000000000000000000000000000000000000..97a701c90ad3521f9ee4ffe561dcc93ceabfebd1 --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/rules/types/body_set_rules_on_the_pronunciation_dictionary_v_1_pronunciation_dictionaries_pronunciation_dictionary_id_set_rules_post_rules_item.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias( + UncheckedBaseModel +): + type: typing.Literal["alias"] = "alias" + string_to_replace: str + case_sensitive: typing.Optional[bool] = None + word_boundaries: typing.Optional[bool] = None + alias: 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 + + +class BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme( + UncheckedBaseModel +): + type: typing.Literal["phoneme"] = "phoneme" + string_to_replace: str + case_sensitive: typing.Optional[bool] = None + word_boundaries: typing.Optional[bool] = None + phoneme: str + alphabet: 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 + + +BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem = typing_extensions.Annotated[ + typing.Union[ + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Alias, + BodySetRulesOnThePronunciationDictionaryV1PronunciationDictionariesPronunciationDictionaryIdSetRulesPostRulesItem_Phoneme, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/rules/types/pronunciation_dictionary_rule.py b/data/src/elevenlabs/pronunciation_dictionaries/rules/types/pronunciation_dictionary_rule.py new file mode 100644 index 0000000000000000000000000000000000000000..e0d1448aa2c40d9a8bfc571ad9a134ad290b4b5e --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/rules/types/pronunciation_dictionary_rule.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class PronunciationDictionaryRule_Alias(UncheckedBaseModel): + type: typing.Literal["alias"] = "alias" + string_to_replace: str + case_sensitive: typing.Optional[bool] = None + word_boundaries: typing.Optional[bool] = None + alias: 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 + + +class PronunciationDictionaryRule_Phoneme(UncheckedBaseModel): + type: typing.Literal["phoneme"] = "phoneme" + string_to_replace: str + case_sensitive: typing.Optional[bool] = None + word_boundaries: typing.Optional[bool] = None + phoneme: str + alphabet: 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 + + +PronunciationDictionaryRule = typing_extensions.Annotated[ + typing.Union[PronunciationDictionaryRule_Alias, PronunciationDictionaryRule_Phoneme], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/types/__init__.py b/data/src/elevenlabs/pronunciation_dictionaries/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6cc3257b9132009d70313f4bd0a6f0d62e23af2a --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/types/__init__.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .add_pronunciation_dictionary_request_workspace_access import AddPronunciationDictionaryRequestWorkspaceAccess + from .body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item import ( + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme, + ) + from .body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_workspace_access import ( + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess, + ) + from .pronunciation_dictionaries_list_request_sort import PronunciationDictionariesListRequestSort +_dynamic_imports: typing.Dict[str, str] = { + "AddPronunciationDictionaryRequestWorkspaceAccess": ".add_pronunciation_dictionary_request_workspace_access", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem": ".body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias": ".body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme": ".body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess": ".body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_workspace_access", + "PronunciationDictionariesListRequestSort": ".pronunciation_dictionaries_list_request_sort", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AddPronunciationDictionaryRequestWorkspaceAccess", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme", + "BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess", + "PronunciationDictionariesListRequestSort", +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/types/add_pronunciation_dictionary_request_workspace_access.py b/data/src/elevenlabs/pronunciation_dictionaries/types/add_pronunciation_dictionary_request_workspace_access.py new file mode 100644 index 0000000000000000000000000000000000000000..b5290e71d1b9d10628c9ab44503d5ba9282447c7 --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/types/add_pronunciation_dictionary_request_workspace_access.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AddPronunciationDictionaryRequestWorkspaceAccess = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/types/body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item.py b/data/src/elevenlabs/pronunciation_dictionaries/types/body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item.py new file mode 100644 index 0000000000000000000000000000000000000000..514bc5c5d6aed6aac1e42273cbfec98fcfc548da --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/types/body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_item.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias(UncheckedBaseModel): + type: typing.Literal["alias"] = "alias" + string_to_replace: str + case_sensitive: typing.Optional[bool] = None + word_boundaries: typing.Optional[bool] = None + alias: 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 + + +class BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme(UncheckedBaseModel): + type: typing.Literal["phoneme"] = "phoneme" + string_to_replace: str + case_sensitive: typing.Optional[bool] = None + word_boundaries: typing.Optional[bool] = None + phoneme: str + alphabet: 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 + + +BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem = typing_extensions.Annotated[ + typing.Union[ + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias, + BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Phoneme, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/types/body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_workspace_access.py b/data/src/elevenlabs/pronunciation_dictionaries/types/body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_workspace_access.py new file mode 100644 index 0000000000000000000000000000000000000000..27c34f7b3069eae6fc5b6dfff5b1dcc01cbe6d74 --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/types/body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_workspace_access.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/pronunciation_dictionaries/types/pronunciation_dictionaries_list_request_sort.py b/data/src/elevenlabs/pronunciation_dictionaries/types/pronunciation_dictionaries_list_request_sort.py new file mode 100644 index 0000000000000000000000000000000000000000..41d39079c92c2c167059665b11f78b01de65554e --- /dev/null +++ b/data/src/elevenlabs/pronunciation_dictionaries/types/pronunciation_dictionaries_list_request_sort.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PronunciationDictionariesListRequestSort = typing.Union[typing.Literal["creation_time_unix", "name"], typing.Any] diff --git a/data/src/elevenlabs/py.typed b/data/src/elevenlabs/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/src/elevenlabs/realtime/__init__.py b/data/src/elevenlabs/realtime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c73d12a1b190b32aca4766211843f7edce70059a --- /dev/null +++ b/data/src/elevenlabs/realtime/__init__.py @@ -0,0 +1,28 @@ +""" +Real-time speech-to-text WebSocket helpers for ElevenLabs API. + +This module provides classes for streaming audio to the ElevenLabs +speech-to-text API and receiving real-time transcription results. +""" + +from .connection import RealtimeConnection, RealtimeEvents +from .scribe import ( + AudioFormat, + CommitStrategy, + RealtimeAudioOptions, + RealtimeEntityDetection, + RealtimeUrlOptions, + ScribeRealtime, +) + +__all__ = [ + "RealtimeConnection", + "RealtimeEvents", + "ScribeRealtime", + "AudioFormat", + "CommitStrategy", + "RealtimeEntityDetection", + "RealtimeAudioOptions", + "RealtimeUrlOptions", +] + diff --git a/data/src/elevenlabs/realtime/connection.py b/data/src/elevenlabs/realtime/connection.py new file mode 100644 index 0000000000000000000000000000000000000000..8ca642f4122cdec419af746568071f05048c8b34 --- /dev/null +++ b/data/src/elevenlabs/realtime/connection.py @@ -0,0 +1,293 @@ +import asyncio +import inspect +import json +import subprocess +import typing +from enum import Enum + +if typing.TYPE_CHECKING: + from websockets.asyncio.client import ClientConnection + + +class RealtimeEvents(str, Enum): + """Events emitted by the RealtimeConnection""" + OPEN = "open" + CLOSE = "close" + SESSION_STARTED = "session_started" + PARTIAL_TRANSCRIPT = "partial_transcript" + FINAL_TRANSCRIPT = "final_transcript" + FINAL_TRANSCRIPT_WITH_TIMESTAMPS = "final_transcript_with_timestamps" + COMMITTED_TRANSCRIPT = "committed_transcript" + COMMITTED_TRANSCRIPT_WITH_TIMESTAMPS = "committed_transcript_with_timestamps" + COMMITTED_TRANSCRIPT_ENTITIES = "committed_transcript_entities" + EDITED_TRANSCRIPT = "edited_transcript" + ERROR = "error" + AUTH_ERROR = "auth_error" + QUOTA_EXCEEDED = "quota_exceeded" + COMMIT_THROTTLED = "commit_throttled" + TRANSCRIBER_ERROR = "transcriber_error" + UNACCEPTED_TERMS = "unaccepted_terms" + # Deprecated: the server sends "unaccepted_terms". Kept so existing + # subscribers keep firing; prefer UNACCEPTED_TERMS. + UNACCEPTED_TERMS_ERROR = "unaccepted_terms_error" + RATE_LIMITED = "rate_limited" + INPUT_ERROR = "input_error" + INVALID_REQUEST = "invalid_request" + QUEUE_OVERFLOW = "queue_overflow" + RESOURCE_EXHAUSTED = "resource_exhausted" + SESSION_TIME_LIMIT_EXCEEDED = "session_time_limit_exceeded" + CHUNK_SIZE_EXCEEDED = "chunk_size_exceeded" + INSUFFICIENT_AUDIO_ACTIVITY = "insufficient_audio_activity" + + + +class RealtimeConnection: + """ + A WebSocket connection for real-time speech-to-text transcription. + + This class handles bidirectional WebSocket communication with the ElevenLabs + speech-to-text API, managing audio streaming and receiving transcription results. + + Example: + ```python + connection = await client.speech_to_text.realtime.connect({ + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000 + }) + + connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, lambda data: print(data)) + connection.on(RealtimeEvents.COMMITTED_TRANSCRIPT, lambda data: print(data)) + + # Send audio + connection.send({"audioBase64": audio_chunk}) + + # When done + connection.commit() + await connection.close() + ``` + """ + + def __init__(self, websocket: "ClientConnection", current_sample_rate: int, ffmpeg_process: typing.Optional[subprocess.Popen] = None): + self.websocket = websocket + self.current_sample_rate = current_sample_rate + self.ffmpeg_process = ffmpeg_process + self._event_handlers: typing.Dict[str, typing.List[typing.Callable]] = {} + self._message_task: typing.Optional[asyncio.Task] = None + + def on(self, event: str, callback: typing.Callable) -> None: + """ + Register an event handler for a specific event type. + + Args: + event: The event type to listen for (from RealtimeEvents enum) + callback: The function to call when the event occurs + + Example: + ```python + def handle_transcript(data): + print(f"Transcript: {data['transcript']}") + + connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, handle_transcript) + ``` + """ + if event not in self._event_handlers: + self._event_handlers[event] = [] + self._event_handlers[event].append(callback) + + def _emit(self, event: str, *args) -> None: + """Emit an event to all registered handlers""" + if event in self._event_handlers: + for handler in self._event_handlers[event]: + try: + handler(*args) + except Exception as e: + print(f"Error in event handler for {event}: {e}") + + async def _start_message_handler(self) -> None: + """Start handling incoming WebSocket messages""" + try: + async for message in self.websocket: + try: + data = json.loads(message) + message_type = data.get("message_type") + + # Try to match message_type to a known event + try: + event = RealtimeEvents(message_type) + self._emit(event, data) + + # The server sends "unaccepted_terms"; also emit under the + # older event name so existing subscribers keep firing. + if event is RealtimeEvents.UNACCEPTED_TERMS: + self._emit(RealtimeEvents.UNACCEPTED_TERMS_ERROR, data) + + # Also emit generic ERROR event for specific error types + error_events = { + RealtimeEvents.AUTH_ERROR, + RealtimeEvents.QUOTA_EXCEEDED, + RealtimeEvents.COMMIT_THROTTLED, + RealtimeEvents.TRANSCRIBER_ERROR, + RealtimeEvents.UNACCEPTED_TERMS, + RealtimeEvents.UNACCEPTED_TERMS_ERROR, + RealtimeEvents.RATE_LIMITED, + RealtimeEvents.INPUT_ERROR, + RealtimeEvents.INVALID_REQUEST, + RealtimeEvents.QUEUE_OVERFLOW, + RealtimeEvents.RESOURCE_EXHAUSTED, + RealtimeEvents.SESSION_TIME_LIMIT_EXCEEDED, + RealtimeEvents.CHUNK_SIZE_EXCEEDED, + RealtimeEvents.INSUFFICIENT_AUDIO_ACTIVITY, + } + if event in error_events: + self._emit(RealtimeEvents.ERROR, data) + except ValueError: + # Unknown message type, ignore + pass + except json.JSONDecodeError as e: + self._emit(RealtimeEvents.ERROR, {"error": f"Failed to parse message: {e}"}) + except Exception as e: + self._emit(RealtimeEvents.ERROR, {"error": str(e)}) + finally: + self._emit_close() + + def _emit_close(self) -> None: + """Emit the CLOSE event with the WebSocket close code and reason. + + Handlers that declare at least one parameter receive + ``{"code": ..., "reason": ...}`` (None when the socket never + completed a close handshake). Zero-argument handlers registered + before close metadata existed keep being called with no arguments. + """ + # websockets 13.x and 14.x asyncio Connection has no close_code/close_reason; + # those live on its sans-I/O protocol (15+ also exposes them on the + # connection by delegating to the protocol). + protocol = getattr(self.websocket, "protocol", None) + source = protocol if hasattr(protocol, "close_code") else self.websocket + close_info = { + "code": getattr(source, "close_code", None), + "reason": getattr(source, "close_reason", None), + } + for handler in self._event_handlers.get(RealtimeEvents.CLOSE, []): + try: + try: + takes_args = len(inspect.signature(handler).parameters) > 0 + except (TypeError, ValueError): + takes_args = True + if takes_args: + handler(close_info) + else: + handler() + except Exception as e: + print(f"Error in event handler for {RealtimeEvents.CLOSE}: {e}") + + async def send(self, data: typing.Dict[str, typing.Any]) -> None: + """ + Send an audio chunk to the server for transcription. + + Args: + data: Dictionary containing the following keys: + - audio_base_64 (str): Base64-encoded audio data to transcribe + - previous_text (str, optional): Previous transcript text to provide context + for more accurate transcription + + Raises: + RuntimeError: If the WebSocket connection is not open + + Example: + ```python + # Send audio chunk + connection.send({ + "audio_base_64": base64_encoded_audio + }) + + # Send audio chunk with context - can only be sent with the first chunk of audio + connection.send({ + "audio_base_64": base64_encoded_audio, + "previous_text": "Previously transcribed text for context" + }) + ``` + """ + if not self.websocket: + raise RuntimeError("WebSocket is not connected") + + message = { + "message_type": "input_audio_chunk", + "audio_base_64": data.get("audio_base_64", ""), + "commit": False, + "sample_rate": self.current_sample_rate, + "previous_text": data.get("previous_text"), + } + + await self.websocket.send(json.dumps(message)) + + async def commit(self) -> None: + """ + Commits the segment, triggering a COMMITTED_TRANSCRIPT event and clearing the buffer. + It's recommend to commit often when using CommitStrategy.MANUAL to keep latency low. + + Raises: + RuntimeError: If the WebSocket connection is not open + + Remarks: + Only needed when using CommitStrategy.MANUAL. + When using CommitStrategy.VAD, commits are handled automatically by the server. + + Example: + ```python + # Send all audio chunks + for chunk in audio_chunks: + connection.send({"audioBase64": chunk}) + + # Commit the audio segment + await connection.commit() + ``` + """ + if not self.websocket: + raise RuntimeError("WebSocket is not connected") + + message = { + "message_type": "input_audio_chunk", + "audio_base_64": "", + "commit": True, + "sample_rate": self.current_sample_rate, + } + + await self.websocket.send(json.dumps(message)) + + async def close(self) -> None: + """ + Closes the WebSocket connection and cleans up resources. + This will terminate any ongoing transcription and stop ffmpeg processes if running. + + Remarks: + After calling close(), this connection cannot be reused. + Create a new connection if you need to start transcribing again. + + Example: + ```python + connection.on(RealtimeEvents.COMMITTED_TRANSCRIPT, async lambda data: ( + print("Committed:", data["transcript"]), + await connection.close() + )) + ``` + """ + await self._cleanup() + if self.websocket: + await self.websocket.close(1000, "User ended conversation") + if self._message_task and not self._message_task.done(): + self._message_task.cancel() + try: + await self._message_task + except asyncio.CancelledError: + pass + + async def _cleanup(self) -> None: + """Clean up resources like ffmpeg processes""" + if self.ffmpeg_process: + self.ffmpeg_process.kill() + try: + self.ffmpeg_process.wait(timeout=1) + except subprocess.TimeoutExpired: + self.ffmpeg_process.kill() + self.ffmpeg_process = None + diff --git a/data/src/elevenlabs/realtime/scribe.py b/data/src/elevenlabs/realtime/scribe.py new file mode 100644 index 0000000000000000000000000000000000000000..6cb0942e5d48bfa1b41efa7ef22cce5e8adf4ff0 --- /dev/null +++ b/data/src/elevenlabs/realtime/scribe.py @@ -0,0 +1,468 @@ +import asyncio +import base64 +import subprocess +import typing +from enum import Enum +from typing import overload + +from typing_extensions import Required + +try: + from websockets.asyncio.client import connect as websocket_connect +except ImportError: + raise ImportError( + "The websockets package is required for realtime speech-to-text. " + "Install it with: pip install websockets" + ) + +from ..url_utils import build_ws_url +from .connection import RealtimeConnection + + +class AudioFormat(str, Enum): + """Audio format options for realtime transcription""" + PCM_8000 = "pcm_8000" + PCM_16000 = "pcm_16000" + PCM_22050 = "pcm_22050" + PCM_24000 = "pcm_24000" + PCM_44100 = "pcm_44100" + PCM_48000 = "pcm_48000" + ULAW_8000 = "ulaw_8000" + + +class CommitStrategy(str, Enum): + """ + Strategy for committing transcription results. + + VAD: Voice Activity Detection - automatically commits when speech ends + MANUAL: Manual commit - requires calling commit() to commit the segment + """ + VAD = "vad" + MANUAL = "manual" + + +RealtimeEntityDetection = typing.Union[str, typing.List[str]] +""" +Entities to detect on committed transcripts. + +Accepts ``"all"``, a single category (``"pii"``, ``"phi"``, ``"pci"``, ``"other"``, +``"offensive_language"``), a specific entity type such as ``"email_address"``, or a +list of categories/types. +""" + + +class _RealtimeSharedOptions(typing.TypedDict, total=False): + """ + Options accepted by both realtime connection modes. + + Attributes: + model_id: The model ID to use for transcription (required) + commit_strategy: Strategy for committing transcriptions (optional, defaults to MANUAL) + vad_silence_threshold_secs: Silence threshold in seconds for VAD (must be between 0.3 and 3.0) + vad_threshold: Threshold for voice activity detection (must be between 0.1 and 0.9) + min_speech_duration_ms: Minimum speech duration in milliseconds (must be between 50 and 2000) + min_silence_duration_ms: Minimum silence duration in milliseconds (must be between 50 and 2000) + language_code: An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. Can sometimes improve transcription performance if known beforehand. + secondary_languages: Additional ISO-639-1 or ISO-639-3 language codes that may be present in the audio. Providing them makes language identification more reliable by only focusing on a certain set of languages. + include_timestamps: Whether to receive the committed_transcript_with_timestamps event after committing the segment (optional, defaults to False) + include_language_detection: Whether to receive a delayed final transcript carrying the detected language_code after each commit (optional, defaults to False) + keyterms: Keyterms to bias the model towards (maximum 50, each at most 20 characters) + no_verbatim: If True, removes filler words, false starts and disfluencies from the transcript + entity_detection: Entities to detect on committed transcripts, delivered in a separate committed_transcript_entities event + transcript_edit: Natural-language instruction applied to each committed transcript (max 2000 characters), delivered in a separate edited_transcript event. Cannot be combined with entity_detection. Adds a 30% premium to the base transcription cost, billed for at least 10 seconds of audio per committed transcript. + filter_background_audio: Reduce false activations from nearby conversations and ambient noise. Cannot be combined with include_timestamps. + enable_logging: When False, zero retention mode is used for the request. Only available to enterprise customers. + token: A single-use token used to authenticate the session instead of an API key. Useful when connecting from a client where an API key should not be exposed. Takes precedence over any configured api_key, which is not sent when a token is supplied. + """ + model_id: Required[str] + commit_strategy: CommitStrategy + vad_silence_threshold_secs: float + vad_threshold: float + min_speech_duration_ms: int + min_silence_duration_ms: int + language_code: str + secondary_languages: typing.List[str] + include_timestamps: bool + include_language_detection: bool + keyterms: typing.List[str] + no_verbatim: bool + entity_detection: RealtimeEntityDetection + transcript_edit: str + filter_background_audio: bool + enable_logging: bool + token: str + + +class RealtimeAudioOptions(_RealtimeSharedOptions, total=False): + """ + Options for providing audio chunks manually. + + Accepts every key in :class:`_RealtimeSharedOptions`, plus: + + Attributes: + audio_format: The audio format (required) + sample_rate: The sample rate in Hz (required) + """ + audio_format: Required[AudioFormat] + sample_rate: Required[int] + + +class RealtimeUrlOptions(_RealtimeSharedOptions, total=False): + """ + Options for streaming audio from a URL. + + Accepts every key in :class:`_RealtimeSharedOptions`, plus: + + Attributes: + url: The URL of the audio stream (required) + """ + url: Required[str] + + +class ScribeRealtime: + """ + Helper class for creating realtime speech-to-text connections. + + Supports two modes: + 1. URL-based: Stream audio from a URL (uses ffmpeg for conversion) + 2. Manual: Send audio chunks yourself + + Example (URL-based): + ```python + connection = await elevenlabs.speech_to_text.realtime.connect({ + "model_id": "scribe_v2_realtime", + "url": "https://stream.example.com/audio.mp3" + }) + ``` + + Example (Manual chunks): + ```python + connection = await elevenlabs.speech_to_text.realtime.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000 + }) + + # Send audio chunks + await connection.send({"audio_base_64": chunk}) + ``` + """ + + def __init__(self, api_key: str, base_url: str = "wss://api.elevenlabs.io"): + self.api_key = api_key + self.base_url = base_url + + @overload + async def connect( + self, + options: RealtimeAudioOptions + ) -> RealtimeConnection: ... + + @overload + async def connect( + self, + options: RealtimeUrlOptions + ) -> RealtimeConnection: ... + + async def connect( + self, + options: typing.Union[RealtimeAudioOptions, RealtimeUrlOptions] + ) -> RealtimeConnection: + """ + Create a realtime transcription connection. + + Args: + options: Either RealtimeAudioOptions for manual chunk sending or RealtimeUrlOptions for URL streaming + + Returns: + RealtimeConnection instance ready to send/receive data + + Raises: + ValueError: If invalid options are provided + RuntimeError: If ffmpeg is not available (for URL-based streaming) + + Example: + ```python + # URL-based streaming + connection = await elevenlabs.speech_to_text.realtime.connect({ + "model_id": "scribe_v2_realtime", + "url": "https://stream.example.com/audio.mp3", + }) + + # Manual chunks + connection = await elevenlabs.speech_to_text.realtime.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000, + "commit_strategy": CommitStrategy.MANUAL + }) + ``` + """ + # Determine if this is URL-based or manual mode + is_url_mode = "url" in options + + if "model_id" not in options: + raise ValueError("model_id is required for realtime transcription") + + if is_url_mode: + return await self._connect_url(typing.cast(RealtimeUrlOptions, options)) + else: + return await self._connect_audio(typing.cast(RealtimeAudioOptions, options)) + + @staticmethod + def _shared_url_kwargs( + options: typing.Union[RealtimeAudioOptions, RealtimeUrlOptions] + ) -> typing.Dict[str, typing.Any]: + """Collect the query parameters both connection modes share.""" + return { + "vad_silence_threshold_secs": options.get("vad_silence_threshold_secs"), + "vad_threshold": options.get("vad_threshold"), + "min_speech_duration_ms": options.get("min_speech_duration_ms"), + "min_silence_duration_ms": options.get("min_silence_duration_ms"), + "language_code": options.get("language_code"), + "secondary_languages": options.get("secondary_languages"), + "include_timestamps": options.get("include_timestamps", False), + "include_language_detection": options.get("include_language_detection"), + "keyterms": options.get("keyterms"), + "no_verbatim": options.get("no_verbatim"), + "entity_detection": options.get("entity_detection"), + "transcript_edit": options.get("transcript_edit"), + "filter_background_audio": options.get("filter_background_audio"), + "enable_logging": options.get("enable_logging"), + "token": options.get("token"), + } + + def _connection_headers( + self, options: typing.Union[RealtimeAudioOptions, RealtimeUrlOptions] + ) -> typing.Dict[str, str]: + """ + Build the handshake headers. + + A single-use token authenticates the session on its own and takes + precedence server-side, so the api key is not sent alongside one. + """ + if options.get("token"): + return {} + if not self.api_key: + raise ValueError( + "An api_key or a single-use token is required for realtime transcription" + ) + return {"xi-api-key": self.api_key} + + async def _connect_audio(self, options: RealtimeAudioOptions) -> RealtimeConnection: + """Connect with manual audio chunk sending""" + model_id = options["model_id"] + audio_format = options.get("audio_format") + sample_rate = options.get("sample_rate") + commit_strategy = options.get("commit_strategy", CommitStrategy.MANUAL) + + if not audio_format or not sample_rate: + raise ValueError("audio_format and sample_rate are required for manual audio mode") + + headers = self._connection_headers(options) + + # Build WebSocket URL with query parameters + ws_url = self._build_websocket_url( + model_id=model_id, + audio_format=audio_format.value, + commit_strategy=commit_strategy.value, + **self._shared_url_kwargs(options), + ) + + # Connect to WebSocket + websocket = await websocket_connect(ws_url, additional_headers=headers) + + # Create connection object + connection = RealtimeConnection( + websocket=websocket, + current_sample_rate=sample_rate, + ffmpeg_process=None + ) + + # Start message handler + connection._message_task = asyncio.create_task(connection._start_message_handler()) + connection._emit("open") + + return connection + + async def _connect_url(self, options: RealtimeUrlOptions) -> RealtimeConnection: + """Connect with URL-based audio streaming using ffmpeg""" + model_id = options["model_id"] + url = options.get("url") + commit_strategy = options.get("commit_strategy", CommitStrategy.MANUAL) + + if not url: + raise ValueError("url is required for URL mode") + + # Default to 16kHz for URL streaming + sample_rate = 16000 + audio_format = AudioFormat.PCM_16000 + + headers = self._connection_headers(options) + + # Build WebSocket URL + ws_url = self._build_websocket_url( + model_id=model_id, + audio_format=audio_format.value, + commit_strategy=commit_strategy.value, + **self._shared_url_kwargs(options), + ) + + # Connect to WebSocket + websocket = await websocket_connect(ws_url, additional_headers=headers) + + # Start ffmpeg process to convert stream to PCM + try: + ffmpeg_process = subprocess.Popen( + [ + "ffmpeg", + "-i", url, + "-f", "s16le", + "-ar", str(sample_rate), + "-ac", "1", + "-" + ], + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + bufsize=0 + ) + except FileNotFoundError: + await websocket.close(1011, "ffmpeg not found") + raise RuntimeError( + "ffmpeg is required for URL-based audio streaming. " + "Please install ffmpeg: https://ffmpeg.org/download.html" + ) + + # Create connection object + connection = RealtimeConnection( + websocket=websocket, + current_sample_rate=sample_rate, + ffmpeg_process=ffmpeg_process + ) + + # Start message handler + connection._message_task = asyncio.create_task(connection._start_message_handler()) + connection._emit("open") + + # Start streaming audio from ffmpeg to websocket + asyncio.create_task(self._stream_ffmpeg_to_websocket(connection)) + + return connection + + async def _stream_ffmpeg_to_websocket(self, connection: RealtimeConnection) -> None: + """Stream audio from ffmpeg process to WebSocket""" + if not connection.ffmpeg_process or not connection.ffmpeg_process.stdout: + return + + try: + # Read chunks from ffmpeg and send to websocket + chunk_size = 8192 # 8KB chunks + + loop = asyncio.get_event_loop() + + while True: + # Read from ffmpeg stdout in a non-blocking way + chunk = await loop.run_in_executor( + None, + connection.ffmpeg_process.stdout.read, + chunk_size + ) + + if not chunk: + # Stream ended + break + + # Convert to base64 and send + chunk_base64 = base64.b64encode(chunk).decode('utf-8') + + try: + await connection.send({"audio_base_64": chunk_base64}) + except Exception as e: + connection._emit("error", {"error": f"Failed to send audio: {e}"}) + break + + # Small delay to prevent overwhelming the connection + await asyncio.sleep(0.01) + + except Exception as e: + connection._emit("error", {"error": f"FFmpeg streaming error: {e}"}) + finally: + # Clean up ffmpeg process + if connection.ffmpeg_process: + connection.ffmpeg_process.kill() + try: + connection.ffmpeg_process.wait(timeout=1) + except subprocess.TimeoutExpired: + connection.ffmpeg_process.kill() + + def _build_websocket_url( + self, + model_id: str, + audio_format: str, + commit_strategy: str, + vad_silence_threshold_secs: typing.Optional[float] = None, + vad_threshold: typing.Optional[float] = None, + min_speech_duration_ms: typing.Optional[int] = None, + min_silence_duration_ms: typing.Optional[int] = None, + language_code: typing.Optional[str] = None, + secondary_languages: typing.Optional[typing.List[str]] = None, + include_timestamps: typing.Optional[bool] = None, + include_language_detection: typing.Optional[bool] = None, + keyterms: typing.Optional[typing.List[str]] = None, + no_verbatim: typing.Optional[bool] = None, + entity_detection: typing.Optional[RealtimeEntityDetection] = None, + transcript_edit: typing.Optional[str] = None, + filter_background_audio: typing.Optional[bool] = None, + enable_logging: typing.Optional[bool] = None, + token: typing.Optional[str] = None, + ) -> str: + """Build the WebSocket URL with query parameters""" + params = [ + ("model_id", model_id), + ("audio_format", audio_format), + ("commit_strategy", commit_strategy), + ] + for key, value in [ + ("vad_silence_threshold_secs", vad_silence_threshold_secs), + ("vad_threshold", vad_threshold), + ("min_speech_duration_ms", min_speech_duration_ms), + ("min_silence_duration_ms", min_silence_duration_ms), + ("language_code", language_code), + ]: + if value is not None: + params.append((key, str(value))) + if secondary_languages is not None: + for language in secondary_languages: + params.append(("secondary_languages", language)) + if include_timestamps is not None: + params.append(("include_timestamps", str(include_timestamps).lower())) + if include_language_detection is not None: + params.append( + ("include_language_detection", str(include_language_detection).lower()) + ) + if keyterms is not None: + for term in keyterms: + params.append(("keyterms", term)) + if no_verbatim is not None: + params.append(("no_verbatim", str(no_verbatim).lower())) + if entity_detection is not None: + entities = ( + [entity_detection] + if isinstance(entity_detection, str) + else entity_detection + ) + for entity in entities: + params.append(("entity_detection", entity)) + if transcript_edit is not None: + params.append(("transcript_edit", transcript_edit)) + if filter_background_audio is not None: + params.append( + ("filter_background_audio", str(filter_background_audio).lower()) + ) + if enable_logging is not None: + params.append(("enable_logging", str(enable_logging).lower())) + if token is not None: + params.append(("token", token)) + + return build_ws_url(self.base_url, ["v1", "speech-to-text", "realtime"], params) + diff --git a/data/src/elevenlabs/realtime_tts.py b/data/src/elevenlabs/realtime_tts.py new file mode 100644 index 0000000000000000000000000000000000000000..48075997ac2372eee690e47efeacef845123e589 --- /dev/null +++ b/data/src/elevenlabs/realtime_tts.py @@ -0,0 +1,152 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import urllib.parse +import json +import base64 +import websockets + +from websockets.sync.client import connect + +from .core.api_error import ApiError +from .core.client_wrapper import SyncClientWrapper +from .core.jsonable_encoder import jsonable_encoder +from .core.remove_none_from_dict import remove_none_from_dict +from .core.request_options import RequestOptions +from .types.voice_settings import VoiceSettings +from .text_to_speech.client import TextToSpeechClient +from .types import OutputFormat +from .url_utils import build_ws_url + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +def text_chunker(chunks: typing.Iterator[str]) -> typing.Iterator[str]: + """Used during input streaming to chunk text blocks and set last char to space""" + splitters = (".", ",", "?", "!", ";", ":", "—", "-", "(", ")", "[", "]", "}", " ") + buffer = "" + for text in chunks: + if buffer.endswith(splitters): + yield buffer if buffer.endswith(" ") else buffer + " " + buffer = text + elif text.startswith(splitters): + output = buffer + text[0] + yield output if output.endswith(" ") else output + " " + buffer = text[1:] + else: + buffer += text + if buffer != "": + yield buffer + " " + + +class RealtimeTextToSpeechClient(TextToSpeechClient): + def __init__(self, *, client_wrapper: SyncClientWrapper): + super().__init__(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._ws_base_url = urllib.parse.urlparse(self._client_wrapper.get_base_url())._replace(scheme="wss").geturl() + + def convert_realtime( + self, + voice_id: str, + *, + text: typing.Iterator[str], + model_id: typing.Optional[str] = OMIT, + output_format: typing.Optional[OutputFormat] = "mp3_44100_128", + voice_settings: typing.Optional[VoiceSettings] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Converts text into speech using a voice of your choice and returns audio. + + Parameters: + - voice_id: str. Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + - text: typing.Iterator[str]. The text that will get converted into speech. + + - model_id: typing.Optional[str]. Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + - voice_settings: typing.Optional[VoiceSettings]. Voice settings overriding stored setttings for the given voice. They are applied only on the given request. + + - request_options: typing.Optional[RequestOptions]. Request-specific configuration. + --- + from elevenlabs import PronunciationDictionaryVersionLocator, VoiceSettings + from elevenlabs.client import ElevenLabs + + def get_text() -> typing.Iterator[str]: + yield "Hello, how are you?" + yield "I am fine, thank you." + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_speech.convert_realtime( + voice_id="string", + text=get_text(), + model_id="string", + voice_settings=VoiceSettings( + stability=1.1, + similarity_boost=1.1, + style=1.1, + use_speaker_boost=True, + ), + ) + """ + # OMIT is a sentinel meaning "not supplied", so it must never reach the wire + if model_id is OMIT: + model_id = None + if voice_settings is OMIT: + voice_settings = None + + with connect( + build_ws_url( + self._ws_base_url, + ["v1", "text-to-speech", voice_id, "stream-input"], + remove_none_from_dict({"model_id": model_id, "output_format": output_format}), + ), + additional_headers=jsonable_encoder( + remove_none_from_dict( + { + **self._client_wrapper.get_headers(), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ) + ) as socket: + try: + socket.send(json.dumps( + dict( + text=" ", + try_trigger_generation=True, + voice_settings=voice_settings.dict() if voice_settings else None, + generation_config=dict( + chunk_length_schedule=[50], + ), + ) + )) + except websockets.exceptions.ConnectionClosedError as ce: + raise ApiError(body=ce.reason, status_code=ce.code) + + try: + for text_chunk in text_chunker(text): + data = dict(text=text_chunk, try_trigger_generation=True) + socket.send(json.dumps(data)) + try: + data = json.loads(socket.recv(1e-2)) + if "audio" in data and data["audio"]: + yield base64.b64decode(data["audio"]) # type: ignore + except TimeoutError: + pass + + socket.send(json.dumps(dict(text=""))) + + while True: + + data = json.loads(socket.recv()) + if "audio" in data and data["audio"]: + yield base64.b64decode(data["audio"]) # type: ignore + except websockets.exceptions.ConnectionClosed as ce: + if "message" in data: + raise ApiError(body=data, status_code=ce.code) + elif ce.code != 1000: + raise ApiError(body=ce.reason, status_code=ce.code) diff --git a/data/src/elevenlabs/samples/__init__.py b/data/src/elevenlabs/samples/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/samples/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/samples/client.py b/data/src/elevenlabs/samples/client.py new file mode 100644 index 0000000000000000000000000000000000000000..c20083e140abc39fe34d9f596210bdb5bee996ec --- /dev/null +++ b/data/src/elevenlabs/samples/client.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.delete_sample_response import DeleteSampleResponse +from .raw_client import AsyncRawSamplesClient, RawSamplesClient + + +class SamplesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSamplesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSamplesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSamplesClient + """ + return self._raw_client + + def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteSampleResponse: + """ + Removes a sample by its ID. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + sample_id : str + ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteSampleResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.samples.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.delete(voice_id, sample_id, request_options=request_options) + return _response.data + + +class AsyncSamplesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSamplesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSamplesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSamplesClient + """ + return self._raw_client + + async def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteSampleResponse: + """ + Removes a sample by its ID. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + sample_id : str + ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteSampleResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.samples.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(voice_id, sample_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/samples/raw_client.py b/data/src/elevenlabs/samples/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..294360c8bf32f1be05d86ee597d91e8cb19437a9 --- /dev/null +++ b/data/src/elevenlabs/samples/raw_client.py @@ -0,0 +1,139 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.delete_sample_response import DeleteSampleResponse +from pydantic import ValidationError + + +class RawSamplesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteSampleResponse]: + """ + Removes a sample by its ID. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + sample_id : str + ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteSampleResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteSampleResponse, + construct_type( + type_=DeleteSampleResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSamplesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteSampleResponse]: + """ + Removes a sample by its ID. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + sample_id : str + ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteSampleResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteSampleResponse, + construct_type( + type_=DeleteSampleResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/service_accounts/__init__.py b/data/src/elevenlabs/service_accounts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8e037576bf5a77e01b5ba8ba9cfa442ba364fd44 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/__init__.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import api_keys + from .api_keys import ( + BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions": ".api_keys", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps": ".api_keys", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit": ".api_keys", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit": ".api_keys", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled": ".api_keys", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit": ".api_keys", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions": ".api_keys", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed": ".api_keys", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit": ".api_keys", + "api_keys": ".api_keys", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit", + "api_keys", +] diff --git a/data/src/elevenlabs/service_accounts/api_keys/__init__.py b/data/src/elevenlabs/service_accounts/api_keys/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..75ab243c1b5578e2e70100c187148c39e45bb688 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/__init__.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed, + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions": ".types", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps": ".types", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit": ".types", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit": ".types", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled": ".types", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit": ".types", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions": ".types", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed": ".types", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit", +] diff --git a/data/src/elevenlabs/service_accounts/api_keys/client.py b/data/src/elevenlabs/service_accounts/api_keys/client.py new file mode 100644 index 0000000000000000000000000000000000000000..93d72d1333ae1418af7a25136991ae94cf220410 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/client.py @@ -0,0 +1,679 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.workspace_api_key_list_response_model import WorkspaceApiKeyListResponseModel +from ...types.workspace_create_api_key_response_model import WorkspaceCreateApiKeyResponseModel +from .raw_client import AsyncRawApiKeysClient, RawApiKeysClient +from .types.body_create_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_post_permissions import ( + BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_allowed_ips import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_character_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_dubbing_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_is_enabled import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_music_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_permissions import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_third_party_disable_allowed import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_tts_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit, +) + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ApiKeysClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawApiKeysClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawApiKeysClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawApiKeysClient + """ + return self._raw_client + + def list( + self, service_account_user_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> WorkspaceApiKeyListResponseModel: + """ + Get all API keys for a service account + + Parameters + ---------- + service_account_user_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceApiKeyListResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.service_accounts.api_keys.list( + service_account_user_id="service_account_user_id", + ) + """ + _response = self._raw_client.list(service_account_user_id, request_options=request_options) + return _response.data + + def create( + self, + service_account_user_id: str, + *, + name: str, + permissions: BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + character_limit: typing.Optional[int] = OMIT, + allowed_ips: typing.Optional[typing.Sequence[str]] = OMIT, + third_party_disable_allowed: typing.Optional[bool] = OMIT, + tts_concurrency_limit: typing.Optional[int] = OMIT, + dubbing_concurrency_limit: typing.Optional[int] = OMIT, + music_concurrency_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceCreateApiKeyResponseModel: + """ + Create a new API key for a service account + + Parameters + ---------- + service_account_user_id : str + + name : str + + permissions : BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions + The permissions of the XI API. + + character_limit : typing.Optional[int] + The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + + allowed_ips : typing.Optional[typing.Sequence[str]] + List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + + third_party_disable_allowed : typing.Optional[bool] + Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + + tts_concurrency_limit : typing.Optional[int] + Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + + dubbing_concurrency_limit : typing.Optional[int] + Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + + music_concurrency_limit : typing.Optional[int] + Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceCreateApiKeyResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.service_accounts.api_keys.create( + service_account_user_id="service_account_user_id", + name="name", + ) + """ + _response = self._raw_client.create( + service_account_user_id, + name=name, + permissions=permissions, + character_limit=character_limit, + allowed_ips=allowed_ips, + third_party_disable_allowed=third_party_disable_allowed, + tts_concurrency_limit=tts_concurrency_limit, + dubbing_concurrency_limit=dubbing_concurrency_limit, + music_concurrency_limit=music_concurrency_limit, + request_options=request_options, + ) + return _response.data + + def delete( + self, service_account_user_id: str, api_key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete an existing API key for a service account + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.service_accounts.api_keys.delete( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", + ) + """ + _response = self._raw_client.delete(service_account_user_id, api_key_id, request_options=request_options) + return _response.data + + def update( + self, + service_account_user_id: str, + api_key_id: str, + *, + is_enabled: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled + ] = OMIT, + name: typing.Optional[str] = OMIT, + permissions: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions + ] = OMIT, + character_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit + ] = OMIT, + allowed_ips: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps + ] = OMIT, + third_party_disable_allowed: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed + ] = OMIT, + tts_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit + ] = OMIT, + dubbing_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit + ] = OMIT, + music_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit + ] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Update an existing API key for a service account + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + is_enabled : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled] + Whether to enable or disable the API key. + + name : typing.Optional[str] + The name of the XI API key to use (used for identification purposes only). + + permissions : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions] + The permissions of the XI API. + + character_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit] + The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + + allowed_ips : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps] + List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + + third_party_disable_allowed : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed] + Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + + tts_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit] + Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + + dubbing_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit] + Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + + music_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit] + Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.service_accounts.api_keys.update( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", + ) + """ + _response = self._raw_client.update( + service_account_user_id, + api_key_id, + is_enabled=is_enabled, + name=name, + permissions=permissions, + character_limit=character_limit, + allowed_ips=allowed_ips, + third_party_disable_allowed=third_party_disable_allowed, + tts_concurrency_limit=tts_concurrency_limit, + dubbing_concurrency_limit=dubbing_concurrency_limit, + music_concurrency_limit=music_concurrency_limit, + request_options=request_options, + ) + return _response.data + + def disable( + self, service_account_user_id: str, api_key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Disable an existing API key for a service account without changing its other settings. This stays available after a workspace downgrades off a plan that includes service accounts. Turning the key back on still requires that plan. + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.service_accounts.api_keys.disable( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", + ) + """ + _response = self._raw_client.disable(service_account_user_id, api_key_id, request_options=request_options) + return _response.data + + +class AsyncApiKeysClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawApiKeysClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawApiKeysClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawApiKeysClient + """ + return self._raw_client + + async def list( + self, service_account_user_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> WorkspaceApiKeyListResponseModel: + """ + Get all API keys for a service account + + Parameters + ---------- + service_account_user_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceApiKeyListResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.service_accounts.api_keys.list( + service_account_user_id="service_account_user_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(service_account_user_id, request_options=request_options) + return _response.data + + async def create( + self, + service_account_user_id: str, + *, + name: str, + permissions: BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + character_limit: typing.Optional[int] = OMIT, + allowed_ips: typing.Optional[typing.Sequence[str]] = OMIT, + third_party_disable_allowed: typing.Optional[bool] = OMIT, + tts_concurrency_limit: typing.Optional[int] = OMIT, + dubbing_concurrency_limit: typing.Optional[int] = OMIT, + music_concurrency_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceCreateApiKeyResponseModel: + """ + Create a new API key for a service account + + Parameters + ---------- + service_account_user_id : str + + name : str + + permissions : BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions + The permissions of the XI API. + + character_limit : typing.Optional[int] + The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + + allowed_ips : typing.Optional[typing.Sequence[str]] + List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + + third_party_disable_allowed : typing.Optional[bool] + Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + + tts_concurrency_limit : typing.Optional[int] + Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + + dubbing_concurrency_limit : typing.Optional[int] + Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + + music_concurrency_limit : typing.Optional[int] + Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceCreateApiKeyResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.service_accounts.api_keys.create( + service_account_user_id="service_account_user_id", + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + service_account_user_id, + name=name, + permissions=permissions, + character_limit=character_limit, + allowed_ips=allowed_ips, + third_party_disable_allowed=third_party_disable_allowed, + tts_concurrency_limit=tts_concurrency_limit, + dubbing_concurrency_limit=dubbing_concurrency_limit, + music_concurrency_limit=music_concurrency_limit, + request_options=request_options, + ) + return _response.data + + async def delete( + self, service_account_user_id: str, api_key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete an existing API key for a service account + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.service_accounts.api_keys.delete( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(service_account_user_id, api_key_id, request_options=request_options) + return _response.data + + async def update( + self, + service_account_user_id: str, + api_key_id: str, + *, + is_enabled: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled + ] = OMIT, + name: typing.Optional[str] = OMIT, + permissions: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions + ] = OMIT, + character_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit + ] = OMIT, + allowed_ips: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps + ] = OMIT, + third_party_disable_allowed: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed + ] = OMIT, + tts_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit + ] = OMIT, + dubbing_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit + ] = OMIT, + music_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit + ] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Update an existing API key for a service account + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + is_enabled : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled] + Whether to enable or disable the API key. + + name : typing.Optional[str] + The name of the XI API key to use (used for identification purposes only). + + permissions : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions] + The permissions of the XI API. + + character_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit] + The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + + allowed_ips : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps] + List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + + third_party_disable_allowed : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed] + Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + + tts_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit] + Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + + dubbing_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit] + Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + + music_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit] + Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.service_accounts.api_keys.update( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + service_account_user_id, + api_key_id, + is_enabled=is_enabled, + name=name, + permissions=permissions, + character_limit=character_limit, + allowed_ips=allowed_ips, + third_party_disable_allowed=third_party_disable_allowed, + tts_concurrency_limit=tts_concurrency_limit, + dubbing_concurrency_limit=dubbing_concurrency_limit, + music_concurrency_limit=music_concurrency_limit, + request_options=request_options, + ) + return _response.data + + async def disable( + self, service_account_user_id: str, api_key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Disable an existing API key for a service account without changing its other settings. This stays available after a workspace downgrades off a plan that includes service accounts. Turning the key back on still requires that plan. + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.service_accounts.api_keys.disable( + service_account_user_id="service_account_user_id", + api_key_id="api_key_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.disable(service_account_user_id, api_key_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/service_accounts/api_keys/raw_client.py b/data/src/elevenlabs/service_accounts/api_keys/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..bf884c27e74578c0037bc28b3d991bb6d277bae9 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/raw_client.py @@ -0,0 +1,921 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.workspace_api_key_list_response_model import WorkspaceApiKeyListResponseModel +from ...types.workspace_create_api_key_response_model import WorkspaceCreateApiKeyResponseModel +from .types.body_create_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_post_permissions import ( + BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_allowed_ips import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_character_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_dubbing_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_is_enabled import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_music_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_permissions import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_third_party_disable_allowed import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed, +) +from .types.body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_tts_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawApiKeysClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, service_account_user_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[WorkspaceApiKeyListResponseModel]: + """ + Get all API keys for a service account + + Parameters + ---------- + service_account_user_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceApiKeyListResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceApiKeyListResponseModel, + construct_type( + type_=WorkspaceApiKeyListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + service_account_user_id: str, + *, + name: str, + permissions: BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + character_limit: typing.Optional[int] = OMIT, + allowed_ips: typing.Optional[typing.Sequence[str]] = OMIT, + third_party_disable_allowed: typing.Optional[bool] = OMIT, + tts_concurrency_limit: typing.Optional[int] = OMIT, + dubbing_concurrency_limit: typing.Optional[int] = OMIT, + music_concurrency_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[WorkspaceCreateApiKeyResponseModel]: + """ + Create a new API key for a service account + + Parameters + ---------- + service_account_user_id : str + + name : str + + permissions : BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions + The permissions of the XI API. + + character_limit : typing.Optional[int] + The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + + allowed_ips : typing.Optional[typing.Sequence[str]] + List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + + third_party_disable_allowed : typing.Optional[bool] + Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + + tts_concurrency_limit : typing.Optional[int] + Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + + dubbing_concurrency_limit : typing.Optional[int] + Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + + music_concurrency_limit : typing.Optional[int] + Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceCreateApiKeyResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys", + method="POST", + json={ + "name": name, + "permissions": convert_and_respect_annotation_metadata( + object_=permissions, + annotation=BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + direction="write", + ), + "character_limit": character_limit, + "allowed_ips": allowed_ips, + "third_party_disable_allowed": third_party_disable_allowed, + "tts_concurrency_limit": tts_concurrency_limit, + "dubbing_concurrency_limit": dubbing_concurrency_limit, + "music_concurrency_limit": music_concurrency_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceCreateApiKeyResponseModel, + construct_type( + type_=WorkspaceCreateApiKeyResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, service_account_user_id: str, api_key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Delete an existing API key for a service account + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys/{jsonable_encoder(api_key_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + service_account_user_id: str, + api_key_id: str, + *, + is_enabled: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled + ] = OMIT, + name: typing.Optional[str] = OMIT, + permissions: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions + ] = OMIT, + character_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit + ] = OMIT, + allowed_ips: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps + ] = OMIT, + third_party_disable_allowed: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed + ] = OMIT, + tts_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit + ] = OMIT, + dubbing_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit + ] = OMIT, + music_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit + ] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Update an existing API key for a service account + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + is_enabled : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled] + Whether to enable or disable the API key. + + name : typing.Optional[str] + The name of the XI API key to use (used for identification purposes only). + + permissions : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions] + The permissions of the XI API. + + character_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit] + The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + + allowed_ips : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps] + List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + + third_party_disable_allowed : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed] + Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + + tts_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit] + Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + + dubbing_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit] + Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + + music_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit] + Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys/{jsonable_encoder(api_key_id)}", + method="PATCH", + json={ + "is_enabled": convert_and_respect_annotation_metadata( + object_=is_enabled, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled, + direction="write", + ), + "name": name, + "permissions": convert_and_respect_annotation_metadata( + object_=permissions, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions, + direction="write", + ), + "character_limit": convert_and_respect_annotation_metadata( + object_=character_limit, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit, + direction="write", + ), + "allowed_ips": convert_and_respect_annotation_metadata( + object_=allowed_ips, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps, + direction="write", + ), + "third_party_disable_allowed": convert_and_respect_annotation_metadata( + object_=third_party_disable_allowed, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed, + direction="write", + ), + "tts_concurrency_limit": convert_and_respect_annotation_metadata( + object_=tts_concurrency_limit, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit, + direction="write", + ), + "dubbing_concurrency_limit": convert_and_respect_annotation_metadata( + object_=dubbing_concurrency_limit, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit, + direction="write", + ), + "music_concurrency_limit": convert_and_respect_annotation_metadata( + object_=music_concurrency_limit, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def disable( + self, service_account_user_id: str, api_key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Disable an existing API key for a service account without changing its other settings. This stays available after a workspace downgrades off a plan that includes service accounts. Turning the key back on still requires that plan. + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys/{jsonable_encoder(api_key_id)}/disable", + method="POST", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawApiKeysClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, service_account_user_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[WorkspaceApiKeyListResponseModel]: + """ + Get all API keys for a service account + + Parameters + ---------- + service_account_user_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceApiKeyListResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceApiKeyListResponseModel, + construct_type( + type_=WorkspaceApiKeyListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + service_account_user_id: str, + *, + name: str, + permissions: BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + character_limit: typing.Optional[int] = OMIT, + allowed_ips: typing.Optional[typing.Sequence[str]] = OMIT, + third_party_disable_allowed: typing.Optional[bool] = OMIT, + tts_concurrency_limit: typing.Optional[int] = OMIT, + dubbing_concurrency_limit: typing.Optional[int] = OMIT, + music_concurrency_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[WorkspaceCreateApiKeyResponseModel]: + """ + Create a new API key for a service account + + Parameters + ---------- + service_account_user_id : str + + name : str + + permissions : BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions + The permissions of the XI API. + + character_limit : typing.Optional[int] + The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + + allowed_ips : typing.Optional[typing.Sequence[str]] + List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + + third_party_disable_allowed : typing.Optional[bool] + Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + + tts_concurrency_limit : typing.Optional[int] + Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + + dubbing_concurrency_limit : typing.Optional[int] + Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + + music_concurrency_limit : typing.Optional[int] + Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceCreateApiKeyResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys", + method="POST", + json={ + "name": name, + "permissions": convert_and_respect_annotation_metadata( + object_=permissions, + annotation=BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + direction="write", + ), + "character_limit": character_limit, + "allowed_ips": allowed_ips, + "third_party_disable_allowed": third_party_disable_allowed, + "tts_concurrency_limit": tts_concurrency_limit, + "dubbing_concurrency_limit": dubbing_concurrency_limit, + "music_concurrency_limit": music_concurrency_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceCreateApiKeyResponseModel, + construct_type( + type_=WorkspaceCreateApiKeyResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, service_account_user_id: str, api_key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete an existing API key for a service account + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys/{jsonable_encoder(api_key_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + service_account_user_id: str, + api_key_id: str, + *, + is_enabled: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled + ] = OMIT, + name: typing.Optional[str] = OMIT, + permissions: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions + ] = OMIT, + character_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit + ] = OMIT, + allowed_ips: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps + ] = OMIT, + third_party_disable_allowed: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed + ] = OMIT, + tts_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit + ] = OMIT, + dubbing_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit + ] = OMIT, + music_concurrency_limit: typing.Optional[ + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit + ] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Update an existing API key for a service account + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + is_enabled : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled] + Whether to enable or disable the API key. + + name : typing.Optional[str] + The name of the XI API key to use (used for identification purposes only). + + permissions : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions] + The permissions of the XI API. + + character_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit] + The character limit of the XI API key. If provided this will limit the usage of this api key to n characters per month where n is the chosen value. Requests that incur charges will fail after reaching this monthly limit. + + allowed_ips : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps] + List of IP addresses or CIDR ranges allowed to use this API key. Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP address (normalized to /32 or /128). On create, omit or pass null to allow all IPs. On update, omit to leave the allowlist unchanged, or pass "clear" to remove it. + + third_party_disable_allowed : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed] + Whether the holder of this key may disable it via the self-disable endpoint. On create, omit or pass null to use the workspace's default (enabled for non-Enterprise plans, disabled for Enterprise plans). On update, omit to leave it unchanged, or pass "clear" to reset it to the workspace default. Only honored for workspaces with self-disable access enabled. + + tts_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit] + Maximum concurrent text-to-speech/speech-to-speech requests for this API key. Only available for enterprise customers. + + dubbing_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit] + Maximum concurrent dubbing requests for this API key. Only available for enterprise customers. + + music_concurrency_limit : typing.Optional[BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit] + Maximum concurrent music generation requests for this API key. Only available for enterprise customers. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys/{jsonable_encoder(api_key_id)}", + method="PATCH", + json={ + "is_enabled": convert_and_respect_annotation_metadata( + object_=is_enabled, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled, + direction="write", + ), + "name": name, + "permissions": convert_and_respect_annotation_metadata( + object_=permissions, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions, + direction="write", + ), + "character_limit": convert_and_respect_annotation_metadata( + object_=character_limit, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit, + direction="write", + ), + "allowed_ips": convert_and_respect_annotation_metadata( + object_=allowed_ips, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps, + direction="write", + ), + "third_party_disable_allowed": convert_and_respect_annotation_metadata( + object_=third_party_disable_allowed, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed, + direction="write", + ), + "tts_concurrency_limit": convert_and_respect_annotation_metadata( + object_=tts_concurrency_limit, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit, + direction="write", + ), + "dubbing_concurrency_limit": convert_and_respect_annotation_metadata( + object_=dubbing_concurrency_limit, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit, + direction="write", + ), + "music_concurrency_limit": convert_and_respect_annotation_metadata( + object_=music_concurrency_limit, + annotation=BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit, + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def disable( + self, service_account_user_id: str, api_key_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Disable an existing API key for a service account without changing its other settings. This stays available after a workspace downgrades off a plan that includes service accounts. Turning the key back on still requires that plan. + + Parameters + ---------- + service_account_user_id : str + + api_key_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/service-accounts/{jsonable_encoder(service_account_user_id)}/api-keys/{jsonable_encoder(api_key_id)}/disable", + method="POST", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/__init__.py b/data/src/elevenlabs/service_accounts/api_keys/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..51f0a9105006c331d4915bbb500dcb5be4fd26ae --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/__init__.py @@ -0,0 +1,80 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_create_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_post_permissions import ( + BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions, + ) + from .body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_allowed_ips import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps, + ) + from .body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_character_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit, + ) + from .body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_dubbing_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit, + ) + from .body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_is_enabled import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled, + ) + from .body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_music_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit, + ) + from .body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_permissions import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions, + ) + from .body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_third_party_disable_allowed import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed, + ) + from .body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_tts_concurrency_limit import ( + BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions": ".body_create_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_post_permissions", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps": ".body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_allowed_ips", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit": ".body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_character_limit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit": ".body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_dubbing_concurrency_limit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled": ".body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_is_enabled", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit": ".body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_music_concurrency_limit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions": ".body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_permissions", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed": ".body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_third_party_disable_allowed", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit": ".body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_tts_concurrency_limit", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed", + "BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit", +] diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_create_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_post_permissions.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_create_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_post_permissions.py new file mode 100644 index 0000000000000000000000000000000000000000..691218683a4cc82e985853c7f19d8a5daa059582 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_create_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_post_permissions.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.permission_type import PermissionType + +BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPostPermissions = typing.Union[ + typing.List[PermissionType], typing.Literal["all"] +] diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_allowed_ips.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_allowed_ips.py new file mode 100644 index 0000000000000000000000000000000000000000..5938128fcc4408a11a686bc96d2ad166f0438563 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_allowed_ips.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps = typing.Union[ + typing.List[str], typing.Literal["clear"], typing.Literal["no_update"] +] diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_character_limit.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_character_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..4db55d7429379225ec93ec42b1549649c62449bd --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_character_limit.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchCharacterLimit = typing.Union[ + int, typing.Literal["clear"], typing.Literal["no_update"] +] diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_dubbing_concurrency_limit.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_dubbing_concurrency_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..631d8a843b4793750a5953ab5ebd93217f7a6200 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_dubbing_concurrency_limit.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchDubbingConcurrencyLimit = ( + typing.Union[int, typing.Literal["clear"], typing.Literal["no_update"]] +) diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_is_enabled.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_is_enabled.py new file mode 100644 index 0000000000000000000000000000000000000000..babb495d9fa2f5ff216f22e1488d28e0c1159f5e --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_is_enabled.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchIsEnabled = typing.Union[ + bool, typing.Literal["no_update"] +] diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_music_concurrency_limit.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_music_concurrency_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..c10deccc15fa165ae09246f4cffac23c972f2b27 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_music_concurrency_limit.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchMusicConcurrencyLimit = ( + typing.Union[int, typing.Literal["clear"], typing.Literal["no_update"]] +) diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_permissions.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_permissions.py new file mode 100644 index 0000000000000000000000000000000000000000..8349e4113cb61ba70b7cf82c67c34ab0f080bde3 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_permissions.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.permission_type import PermissionType + +BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchPermissions = typing.Union[ + typing.List[PermissionType], typing.Literal["all"], typing.Literal["no_update"] +] diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_third_party_disable_allowed.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_third_party_disable_allowed.py new file mode 100644 index 0000000000000000000000000000000000000000..a1abd2b817ef31340cecbad534887cae188e056c --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_third_party_disable_allowed.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchThirdPartyDisableAllowed = ( + typing.Union[bool, typing.Literal["clear"], typing.Literal["no_update"]] +) diff --git a/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_tts_concurrency_limit.py b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_tts_concurrency_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..d456b7cc022d297b244e32496b705a4aced2f98e --- /dev/null +++ b/data/src/elevenlabs/service_accounts/api_keys/types/body_edit_service_account_api_key_v_1_service_accounts_service_account_user_id_api_keys_api_key_id_patch_tts_concurrency_limit.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchTtsConcurrencyLimit = typing.Union[ + int, typing.Literal["clear"], typing.Literal["no_update"] +] diff --git a/data/src/elevenlabs/service_accounts/client.py b/data/src/elevenlabs/service_accounts/client.py new file mode 100644 index 0000000000000000000000000000000000000000..f7c81d3819703cf29f6e897d20c1378d0ac30bf6 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/client.py @@ -0,0 +1,223 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.default_sharing_group_config import DefaultSharingGroupConfig +from ..types.workspace_create_service_account_response_model import WorkspaceCreateServiceAccountResponseModel +from ..types.workspace_service_account_list_response_model import WorkspaceServiceAccountListResponseModel +from .raw_client import AsyncRawServiceAccountsClient, RawServiceAccountsClient + +if typing.TYPE_CHECKING: + from .api_keys.client import ApiKeysClient, AsyncApiKeysClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ServiceAccountsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawServiceAccountsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._api_keys: typing.Optional[ApiKeysClient] = None + + @property + def with_raw_response(self) -> RawServiceAccountsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawServiceAccountsClient + """ + return self._raw_client + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> WorkspaceServiceAccountListResponseModel: + """ + List all service accounts in the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceServiceAccountListResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.service_accounts.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def create( + self, + *, + name: str, + default_sharing_groups: typing.Optional[typing.Sequence[DefaultSharingGroupConfig]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceCreateServiceAccountResponseModel: + """ + Create a new service account in the workspace. By default, a workspace can have up to 20 service accounts. Enterprise customers may request an increase to this limit, up to 100. + + Parameters + ---------- + name : str + + default_sharing_groups : typing.Optional[typing.Sequence[DefaultSharingGroupConfig]] + List of groups with their permission levels to share with by default. Each entry should specify a group_id and a permission_level (admin, editor, or viewer). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceCreateServiceAccountResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.service_accounts.create( + name="name", + ) + """ + _response = self._raw_client.create( + name=name, default_sharing_groups=default_sharing_groups, request_options=request_options + ) + return _response.data + + @property + def api_keys(self): + if self._api_keys is None: + from .api_keys.client import ApiKeysClient # noqa: E402 + + self._api_keys = ApiKeysClient(client_wrapper=self._client_wrapper) + return self._api_keys + + +class AsyncServiceAccountsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawServiceAccountsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._api_keys: typing.Optional[AsyncApiKeysClient] = None + + @property + def with_raw_response(self) -> AsyncRawServiceAccountsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawServiceAccountsClient + """ + return self._raw_client + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> WorkspaceServiceAccountListResponseModel: + """ + List all service accounts in the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceServiceAccountListResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.service_accounts.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, + *, + name: str, + default_sharing_groups: typing.Optional[typing.Sequence[DefaultSharingGroupConfig]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceCreateServiceAccountResponseModel: + """ + Create a new service account in the workspace. By default, a workspace can have up to 20 service accounts. Enterprise customers may request an increase to this limit, up to 100. + + Parameters + ---------- + name : str + + default_sharing_groups : typing.Optional[typing.Sequence[DefaultSharingGroupConfig]] + List of groups with their permission levels to share with by default. Each entry should specify a group_id and a permission_level (admin, editor, or viewer). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceCreateServiceAccountResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.service_accounts.create( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + name=name, default_sharing_groups=default_sharing_groups, request_options=request_options + ) + return _response.data + + @property + def api_keys(self): + if self._api_keys is None: + from .api_keys.client import AsyncApiKeysClient # noqa: E402 + + self._api_keys = AsyncApiKeysClient(client_wrapper=self._client_wrapper) + return self._api_keys diff --git a/data/src/elevenlabs/service_accounts/raw_client.py b/data/src/elevenlabs/service_accounts/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..bbb03b3b49d9ded993242da8e351f6ea8bea2903 --- /dev/null +++ b/data/src/elevenlabs/service_accounts/raw_client.py @@ -0,0 +1,276 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.default_sharing_group_config import DefaultSharingGroupConfig +from ..types.workspace_create_service_account_response_model import WorkspaceCreateServiceAccountResponseModel +from ..types.workspace_service_account_list_response_model import WorkspaceServiceAccountListResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawServiceAccountsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[WorkspaceServiceAccountListResponseModel]: + """ + List all service accounts in the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceServiceAccountListResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/service-accounts", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceServiceAccountListResponseModel, + construct_type( + type_=WorkspaceServiceAccountListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + name: str, + default_sharing_groups: typing.Optional[typing.Sequence[DefaultSharingGroupConfig]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[WorkspaceCreateServiceAccountResponseModel]: + """ + Create a new service account in the workspace. By default, a workspace can have up to 20 service accounts. Enterprise customers may request an increase to this limit, up to 100. + + Parameters + ---------- + name : str + + default_sharing_groups : typing.Optional[typing.Sequence[DefaultSharingGroupConfig]] + List of groups with their permission levels to share with by default. Each entry should specify a group_id and a permission_level (admin, editor, or viewer). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceCreateServiceAccountResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/service-accounts", + method="POST", + json={ + "name": name, + "default_sharing_groups": convert_and_respect_annotation_metadata( + object_=default_sharing_groups, + annotation=typing.Sequence[DefaultSharingGroupConfig], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceCreateServiceAccountResponseModel, + construct_type( + type_=WorkspaceCreateServiceAccountResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawServiceAccountsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[WorkspaceServiceAccountListResponseModel]: + """ + List all service accounts in the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceServiceAccountListResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/service-accounts", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceServiceAccountListResponseModel, + construct_type( + type_=WorkspaceServiceAccountListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + name: str, + default_sharing_groups: typing.Optional[typing.Sequence[DefaultSharingGroupConfig]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[WorkspaceCreateServiceAccountResponseModel]: + """ + Create a new service account in the workspace. By default, a workspace can have up to 20 service accounts. Enterprise customers may request an increase to this limit, up to 100. + + Parameters + ---------- + name : str + + default_sharing_groups : typing.Optional[typing.Sequence[DefaultSharingGroupConfig]] + List of groups with their permission levels to share with by default. Each entry should specify a group_id and a permission_level (admin, editor, or viewer). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceCreateServiceAccountResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/service-accounts", + method="POST", + json={ + "name": name, + "default_sharing_groups": convert_and_respect_annotation_metadata( + object_=default_sharing_groups, + annotation=typing.Sequence[DefaultSharingGroupConfig], + direction="write", + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceCreateServiceAccountResponseModel, + construct_type( + type_=WorkspaceCreateServiceAccountResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/speech_engine/__init__.py b/data/src/elevenlabs/speech_engine/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7b613d7db748ac967861d81d1948a0213aaaef7d --- /dev/null +++ b/data/src/elevenlabs/speech_engine/__init__.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +"""ElevenLabs Speech Engine SDK module.""" + +from .resource import SpeechEngineResource, verify_speech_engine_jwt +from .server import SpeechEngineServer +from .session import SpeechEngineSession +from .types import ( + CLOSE, + DISCONNECTED, + ERROR, + INIT, + USER_TRANSCRIPT, + ConversationMessage, + WebSocketLike, +) + +__all__ = [ + "ConversationMessage", + "SpeechEngineResource", + "SpeechEngineServer", + "SpeechEngineSession", + "WebSocketLike", + "verify_speech_engine_jwt", + "CLOSE", + "DISCONNECTED", + "ERROR", + "INIT", + "USER_TRANSCRIPT", +] diff --git a/data/src/elevenlabs/speech_engine/client.py b/data/src/elevenlabs/speech_engine/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7b3f2fb7d33dc9f0bf015f58f50491359405e983 --- /dev/null +++ b/data/src/elevenlabs/speech_engine/client.py @@ -0,0 +1,680 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.agent_call_limits import AgentCallLimits +from ..types.agent_sort_by import AgentSortBy +from ..types.asr_conversational_config import AsrConversationalConfig +from ..types.base_turn_config import BaseTurnConfig +from ..types.conversation_config_input import ConversationConfigInput +from ..types.list_speech_engines_response import ListSpeechEnginesResponse +from ..types.privacy_config_input import PrivacyConfigInput +from ..types.sort_direction import SortDirection +from ..types.speech_engine_config import SpeechEngineConfig +from ..types.speech_engine_conversation_initiation_client_data_config import SpeechEngineConversationInitiationClientDataConfig +from ..types.speech_engine_response import SpeechEngineResponse +from ..types.tts_conversational_config_input import TtsConversationalConfigInput +from .raw_client import AsyncRawSpeechEngineClient, RawSpeechEngineClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SpeechEngineClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSpeechEngineClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSpeechEngineClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSpeechEngineClient + """ + return self._raw_client + + def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[AgentSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListSpeechEnginesResponse: + """ + Returns a paginated list of Speech Engine resources. + + Parameters + ---------- + page_size : typing.Optional[int] + How many Speech Engines to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search term to filter Speech Engines by name + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[AgentSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListSpeechEnginesResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_engine.list( + page_size=1, + search="search", + sort_direction="asc", + sort_by="name", + cursor="cursor", + ) + """ + _response = self._raw_client.list( + page_size=page_size, + search=search, + sort_direction=sort_direction, + sort_by=sort_by, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + def create( + self, + *, + speech_engine: SpeechEngineConfig, + name: typing.Optional[str] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResponse: + """ + Create a new Speech Engine resource + + Parameters + ---------- + speech_engine : SpeechEngineConfig + Speech engine WebSocket configuration + + name : typing.Optional[str] + Name of the speech engine + + asr : typing.Optional[AsrConversationalConfig] + ASR configuration + + tts : typing.Optional[TtsConversationalConfigInput] + TTS configuration + + turn : typing.Optional[BaseTurnConfig] + Turn detection configuration + + conversation : typing.Optional[ConversationConfigInput] + Conversation configuration (client events, etc.) + + privacy : typing.Optional[PrivacyConfigInput] + Privacy settings (recording, retention, zero retention mode) + + call_limits : typing.Optional[AgentCallLimits] + Concurrency and daily conversation limits for this speech engine + + language : typing.Optional[str] + Language for the speech engine + + tags : typing.Optional[typing.Sequence[str]] + Tags for categorization + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechEngineResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, SpeechEngineConfig + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_engine.create( + speech_engine=SpeechEngineConfig( + ws_url="ws_url", + ), + ) + """ + _response = self._raw_client.create( + speech_engine=speech_engine, + name=name, + asr=asr, + tts=tts, + turn=turn, + conversation=conversation, + privacy=privacy, + call_limits=call_limits, + language=language, + tags=tags, + overrides=overrides, + request_options=request_options, + ) + return _response.data + + def get( + self, speech_engine_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SpeechEngineResponse: + """ + Retrieve a Speech Engine resource + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechEngineResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_engine.get( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + """ + _response = self._raw_client.get(speech_engine_id, request_options=request_options) + return _response.data + + def delete(self, speech_engine_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a Speech Engine resource + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_engine.delete( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + """ + _response = self._raw_client.delete(speech_engine_id, request_options=request_options) + return _response.data + + def update( + self, + speech_engine_id: str, + *, + name: typing.Optional[str] = OMIT, + speech_engine: typing.Optional[SpeechEngineConfig] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResponse: + """ + Update a Speech Engine resource (partial update) + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + name : typing.Optional[str] + + speech_engine : typing.Optional[SpeechEngineConfig] + + asr : typing.Optional[AsrConversationalConfig] + + tts : typing.Optional[TtsConversationalConfigInput] + + turn : typing.Optional[BaseTurnConfig] + + conversation : typing.Optional[ConversationConfigInput] + + privacy : typing.Optional[PrivacyConfigInput] + + call_limits : typing.Optional[AgentCallLimits] + + language : typing.Optional[str] + + tags : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechEngineResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_engine.update( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + """ + _response = self._raw_client.update( + speech_engine_id, + name=name, + speech_engine=speech_engine, + asr=asr, + tts=tts, + turn=turn, + conversation=conversation, + privacy=privacy, + call_limits=call_limits, + language=language, + tags=tags, + request_options=request_options, + ) + return _response.data + + +class AsyncSpeechEngineClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSpeechEngineClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSpeechEngineClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSpeechEngineClient + """ + return self._raw_client + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[AgentSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ListSpeechEnginesResponse: + """ + Returns a paginated list of Speech Engine resources. + + Parameters + ---------- + page_size : typing.Optional[int] + How many Speech Engines to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search term to filter Speech Engines by name + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[AgentSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListSpeechEnginesResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_engine.list( + page_size=1, + search="search", + sort_direction="asc", + sort_by="name", + cursor="cursor", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + page_size=page_size, + search=search, + sort_direction=sort_direction, + sort_by=sort_by, + cursor=cursor, + request_options=request_options, + ) + return _response.data + + async def create( + self, + *, + speech_engine: SpeechEngineConfig, + name: typing.Optional[str] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResponse: + """ + Create a new Speech Engine resource + + Parameters + ---------- + speech_engine : SpeechEngineConfig + Speech engine WebSocket configuration + + name : typing.Optional[str] + Name of the speech engine + + asr : typing.Optional[AsrConversationalConfig] + ASR configuration + + tts : typing.Optional[TtsConversationalConfigInput] + TTS configuration + + turn : typing.Optional[BaseTurnConfig] + Turn detection configuration + + conversation : typing.Optional[ConversationConfigInput] + Conversation configuration (client events, etc.) + + privacy : typing.Optional[PrivacyConfigInput] + Privacy settings (recording, retention, zero retention mode) + + call_limits : typing.Optional[AgentCallLimits] + Concurrency and daily conversation limits for this speech engine + + language : typing.Optional[str] + Language for the speech engine + + tags : typing.Optional[typing.Sequence[str]] + Tags for categorization + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechEngineResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, SpeechEngineConfig + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_engine.create( + speech_engine=SpeechEngineConfig( + ws_url="ws_url", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + speech_engine=speech_engine, + name=name, + asr=asr, + tts=tts, + turn=turn, + conversation=conversation, + privacy=privacy, + call_limits=call_limits, + language=language, + tags=tags, + overrides=overrides, + request_options=request_options, + ) + return _response.data + + async def get( + self, speech_engine_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SpeechEngineResponse: + """ + Retrieve a Speech Engine resource + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechEngineResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_engine.get( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(speech_engine_id, request_options=request_options) + return _response.data + + async def delete(self, speech_engine_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Delete a Speech Engine resource + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_engine.delete( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(speech_engine_id, request_options=request_options) + return _response.data + + async def update( + self, + speech_engine_id: str, + *, + name: typing.Optional[str] = OMIT, + speech_engine: typing.Optional[SpeechEngineConfig] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResponse: + """ + Update a Speech Engine resource (partial update) + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + name : typing.Optional[str] + + speech_engine : typing.Optional[SpeechEngineConfig] + + asr : typing.Optional[AsrConversationalConfig] + + tts : typing.Optional[TtsConversationalConfigInput] + + turn : typing.Optional[BaseTurnConfig] + + conversation : typing.Optional[ConversationConfigInput] + + privacy : typing.Optional[PrivacyConfigInput] + + call_limits : typing.Optional[AgentCallLimits] + + language : typing.Optional[str] + + tags : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechEngineResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_engine.update( + speech_engine_id="seng_3701k3ttaq12ewp8b7qv5rfyszkz", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + speech_engine_id, + name=name, + speech_engine=speech_engine, + asr=asr, + tts=tts, + turn=turn, + conversation=conversation, + privacy=privacy, + call_limits=call_limits, + language=language, + tags=tags, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/speech_engine/raw_client.py b/data/src/elevenlabs/speech_engine/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d991374afaf16129df6b297cef9923d321fd8372 --- /dev/null +++ b/data/src/elevenlabs/speech_engine/raw_client.py @@ -0,0 +1,846 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.agent_call_limits import AgentCallLimits +from ..types.agent_sort_by import AgentSortBy +from ..types.asr_conversational_config import AsrConversationalConfig +from ..types.base_turn_config import BaseTurnConfig +from ..types.conversation_config_input import ConversationConfigInput +from ..types.list_speech_engines_response import ListSpeechEnginesResponse +from ..types.privacy_config_input import PrivacyConfigInput +from ..types.sort_direction import SortDirection +from ..types.speech_engine_config import SpeechEngineConfig +from ..types.speech_engine_conversation_initiation_client_data_config import SpeechEngineConversationInitiationClientDataConfig +from ..types.speech_engine_response import SpeechEngineResponse +from ..types.tts_conversational_config_input import TtsConversationalConfigInput + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSpeechEngineClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[AgentSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ListSpeechEnginesResponse]: + """ + Returns a paginated list of Speech Engine resources. + + Parameters + ---------- + page_size : typing.Optional[int] + How many Speech Engines to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search term to filter Speech Engines by name + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[AgentSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListSpeechEnginesResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/speech-engine", + method="GET", + params={ + "page_size": page_size, + "search": search, + "sort_direction": sort_direction, + "sort_by": sort_by, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListSpeechEnginesResponse, + construct_type( + type_=ListSpeechEnginesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + speech_engine: SpeechEngineConfig, + name: typing.Optional[str] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SpeechEngineResponse]: + """ + Create a new Speech Engine resource + + Parameters + ---------- + speech_engine : SpeechEngineConfig + Speech engine WebSocket configuration + + name : typing.Optional[str] + Name of the speech engine + + asr : typing.Optional[AsrConversationalConfig] + ASR configuration + + tts : typing.Optional[TtsConversationalConfigInput] + TTS configuration + + turn : typing.Optional[BaseTurnConfig] + Turn detection configuration + + conversation : typing.Optional[ConversationConfigInput] + Conversation configuration (client events, etc.) + + privacy : typing.Optional[PrivacyConfigInput] + Privacy settings (recording, retention, zero retention mode) + + call_limits : typing.Optional[AgentCallLimits] + Concurrency and daily conversation limits for this speech engine + + language : typing.Optional[str] + Language for the speech engine + + tags : typing.Optional[typing.Sequence[str]] + Tags for categorization + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeechEngineResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/speech-engine", + method="POST", + json={ + "name": name, + "speech_engine": convert_and_respect_annotation_metadata( + object_=speech_engine, annotation=SpeechEngineConfig, direction="write" + ), + "asr": convert_and_respect_annotation_metadata( + object_=asr, annotation=AsrConversationalConfig, direction="write" + ), + "tts": convert_and_respect_annotation_metadata( + object_=tts, annotation=TtsConversationalConfigInput, direction="write" + ), + "turn": convert_and_respect_annotation_metadata( + object_=turn, annotation=BaseTurnConfig, direction="write" + ), + "conversation": convert_and_respect_annotation_metadata( + object_=conversation, annotation=ConversationConfigInput, direction="write" + ), + "privacy": convert_and_respect_annotation_metadata( + object_=privacy, annotation=PrivacyConfigInput, direction="write" + ), + "call_limits": convert_and_respect_annotation_metadata( + object_=call_limits, annotation=AgentCallLimits, direction="write" + ), + "language": language, + "tags": tags, + "overrides": convert_and_respect_annotation_metadata( + object_=overrides, annotation=SpeechEngineConversationInitiationClientDataConfig, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechEngineResponse, + construct_type( + type_=SpeechEngineResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, speech_engine_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SpeechEngineResponse]: + """ + Retrieve a Speech Engine resource + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeechEngineResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/speech-engine/{jsonable_encoder(speech_engine_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechEngineResponse, + construct_type( + type_=SpeechEngineResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, speech_engine_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[None]: + """ + Delete a Speech Engine resource + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/speech-engine/{jsonable_encoder(speech_engine_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + speech_engine_id: str, + *, + name: typing.Optional[str] = OMIT, + speech_engine: typing.Optional[SpeechEngineConfig] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SpeechEngineResponse]: + """ + Update a Speech Engine resource (partial update) + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + name : typing.Optional[str] + + speech_engine : typing.Optional[SpeechEngineConfig] + + asr : typing.Optional[AsrConversationalConfig] + + tts : typing.Optional[TtsConversationalConfigInput] + + turn : typing.Optional[BaseTurnConfig] + + conversation : typing.Optional[ConversationConfigInput] + + privacy : typing.Optional[PrivacyConfigInput] + + call_limits : typing.Optional[AgentCallLimits] + + language : typing.Optional[str] + + tags : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeechEngineResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/speech-engine/{jsonable_encoder(speech_engine_id)}", + method="PATCH", + json={ + "name": name, + "speech_engine": convert_and_respect_annotation_metadata( + object_=speech_engine, annotation=SpeechEngineConfig, direction="write" + ), + "asr": convert_and_respect_annotation_metadata( + object_=asr, annotation=AsrConversationalConfig, direction="write" + ), + "tts": convert_and_respect_annotation_metadata( + object_=tts, annotation=TtsConversationalConfigInput, direction="write" + ), + "turn": convert_and_respect_annotation_metadata( + object_=turn, annotation=BaseTurnConfig, direction="write" + ), + "conversation": convert_and_respect_annotation_metadata( + object_=conversation, annotation=ConversationConfigInput, direction="write" + ), + "privacy": convert_and_respect_annotation_metadata( + object_=privacy, annotation=PrivacyConfigInput, direction="write" + ), + "call_limits": convert_and_respect_annotation_metadata( + object_=call_limits, annotation=AgentCallLimits, direction="write" + ), + "language": language, + "tags": tags, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechEngineResponse, + construct_type( + type_=SpeechEngineResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSpeechEngineClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + sort_direction: typing.Optional[SortDirection] = None, + sort_by: typing.Optional[AgentSortBy] = None, + cursor: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ListSpeechEnginesResponse]: + """ + Returns a paginated list of Speech Engine resources. + + Parameters + ---------- + page_size : typing.Optional[int] + How many Speech Engines to return at maximum. Can not exceed 100, defaults to 30. + + search : typing.Optional[str] + Search term to filter Speech Engines by name + + sort_direction : typing.Optional[SortDirection] + The direction to sort the results + + sort_by : typing.Optional[AgentSortBy] + The field to sort the results by + + cursor : typing.Optional[str] + Used for fetching next page. Cursor is returned in the response. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListSpeechEnginesResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/speech-engine", + method="GET", + params={ + "page_size": page_size, + "search": search, + "sort_direction": sort_direction, + "sort_by": sort_by, + "cursor": cursor, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListSpeechEnginesResponse, + construct_type( + type_=ListSpeechEnginesResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + speech_engine: SpeechEngineConfig, + name: typing.Optional[str] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SpeechEngineResponse]: + """ + Create a new Speech Engine resource + + Parameters + ---------- + speech_engine : SpeechEngineConfig + Speech engine WebSocket configuration + + name : typing.Optional[str] + Name of the speech engine + + asr : typing.Optional[AsrConversationalConfig] + ASR configuration + + tts : typing.Optional[TtsConversationalConfigInput] + TTS configuration + + turn : typing.Optional[BaseTurnConfig] + Turn detection configuration + + conversation : typing.Optional[ConversationConfigInput] + Conversation configuration (client events, etc.) + + privacy : typing.Optional[PrivacyConfigInput] + Privacy settings (recording, retention, zero retention mode) + + call_limits : typing.Optional[AgentCallLimits] + Concurrency and daily conversation limits for this speech engine + + language : typing.Optional[str] + Language for the speech engine + + tags : typing.Optional[typing.Sequence[str]] + Tags for categorization + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeechEngineResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/speech-engine", + method="POST", + json={ + "name": name, + "speech_engine": convert_and_respect_annotation_metadata( + object_=speech_engine, annotation=SpeechEngineConfig, direction="write" + ), + "asr": convert_and_respect_annotation_metadata( + object_=asr, annotation=AsrConversationalConfig, direction="write" + ), + "tts": convert_and_respect_annotation_metadata( + object_=tts, annotation=TtsConversationalConfigInput, direction="write" + ), + "turn": convert_and_respect_annotation_metadata( + object_=turn, annotation=BaseTurnConfig, direction="write" + ), + "conversation": convert_and_respect_annotation_metadata( + object_=conversation, annotation=ConversationConfigInput, direction="write" + ), + "privacy": convert_and_respect_annotation_metadata( + object_=privacy, annotation=PrivacyConfigInput, direction="write" + ), + "call_limits": convert_and_respect_annotation_metadata( + object_=call_limits, annotation=AgentCallLimits, direction="write" + ), + "language": language, + "tags": tags, + "overrides": convert_and_respect_annotation_metadata( + object_=overrides, annotation=SpeechEngineConversationInitiationClientDataConfig, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechEngineResponse, + construct_type( + type_=SpeechEngineResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, speech_engine_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SpeechEngineResponse]: + """ + Retrieve a Speech Engine resource + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeechEngineResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/speech-engine/{jsonable_encoder(speech_engine_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechEngineResponse, + construct_type( + type_=SpeechEngineResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, speech_engine_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Delete a Speech Engine resource + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/speech-engine/{jsonable_encoder(speech_engine_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + speech_engine_id: str, + *, + name: typing.Optional[str] = OMIT, + speech_engine: typing.Optional[SpeechEngineConfig] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SpeechEngineResponse]: + """ + Update a Speech Engine resource (partial update) + + Parameters + ---------- + speech_engine_id : str + The speech engine ID (accepts seng_ or agent_ prefix) + + name : typing.Optional[str] + + speech_engine : typing.Optional[SpeechEngineConfig] + + asr : typing.Optional[AsrConversationalConfig] + + tts : typing.Optional[TtsConversationalConfigInput] + + turn : typing.Optional[BaseTurnConfig] + + conversation : typing.Optional[ConversationConfigInput] + + privacy : typing.Optional[PrivacyConfigInput] + + call_limits : typing.Optional[AgentCallLimits] + + language : typing.Optional[str] + + tags : typing.Optional[typing.Sequence[str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeechEngineResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/speech-engine/{jsonable_encoder(speech_engine_id)}", + method="PATCH", + json={ + "name": name, + "speech_engine": convert_and_respect_annotation_metadata( + object_=speech_engine, annotation=SpeechEngineConfig, direction="write" + ), + "asr": convert_and_respect_annotation_metadata( + object_=asr, annotation=AsrConversationalConfig, direction="write" + ), + "tts": convert_and_respect_annotation_metadata( + object_=tts, annotation=TtsConversationalConfigInput, direction="write" + ), + "turn": convert_and_respect_annotation_metadata( + object_=turn, annotation=BaseTurnConfig, direction="write" + ), + "conversation": convert_and_respect_annotation_metadata( + object_=conversation, annotation=ConversationConfigInput, direction="write" + ), + "privacy": convert_and_respect_annotation_metadata( + object_=privacy, annotation=PrivacyConfigInput, direction="write" + ), + "call_limits": convert_and_respect_annotation_metadata( + object_=call_limits, annotation=AgentCallLimits, direction="write" + ), + "language": language, + "tags": tags, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechEngineResponse, + construct_type( + type_=SpeechEngineResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/speech_engine/resource.py b/data/src/elevenlabs/speech_engine/resource.py new file mode 100644 index 0000000000000000000000000000000000000000..cc43b90cdf7b594b2f3e1e1f848d2e5ecb07449b --- /dev/null +++ b/data/src/elevenlabs/speech_engine/resource.py @@ -0,0 +1,212 @@ +"""SpeechEngineResource — client-facing handle for a speech engine instance.""" + +import base64 +import hashlib +import hmac +import json +import logging +import re +import time +import typing + +from .server import SpeechEngineServer +from .session import SpeechEngineSession +from .types import WebSocketLike +from ..types.speech_engine_response import SpeechEngineResponse + +logger = logging.getLogger("elevenlabs.speech_engine") + +_ISSUER = "https://api.elevenlabs.io/convai/speech-engine" +_SUBJECT = "convai_speech_engine_upstream" +_LEEWAY_SECONDS = 60 +_RESIDENCY_KEY_SUFFIX = re.compile(r"_residency_[a-z0-9]+$") + + +def _normalize_api_key_for_signing(api_key: str) -> str: + """Trim the key and drop any ``_residency_`` suffix. + + The API signs Speech Engine JWTs with the SHA-256 of the *base* key, so a + data-residency key such as ``sk_..._residency_in`` must have its suffix + removed before it is hashed here. + """ + return _RESIDENCY_KEY_SUFFIX.sub("", api_key.strip()) + + +def _base64url_decode(data: str) -> bytes: + padded = data.replace("-", "+").replace("_", "/") + remainder = len(padded) % 4 + if remainder: + padded += "=" * (4 - remainder) + return base64.b64decode(padded) + + +def verify_speech_engine_jwt(value: str, api_key: str) -> typing.Dict[str, typing.Any]: + """Verify an HS256 JWT from the ElevenLabs Speech Engine API. + + The HMAC secret is the SHA-256 hash of the API key. Returns the + decoded payload on success, raises :class:`ValueError` on failure. + """ + token = value.strip() + if token.lower().startswith("bearer "): + token = token[7:].strip() + + parts = token.split(".") + if len(parts) != 3: + raise ValueError("Invalid JWT: expected 3 parts") + + header_b64, payload_b64, signature_b64 = parts + + try: + payload = json.loads(_base64url_decode(payload_b64)) + except Exception: + raise ValueError("Invalid JWT: failed to decode payload") + + secret = hashlib.sha256(_normalize_api_key_for_signing(api_key).encode("utf-8")).digest() + + expected_sig = hmac.new( + secret, f"{header_b64}.{payload_b64}".encode(), hashlib.sha256 + ).digest() + actual_sig = _base64url_decode(signature_b64) + + if not hmac.compare_digest(expected_sig, actual_sig): + raise ValueError( + "Invalid JWT: signature mismatch — make sure the API key used " + "by your Speech Engine server matches the one used to create " + "the engine." + ) + + if payload.get("iss") != _ISSUER: + raise ValueError( + f'Invalid JWT: expected issuer "{_ISSUER}", got "{payload.get("iss")}"' + ) + if payload.get("sub") != _SUBJECT: + raise ValueError( + f'Invalid JWT: expected subject "{_SUBJECT}", got "{payload.get("sub")}"' + ) + + now = int(time.time()) + + exp = payload.get("exp") + if not isinstance(exp, (int, float)): + raise ValueError("Invalid JWT: missing exp claim") + iat = payload.get("iat") + if not isinstance(iat, (int, float)): + raise ValueError("Invalid JWT: missing iat claim") + if exp + _LEEWAY_SECONDS < now: + raise ValueError("Invalid JWT: token has expired") + if iat - _LEEWAY_SECONDS > now: + raise ValueError("Invalid JWT: iat is in the future") + + return payload + + +class SpeechEngineResource: + """Represents a speech engine instance. + + Returned by ``await client.speech_engine.get("seng_123")``. + + Use :meth:`serve` to start a standalone WebSocket server, or + :meth:`create_session` to wrap an existing WebSocket for custom + server integration (FastAPI, Starlette, etc.). + + Example:: + + engine = await elevenlabs.speech_engine.get("seng_123") + + async def on_transcript(transcript, session): + stream = await openai.responses.create(...) + await session.send_response(stream) + + await engine.serve( + port=3001, + debug=True, + on_transcript=on_transcript, + ) + """ + + def __init__( + self, + engine_id: str, + client_wrapper: typing.Any = None, + response: typing.Optional[SpeechEngineResponse] = None, + ) -> None: + self.engine_id = engine_id + self._client_wrapper = client_wrapper + + # Full API response, accessible as engine.config.asr, engine.config.overrides, etc. + # None when the resource is constructed directly without an API call. + self.config: typing.Optional[SpeechEngineResponse] = response + + def _get_api_key(self) -> typing.Optional[str]: + if self._client_wrapper is None: + return None + headers = self._client_wrapper.get_headers() + return headers.get("xi-api-key") + + def verify_request( + self, headers: typing.Dict[str, typing.Any] + ) -> bool: + """Verify that an incoming request is from the ElevenLabs API. + + Checks the ``X-Elevenlabs-Speech-Engine-Authorization`` header + for a valid JWT signed with the SHA-256 hash of the API key. + + Only needed when managing the WebSocket upgrade yourself. + When using :meth:`serve`, verification is handled automatically. + """ + api_key = self._get_api_key() + if not api_key: + return False + raw = headers.get("x-elevenlabs-speech-engine-authorization") + if isinstance(raw, list): + raw = raw[0] if raw else None + if not raw: + return False + try: + verify_speech_engine_jwt(raw, api_key) + return True + except ValueError: + return False + + async def serve( + self, + *, + port: int = 3001, + path: typing.Optional[str] = None, + debug: bool = False, + disable_auth: bool = False, + **handlers: typing.Any, + ) -> None: + """Start a standalone WebSocket server. Blocks until stopped. + + :param disable_auth: If ``True``, skip verification of the + ``X-Elevenlabs-Speech-Engine-Authorization`` JWT on incoming + connections. **Insecure** — only enable this if the server is + protected by an IP allowlist scoped to ElevenLabs' egress + ranges. Without one, anyone on the internet can open a session + and consume your compute and downstream LLM quota. + """ + api_key = self._get_api_key() + server = SpeechEngineServer( + port=port, + path=path, + debug=debug, + api_key=api_key, + disable_auth=disable_auth, + **handlers, + ) + await server.serve() + + def create_session( + self, + ws: WebSocketLike, + *, + debug: bool = False, + ) -> SpeechEngineSession: + """Wrap *ws* in a :class:`SpeechEngineSession`. + + Use this for custom server integration (e.g. FastAPI, Starlette). + Wire handlers via :meth:`~SpeechEngineSession.on` then ``await + session.run()``. + """ + return SpeechEngineSession(ws, debug=debug) diff --git a/data/src/elevenlabs/speech_engine/server.py b/data/src/elevenlabs/speech_engine/server.py new file mode 100644 index 0000000000000000000000000000000000000000..9de53490c74e6cd92f19812cb80ff8ff21f09d3e --- /dev/null +++ b/data/src/elevenlabs/speech_engine/server.py @@ -0,0 +1,168 @@ +"""SpeechEngineServer — standalone WebSocket server for Speech Engine.""" + +import asyncio +import http +import os +import typing +import warnings + +from .session import SpeechEngineSession, _make_log, _wire_handlers +from .types import WebSocketLike + + +class SpeechEngineServer: + """Standalone WebSocket server that produces :class:`SpeechEngineSession` + instances for each incoming connection from the ElevenLabs Speech Engine + API. + + Every incoming connection is verified against the ElevenLabs API using + the configured API key before being accepted, unless ``disable_auth`` is + set to ``True``. + + Example:: + + server = SpeechEngineServer( + port=3001, + api_key="sk_...", + debug=True, + on_transcript=handle_transcript, + ) + await server.serve() + """ + + def __init__( + self, + *, + port: int = 3001, + path: typing.Optional[str] = None, + api_key: typing.Optional[str] = None, + debug: bool = False, + disable_auth: bool = False, + **handlers: typing.Any, + ) -> None: + """Initialize a Speech Engine server. + + :param disable_auth: If ``True``, skip verification of the + ``X-Elevenlabs-Speech-Engine-Authorization`` JWT on incoming + connections. **Insecure** — only enable this if the server is + protected by an IP allowlist scoped to ElevenLabs' egress + ranges. Without one, anyone on the internet can open a session + and consume your compute and downstream LLM quota. + """ + self._port = port + self._path = path + self._api_key = api_key + self._debug = debug + self._disable_auth = disable_auth + self._handlers = handlers + self._stop_event = None # type: typing.Optional[asyncio.Event] + self._server = None # type: typing.Any + self._log = _make_log(debug) + + def handle_connection(self, ws: WebSocketLike) -> SpeechEngineSession: + """Wrap *ws* in a :class:`SpeechEngineSession` with the server's + handlers wired up. + + Use this when you manage your own WebSocket server and want to wrap + individual connections. The returned session's :meth:`run` must + still be awaited by the caller. + """ + self._log("creating new session") + session = SpeechEngineSession(ws, debug=self._debug) + _wire_handlers(session, self._handlers) + return session + + async def serve(self) -> None: + """Start the WebSocket server. Blocks until :meth:`stop` is called.""" + from .resource import verify_speech_engine_jwt # noqa: E402 + + # Use the new asyncio API explicitly: `websockets.serve` was still + # the legacy server on websockets 13.x and only became the asyncio + # one in 14.0. The process_request callback below relies on the + # asyncio signature (connection, request) and connection.respond(). + from websockets.asyncio.server import serve as _ws_serve # noqa: E402 + + api_key = self._api_key or os.environ.get("ELEVENLABS_API_KEY") + if not api_key and not self._disable_auth: + raise RuntimeError( + "SpeechEngineServer requires an API key to verify incoming " + "connections. Pass api_key= or set the ELEVENLABS_API_KEY " + "environment variable. To run without authentication, pass " + "disable_auth=True — but only behind an IP allowlist." + ) + + if self._disable_auth: + warnings.warn( + "SpeechEngineServer: authentication is disabled — incoming " + "connections will NOT be verified. Make sure the server is " + "protected by either IP allowlist restricting traffic to " + "ElevenLabs or custom header values.", + UserWarning, + stacklevel=2, + ) + + self._stop_event = asyncio.Event() + + def _process_request( + connection: typing.Any, request: typing.Any + ) -> typing.Any: + if self._path is not None and request.path != self._path: + self._log( + "rejected connection — path mismatch: " + "expected %s, got %s", + self._path, + request.path, + ) + return connection.respond( + http.HTTPStatus.NOT_FOUND, "not found\n" + ) + + if self._disable_auth: + return None + + header_value = request.headers.get( + "x-elevenlabs-speech-engine-authorization" + ) + if not header_value: + self._log( + "rejected connection — missing " + "X-Elevenlabs-Speech-Engine-Authorization header" + ) + return connection.respond( + http.HTTPStatus.UNAUTHORIZED, + "missing authorization header\n", + ) + + try: + verify_speech_engine_jwt(header_value, typing.cast(str, api_key)) + except ValueError as e: + self._log("rejected connection — %s", e) + return connection.respond( + http.HTTPStatus.UNAUTHORIZED, + "authorization failed\n", + ) + + return None + + async def _handler(websocket: typing.Any) -> None: + self._log("verified connection, accepting WebSocket") + session = self.handle_connection(websocket) + await session.run() + + self._server = await _ws_serve( + _handler, + "", + self._port, + process_request=_process_request, + ) + self._log("speech engine server listening on port %d", self._port) + try: + await self._stop_event.wait() + finally: + self._server.close() + await self._server.wait_closed() + + async def stop(self) -> None: + """Signal the server to shut down gracefully.""" + if self._stop_event is not None: + self._stop_event.set() diff --git a/data/src/elevenlabs/speech_engine/session.py b/data/src/elevenlabs/speech_engine/session.py new file mode 100644 index 0000000000000000000000000000000000000000..3279a966af4a846fc5e844fd5ba627257275b9ef --- /dev/null +++ b/data/src/elevenlabs/speech_engine/session.py @@ -0,0 +1,533 @@ +"""SpeechEngineSession — WebSocket session for Speech Engine conversations.""" + +import asyncio +import json +import logging +import typing + +from .types import ConversationMessage, WebSocketLike, wrap_websocket + +logger = logging.getLogger("elevenlabs.speech_engine") + + +def _make_log( + debug: bool, +) -> typing.Callable[..., None]: + """Return a per-instance log function, mirroring the JS SDK pattern.""" + if debug: + def _log(msg: str, *args: typing.Any) -> None: + print("[SpeechEngine]", msg % args if args else msg) + return _log + return lambda *_args, **_kw: None + +Callback = typing.Callable[..., typing.Any] + + +# --------------------------------------------------------------------------- +# LLM stream text extraction +# --------------------------------------------------------------------------- + + +def _get(obj: typing.Any, key: str) -> typing.Any: + """Attribute-or-key access helper for LLM stream chunks.""" + if isinstance(obj, dict): + return obj.get(key) + return getattr(obj, key, None) + + +def _extract_text(chunk: typing.Any) -> typing.Optional[str]: + """Extract text content from an LLM stream chunk. + + Handles plain strings and common LLM streaming formats: + + - OpenAI Responses API (``response.output_text.delta``) + - OpenAI Chat Completions API (``choices[0].delta.content``) + - Anthropic Messages API (``content_block_delta`` with ``text_delta``) + - Google Gemini API (``candidates[0].content.parts[0].text``) + """ + if isinstance(chunk, str): + return chunk + if chunk is None or isinstance(chunk, (int, float, bool)): + return None + + # OpenAI Responses API + if _get(chunk, "type") == "response.output_text.delta": + delta = _get(chunk, "delta") + if isinstance(delta, str): + return delta + + # OpenAI Chat Completions API + choices = _get(chunk, "choices") + if isinstance(choices, (list, tuple)) and len(choices) > 0: + delta = _get(choices[0], "delta") + if delta is not None: + content = _get(delta, "content") + if isinstance(content, str): + return content + + # Anthropic Messages API + if _get(chunk, "type") == "content_block_delta": + delta = _get(chunk, "delta") + if delta is not None: + if _get(delta, "type") == "text_delta": + text = _get(delta, "text") + if isinstance(text, str): + return text + + # Google Gemini API + candidates = _get(chunk, "candidates") + if isinstance(candidates, (list, tuple)) and len(candidates) > 0: + content = _get(candidates[0], "content") + if content is not None: + parts = _get(content, "parts") + if isinstance(parts, (list, tuple)) and len(parts) > 0: + text = _get(parts[0], "text") + if isinstance(text, str): + return text + + return None + + +# --------------------------------------------------------------------------- +# Handler wiring (kwargs -> event emitter) +# --------------------------------------------------------------------------- + + +def _wire_handlers( + session: "SpeechEngineSession", + handlers: typing.Dict[str, typing.Any], +) -> None: + """Wire keyword-argument handlers onto *session* events.""" + on_init = handlers.get("on_init") + on_transcript = handlers.get("on_transcript") + on_close = handlers.get("on_close") + on_disconnect = handlers.get("on_disconnect") + on_error = handlers.get("on_error") + + if on_init: + async def _init_handler(conversation_id: str) -> None: + result = on_init(conversation_id, session) + if asyncio.iscoroutine(result): + await result + session.on("init", _init_handler) + + if on_transcript: + async def _transcript_handler( + transcript: typing.List[ConversationMessage], + ) -> None: + result = on_transcript(transcript, session) + if asyncio.iscoroutine(result): + await result + session.on("user_transcript", _transcript_handler) + + if on_close: + async def _close_handler() -> None: + result = on_close(session) + if asyncio.iscoroutine(result): + await result + session.on("close", _close_handler) + + if on_disconnect: + async def _disconnect_handler() -> None: + result = on_disconnect(session) + if asyncio.iscoroutine(result): + await result + session.on("disconnected", _disconnect_handler) + + if on_error: + async def _error_handler(err: Exception) -> None: + result = on_error(err, session) + if asyncio.iscoroutine(result): + await result + session.on("error", _error_handler) + + +# --------------------------------------------------------------------------- +# SpeechEngineSession +# --------------------------------------------------------------------------- + + +class SpeechEngineSession: + """Wraps a WebSocket connection from the ElevenLabs Speech Engine API. + + Each connection represents one conversation. The session emits events + for transcripts and lifecycle changes, and provides methods to send LLM + responses back. When a new transcript arrives the previous transcript's + handler task is cancelled automatically, interrupting any in-flight LLM + call. + + Example:: + + session = SpeechEngineSession(ws, debug=True) + + async def handle(transcript): + stream = await openai.responses.create(...) + await session.send_response(stream) + + session.on("user_transcript", handle) + await session.run() + """ + + def __init__( + self, + ws: typing.Any, + *, + debug: bool = False, + ) -> None: + self._ws = wrap_websocket(ws) + self._conversation_id = None # type: typing.Optional[str] + self._current_task = None # type: typing.Optional[asyncio.Task] # type: ignore[type-arg] + self._current_event_id = None # type: typing.Optional[int] + self._in_transcript_handler = False + self._closed = False + self._event_handlers = {} # type: typing.Dict[str, typing.List[Callback]] + self._once_handlers = {} # type: typing.Dict[str, typing.List[Callback]] + self._log = _make_log(debug) + + # ------------------------------------------------------------------ + # Event emitter interface + # ------------------------------------------------------------------ + + def on(self, event: str, handler: Callback) -> "SpeechEngineSession": + """Register *handler* for *event*.""" + self._event_handlers.setdefault(event, []).append(handler) + return self + + def off(self, event: str, handler: Callback) -> "SpeechEngineSession": + """Remove *handler* from *event*.""" + handlers = self._event_handlers.get(event, []) + try: + handlers.remove(handler) + except ValueError: + pass + return self + + def once(self, event: str, handler: Callback) -> "SpeechEngineSession": + """Register *handler* for *event*, removed after the first call.""" + self._once_handlers.setdefault(event, []).append(handler) + return self + + # ------------------------------------------------------------------ + # Properties + # ------------------------------------------------------------------ + + @property + def conversation_id(self) -> typing.Optional[str]: + """The conversation ID assigned by the Speech Engine API. + + Available after the ``init`` event fires. + """ + return self._conversation_id + + @property + def is_open(self) -> bool: + """Whether the session is still open.""" + return not self._closed + + # ------------------------------------------------------------------ + # Main message loop + # ------------------------------------------------------------------ + + async def run(self) -> None: + """Run the receive loop until the WebSocket closes. + + This is the main entry point after constructing a session. It + processes incoming messages and dispatches events to registered + handlers. + """ + try: + while not self._closed: + try: + raw = await self._ws.recv() + except asyncio.CancelledError: + raise + except Exception: + self._log("WebSocket connection lost") + break + + try: + if isinstance(raw, bytes): + raw = raw.decode("utf-8") + msg = json.loads(raw) + except (ValueError, TypeError, UnicodeDecodeError) as e: + await self._emit("error", e) + continue + + if not isinstance(msg, dict): + await self._emit( + "error", + ValueError(f"expected JSON object, got {type(msg).__name__}"), + ) + continue + + await self._handle_message(msg) + except asyncio.CancelledError: + raise + finally: + if not self._closed: + self._closed = True + await self._cancel_current_and_wait() + await self._emit("disconnected") + + # ------------------------------------------------------------------ + # Sending responses + # ------------------------------------------------------------------ + + async def send_response( + self, + response: typing.Any, + ) -> None: + """Send an LLM response back for TTS synthesis. + + Accepts: + + * A plain **string** — sent as a single agent response. + * An **async iterator** yielding strings or LLM stream event objects + (OpenAI, Anthropic, Gemini formats are auto-detected). + + This method is a coroutine so the caller can ``await`` it to know + when the full response has been sent. + """ + if self._closed: + raise RuntimeError("Cannot send response: session is closed") + + if not self._in_transcript_handler: + logger.warning( + "send_response() called outside of an on_transcript handler. " + "Responses can only be sent in reply to a user transcript. " + "To have the agent speak first, set a first message in your " + "Speech Engine conversation config on the client." + ) + return + + event_id = self._current_event_id + + if isinstance(response, str): + self._log( + 'sending string response: "%s", event_id=%s', + response, + event_id, + ) + await self._send_agent_response(response, False, event_id) + await self._send_agent_response("", True, event_id) + else: + self._log( + "starting streamed response, event_id=%s", + event_id, + ) + await self._stream_response(response, event_id) + + def close(self) -> None: + """Close the session and the underlying WebSocket connection.""" + if self._closed: + return + self._closed = True + self._cancel_current() + try: + asyncio.ensure_future(self._ws.close()) + except RuntimeError: + # No running event loop — best-effort. + pass + + # ------------------------------------------------------------------ + # Internals + # ------------------------------------------------------------------ + + async def _handle_message(self, msg: typing.Dict[str, typing.Any]) -> None: + msg_type = msg.get("type") + + if msg_type == "init": + self._conversation_id = msg.get("conversation_id") + self._log( + "session initialized, conversation_id=%s", + self._conversation_id, + ) + await self._emit("init", self._conversation_id) + + elif msg_type == "user_transcript": + incoming_event_id = msg.get("event_id") + + if ( + incoming_event_id is not None + and incoming_event_id == self._current_event_id + and self._current_task is not None + and not self._current_task.done() + ): + self._log( + "skipping duplicate transcript, event_id=%s", + incoming_event_id, + ) + return + + was_active = ( + self._current_task is not None + and not self._current_task.done() + ) + await self._cancel_current_and_wait() + if was_active: + self._log( + "interrupted: cancelling previous response " + "(event_id=%s) for new transcript (event_id=%s)", + self._current_event_id, + incoming_event_id, + ) + + self._current_event_id = incoming_event_id + transcript_data = msg.get("user_transcript") or [] + + try: + transcript = [ + ConversationMessage(role=m["role"], content=m["content"]) + for m in transcript_data + ] + except (KeyError, TypeError) as e: + await self._emit("error", e) + return + + self._log( + "received transcript, event_id=%s, messages=%d", + self._current_event_id, + len(transcript), + ) + + handlers = list( + self._event_handlers.get("user_transcript", []) + ) + once_handlers = self._once_handlers.pop("user_transcript", []) + all_handlers = handlers + once_handlers + + if all_handlers: + self._current_task = asyncio.create_task( + self._run_transcript_handlers(all_handlers, transcript) + ) + # Yield so the handler task can start before the next + # message is read. This mirrors the JS behaviour where + # emitter.emit() invokes listeners synchronously. + await asyncio.sleep(0) + + elif msg_type == "ping": + await self._send({"type": "pong"}) + + elif msg_type == "close": + self._closed = True + self._in_transcript_handler = False + await self._cancel_current_and_wait() + await self._emit("close") + + elif msg_type == "error": + await self._emit("error", Exception(msg.get("message", ""))) + + # Unknown types are silently ignored for forward compatibility. + + async def _run_transcript_handlers( + self, + handlers: typing.List[Callback], + transcript: typing.List[ConversationMessage], + ) -> None: + self._in_transcript_handler = True + try: + for handler in handlers: + result = handler(transcript) + if asyncio.iscoroutine(result): + await result + except asyncio.CancelledError: + raise + except Exception as e: + await self._emit("error", e) + finally: + self._in_transcript_handler = False + + async def _stream_response( + self, stream: typing.Any, event_id: typing.Optional[int] = None + ) -> None: + chunks = 0 + try: + async for chunk in stream: + if self._closed: + self._log( + "stream stopped: session closed after %d chunks, " + "event_id=%s", + chunks, + event_id, + ) + return + text = _extract_text(chunk) + if text: + chunks += 1 + await self._send_agent_response(text, False, event_id) + if not self._closed: + self._log( + "stream complete: %d chunks sent, event_id=%s", + chunks, + event_id, + ) + await self._send_agent_response("", True, event_id) + except asyncio.CancelledError: + raise + except Exception as e: + await self._emit("error", e) + if not self._closed: + await self._send_agent_response("", True, event_id) + + async def _send_agent_response( + self, + content: str, + is_final: bool, + event_id: typing.Optional[int] = None, + ) -> None: + if event_id is None: + event_id = self._current_event_id + await self._send( + { + "type": "agent_response", + "content": content, + "event_id": event_id, + "is_final": is_final, + } + ) + + async def _send(self, msg: typing.Dict[str, typing.Any]) -> None: + if self._closed: + return + try: + await self._ws.send(json.dumps(msg)) + except asyncio.CancelledError: + raise + except Exception: + # Send failed — the recv loop will detect the closed connection. + pass + + async def _emit(self, event: str, *args: typing.Any) -> None: + handlers = list(self._event_handlers.get(event, [])) + once_handlers = self._once_handlers.pop(event, []) + all_handlers = handlers + once_handlers + + for handler in all_handlers: + try: + result = handler(*args) + if asyncio.iscoroutine(result): + await result + except asyncio.CancelledError: + raise + except Exception as e: + if event != "error": + await self._emit("error", e) + else: + logger.exception("unhandled error in error handler: %s", e) + + async def _cancel_current_and_wait(self) -> None: + """Cancel the current handler task and wait for cleanup.""" + task = self._current_task + self._current_task = None + if task is not None and not task.done(): + task.cancel() + try: + await task + except (asyncio.CancelledError, Exception): + pass + + def _cancel_current(self) -> None: + """Cancel the current handler task (fire-and-forget).""" + if self._current_task is not None and not self._current_task.done(): + self._current_task.cancel() + self._current_task = None diff --git a/data/src/elevenlabs/speech_engine/types.py b/data/src/elevenlabs/speech_engine/types.py new file mode 100644 index 0000000000000000000000000000000000000000..0b9f676cbd49864952d21a90ed76d55bdc5e8ffa --- /dev/null +++ b/data/src/elevenlabs/speech_engine/types.py @@ -0,0 +1,105 @@ +"""Types for the Speech Engine module.""" + +import typing + +import pydantic + +# --------------------------------------------------------------------------- +# Event name constants +# --------------------------------------------------------------------------- + +INIT = "init" +USER_TRANSCRIPT = "user_transcript" +CLOSE = "close" +ERROR = "error" +DISCONNECTED = "disconnected" + +# --------------------------------------------------------------------------- +# Wire protocol — incoming (ElevenLabs API -> developer server) +# --------------------------------------------------------------------------- +# +# InitMessage: {"type": "init", "conversation_id": "..."} +# UserTranscriptMessage: {"type": "user_transcript", "user_transcript": [...], "event_id": N} +# PingMessage: {"type": "ping"} +# CloseMessage: {"type": "close"} +# ErrorMessage: {"type": "error", "message": "..."} +# +# --------------------------------------------------------------------------- +# Wire protocol — outgoing (developer server -> ElevenLabs API) +# --------------------------------------------------------------------------- +# +# AgentResponseMessage: {"type": "agent_response", "content": "...", "event_id": N, "is_final": bool} +# PongMessage: {"type": "pong"} +# + +# --------------------------------------------------------------------------- +# ConversationMessage +# --------------------------------------------------------------------------- + + +class ConversationMessage(pydantic.BaseModel): + """A single message in a speech engine conversation. + + Attributes: + role: Either ``"user"`` or ``"agent"``. + content: The text content of the message. + """ + + role: str + content: str + + +# --------------------------------------------------------------------------- +# WebSocket abstraction +# --------------------------------------------------------------------------- + + +class WebSocketLike(typing.Protocol): + """Protocol for WebSocket-like objects. + + Compatible with ``websockets.WebSocketServerProtocol`` and + FastAPI/Starlette ``WebSocket`` out of the box (auto-detected). + """ + + async def recv(self) -> typing.Union[str, bytes]: + ... # pragma: no cover + + async def send(self, data: str) -> None: + ... # pragma: no cover + + async def close(self) -> None: + ... # pragma: no cover + + +class _ASGIWebSocketAdapter: + """Adapts a FastAPI/Starlette WebSocket to the :class:`WebSocketLike` + interface expected by :class:`~.session.SpeechEngineSession`.""" + + def __init__(self, ws: typing.Any) -> None: + self._ws = ws + + async def recv(self) -> typing.Union[str, bytes]: + return await self._ws.receive_text() + + async def send(self, data: str) -> None: + await self._ws.send_text(data) + + async def close(self) -> None: + await self._ws.close() + + +def wrap_websocket(ws: typing.Any) -> WebSocketLike: + """Return a :class:`WebSocketLike` wrapper for *ws*. + + If *ws* already has ``recv``/``send`` (e.g. the ``websockets`` library), + it is returned as-is. If it has ``receive_text``/``send_text`` (e.g. + FastAPI/Starlette), it is wrapped with :class:`_ASGIWebSocketAdapter`. + """ + if hasattr(ws, "recv"): + return ws + if hasattr(ws, "receive_text"): + return _ASGIWebSocketAdapter(ws) + raise TypeError( + f"Cannot wrap {type(ws).__name__}: expected a websockets-style " + f"object (recv/send) or an ASGI-style object (receive_text/send_text)" + ) diff --git a/data/src/elevenlabs/speech_engine_custom.py b/data/src/elevenlabs/speech_engine_custom.py new file mode 100644 index 0000000000000000000000000000000000000000..a316b8b737a78dd1ebe346b961066b11053ab536 --- /dev/null +++ b/data/src/elevenlabs/speech_engine_custom.py @@ -0,0 +1,242 @@ +import typing + +from .core import RequestOptions +from .speech_engine.client import AsyncSpeechEngineClient as AutogeneratedAsyncSpeechEngineClient +from .speech_engine.client import SpeechEngineClient as AutogeneratedSpeechEngineClient +from .speech_engine.resource import SpeechEngineResource +from .types.agent_call_limits import AgentCallLimits +from .types.asr_conversational_config import AsrConversationalConfig +from .types.base_turn_config import BaseTurnConfig +from .types.conversation_config_input import ConversationConfigInput +from .types.privacy_config_input import PrivacyConfigInput +from .types.speech_engine_config import SpeechEngineConfig +from .types.speech_engine_conversation_initiation_client_data_config import SpeechEngineConversationInitiationClientDataConfig +from .types.tts_conversational_config_input import TtsConversationalConfigInput + +OMIT = typing.cast(typing.Any, ...) + + +class SpeechEngineClient(AutogeneratedSpeechEngineClient): + """Extends the generated SpeechEngineClient with WebSocket server integration.""" + + def create( # type: ignore[override] + self, + *, + speech_engine: SpeechEngineConfig, + name: typing.Optional[str] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResource: + """Create a Speech Engine resource. + + Makes an API call to create the engine, then returns a + :class:`SpeechEngineResource` with WebSocket integration methods + (:meth:`~SpeechEngineResource.serve`, + :meth:`~SpeechEngineResource.create_session`, + :meth:`~SpeechEngineResource.verify_request`). + """ + response = super().create( + speech_engine=speech_engine, + name=name, + asr=asr, + tts=tts, + turn=turn, + conversation=conversation, + privacy=privacy, + call_limits=call_limits, + language=language, + tags=tags, + overrides=overrides, + request_options=request_options, + ) + return SpeechEngineResource( + engine_id=response.speech_engine_id, + client_wrapper=self._raw_client._client_wrapper, + response=response, + ) + + def get( # type: ignore[override] + self, + speech_engine_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResource: + """Retrieve a Speech Engine resource. + + Makes an API call to validate the engine exists, then returns a + :class:`SpeechEngineResource` with WebSocket integration methods + (:meth:`~SpeechEngineResource.serve`, + :meth:`~SpeechEngineResource.create_session`, + :meth:`~SpeechEngineResource.verify_request`). + """ + response = super().get(speech_engine_id, request_options=request_options) + return SpeechEngineResource( + engine_id=speech_engine_id, + client_wrapper=self._raw_client._client_wrapper, + response=response, + ) + + def update( # type: ignore[override] + self, + speech_engine_id: str, + *, + name: typing.Optional[str] = OMIT, + speech_engine: typing.Optional[SpeechEngineConfig] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResource: + """Update a Speech Engine resource. + + Makes an API call to update the engine, then returns a + :class:`SpeechEngineResource` with WebSocket integration methods + (:meth:`~SpeechEngineResource.serve`, + :meth:`~SpeechEngineResource.create_session`, + :meth:`~SpeechEngineResource.verify_request`). + """ + response = super().update( + speech_engine_id, + name=name, + speech_engine=speech_engine, + asr=asr, + tts=tts, + turn=turn, + conversation=conversation, + privacy=privacy, + call_limits=call_limits, + language=language, + tags=tags, + request_options=request_options, + ) + return SpeechEngineResource( + engine_id=speech_engine_id, + client_wrapper=self._raw_client._client_wrapper, + response=response, + ) + + +class AsyncSpeechEngineClient(AutogeneratedAsyncSpeechEngineClient): + """Extends the generated AsyncSpeechEngineClient with WebSocket server integration.""" + + async def create( # type: ignore[override] + self, + *, + speech_engine: SpeechEngineConfig, + name: typing.Optional[str] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + overrides: typing.Optional[SpeechEngineConversationInitiationClientDataConfig] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResource: + """Create a Speech Engine resource. + + Makes an API call to create the engine, then returns a + :class:`SpeechEngineResource` with WebSocket integration methods + (:meth:`~SpeechEngineResource.serve`, + :meth:`~SpeechEngineResource.create_session`, + :meth:`~SpeechEngineResource.verify_request`). + """ + response = await super().create( + speech_engine=speech_engine, + name=name, + asr=asr, + tts=tts, + turn=turn, + conversation=conversation, + privacy=privacy, + call_limits=call_limits, + language=language, + tags=tags, + overrides=overrides, + request_options=request_options, + ) + return SpeechEngineResource( + engine_id=response.speech_engine_id, + client_wrapper=self._raw_client._client_wrapper, + response=response, + ) + + async def get( # type: ignore[override] + self, + speech_engine_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResource: + """Retrieve a Speech Engine resource. + + Makes an API call to validate the engine exists, then returns a + :class:`SpeechEngineResource` with WebSocket integration methods + (:meth:`~SpeechEngineResource.serve`, + :meth:`~SpeechEngineResource.create_session`, + :meth:`~SpeechEngineResource.verify_request`). + """ + response = await super().get(speech_engine_id, request_options=request_options) + return SpeechEngineResource( + engine_id=speech_engine_id, + client_wrapper=self._raw_client._client_wrapper, + response=response, + ) + + async def update( # type: ignore[override] + self, + speech_engine_id: str, + *, + name: typing.Optional[str] = OMIT, + speech_engine: typing.Optional[SpeechEngineConfig] = OMIT, + asr: typing.Optional[AsrConversationalConfig] = OMIT, + tts: typing.Optional[TtsConversationalConfigInput] = OMIT, + turn: typing.Optional[BaseTurnConfig] = OMIT, + conversation: typing.Optional[ConversationConfigInput] = OMIT, + privacy: typing.Optional[PrivacyConfigInput] = OMIT, + call_limits: typing.Optional[AgentCallLimits] = OMIT, + language: typing.Optional[str] = OMIT, + tags: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechEngineResource: + """Update a Speech Engine resource. + + Makes an API call to update the engine, then returns a + :class:`SpeechEngineResource` with WebSocket integration methods + (:meth:`~SpeechEngineResource.serve`, + :meth:`~SpeechEngineResource.create_session`, + :meth:`~SpeechEngineResource.verify_request`). + """ + response = await super().update( + speech_engine_id, + name=name, + speech_engine=speech_engine, + asr=asr, + tts=tts, + turn=turn, + conversation=conversation, + privacy=privacy, + call_limits=call_limits, + language=language, + tags=tags, + request_options=request_options, + ) + return SpeechEngineResource( + engine_id=speech_engine_id, + client_wrapper=self._raw_client._client_wrapper, + response=response, + ) diff --git a/data/src/elevenlabs/speech_engine_upstream/__init__.py b/data/src/elevenlabs/speech_engine_upstream/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8fe7363671f37aaee977ac52591f1c4240cbaabd --- /dev/null +++ b/data/src/elevenlabs/speech_engine_upstream/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ReceiveUpstreamMessage, SendUpstreamMessage +_dynamic_imports: typing.Dict[str, str] = {"ReceiveUpstreamMessage": ".types", "SendUpstreamMessage": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveUpstreamMessage", "SendUpstreamMessage"] diff --git a/data/src/elevenlabs/speech_engine_upstream/types/__init__.py b/data/src/elevenlabs/speech_engine_upstream/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ef706fbe2f0fba27c45790009cc5fbad2203442c --- /dev/null +++ b/data/src/elevenlabs/speech_engine_upstream/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .receive_upstream_message import ReceiveUpstreamMessage + from .send_upstream_message import SendUpstreamMessage +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveUpstreamMessage": ".receive_upstream_message", + "SendUpstreamMessage": ".send_upstream_message", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveUpstreamMessage", "SendUpstreamMessage"] diff --git a/data/src/elevenlabs/speech_engine_upstream/types/receive_upstream_message.py b/data/src/elevenlabs/speech_engine_upstream/types/receive_upstream_message.py new file mode 100644 index 0000000000000000000000000000000000000000..98a5642dd16820d245f8c8984de0c08950f855c7 --- /dev/null +++ b/data/src/elevenlabs/speech_engine_upstream/types/receive_upstream_message.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.close_payload import ClosePayload +from ...types.error_payload import ErrorPayload +from ...types.init_payload import InitPayload +from ...types.ping_payload import PingPayload +from ...types.user_transcript_payload import UserTranscriptPayload + +ReceiveUpstreamMessage = typing.Union[InitPayload, UserTranscriptPayload, PingPayload, ClosePayload, ErrorPayload] diff --git a/data/src/elevenlabs/speech_engine_upstream/types/send_upstream_message.py b/data/src/elevenlabs/speech_engine_upstream/types/send_upstream_message.py new file mode 100644 index 0000000000000000000000000000000000000000..bb0a8f90cb4c0318330922723a3a1d6d73617a9a --- /dev/null +++ b/data/src/elevenlabs/speech_engine_upstream/types/send_upstream_message.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.agent_response_payload import AgentResponsePayload +from ...types.pong_payload import PongPayload + +SendUpstreamMessage = typing.Union[AgentResponsePayload, PongPayload] diff --git a/data/src/elevenlabs/speech_to_speech/__init__.py b/data/src/elevenlabs/speech_to_speech/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b97438c147e8f78f61934a1c3cd649c400dea740 --- /dev/null +++ b/data/src/elevenlabs/speech_to_speech/__init__.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + SpeechToSpeechConvertRequestOutputFormat, + SpeechToSpeechRequestFileFormat, + SpeechToSpeechStreamRequestFileFormat, + SpeechToSpeechStreamRequestOutputFormat, + ) +_dynamic_imports: typing.Dict[str, str] = { + "SpeechToSpeechConvertRequestOutputFormat": ".types", + "SpeechToSpeechRequestFileFormat": ".types", + "SpeechToSpeechStreamRequestFileFormat": ".types", + "SpeechToSpeechStreamRequestOutputFormat": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "SpeechToSpeechConvertRequestOutputFormat", + "SpeechToSpeechRequestFileFormat", + "SpeechToSpeechStreamRequestFileFormat", + "SpeechToSpeechStreamRequestOutputFormat", +] diff --git a/data/src/elevenlabs/speech_to_speech/client.py b/data/src/elevenlabs/speech_to_speech/client.py new file mode 100644 index 0000000000000000000000000000000000000000..cf6d01346f8507ff9cbea56299b6fc51427fb2e9 --- /dev/null +++ b/data/src/elevenlabs/speech_to_speech/client.py @@ -0,0 +1,437 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from .raw_client import AsyncRawSpeechToSpeechClient, RawSpeechToSpeechClient +from .types.speech_to_speech_convert_request_output_format import SpeechToSpeechConvertRequestOutputFormat +from .types.speech_to_speech_request_file_format import SpeechToSpeechRequestFileFormat +from .types.speech_to_speech_stream_request_file_format import SpeechToSpeechStreamRequestFileFormat +from .types.speech_to_speech_stream_request_output_format import SpeechToSpeechStreamRequestOutputFormat + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SpeechToSpeechClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSpeechToSpeechClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSpeechToSpeechClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSpeechToSpeechClient + """ + return self._raw_client + + def convert( + self, + voice_id: str, + *, + audio: core.File, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[SpeechToSpeechConvertRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[str] = OMIT, + seed: typing.Optional[int] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + file_format: typing.Optional[SpeechToSpeechRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Transform audio from one voice to another. Maintain full control over emotion, timing and delivery. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + audio : core.File + See core.File for more documentation + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[SpeechToSpeechConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + + voice_settings : typing.Optional[str] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + remove_background_noise : typing.Optional[bool] + If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + + file_format : typing.Optional[SpeechToSpeechRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The generated audio file + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_to_speech.convert( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + model_id="eleven_multilingual_sts_v2", + ) + """ + with self._raw_client.convert( + voice_id, + audio=audio, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + voice_settings=voice_settings, + seed=seed, + remove_background_noise=remove_background_noise, + file_format=file_format, + request_options=request_options, + ) as r: + yield from r.data + + def stream( + self, + voice_id: str, + *, + audio: core.File, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[SpeechToSpeechStreamRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[str] = OMIT, + seed: typing.Optional[int] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + file_format: typing.Optional[SpeechToSpeechStreamRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Stream audio from one voice to another. Maintain full control over emotion, timing and delivery. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + audio : core.File + See core.File for more documentation + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[SpeechToSpeechStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + + voice_settings : typing.Optional[str] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + remove_background_noise : typing.Optional[bool] + If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + + file_format : typing.Optional[SpeechToSpeechStreamRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Streaming audio data + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_to_speech.stream( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + model_id="eleven_multilingual_sts_v2", + ) + """ + with self._raw_client.stream( + voice_id, + audio=audio, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + voice_settings=voice_settings, + seed=seed, + remove_background_noise=remove_background_noise, + file_format=file_format, + request_options=request_options, + ) as r: + yield from r.data + + +class AsyncSpeechToSpeechClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSpeechToSpeechClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSpeechToSpeechClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSpeechToSpeechClient + """ + return self._raw_client + + async def convert( + self, + voice_id: str, + *, + audio: core.File, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[SpeechToSpeechConvertRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[str] = OMIT, + seed: typing.Optional[int] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + file_format: typing.Optional[SpeechToSpeechRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Transform audio from one voice to another. Maintain full control over emotion, timing and delivery. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + audio : core.File + See core.File for more documentation + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[SpeechToSpeechConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + + voice_settings : typing.Optional[str] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + remove_background_noise : typing.Optional[bool] + If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + + file_format : typing.Optional[SpeechToSpeechRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The generated audio file + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_to_speech.convert( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + model_id="eleven_multilingual_sts_v2", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.convert( + voice_id, + audio=audio, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + voice_settings=voice_settings, + seed=seed, + remove_background_noise=remove_background_noise, + file_format=file_format, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def stream( + self, + voice_id: str, + *, + audio: core.File, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[SpeechToSpeechStreamRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[str] = OMIT, + seed: typing.Optional[int] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + file_format: typing.Optional[SpeechToSpeechStreamRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Stream audio from one voice to another. Maintain full control over emotion, timing and delivery. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + audio : core.File + See core.File for more documentation + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[SpeechToSpeechStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + + voice_settings : typing.Optional[str] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + remove_background_noise : typing.Optional[bool] + If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + + file_format : typing.Optional[SpeechToSpeechStreamRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Streaming audio data + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_to_speech.stream( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + model_id="eleven_multilingual_sts_v2", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.stream( + voice_id, + audio=audio, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + voice_settings=voice_settings, + seed=seed, + remove_background_noise=remove_background_noise, + file_format=file_format, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/speech_to_speech/raw_client.py b/data/src/elevenlabs/speech_to_speech/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..5f823703c56c7964453934f914f6206efdeb7401 --- /dev/null +++ b/data/src/elevenlabs/speech_to_speech/raw_client.py @@ -0,0 +1,531 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from .types.speech_to_speech_convert_request_output_format import SpeechToSpeechConvertRequestOutputFormat +from .types.speech_to_speech_request_file_format import SpeechToSpeechRequestFileFormat +from .types.speech_to_speech_stream_request_file_format import SpeechToSpeechStreamRequestFileFormat +from .types.speech_to_speech_stream_request_output_format import SpeechToSpeechStreamRequestOutputFormat +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSpeechToSpeechClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def convert( + self, + voice_id: str, + *, + audio: core.File, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[SpeechToSpeechConvertRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[str] = OMIT, + seed: typing.Optional[int] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + file_format: typing.Optional[SpeechToSpeechRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Transform audio from one voice to another. Maintain full control over emotion, timing and delivery. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + audio : core.File + See core.File for more documentation + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[SpeechToSpeechConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + + voice_settings : typing.Optional[str] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + remove_background_noise : typing.Optional[bool] + If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + + file_format : typing.Optional[SpeechToSpeechRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The generated audio file + """ + with self._client_wrapper.httpx_client.stream( + f"v1/speech-to-speech/{jsonable_encoder(voice_id)}", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + data={ + "model_id": model_id, + "voice_settings": voice_settings, + "seed": seed, + "remove_background_noise": remove_background_noise, + "file_format": file_format, + }, + files={ + "audio": audio, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def stream( + self, + voice_id: str, + *, + audio: core.File, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[SpeechToSpeechStreamRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[str] = OMIT, + seed: typing.Optional[int] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + file_format: typing.Optional[SpeechToSpeechStreamRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Stream audio from one voice to another. Maintain full control over emotion, timing and delivery. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + audio : core.File + See core.File for more documentation + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[SpeechToSpeechStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + + voice_settings : typing.Optional[str] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + remove_background_noise : typing.Optional[bool] + If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + + file_format : typing.Optional[SpeechToSpeechStreamRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Streaming audio data + """ + with self._client_wrapper.httpx_client.stream( + f"v1/speech-to-speech/{jsonable_encoder(voice_id)}/stream", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + data={ + "model_id": model_id, + "voice_settings": voice_settings, + "seed": seed, + "remove_background_noise": remove_background_noise, + "file_format": file_format, + }, + files={ + "audio": audio, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawSpeechToSpeechClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def convert( + self, + voice_id: str, + *, + audio: core.File, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[SpeechToSpeechConvertRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[str] = OMIT, + seed: typing.Optional[int] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + file_format: typing.Optional[SpeechToSpeechRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Transform audio from one voice to another. Maintain full control over emotion, timing and delivery. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + audio : core.File + See core.File for more documentation + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[SpeechToSpeechConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + + voice_settings : typing.Optional[str] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + remove_background_noise : typing.Optional[bool] + If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + + file_format : typing.Optional[SpeechToSpeechRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The generated audio file + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/speech-to-speech/{jsonable_encoder(voice_id)}", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + data={ + "model_id": model_id, + "voice_settings": voice_settings, + "seed": seed, + "remove_background_noise": remove_background_noise, + "file_format": file_format, + }, + files={ + "audio": audio, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def stream( + self, + voice_id: str, + *, + audio: core.File, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[SpeechToSpeechStreamRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[str] = OMIT, + seed: typing.Optional[int] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + file_format: typing.Optional[SpeechToSpeechStreamRequestFileFormat] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Stream audio from one voice to another. Maintain full control over emotion, timing and delivery. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + audio : core.File + See core.File for more documentation + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[SpeechToSpeechStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for speech to speech, you can check this using the can_do_voice_conversion property. + + voice_settings : typing.Optional[str] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. Needs to be send as a JSON encoded string. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + remove_background_noise : typing.Optional[bool] + If set, will remove the background noise from your audio input using our audio isolation model. Only applies to Voice Changer. + + file_format : typing.Optional[SpeechToSpeechStreamRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Streaming audio data + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/speech-to-speech/{jsonable_encoder(voice_id)}/stream", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + data={ + "model_id": model_id, + "voice_settings": voice_settings, + "seed": seed, + "remove_background_noise": remove_background_noise, + "file_format": file_format, + }, + files={ + "audio": audio, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/speech_to_speech/types/__init__.py b/data/src/elevenlabs/speech_to_speech/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ecd7e62f213d22088ffeba562064a3361717bb89 --- /dev/null +++ b/data/src/elevenlabs/speech_to_speech/types/__init__.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .speech_to_speech_convert_request_output_format import SpeechToSpeechConvertRequestOutputFormat + from .speech_to_speech_request_file_format import SpeechToSpeechRequestFileFormat + from .speech_to_speech_stream_request_file_format import SpeechToSpeechStreamRequestFileFormat + from .speech_to_speech_stream_request_output_format import SpeechToSpeechStreamRequestOutputFormat +_dynamic_imports: typing.Dict[str, str] = { + "SpeechToSpeechConvertRequestOutputFormat": ".speech_to_speech_convert_request_output_format", + "SpeechToSpeechRequestFileFormat": ".speech_to_speech_request_file_format", + "SpeechToSpeechStreamRequestFileFormat": ".speech_to_speech_stream_request_file_format", + "SpeechToSpeechStreamRequestOutputFormat": ".speech_to_speech_stream_request_output_format", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "SpeechToSpeechConvertRequestOutputFormat", + "SpeechToSpeechRequestFileFormat", + "SpeechToSpeechStreamRequestFileFormat", + "SpeechToSpeechStreamRequestOutputFormat", +] diff --git a/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_convert_request_output_format.py b/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_convert_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..14f253e01f21b94f6bfb0d3e6012f219ce11d03b --- /dev/null +++ b/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_convert_request_output_format.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToSpeechConvertRequestOutputFormat = typing.Union[ + typing.Literal[ + "alaw_8000", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_128", + "mp3_44100_192", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "opus_48000_128", + "opus_48000_192", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "pcm_8000", + "ulaw_8000", + "wav_16000", + "wav_22050", + "wav_24000", + "wav_32000", + "wav_44100", + "wav_48000", + "wav_8000", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_request_file_format.py b/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_request_file_format.py new file mode 100644 index 0000000000000000000000000000000000000000..38982f747f0954191e391b319f6afbb08303b08c --- /dev/null +++ b/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_request_file_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToSpeechRequestFileFormat = typing.Union[typing.Literal["pcm_s16le_16", "other"], typing.Any] diff --git a/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_stream_request_file_format.py b/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_stream_request_file_format.py new file mode 100644 index 0000000000000000000000000000000000000000..d10faa2db45e561715a24fca427acf68f287ac84 --- /dev/null +++ b/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_stream_request_file_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToSpeechStreamRequestFileFormat = typing.Union[typing.Literal["pcm_s16le_16", "other"], typing.Any] diff --git a/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_stream_request_output_format.py b/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_stream_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..c8da31f8ff7b03b0284fdd2a1b360b6f59ea2eb5 --- /dev/null +++ b/data/src/elevenlabs/speech_to_speech/types/speech_to_speech_stream_request_output_format.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToSpeechStreamRequestOutputFormat = typing.Union[ + typing.Literal[ + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/speech_to_text/__init__.py b/data/src/elevenlabs/speech_to_text/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1cb7cd542846f3c9dc3cff0d63c99e35501207c4 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/__init__.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + SpeechToTextConvertRequestEntityDetection, + SpeechToTextConvertRequestEntityRedaction, + SpeechToTextConvertRequestFileFormat, + SpeechToTextConvertRequestMultichannelOutputStyle, + SpeechToTextConvertRequestTimestampsGranularity, + SpeechToTextConvertRequestWebhookMetadata, + SpeechToTextConvertResponse, + ) + from . import transcripts + from .transcripts import TranscriptsGetResponse +_dynamic_imports: typing.Dict[str, str] = { + "SpeechToTextConvertRequestEntityDetection": ".types", + "SpeechToTextConvertRequestEntityRedaction": ".types", + "SpeechToTextConvertRequestFileFormat": ".types", + "SpeechToTextConvertRequestMultichannelOutputStyle": ".types", + "SpeechToTextConvertRequestTimestampsGranularity": ".types", + "SpeechToTextConvertRequestWebhookMetadata": ".types", + "SpeechToTextConvertResponse": ".types", + "TranscriptsGetResponse": ".transcripts", + "transcripts": ".transcripts", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "SpeechToTextConvertRequestEntityDetection", + "SpeechToTextConvertRequestEntityRedaction", + "SpeechToTextConvertRequestFileFormat", + "SpeechToTextConvertRequestMultichannelOutputStyle", + "SpeechToTextConvertRequestTimestampsGranularity", + "SpeechToTextConvertRequestWebhookMetadata", + "SpeechToTextConvertResponse", + "TranscriptsGetResponse", + "transcripts", +] diff --git a/data/src/elevenlabs/speech_to_text/client.py b/data/src/elevenlabs/speech_to_text/client.py new file mode 100644 index 0000000000000000000000000000000000000000..aafabd890aa196d50c75b08b3e10bc7ba63332e3 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/client.py @@ -0,0 +1,447 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.additional_formats import AdditionalFormats +from .raw_client import AsyncRawSpeechToTextClient, RawSpeechToTextClient +from .types.speech_to_text_convert_request_entity_detection import SpeechToTextConvertRequestEntityDetection +from .types.speech_to_text_convert_request_entity_redaction import SpeechToTextConvertRequestEntityRedaction +from .types.speech_to_text_convert_request_file_format import SpeechToTextConvertRequestFileFormat +from .types.speech_to_text_convert_request_multichannel_output_style import ( + SpeechToTextConvertRequestMultichannelOutputStyle, +) +from .types.speech_to_text_convert_request_timestamps_granularity import SpeechToTextConvertRequestTimestampsGranularity +from .types.speech_to_text_convert_request_webhook_metadata import SpeechToTextConvertRequestWebhookMetadata +from .types.speech_to_text_convert_response import SpeechToTextConvertResponse + +if typing.TYPE_CHECKING: + from .transcripts.client import AsyncTranscriptsClient, TranscriptsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SpeechToTextClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSpeechToTextClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._transcripts: typing.Optional[TranscriptsClient] = None + + @property + def with_raw_response(self) -> RawSpeechToTextClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSpeechToTextClient + """ + return self._raw_client + + def convert( + self, + *, + model_id: str, + token: typing.Optional[str] = None, + enable_logging: typing.Optional[bool] = None, + file: typing.Optional[core.File] = OMIT, + language_code: typing.Optional[str] = OMIT, + transcript_edit: typing.Optional[str] = OMIT, + tag_audio_events: typing.Optional[bool] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + timestamps_granularity: typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] = OMIT, + diarize: typing.Optional[bool] = OMIT, + diarization_threshold: typing.Optional[float] = OMIT, + additional_formats: typing.Optional[AdditionalFormats] = OMIT, + file_format: typing.Optional[SpeechToTextConvertRequestFileFormat] = OMIT, + cloud_storage_url: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + webhook: typing.Optional[bool] = OMIT, + webhook_id: typing.Optional[str] = OMIT, + temperature: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + use_multi_channel: typing.Optional[bool] = OMIT, + multichannel_output_style: typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] = OMIT, + webhook_metadata: typing.Optional[SpeechToTextConvertRequestWebhookMetadata] = OMIT, + entity_detection: typing.Optional[SpeechToTextConvertRequestEntityDetection] = OMIT, + no_verbatim: typing.Optional[bool] = OMIT, + use_speaker_library: typing.Optional[bool] = OMIT, + detect_speaker_roles: typing.Optional[bool] = OMIT, + entity_redaction: typing.Optional[SpeechToTextConvertRequestEntityRedaction] = OMIT, + entity_redaction_mode: typing.Optional[str] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechToTextConvertResponse: + """ + Transcribe an audio or video file. If webhook is set to true, the request will be processed asynchronously and results sent to configured webhooks. When use_multi_channel is true and the provided audio has multiple channels, a 'transcripts' object with separate transcripts for each channel is returned; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Otherwise, returns a single transcript. The optional webhook_metadata parameter allows you to attach custom data that will be included in webhook responses for request correlation and tracking. + + Parameters + ---------- + model_id : str + The ID of the model to use for transcription. + + token : typing.Optional[str] + A single-use authentication token created via POST /v1/single-use-token/batch_scribe. This token can only be used once and expires after 15 minutes. Alternative to API key or bearer token authentication for frontend clients. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean log and transcript storage features are unavailable for this request. Zero retention mode may only be used by enterprise customers. + + file : typing.Optional[core.File] + See core.File for more documentation + + language_code : typing.Optional[str] + An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. Can sometimes improve transcription performance if known beforehand. Defaults to null, in this case the language is predicted automatically. + + transcript_edit : typing.Optional[str] + Natural-language instruction applied to the final transcript (max 2000 characters). The edited text is returned in 'edited_transcript' alongside the original transcript. Cannot be combined with entity_detection, entity_redaction or use_multi_channel. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost, billed for at least 10 seconds of audio. + + tag_audio_events : typing.Optional[bool] + Whether to tag audio events like (laughter), (footsteps), etc. in the transcription. + + num_speakers : typing.Optional[int] + The maximum amount of speakers talking in the uploaded file. Can help with predicting who speaks when. The maximum amount of speakers that can be predicted is 32. Defaults to null, in this case the amount of speakers is set to the maximum value the model supports. + + timestamps_granularity : typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] + The granularity of the timestamps in the transcription. 'word' provides word-level timestamps and 'character' provides character-level timestamps per word. + + diarize : typing.Optional[bool] + Whether to annotate which speaker is currently talking in the uploaded file. + + diarization_threshold : typing.Optional[float] + Diarization threshold to apply during speaker diarization. A higher value means there will be a lower chance of one speaker being diarized as two different speakers but also a higher chance of two different speakers being diarized as one speaker (less total speakers predicted). A low value means there will be a higher chance of one speaker being diarized as two different speakers but also a lower chance of two different speakers being diarized as one speaker (more total speakers predicted). Can only be set when diarize=True and num_speakers=None. Defaults to None, in which case we will choose a threshold based on the model_id (0.22 usually). + + additional_formats : typing.Optional[AdditionalFormats] + A list of additional formats to export the transcript to. + + file_format : typing.Optional[SpeechToTextConvertRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + cloud_storage_url : typing.Optional[str] + [Deprecated] This parameter is deprecated and will be removed in the future. Use 'source_url' instead.The HTTPS URL of the file to transcribe. Exactly one of the file or cloud_storage_url parameters must be provided. The file must be accessible via HTTPS and the file size must be less than 2GB. Any valid HTTPS URL is accepted, including URLs from cloud storage providers (AWS S3, Google Cloud Storage, Cloudflare R2, etc.), CDNs, or any other HTTPS source. URLs can be pre-signed or include authentication tokens in query parameters. + + source_url : typing.Optional[str] + The URL of an audio or video file to transcribe. Supports hosted video or audio files, YouTube video URLs, TikTok video URLs, and other video hosting services. + + webhook : typing.Optional[bool] + Whether to send the transcription result to configured speech-to-text webhooks. If set the request will return early without the transcription, which will be delivered later via webhook. + + webhook_id : typing.Optional[str] + Optional specific webhook ID to send the transcription result to. Only valid when webhook is set to true. If not provided, transcription will be sent to all configured speech-to-text webhooks. + + temperature : typing.Optional[float] + Controls the randomness of the transcription output. Accepts values between 0.0 and 2.0, where higher values result in more diverse and less deterministic results. If omitted, we will use a temperature based on the model you selected which is usually 0. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be an integer between 0 and 2147483647. + + use_multi_channel : typing.Optional[bool] + Whether the audio file contains multiple channels where each channel contains a single speaker. When enabled, each channel is transcribed independently. By default a separate transcript is returned per channel; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Each word in the response includes a 'channel_index' field indicating which channel it was spoken on. A maximum of 5 channels is supported. Each channel is billed independently at the full audio duration, so cost scales linearly with the number of channels. + + multichannel_output_style : typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] + Controls the response shape when use_multi_channel is enabled. 'separate' (default) returns one transcript per channel under 'transcripts'. 'combined' merges all channels into a single transcript whose words are sorted by start time, each carrying a 'channel_index' - matching the single-channel response shape. 'combined' requires timestamps (timestamps_granularity must not be 'none') and does not support entity detection or redaction. + + webhook_metadata : typing.Optional[SpeechToTextConvertRequestWebhookMetadata] + Optional metadata to be included in the webhook response. This should be a JSON string representing an object with a maximum depth of 2 levels and maximum size of 16KB. Useful for tracking internal IDs, job references, or other contextual information. + + entity_detection : typing.Optional[SpeechToTextConvertRequestEntityDetection] + Detect entities in the transcript. Can be 'all' to detect all entities, a single entity type or category string, or a list of entity types/categories. Categories include 'pii', 'phi', 'pci', 'other', 'offensive_language'. When enabled, detected entities will be returned in the 'entities' field with their text, type, and character positions. + + no_verbatim : typing.Optional[bool] + If true, the transcription will not have any filler words, false starts and non-speech sounds. Only supported with scribe_v2 model. + + use_speaker_library : typing.Optional[bool] + Whether to use the speaker library for identifying known speakers during diarization. When enabled and diarize is true, detected speakers will be matched against registered speakers in the workspace's speaker library. + + detect_speaker_roles : typing.Optional[bool] + Whether to detect speaker roles (agent vs customer). Requires diarize=true. Cannot be used with use_multi_channel=true. When enabled, speaker_id values will be 'agent' and 'customer' instead of 'speaker_0', 'speaker_1', etc. Usage incurs an additional 10% surcharge on base transcription cost. + + entity_redaction : typing.Optional[SpeechToTextConvertRequestEntityRedaction] + Redact entities from the transcript text. Accepts the same format as entity_detection: 'all', a category ('pii', 'phi'), or specific entity types. Must be a subset of entity_detection. When redaction is enabled, the entities field will not be returned. + + entity_redaction_mode : typing.Optional[str] + How to format redacted entities. 'redacted' replaces with {REDACTED}, 'entity_type' replaces with {ENTITY_TYPE}, 'enumerated_entity_type' replaces with {ENTITY_TYPE_N} where N enumerates each occurrence. Only used when entity_redaction is set. + + keyterms : typing.Optional[typing.List[str]] + A list of keyterms to bias the transcription towards. The keyterms are words or phrases you want the model to recognise more accurately. The number of keyterms cannot exceed 1000. The length of each keyterm must be less than 50 characters. Keyterms can contain at most 5 words (after normalisation). For example ["hello", "world", "technical term"]. The following characters are not supported: `<`, `>`, `{`, `}`, `[`, `]`, `\\`. Usage of this parameter will incur an additional 20% surcharge on the base transcription cost. When more than 100 keyterms are provided, a minimum billable duration of 20 seconds applies per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechToTextConvertResponse + Synchronous transcription result + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_to_text.convert( + token="token", + enable_logging=True, + model_id="scribe_v2", + ) + """ + _response = self._raw_client.convert( + model_id=model_id, + token=token, + enable_logging=enable_logging, + file=file, + language_code=language_code, + transcript_edit=transcript_edit, + tag_audio_events=tag_audio_events, + num_speakers=num_speakers, + timestamps_granularity=timestamps_granularity, + diarize=diarize, + diarization_threshold=diarization_threshold, + additional_formats=additional_formats, + file_format=file_format, + cloud_storage_url=cloud_storage_url, + source_url=source_url, + webhook=webhook, + webhook_id=webhook_id, + temperature=temperature, + seed=seed, + use_multi_channel=use_multi_channel, + multichannel_output_style=multichannel_output_style, + webhook_metadata=webhook_metadata, + entity_detection=entity_detection, + no_verbatim=no_verbatim, + use_speaker_library=use_speaker_library, + detect_speaker_roles=detect_speaker_roles, + entity_redaction=entity_redaction, + entity_redaction_mode=entity_redaction_mode, + keyterms=keyterms, + request_options=request_options, + ) + return _response.data + + @property + def transcripts(self): + if self._transcripts is None: + from .transcripts.client import TranscriptsClient # noqa: E402 + + self._transcripts = TranscriptsClient(client_wrapper=self._client_wrapper) + return self._transcripts + + +class AsyncSpeechToTextClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSpeechToTextClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._transcripts: typing.Optional[AsyncTranscriptsClient] = None + + @property + def with_raw_response(self) -> AsyncRawSpeechToTextClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSpeechToTextClient + """ + return self._raw_client + + async def convert( + self, + *, + model_id: str, + token: typing.Optional[str] = None, + enable_logging: typing.Optional[bool] = None, + file: typing.Optional[core.File] = OMIT, + language_code: typing.Optional[str] = OMIT, + transcript_edit: typing.Optional[str] = OMIT, + tag_audio_events: typing.Optional[bool] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + timestamps_granularity: typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] = OMIT, + diarize: typing.Optional[bool] = OMIT, + diarization_threshold: typing.Optional[float] = OMIT, + additional_formats: typing.Optional[AdditionalFormats] = OMIT, + file_format: typing.Optional[SpeechToTextConvertRequestFileFormat] = OMIT, + cloud_storage_url: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + webhook: typing.Optional[bool] = OMIT, + webhook_id: typing.Optional[str] = OMIT, + temperature: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + use_multi_channel: typing.Optional[bool] = OMIT, + multichannel_output_style: typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] = OMIT, + webhook_metadata: typing.Optional[SpeechToTextConvertRequestWebhookMetadata] = OMIT, + entity_detection: typing.Optional[SpeechToTextConvertRequestEntityDetection] = OMIT, + no_verbatim: typing.Optional[bool] = OMIT, + use_speaker_library: typing.Optional[bool] = OMIT, + detect_speaker_roles: typing.Optional[bool] = OMIT, + entity_redaction: typing.Optional[SpeechToTextConvertRequestEntityRedaction] = OMIT, + entity_redaction_mode: typing.Optional[str] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> SpeechToTextConvertResponse: + """ + Transcribe an audio or video file. If webhook is set to true, the request will be processed asynchronously and results sent to configured webhooks. When use_multi_channel is true and the provided audio has multiple channels, a 'transcripts' object with separate transcripts for each channel is returned; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Otherwise, returns a single transcript. The optional webhook_metadata parameter allows you to attach custom data that will be included in webhook responses for request correlation and tracking. + + Parameters + ---------- + model_id : str + The ID of the model to use for transcription. + + token : typing.Optional[str] + A single-use authentication token created via POST /v1/single-use-token/batch_scribe. This token can only be used once and expires after 15 minutes. Alternative to API key or bearer token authentication for frontend clients. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean log and transcript storage features are unavailable for this request. Zero retention mode may only be used by enterprise customers. + + file : typing.Optional[core.File] + See core.File for more documentation + + language_code : typing.Optional[str] + An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. Can sometimes improve transcription performance if known beforehand. Defaults to null, in this case the language is predicted automatically. + + transcript_edit : typing.Optional[str] + Natural-language instruction applied to the final transcript (max 2000 characters). The edited text is returned in 'edited_transcript' alongside the original transcript. Cannot be combined with entity_detection, entity_redaction or use_multi_channel. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost, billed for at least 10 seconds of audio. + + tag_audio_events : typing.Optional[bool] + Whether to tag audio events like (laughter), (footsteps), etc. in the transcription. + + num_speakers : typing.Optional[int] + The maximum amount of speakers talking in the uploaded file. Can help with predicting who speaks when. The maximum amount of speakers that can be predicted is 32. Defaults to null, in this case the amount of speakers is set to the maximum value the model supports. + + timestamps_granularity : typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] + The granularity of the timestamps in the transcription. 'word' provides word-level timestamps and 'character' provides character-level timestamps per word. + + diarize : typing.Optional[bool] + Whether to annotate which speaker is currently talking in the uploaded file. + + diarization_threshold : typing.Optional[float] + Diarization threshold to apply during speaker diarization. A higher value means there will be a lower chance of one speaker being diarized as two different speakers but also a higher chance of two different speakers being diarized as one speaker (less total speakers predicted). A low value means there will be a higher chance of one speaker being diarized as two different speakers but also a lower chance of two different speakers being diarized as one speaker (more total speakers predicted). Can only be set when diarize=True and num_speakers=None. Defaults to None, in which case we will choose a threshold based on the model_id (0.22 usually). + + additional_formats : typing.Optional[AdditionalFormats] + A list of additional formats to export the transcript to. + + file_format : typing.Optional[SpeechToTextConvertRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + cloud_storage_url : typing.Optional[str] + [Deprecated] This parameter is deprecated and will be removed in the future. Use 'source_url' instead.The HTTPS URL of the file to transcribe. Exactly one of the file or cloud_storage_url parameters must be provided. The file must be accessible via HTTPS and the file size must be less than 2GB. Any valid HTTPS URL is accepted, including URLs from cloud storage providers (AWS S3, Google Cloud Storage, Cloudflare R2, etc.), CDNs, or any other HTTPS source. URLs can be pre-signed or include authentication tokens in query parameters. + + source_url : typing.Optional[str] + The URL of an audio or video file to transcribe. Supports hosted video or audio files, YouTube video URLs, TikTok video URLs, and other video hosting services. + + webhook : typing.Optional[bool] + Whether to send the transcription result to configured speech-to-text webhooks. If set the request will return early without the transcription, which will be delivered later via webhook. + + webhook_id : typing.Optional[str] + Optional specific webhook ID to send the transcription result to. Only valid when webhook is set to true. If not provided, transcription will be sent to all configured speech-to-text webhooks. + + temperature : typing.Optional[float] + Controls the randomness of the transcription output. Accepts values between 0.0 and 2.0, where higher values result in more diverse and less deterministic results. If omitted, we will use a temperature based on the model you selected which is usually 0. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be an integer between 0 and 2147483647. + + use_multi_channel : typing.Optional[bool] + Whether the audio file contains multiple channels where each channel contains a single speaker. When enabled, each channel is transcribed independently. By default a separate transcript is returned per channel; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Each word in the response includes a 'channel_index' field indicating which channel it was spoken on. A maximum of 5 channels is supported. Each channel is billed independently at the full audio duration, so cost scales linearly with the number of channels. + + multichannel_output_style : typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] + Controls the response shape when use_multi_channel is enabled. 'separate' (default) returns one transcript per channel under 'transcripts'. 'combined' merges all channels into a single transcript whose words are sorted by start time, each carrying a 'channel_index' - matching the single-channel response shape. 'combined' requires timestamps (timestamps_granularity must not be 'none') and does not support entity detection or redaction. + + webhook_metadata : typing.Optional[SpeechToTextConvertRequestWebhookMetadata] + Optional metadata to be included in the webhook response. This should be a JSON string representing an object with a maximum depth of 2 levels and maximum size of 16KB. Useful for tracking internal IDs, job references, or other contextual information. + + entity_detection : typing.Optional[SpeechToTextConvertRequestEntityDetection] + Detect entities in the transcript. Can be 'all' to detect all entities, a single entity type or category string, or a list of entity types/categories. Categories include 'pii', 'phi', 'pci', 'other', 'offensive_language'. When enabled, detected entities will be returned in the 'entities' field with their text, type, and character positions. + + no_verbatim : typing.Optional[bool] + If true, the transcription will not have any filler words, false starts and non-speech sounds. Only supported with scribe_v2 model. + + use_speaker_library : typing.Optional[bool] + Whether to use the speaker library for identifying known speakers during diarization. When enabled and diarize is true, detected speakers will be matched against registered speakers in the workspace's speaker library. + + detect_speaker_roles : typing.Optional[bool] + Whether to detect speaker roles (agent vs customer). Requires diarize=true. Cannot be used with use_multi_channel=true. When enabled, speaker_id values will be 'agent' and 'customer' instead of 'speaker_0', 'speaker_1', etc. Usage incurs an additional 10% surcharge on base transcription cost. + + entity_redaction : typing.Optional[SpeechToTextConvertRequestEntityRedaction] + Redact entities from the transcript text. Accepts the same format as entity_detection: 'all', a category ('pii', 'phi'), or specific entity types. Must be a subset of entity_detection. When redaction is enabled, the entities field will not be returned. + + entity_redaction_mode : typing.Optional[str] + How to format redacted entities. 'redacted' replaces with {REDACTED}, 'entity_type' replaces with {ENTITY_TYPE}, 'enumerated_entity_type' replaces with {ENTITY_TYPE_N} where N enumerates each occurrence. Only used when entity_redaction is set. + + keyterms : typing.Optional[typing.List[str]] + A list of keyterms to bias the transcription towards. The keyterms are words or phrases you want the model to recognise more accurately. The number of keyterms cannot exceed 1000. The length of each keyterm must be less than 50 characters. Keyterms can contain at most 5 words (after normalisation). For example ["hello", "world", "technical term"]. The following characters are not supported: `<`, `>`, `{`, `}`, `[`, `]`, `\\`. Usage of this parameter will incur an additional 20% surcharge on the base transcription cost. When more than 100 keyterms are provided, a minimum billable duration of 20 seconds applies per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeechToTextConvertResponse + Synchronous transcription result + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_to_text.convert( + token="token", + enable_logging=True, + model_id="scribe_v2", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.convert( + model_id=model_id, + token=token, + enable_logging=enable_logging, + file=file, + language_code=language_code, + transcript_edit=transcript_edit, + tag_audio_events=tag_audio_events, + num_speakers=num_speakers, + timestamps_granularity=timestamps_granularity, + diarize=diarize, + diarization_threshold=diarization_threshold, + additional_formats=additional_formats, + file_format=file_format, + cloud_storage_url=cloud_storage_url, + source_url=source_url, + webhook=webhook, + webhook_id=webhook_id, + temperature=temperature, + seed=seed, + use_multi_channel=use_multi_channel, + multichannel_output_style=multichannel_output_style, + webhook_metadata=webhook_metadata, + entity_detection=entity_detection, + no_verbatim=no_verbatim, + use_speaker_library=use_speaker_library, + detect_speaker_roles=detect_speaker_roles, + entity_redaction=entity_redaction, + entity_redaction_mode=entity_redaction_mode, + keyterms=keyterms, + request_options=request_options, + ) + return _response.data + + @property + def transcripts(self): + if self._transcripts is None: + from .transcripts.client import AsyncTranscriptsClient # noqa: E402 + + self._transcripts = AsyncTranscriptsClient(client_wrapper=self._client_wrapper) + return self._transcripts diff --git a/data/src/elevenlabs/speech_to_text/raw_client.py b/data/src/elevenlabs/speech_to_text/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b05a3ef97231212c14f4e2fb81692e9d207ef6c1 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/raw_client.py @@ -0,0 +1,459 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.additional_formats import AdditionalFormats +from .types.speech_to_text_convert_request_entity_detection import SpeechToTextConvertRequestEntityDetection +from .types.speech_to_text_convert_request_entity_redaction import SpeechToTextConvertRequestEntityRedaction +from .types.speech_to_text_convert_request_file_format import SpeechToTextConvertRequestFileFormat +from .types.speech_to_text_convert_request_multichannel_output_style import ( + SpeechToTextConvertRequestMultichannelOutputStyle, +) +from .types.speech_to_text_convert_request_timestamps_granularity import SpeechToTextConvertRequestTimestampsGranularity +from .types.speech_to_text_convert_request_webhook_metadata import SpeechToTextConvertRequestWebhookMetadata +from .types.speech_to_text_convert_response import SpeechToTextConvertResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSpeechToTextClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def convert( + self, + *, + model_id: str, + token: typing.Optional[str] = None, + enable_logging: typing.Optional[bool] = None, + file: typing.Optional[core.File] = OMIT, + language_code: typing.Optional[str] = OMIT, + transcript_edit: typing.Optional[str] = OMIT, + tag_audio_events: typing.Optional[bool] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + timestamps_granularity: typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] = OMIT, + diarize: typing.Optional[bool] = OMIT, + diarization_threshold: typing.Optional[float] = OMIT, + additional_formats: typing.Optional[AdditionalFormats] = OMIT, + file_format: typing.Optional[SpeechToTextConvertRequestFileFormat] = OMIT, + cloud_storage_url: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + webhook: typing.Optional[bool] = OMIT, + webhook_id: typing.Optional[str] = OMIT, + temperature: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + use_multi_channel: typing.Optional[bool] = OMIT, + multichannel_output_style: typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] = OMIT, + webhook_metadata: typing.Optional[SpeechToTextConvertRequestWebhookMetadata] = OMIT, + entity_detection: typing.Optional[SpeechToTextConvertRequestEntityDetection] = OMIT, + no_verbatim: typing.Optional[bool] = OMIT, + use_speaker_library: typing.Optional[bool] = OMIT, + detect_speaker_roles: typing.Optional[bool] = OMIT, + entity_redaction: typing.Optional[SpeechToTextConvertRequestEntityRedaction] = OMIT, + entity_redaction_mode: typing.Optional[str] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[SpeechToTextConvertResponse]: + """ + Transcribe an audio or video file. If webhook is set to true, the request will be processed asynchronously and results sent to configured webhooks. When use_multi_channel is true and the provided audio has multiple channels, a 'transcripts' object with separate transcripts for each channel is returned; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Otherwise, returns a single transcript. The optional webhook_metadata parameter allows you to attach custom data that will be included in webhook responses for request correlation and tracking. + + Parameters + ---------- + model_id : str + The ID of the model to use for transcription. + + token : typing.Optional[str] + A single-use authentication token created via POST /v1/single-use-token/batch_scribe. This token can only be used once and expires after 15 minutes. Alternative to API key or bearer token authentication for frontend clients. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean log and transcript storage features are unavailable for this request. Zero retention mode may only be used by enterprise customers. + + file : typing.Optional[core.File] + See core.File for more documentation + + language_code : typing.Optional[str] + An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. Can sometimes improve transcription performance if known beforehand. Defaults to null, in this case the language is predicted automatically. + + transcript_edit : typing.Optional[str] + Natural-language instruction applied to the final transcript (max 2000 characters). The edited text is returned in 'edited_transcript' alongside the original transcript. Cannot be combined with entity_detection, entity_redaction or use_multi_channel. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost, billed for at least 10 seconds of audio. + + tag_audio_events : typing.Optional[bool] + Whether to tag audio events like (laughter), (footsteps), etc. in the transcription. + + num_speakers : typing.Optional[int] + The maximum amount of speakers talking in the uploaded file. Can help with predicting who speaks when. The maximum amount of speakers that can be predicted is 32. Defaults to null, in this case the amount of speakers is set to the maximum value the model supports. + + timestamps_granularity : typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] + The granularity of the timestamps in the transcription. 'word' provides word-level timestamps and 'character' provides character-level timestamps per word. + + diarize : typing.Optional[bool] + Whether to annotate which speaker is currently talking in the uploaded file. + + diarization_threshold : typing.Optional[float] + Diarization threshold to apply during speaker diarization. A higher value means there will be a lower chance of one speaker being diarized as two different speakers but also a higher chance of two different speakers being diarized as one speaker (less total speakers predicted). A low value means there will be a higher chance of one speaker being diarized as two different speakers but also a lower chance of two different speakers being diarized as one speaker (more total speakers predicted). Can only be set when diarize=True and num_speakers=None. Defaults to None, in which case we will choose a threshold based on the model_id (0.22 usually). + + additional_formats : typing.Optional[AdditionalFormats] + A list of additional formats to export the transcript to. + + file_format : typing.Optional[SpeechToTextConvertRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + cloud_storage_url : typing.Optional[str] + [Deprecated] This parameter is deprecated and will be removed in the future. Use 'source_url' instead.The HTTPS URL of the file to transcribe. Exactly one of the file or cloud_storage_url parameters must be provided. The file must be accessible via HTTPS and the file size must be less than 2GB. Any valid HTTPS URL is accepted, including URLs from cloud storage providers (AWS S3, Google Cloud Storage, Cloudflare R2, etc.), CDNs, or any other HTTPS source. URLs can be pre-signed or include authentication tokens in query parameters. + + source_url : typing.Optional[str] + The URL of an audio or video file to transcribe. Supports hosted video or audio files, YouTube video URLs, TikTok video URLs, and other video hosting services. + + webhook : typing.Optional[bool] + Whether to send the transcription result to configured speech-to-text webhooks. If set the request will return early without the transcription, which will be delivered later via webhook. + + webhook_id : typing.Optional[str] + Optional specific webhook ID to send the transcription result to. Only valid when webhook is set to true. If not provided, transcription will be sent to all configured speech-to-text webhooks. + + temperature : typing.Optional[float] + Controls the randomness of the transcription output. Accepts values between 0.0 and 2.0, where higher values result in more diverse and less deterministic results. If omitted, we will use a temperature based on the model you selected which is usually 0. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be an integer between 0 and 2147483647. + + use_multi_channel : typing.Optional[bool] + Whether the audio file contains multiple channels where each channel contains a single speaker. When enabled, each channel is transcribed independently. By default a separate transcript is returned per channel; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Each word in the response includes a 'channel_index' field indicating which channel it was spoken on. A maximum of 5 channels is supported. Each channel is billed independently at the full audio duration, so cost scales linearly with the number of channels. + + multichannel_output_style : typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] + Controls the response shape when use_multi_channel is enabled. 'separate' (default) returns one transcript per channel under 'transcripts'. 'combined' merges all channels into a single transcript whose words are sorted by start time, each carrying a 'channel_index' - matching the single-channel response shape. 'combined' requires timestamps (timestamps_granularity must not be 'none') and does not support entity detection or redaction. + + webhook_metadata : typing.Optional[SpeechToTextConvertRequestWebhookMetadata] + Optional metadata to be included in the webhook response. This should be a JSON string representing an object with a maximum depth of 2 levels and maximum size of 16KB. Useful for tracking internal IDs, job references, or other contextual information. + + entity_detection : typing.Optional[SpeechToTextConvertRequestEntityDetection] + Detect entities in the transcript. Can be 'all' to detect all entities, a single entity type or category string, or a list of entity types/categories. Categories include 'pii', 'phi', 'pci', 'other', 'offensive_language'. When enabled, detected entities will be returned in the 'entities' field with their text, type, and character positions. + + no_verbatim : typing.Optional[bool] + If true, the transcription will not have any filler words, false starts and non-speech sounds. Only supported with scribe_v2 model. + + use_speaker_library : typing.Optional[bool] + Whether to use the speaker library for identifying known speakers during diarization. When enabled and diarize is true, detected speakers will be matched against registered speakers in the workspace's speaker library. + + detect_speaker_roles : typing.Optional[bool] + Whether to detect speaker roles (agent vs customer). Requires diarize=true. Cannot be used with use_multi_channel=true. When enabled, speaker_id values will be 'agent' and 'customer' instead of 'speaker_0', 'speaker_1', etc. Usage incurs an additional 10% surcharge on base transcription cost. + + entity_redaction : typing.Optional[SpeechToTextConvertRequestEntityRedaction] + Redact entities from the transcript text. Accepts the same format as entity_detection: 'all', a category ('pii', 'phi'), or specific entity types. Must be a subset of entity_detection. When redaction is enabled, the entities field will not be returned. + + entity_redaction_mode : typing.Optional[str] + How to format redacted entities. 'redacted' replaces with {REDACTED}, 'entity_type' replaces with {ENTITY_TYPE}, 'enumerated_entity_type' replaces with {ENTITY_TYPE_N} where N enumerates each occurrence. Only used when entity_redaction is set. + + keyterms : typing.Optional[typing.List[str]] + A list of keyterms to bias the transcription towards. The keyterms are words or phrases you want the model to recognise more accurately. The number of keyterms cannot exceed 1000. The length of each keyterm must be less than 50 characters. Keyterms can contain at most 5 words (after normalisation). For example ["hello", "world", "technical term"]. The following characters are not supported: `<`, `>`, `{`, `}`, `[`, `]`, `\\`. Usage of this parameter will incur an additional 20% surcharge on the base transcription cost. When more than 100 keyterms are provided, a minimum billable duration of 20 seconds applies per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeechToTextConvertResponse] + Synchronous transcription result + """ + _response = self._client_wrapper.httpx_client.request( + "v1/speech-to-text", + method="POST", + params={ + "token": token, + "enable_logging": enable_logging, + }, + data={ + "model_id": model_id, + "language_code": language_code, + "transcript_edit": transcript_edit, + "tag_audio_events": tag_audio_events, + "num_speakers": num_speakers, + "timestamps_granularity": timestamps_granularity, + "diarize": diarize, + "diarization_threshold": diarization_threshold, + "file_format": file_format, + "cloud_storage_url": cloud_storage_url, + "source_url": source_url, + "webhook": webhook, + "webhook_id": webhook_id, + "temperature": temperature, + "seed": seed, + "use_multi_channel": use_multi_channel, + "multichannel_output_style": multichannel_output_style, + "webhook_metadata": json.dumps(jsonable_encoder(webhook_metadata)), + "entity_detection": json.dumps(jsonable_encoder(entity_detection)), + "no_verbatim": no_verbatim, + "use_speaker_library": use_speaker_library, + "detect_speaker_roles": detect_speaker_roles, + "entity_redaction": json.dumps(jsonable_encoder(entity_redaction)), + "entity_redaction_mode": entity_redaction_mode, + "keyterms": keyterms, + }, + files={ + **({"file": file} if file is not None else {}), + **( + {"additional_formats": (None, json.dumps(jsonable_encoder(additional_formats)), "application/json")} + if additional_formats is not OMIT + else {} + ), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechToTextConvertResponse, + construct_type( + type_=SpeechToTextConvertResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSpeechToTextClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def convert( + self, + *, + model_id: str, + token: typing.Optional[str] = None, + enable_logging: typing.Optional[bool] = None, + file: typing.Optional[core.File] = OMIT, + language_code: typing.Optional[str] = OMIT, + transcript_edit: typing.Optional[str] = OMIT, + tag_audio_events: typing.Optional[bool] = OMIT, + num_speakers: typing.Optional[int] = OMIT, + timestamps_granularity: typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] = OMIT, + diarize: typing.Optional[bool] = OMIT, + diarization_threshold: typing.Optional[float] = OMIT, + additional_formats: typing.Optional[AdditionalFormats] = OMIT, + file_format: typing.Optional[SpeechToTextConvertRequestFileFormat] = OMIT, + cloud_storage_url: typing.Optional[str] = OMIT, + source_url: typing.Optional[str] = OMIT, + webhook: typing.Optional[bool] = OMIT, + webhook_id: typing.Optional[str] = OMIT, + temperature: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + use_multi_channel: typing.Optional[bool] = OMIT, + multichannel_output_style: typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] = OMIT, + webhook_metadata: typing.Optional[SpeechToTextConvertRequestWebhookMetadata] = OMIT, + entity_detection: typing.Optional[SpeechToTextConvertRequestEntityDetection] = OMIT, + no_verbatim: typing.Optional[bool] = OMIT, + use_speaker_library: typing.Optional[bool] = OMIT, + detect_speaker_roles: typing.Optional[bool] = OMIT, + entity_redaction: typing.Optional[SpeechToTextConvertRequestEntityRedaction] = OMIT, + entity_redaction_mode: typing.Optional[str] = OMIT, + keyterms: typing.Optional[typing.List[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[SpeechToTextConvertResponse]: + """ + Transcribe an audio or video file. If webhook is set to true, the request will be processed asynchronously and results sent to configured webhooks. When use_multi_channel is true and the provided audio has multiple channels, a 'transcripts' object with separate transcripts for each channel is returned; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Otherwise, returns a single transcript. The optional webhook_metadata parameter allows you to attach custom data that will be included in webhook responses for request correlation and tracking. + + Parameters + ---------- + model_id : str + The ID of the model to use for transcription. + + token : typing.Optional[str] + A single-use authentication token created via POST /v1/single-use-token/batch_scribe. This token can only be used once and expires after 15 minutes. Alternative to API key or bearer token authentication for frontend clients. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean log and transcript storage features are unavailable for this request. Zero retention mode may only be used by enterprise customers. + + file : typing.Optional[core.File] + See core.File for more documentation + + language_code : typing.Optional[str] + An ISO-639-1 or ISO-639-3 language_code corresponding to the language of the audio file. Can sometimes improve transcription performance if known beforehand. Defaults to null, in this case the language is predicted automatically. + + transcript_edit : typing.Optional[str] + Natural-language instruction applied to the final transcript (max 2000 characters). The edited text is returned in 'edited_transcript' alongside the original transcript. Cannot be combined with entity_detection, entity_redaction or use_multi_channel. Usage of this parameter will incur an additional 30% surcharge on the base transcription cost, billed for at least 10 seconds of audio. + + tag_audio_events : typing.Optional[bool] + Whether to tag audio events like (laughter), (footsteps), etc. in the transcription. + + num_speakers : typing.Optional[int] + The maximum amount of speakers talking in the uploaded file. Can help with predicting who speaks when. The maximum amount of speakers that can be predicted is 32. Defaults to null, in this case the amount of speakers is set to the maximum value the model supports. + + timestamps_granularity : typing.Optional[SpeechToTextConvertRequestTimestampsGranularity] + The granularity of the timestamps in the transcription. 'word' provides word-level timestamps and 'character' provides character-level timestamps per word. + + diarize : typing.Optional[bool] + Whether to annotate which speaker is currently talking in the uploaded file. + + diarization_threshold : typing.Optional[float] + Diarization threshold to apply during speaker diarization. A higher value means there will be a lower chance of one speaker being diarized as two different speakers but also a higher chance of two different speakers being diarized as one speaker (less total speakers predicted). A low value means there will be a higher chance of one speaker being diarized as two different speakers but also a lower chance of two different speakers being diarized as one speaker (more total speakers predicted). Can only be set when diarize=True and num_speakers=None. Defaults to None, in which case we will choose a threshold based on the model_id (0.22 usually). + + additional_formats : typing.Optional[AdditionalFormats] + A list of additional formats to export the transcript to. + + file_format : typing.Optional[SpeechToTextConvertRequestFileFormat] + The format of input audio. Options are 'pcm_s16le_16' or 'other' For `pcm_s16le_16`, the input audio must be 16-bit PCM at a 16kHz sample rate, single channel (mono), and little-endian byte order. Latency will be lower than with passing an encoded waveform. + + cloud_storage_url : typing.Optional[str] + [Deprecated] This parameter is deprecated and will be removed in the future. Use 'source_url' instead.The HTTPS URL of the file to transcribe. Exactly one of the file or cloud_storage_url parameters must be provided. The file must be accessible via HTTPS and the file size must be less than 2GB. Any valid HTTPS URL is accepted, including URLs from cloud storage providers (AWS S3, Google Cloud Storage, Cloudflare R2, etc.), CDNs, or any other HTTPS source. URLs can be pre-signed or include authentication tokens in query parameters. + + source_url : typing.Optional[str] + The URL of an audio or video file to transcribe. Supports hosted video or audio files, YouTube video URLs, TikTok video URLs, and other video hosting services. + + webhook : typing.Optional[bool] + Whether to send the transcription result to configured speech-to-text webhooks. If set the request will return early without the transcription, which will be delivered later via webhook. + + webhook_id : typing.Optional[str] + Optional specific webhook ID to send the transcription result to. Only valid when webhook is set to true. If not provided, transcription will be sent to all configured speech-to-text webhooks. + + temperature : typing.Optional[float] + Controls the randomness of the transcription output. Accepts values between 0.0 and 2.0, where higher values result in more diverse and less deterministic results. If omitted, we will use a temperature based on the model you selected which is usually 0. + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be an integer between 0 and 2147483647. + + use_multi_channel : typing.Optional[bool] + Whether the audio file contains multiple channels where each channel contains a single speaker. When enabled, each channel is transcribed independently. By default a separate transcript is returned per channel; set multichannel_output_style='combined' to instead receive a single transcript with all channels merged and sorted by time. Each word in the response includes a 'channel_index' field indicating which channel it was spoken on. A maximum of 5 channels is supported. Each channel is billed independently at the full audio duration, so cost scales linearly with the number of channels. + + multichannel_output_style : typing.Optional[SpeechToTextConvertRequestMultichannelOutputStyle] + Controls the response shape when use_multi_channel is enabled. 'separate' (default) returns one transcript per channel under 'transcripts'. 'combined' merges all channels into a single transcript whose words are sorted by start time, each carrying a 'channel_index' - matching the single-channel response shape. 'combined' requires timestamps (timestamps_granularity must not be 'none') and does not support entity detection or redaction. + + webhook_metadata : typing.Optional[SpeechToTextConvertRequestWebhookMetadata] + Optional metadata to be included in the webhook response. This should be a JSON string representing an object with a maximum depth of 2 levels and maximum size of 16KB. Useful for tracking internal IDs, job references, or other contextual information. + + entity_detection : typing.Optional[SpeechToTextConvertRequestEntityDetection] + Detect entities in the transcript. Can be 'all' to detect all entities, a single entity type or category string, or a list of entity types/categories. Categories include 'pii', 'phi', 'pci', 'other', 'offensive_language'. When enabled, detected entities will be returned in the 'entities' field with their text, type, and character positions. + + no_verbatim : typing.Optional[bool] + If true, the transcription will not have any filler words, false starts and non-speech sounds. Only supported with scribe_v2 model. + + use_speaker_library : typing.Optional[bool] + Whether to use the speaker library for identifying known speakers during diarization. When enabled and diarize is true, detected speakers will be matched against registered speakers in the workspace's speaker library. + + detect_speaker_roles : typing.Optional[bool] + Whether to detect speaker roles (agent vs customer). Requires diarize=true. Cannot be used with use_multi_channel=true. When enabled, speaker_id values will be 'agent' and 'customer' instead of 'speaker_0', 'speaker_1', etc. Usage incurs an additional 10% surcharge on base transcription cost. + + entity_redaction : typing.Optional[SpeechToTextConvertRequestEntityRedaction] + Redact entities from the transcript text. Accepts the same format as entity_detection: 'all', a category ('pii', 'phi'), or specific entity types. Must be a subset of entity_detection. When redaction is enabled, the entities field will not be returned. + + entity_redaction_mode : typing.Optional[str] + How to format redacted entities. 'redacted' replaces with {REDACTED}, 'entity_type' replaces with {ENTITY_TYPE}, 'enumerated_entity_type' replaces with {ENTITY_TYPE_N} where N enumerates each occurrence. Only used when entity_redaction is set. + + keyterms : typing.Optional[typing.List[str]] + A list of keyterms to bias the transcription towards. The keyterms are words or phrases you want the model to recognise more accurately. The number of keyterms cannot exceed 1000. The length of each keyterm must be less than 50 characters. Keyterms can contain at most 5 words (after normalisation). For example ["hello", "world", "technical term"]. The following characters are not supported: `<`, `>`, `{`, `}`, `[`, `]`, `\\`. Usage of this parameter will incur an additional 20% surcharge on the base transcription cost. When more than 100 keyterms are provided, a minimum billable duration of 20 seconds applies per request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeechToTextConvertResponse] + Synchronous transcription result + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/speech-to-text", + method="POST", + params={ + "token": token, + "enable_logging": enable_logging, + }, + data={ + "model_id": model_id, + "language_code": language_code, + "transcript_edit": transcript_edit, + "tag_audio_events": tag_audio_events, + "num_speakers": num_speakers, + "timestamps_granularity": timestamps_granularity, + "diarize": diarize, + "diarization_threshold": diarization_threshold, + "file_format": file_format, + "cloud_storage_url": cloud_storage_url, + "source_url": source_url, + "webhook": webhook, + "webhook_id": webhook_id, + "temperature": temperature, + "seed": seed, + "use_multi_channel": use_multi_channel, + "multichannel_output_style": multichannel_output_style, + "webhook_metadata": json.dumps(jsonable_encoder(webhook_metadata)), + "entity_detection": json.dumps(jsonable_encoder(entity_detection)), + "no_verbatim": no_verbatim, + "use_speaker_library": use_speaker_library, + "detect_speaker_roles": detect_speaker_roles, + "entity_redaction": json.dumps(jsonable_encoder(entity_redaction)), + "entity_redaction_mode": entity_redaction_mode, + "keyterms": keyterms, + }, + files={ + **({"file": file} if file is not None else {}), + **( + {"additional_formats": (None, json.dumps(jsonable_encoder(additional_formats)), "application/json")} + if additional_formats is not OMIT + else {} + ), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeechToTextConvertResponse, + construct_type( + type_=SpeechToTextConvertResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/speech_to_text/transcripts/__init__.py b/data/src/elevenlabs/speech_to_text/transcripts/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..51c0952b346cc7038d603b42e44385cd63c6dbe2 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/transcripts/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import TranscriptsGetResponse +_dynamic_imports: typing.Dict[str, str] = {"TranscriptsGetResponse": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TranscriptsGetResponse"] diff --git a/data/src/elevenlabs/speech_to_text/transcripts/client.py b/data/src/elevenlabs/speech_to_text/transcripts/client.py new file mode 100644 index 0000000000000000000000000000000000000000..4e5b66af8c333514d26324151adbd39b6819874f --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/transcripts/client.py @@ -0,0 +1,186 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from .raw_client import AsyncRawTranscriptsClient, RawTranscriptsClient +from .types.transcripts_get_response import TranscriptsGetResponse + + +class TranscriptsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTranscriptsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTranscriptsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTranscriptsClient + """ + return self._raw_client + + def get( + self, transcription_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> TranscriptsGetResponse: + """ + Retrieve a previously generated transcript by its ID. + + Parameters + ---------- + transcription_id : str + The unique ID of the transcript to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TranscriptsGetResponse + The transcript data + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_to_text.transcripts.get( + transcription_id="transcription_id", + ) + """ + _response = self._raw_client.get(transcription_id, request_options=request_options) + return _response.data + + def delete(self, transcription_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete a previously generated transcript by its ID. + + Parameters + ---------- + transcription_id : str + The unique ID of the transcript to delete + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Delete completed successfully. + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.speech_to_text.transcripts.delete( + transcription_id="transcription_id", + ) + """ + _response = self._raw_client.delete(transcription_id, request_options=request_options) + return _response.data + + +class AsyncTranscriptsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTranscriptsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTranscriptsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTranscriptsClient + """ + return self._raw_client + + async def get( + self, transcription_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> TranscriptsGetResponse: + """ + Retrieve a previously generated transcript by its ID. + + Parameters + ---------- + transcription_id : str + The unique ID of the transcript to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + TranscriptsGetResponse + The transcript data + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_to_text.transcripts.get( + transcription_id="transcription_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(transcription_id, request_options=request_options) + return _response.data + + async def delete( + self, transcription_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete a previously generated transcript by its ID. + + Parameters + ---------- + transcription_id : str + The unique ID of the transcript to delete + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Delete completed successfully. + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.speech_to_text.transcripts.delete( + transcription_id="transcription_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(transcription_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/speech_to_text/transcripts/raw_client.py b/data/src/elevenlabs/speech_to_text/transcripts/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..856d0d04e7269b046daaf27ff14455114ffc1c7e --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/transcripts/raw_client.py @@ -0,0 +1,313 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.not_found_error import NotFoundError +from ...errors.unauthorized_error import UnauthorizedError +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from .types.transcripts_get_response import TranscriptsGetResponse +from pydantic import ValidationError + + +class RawTranscriptsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, transcription_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[TranscriptsGetResponse]: + """ + Retrieve a previously generated transcript by its ID. + + Parameters + ---------- + transcription_id : str + The unique ID of the transcript to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[TranscriptsGetResponse] + The transcript data + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/speech-to-text/transcripts/{jsonable_encoder(transcription_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TranscriptsGetResponse, + construct_type( + type_=TranscriptsGetResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, transcription_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Delete a previously generated transcript by its ID. + + Parameters + ---------- + transcription_id : str + The unique ID of the transcript to delete + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Delete completed successfully. + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/speech-to-text/transcripts/{jsonable_encoder(transcription_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTranscriptsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, transcription_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[TranscriptsGetResponse]: + """ + Retrieve a previously generated transcript by its ID. + + Parameters + ---------- + transcription_id : str + The unique ID of the transcript to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[TranscriptsGetResponse] + The transcript data + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/speech-to-text/transcripts/{jsonable_encoder(transcription_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + TranscriptsGetResponse, + construct_type( + type_=TranscriptsGetResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 404: + raise NotFoundError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, transcription_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete a previously generated transcript by its ID. + + Parameters + ---------- + transcription_id : str + The unique ID of the transcript to delete + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Delete completed successfully. + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/speech-to-text/transcripts/{jsonable_encoder(transcription_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 401: + raise UnauthorizedError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/speech_to_text/transcripts/types/__init__.py b/data/src/elevenlabs/speech_to_text/transcripts/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..57194ed51dc0a9d6e80e2efde908b60e4c31f20d --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/transcripts/types/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .transcripts_get_response import TranscriptsGetResponse +_dynamic_imports: typing.Dict[str, str] = {"TranscriptsGetResponse": ".transcripts_get_response"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TranscriptsGetResponse"] diff --git a/data/src/elevenlabs/speech_to_text/transcripts/types/transcripts_get_response.py b/data/src/elevenlabs/speech_to_text/transcripts/types/transcripts_get_response.py new file mode 100644 index 0000000000000000000000000000000000000000..394743519b855fdd0fede8eba4f710b760645a47 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/transcripts/types/transcripts_get_response.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....types.multichannel_speech_to_text_response_model import MultichannelSpeechToTextResponseModel +from ....types.speech_to_text_chunk_response_model import SpeechToTextChunkResponseModel + +TranscriptsGetResponse = typing.Union[SpeechToTextChunkResponseModel, MultichannelSpeechToTextResponseModel] diff --git a/data/src/elevenlabs/speech_to_text/types/__init__.py b/data/src/elevenlabs/speech_to_text/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f17c60119277ac67f43ab91647c04024c64430a1 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/types/__init__.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .speech_to_text_convert_request_entity_detection import SpeechToTextConvertRequestEntityDetection + from .speech_to_text_convert_request_entity_redaction import SpeechToTextConvertRequestEntityRedaction + from .speech_to_text_convert_request_file_format import SpeechToTextConvertRequestFileFormat + from .speech_to_text_convert_request_multichannel_output_style import ( + SpeechToTextConvertRequestMultichannelOutputStyle, + ) + from .speech_to_text_convert_request_timestamps_granularity import SpeechToTextConvertRequestTimestampsGranularity + from .speech_to_text_convert_request_webhook_metadata import SpeechToTextConvertRequestWebhookMetadata + from .speech_to_text_convert_response import SpeechToTextConvertResponse +_dynamic_imports: typing.Dict[str, str] = { + "SpeechToTextConvertRequestEntityDetection": ".speech_to_text_convert_request_entity_detection", + "SpeechToTextConvertRequestEntityRedaction": ".speech_to_text_convert_request_entity_redaction", + "SpeechToTextConvertRequestFileFormat": ".speech_to_text_convert_request_file_format", + "SpeechToTextConvertRequestMultichannelOutputStyle": ".speech_to_text_convert_request_multichannel_output_style", + "SpeechToTextConvertRequestTimestampsGranularity": ".speech_to_text_convert_request_timestamps_granularity", + "SpeechToTextConvertRequestWebhookMetadata": ".speech_to_text_convert_request_webhook_metadata", + "SpeechToTextConvertResponse": ".speech_to_text_convert_response", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "SpeechToTextConvertRequestEntityDetection", + "SpeechToTextConvertRequestEntityRedaction", + "SpeechToTextConvertRequestFileFormat", + "SpeechToTextConvertRequestMultichannelOutputStyle", + "SpeechToTextConvertRequestTimestampsGranularity", + "SpeechToTextConvertRequestWebhookMetadata", + "SpeechToTextConvertResponse", +] diff --git a/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_entity_detection.py b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_entity_detection.py new file mode 100644 index 0000000000000000000000000000000000000000..8b406722fc8e408cbc22d9026275a3ad078781c9 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_entity_detection.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToTextConvertRequestEntityDetection = typing.Union[str, typing.List[str]] diff --git a/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_entity_redaction.py b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_entity_redaction.py new file mode 100644 index 0000000000000000000000000000000000000000..08e08ac97c0a7cf2af2b9737011cd1d3e849b45c --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_entity_redaction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToTextConvertRequestEntityRedaction = typing.Union[str, typing.List[str]] diff --git a/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_file_format.py b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_file_format.py new file mode 100644 index 0000000000000000000000000000000000000000..2dc6c670b5cb4116e32a82871f03c75a62e129f6 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_file_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToTextConvertRequestFileFormat = typing.Union[typing.Literal["pcm_s16le_16", "other"], typing.Any] diff --git a/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_multichannel_output_style.py b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_multichannel_output_style.py new file mode 100644 index 0000000000000000000000000000000000000000..e46c39b42c8f57e96722d64936ec6dc610e613f9 --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_multichannel_output_style.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToTextConvertRequestMultichannelOutputStyle = typing.Union[typing.Literal["separate", "combined"], typing.Any] diff --git a/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_timestamps_granularity.py b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_timestamps_granularity.py new file mode 100644 index 0000000000000000000000000000000000000000..f01a8f83d91f217ea603e52906ab418504ef1fdc --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_timestamps_granularity.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToTextConvertRequestTimestampsGranularity = typing.Union[typing.Literal["none", "word", "character"], typing.Any] diff --git a/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_webhook_metadata.py b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_webhook_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..a6c7a4e31c74caa761f5ae8f29079994c3d9be2e --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_request_webhook_metadata.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToTextConvertRequestWebhookMetadata = typing.Union[str, typing.Dict[str, typing.Any]] diff --git a/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_response.py b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_response.py new file mode 100644 index 0000000000000000000000000000000000000000..625287a066c672bebb125acc0a898c6453aff35d --- /dev/null +++ b/data/src/elevenlabs/speech_to_text/types/speech_to_text_convert_response.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.multichannel_speech_to_text_response_model import MultichannelSpeechToTextResponseModel +from ...types.speech_to_text_chunk_response_model import SpeechToTextChunkResponseModel +from ...types.speech_to_text_webhook_response_model import SpeechToTextWebhookResponseModel + +SpeechToTextConvertResponse = typing.Union[ + SpeechToTextChunkResponseModel, MultichannelSpeechToTextResponseModel, SpeechToTextWebhookResponseModel +] diff --git a/data/src/elevenlabs/speech_to_text_custom.py b/data/src/elevenlabs/speech_to_text_custom.py new file mode 100644 index 0000000000000000000000000000000000000000..45013c063e379796353f460bc840b1864318f16d --- /dev/null +++ b/data/src/elevenlabs/speech_to_text_custom.py @@ -0,0 +1,100 @@ +import typing + +from elevenlabs.speech_to_text.client import SpeechToTextClient as AutogeneratedSpeechToTextClient +from elevenlabs.speech_to_text.client import AsyncSpeechToTextClient as AutogeneratedAsyncSpeechToTextClient +from elevenlabs.realtime import ScribeRealtime + + +class SpeechToTextClient(AutogeneratedSpeechToTextClient): + """ + A client to handle ElevenLabs speech-to-text functionality. + Extends the autogenerated client to include realtime transcription. + """ + + def __init__(self, **kwargs: typing.Any) -> None: + super().__init__(**kwargs) + self._realtime: typing.Optional[ScribeRealtime] = None + + @property + def realtime(self) -> ScribeRealtime: + """ + Access the realtime speech-to-text transcription API. + + Returns: + ScribeRealtime instance for creating WebSocket connections + + Example: + ```python + from elevenlabs import ElevenLabs, RealtimeEvents, AudioFormat + + client = ElevenLabs(api_key="your-api-key") + + # URL-based streaming + connection = await client.speech_to_text.realtime.connect({ + "url": "https://stream.example.com/audio.mp3" + }) + + connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, lambda data: print(data)) + + # Manual audio chunks + connection = await client.speech_to_text.realtime.connect({ + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000 + }) + ``` + """ + if not self._realtime: + # Extract API key from client wrapper + api_key = self._client_wrapper.get_headers().get("xi-api-key", "") + base_url = self._client_wrapper.get_base_url() + + self._realtime = ScribeRealtime(api_key=api_key, base_url=base_url) + return self._realtime + + +class AsyncSpeechToTextClient(AutogeneratedAsyncSpeechToTextClient): + """ + An async client to handle ElevenLabs speech-to-text functionality. + Extends the autogenerated async client to include realtime transcription. + """ + + def __init__(self, **kwargs: typing.Any) -> None: + super().__init__(**kwargs) + self._realtime: typing.Optional[ScribeRealtime] = None + + @property + def realtime(self) -> ScribeRealtime: + """ + Access the realtime speech-to-text transcription API. + + Returns: + ScribeRealtime instance for creating WebSocket connections + + Example: + ```python + from elevenlabs import AsyncElevenLabs, RealtimeEvents, AudioFormat + + client = AsyncElevenLabs(api_key="your-api-key") + + # URL-based streaming + connection = await client.speech_to_text.realtime.connect({ + "url": "https://stream.example.com/audio.mp3" + }) + + connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, lambda data: print(data)) + + # Manual audio chunks + connection = await client.speech_to_text.realtime.connect({ + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000 + }) + ``` + """ + if not self._realtime: + # Extract API key from client wrapper + api_key = self._client_wrapper.get_headers().get("xi-api-key", "") + base_url = self._client_wrapper.get_base_url() + + self._realtime = ScribeRealtime(api_key=api_key, base_url=base_url) + return self._realtime + diff --git a/data/src/elevenlabs/studio/__init__.py b/data/src/elevenlabs/studio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..44318af88c437fad67dc4f946fa560bb61b12499 --- /dev/null +++ b/data/src/elevenlabs/studio/__init__.py @@ -0,0 +1,81 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization, + BodyCreatePodcastV1StudioPodcastsPostDurationScale, + BodyCreatePodcastV1StudioPodcastsPostMode, + BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin, + BodyCreatePodcastV1StudioPodcastsPostMode_Conversation, + BodyCreatePodcastV1StudioPodcastsPostSource, + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem, + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text, + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url, + ) + from . import projects + from .projects import ( + ProjectsCreateRequestApplyTextNormalization, + ProjectsCreateRequestFiction, + ProjectsCreateRequestSourceType, + ProjectsCreateRequestTargetAudience, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization": ".types", + "BodyCreatePodcastV1StudioPodcastsPostDurationScale": ".types", + "BodyCreatePodcastV1StudioPodcastsPostMode": ".types", + "BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin": ".types", + "BodyCreatePodcastV1StudioPodcastsPostMode_Conversation": ".types", + "BodyCreatePodcastV1StudioPodcastsPostSource": ".types", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem": ".types", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text": ".types", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url": ".types", + "ProjectsCreateRequestApplyTextNormalization": ".projects", + "ProjectsCreateRequestFiction": ".projects", + "ProjectsCreateRequestSourceType": ".projects", + "ProjectsCreateRequestTargetAudience": ".projects", + "projects": ".projects", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization", + "BodyCreatePodcastV1StudioPodcastsPostDurationScale", + "BodyCreatePodcastV1StudioPodcastsPostMode", + "BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin", + "BodyCreatePodcastV1StudioPodcastsPostMode_Conversation", + "BodyCreatePodcastV1StudioPodcastsPostSource", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url", + "ProjectsCreateRequestApplyTextNormalization", + "ProjectsCreateRequestFiction", + "ProjectsCreateRequestSourceType", + "ProjectsCreateRequestTargetAudience", + "projects", +] diff --git a/data/src/elevenlabs/studio/client.py b/data/src/elevenlabs/studio/client.py new file mode 100644 index 0000000000000000000000000000000000000000..38d9a35499a76058da6d21cd1e7c749260e7ba8a --- /dev/null +++ b/data/src/elevenlabs/studio/client.py @@ -0,0 +1,448 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.podcast_project_response_model import PodcastProjectResponseModel +from ..types.quality_preset_type import QualityPresetType +from .raw_client import AsyncRawStudioClient, RawStudioClient +from .types.body_create_podcast_v_1_studio_podcasts_post_apply_text_normalization import ( + BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization, +) +from .types.body_create_podcast_v_1_studio_podcasts_post_duration_scale import ( + BodyCreatePodcastV1StudioPodcastsPostDurationScale, +) +from .types.body_create_podcast_v_1_studio_podcasts_post_mode import BodyCreatePodcastV1StudioPodcastsPostMode +from .types.body_create_podcast_v_1_studio_podcasts_post_source import BodyCreatePodcastV1StudioPodcastsPostSource + +if typing.TYPE_CHECKING: + from .projects.client import AsyncProjectsClient, ProjectsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class StudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawStudioClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._projects: typing.Optional[ProjectsClient] = None + + @property + def with_raw_response(self) -> RawStudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawStudioClient + """ + return self._raw_client + + def create_podcast( + self, + *, + model_id: str, + mode: BodyCreatePodcastV1StudioPodcastsPostMode, + source: BodyCreatePodcastV1StudioPodcastsPostSource, + safety_identifier: typing.Optional[str] = None, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + duration_scale: typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale] = OMIT, + language: typing.Optional[str] = OMIT, + intro: typing.Optional[str] = OMIT, + outro: typing.Optional[str] = OMIT, + instructions_prompt: typing.Optional[str] = OMIT, + highlights: typing.Optional[typing.Sequence[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + apply_text_normalization: typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PodcastProjectResponseModel: + """ + Create and auto-convert a podcast project. Currently, the LLM cost is covered by us but you will still be charged for the audio generation. In the future, you will be charged for both the LLM and audio generation costs. + + Parameters + ---------- + model_id : str + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + mode : BodyCreatePodcastV1StudioPodcastsPostMode + The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue. + + source : BodyCreatePodcastV1StudioPodcastsPostSource + The source content for the Podcast. + + safety_identifier : typing.Optional[str] + Used for moderation. Your workspace must be allowlisted to use this feature. + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + If not provided, defaults to the highest quality preset available on your subscription tier. + + duration_scale : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale] + Duration of the generated podcast. Must be one of: + short - produces podcasts shorter than 3 minutes. + default - produces podcasts roughly between 3-7 minutes. + long - produces podcasts longer than 7 minutes. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + intro : typing.Optional[str] + The intro text that will always be added to the beginning of the podcast. + + outro : typing.Optional[str] + The outro text that will always be added to the end of the podcast. + + instructions_prompt : typing.Optional[str] + Additional instructions prompt for the podcast generation used to adjust the podcast's style and tone. + + highlights : typing.Optional[typing.Sequence[str]] + A brief summary or highlights of the Studio project's content, providing key points or themes. This should be between 10 and 70 characters. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + apply_text_normalization : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PodcastProjectResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ( + ElevenLabs, + PodcastConversationModeData, + PodcastTextSource, + ) + from elevenlabs.studio import ( + BodyCreatePodcastV1StudioPodcastsPostMode_Conversation, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.create_podcast( + model_id="eleven_multilingual_v2", + mode=BodyCreatePodcastV1StudioPodcastsPostMode_Conversation( + conversation=PodcastConversationModeData( + host_voice_id="aw1NgEzBg83R7vgmiJt6", + guest_voice_id="aw1NgEzBg83R7vgmiJt7", + ), + ), + source=PodcastTextSource( + text="This is a test podcast.", + ), + ) + """ + _response = self._raw_client.create_podcast( + model_id=model_id, + mode=mode, + source=source, + safety_identifier=safety_identifier, + quality_preset=quality_preset, + duration_scale=duration_scale, + language=language, + intro=intro, + outro=outro, + instructions_prompt=instructions_prompt, + highlights=highlights, + callback_url=callback_url, + apply_text_normalization=apply_text_normalization, + request_options=request_options, + ) + return _response.data + + @property + def projects(self): + if self._projects is None: + from .projects.client import ProjectsClient # noqa: E402 + + self._projects = ProjectsClient(client_wrapper=self._client_wrapper) + return self._projects + + +class AsyncStudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawStudioClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._projects: typing.Optional[AsyncProjectsClient] = None + + @property + def with_raw_response(self) -> AsyncRawStudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawStudioClient + """ + return self._raw_client + + async def create_podcast( + self, + *, + model_id: str, + mode: BodyCreatePodcastV1StudioPodcastsPostMode, + source: BodyCreatePodcastV1StudioPodcastsPostSource, + safety_identifier: typing.Optional[str] = None, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + duration_scale: typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale] = OMIT, + language: typing.Optional[str] = OMIT, + intro: typing.Optional[str] = OMIT, + outro: typing.Optional[str] = OMIT, + instructions_prompt: typing.Optional[str] = OMIT, + highlights: typing.Optional[typing.Sequence[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + apply_text_normalization: typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PodcastProjectResponseModel: + """ + Create and auto-convert a podcast project. Currently, the LLM cost is covered by us but you will still be charged for the audio generation. In the future, you will be charged for both the LLM and audio generation costs. + + Parameters + ---------- + model_id : str + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + mode : BodyCreatePodcastV1StudioPodcastsPostMode + The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue. + + source : BodyCreatePodcastV1StudioPodcastsPostSource + The source content for the Podcast. + + safety_identifier : typing.Optional[str] + Used for moderation. Your workspace must be allowlisted to use this feature. + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + If not provided, defaults to the highest quality preset available on your subscription tier. + + duration_scale : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale] + Duration of the generated podcast. Must be one of: + short - produces podcasts shorter than 3 minutes. + default - produces podcasts roughly between 3-7 minutes. + long - produces podcasts longer than 7 minutes. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + intro : typing.Optional[str] + The intro text that will always be added to the beginning of the podcast. + + outro : typing.Optional[str] + The outro text that will always be added to the end of the podcast. + + instructions_prompt : typing.Optional[str] + Additional instructions prompt for the podcast generation used to adjust the podcast's style and tone. + + highlights : typing.Optional[typing.Sequence[str]] + A brief summary or highlights of the Studio project's content, providing key points or themes. This should be between 10 and 70 characters. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + apply_text_normalization : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PodcastProjectResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import ( + AsyncElevenLabs, + PodcastConversationModeData, + PodcastTextSource, + ) + from elevenlabs.studio import ( + BodyCreatePodcastV1StudioPodcastsPostMode_Conversation, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.create_podcast( + model_id="eleven_multilingual_v2", + mode=BodyCreatePodcastV1StudioPodcastsPostMode_Conversation( + conversation=PodcastConversationModeData( + host_voice_id="aw1NgEzBg83R7vgmiJt6", + guest_voice_id="aw1NgEzBg83R7vgmiJt7", + ), + ), + source=PodcastTextSource( + text="This is a test podcast.", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_podcast( + model_id=model_id, + mode=mode, + source=source, + safety_identifier=safety_identifier, + quality_preset=quality_preset, + duration_scale=duration_scale, + language=language, + intro=intro, + outro=outro, + instructions_prompt=instructions_prompt, + highlights=highlights, + callback_url=callback_url, + apply_text_normalization=apply_text_normalization, + request_options=request_options, + ) + return _response.data + + @property + def projects(self): + if self._projects is None: + from .projects.client import AsyncProjectsClient # noqa: E402 + + self._projects = AsyncProjectsClient(client_wrapper=self._client_wrapper) + return self._projects diff --git a/data/src/elevenlabs/studio/projects/__init__.py b/data/src/elevenlabs/studio/projects/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..eda81aff2076460f4328763a07821a951a5f30ad --- /dev/null +++ b/data/src/elevenlabs/studio/projects/__init__.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + ProjectsCreateRequestApplyTextNormalization, + ProjectsCreateRequestFiction, + ProjectsCreateRequestSourceType, + ProjectsCreateRequestTargetAudience, + ) + from . import chapters, content, pronunciation_dictionaries, snapshots +_dynamic_imports: typing.Dict[str, str] = { + "ProjectsCreateRequestApplyTextNormalization": ".types", + "ProjectsCreateRequestFiction": ".types", + "ProjectsCreateRequestSourceType": ".types", + "ProjectsCreateRequestTargetAudience": ".types", + "chapters": ".chapters", + "content": ".content", + "pronunciation_dictionaries": ".pronunciation_dictionaries", + "snapshots": ".snapshots", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ProjectsCreateRequestApplyTextNormalization", + "ProjectsCreateRequestFiction", + "ProjectsCreateRequestSourceType", + "ProjectsCreateRequestTargetAudience", + "chapters", + "content", + "pronunciation_dictionaries", + "snapshots", +] diff --git a/data/src/elevenlabs/studio/projects/chapters/__init__.py b/data/src/elevenlabs/studio/projects/chapters/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..89557354ed2b6b60c7dc8260055f82793597bc44 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/chapters/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import snapshots +_dynamic_imports: typing.Dict[str, str] = {"snapshots": ".snapshots"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["snapshots"] diff --git a/data/src/elevenlabs/studio/projects/chapters/client.py b/data/src/elevenlabs/studio/projects/chapters/client.py new file mode 100644 index 0000000000000000000000000000000000000000..b9dd3cca2173eddaa09b1c284441277c84e971e1 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/chapters/client.py @@ -0,0 +1,601 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.add_chapter_response_model import AddChapterResponseModel +from ....types.chapter_content_input_model import ChapterContentInputModel +from ....types.chapter_with_content_response_model import ChapterWithContentResponseModel +from ....types.convert_chapter_response_model import ConvertChapterResponseModel +from ....types.delete_chapter_response_model import DeleteChapterResponseModel +from ....types.edit_chapter_response_model import EditChapterResponseModel +from ....types.get_chapters_response import GetChaptersResponse +from .raw_client import AsyncRawChaptersClient, RawChaptersClient + +if typing.TYPE_CHECKING: + from .snapshots.client import AsyncSnapshotsClient, SnapshotsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ChaptersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawChaptersClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._snapshots: typing.Optional[SnapshotsClient] = None + + @property + def with_raw_response(self) -> RawChaptersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawChaptersClient + """ + return self._raw_client + + def list(self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetChaptersResponse: + """ + Returns a list of a Studio project's chapters. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetChaptersResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.list( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.list(project_id, request_options=request_options) + return _response.data + + def create( + self, + project_id: str, + *, + name: str, + from_url: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddChapterResponseModel: + """ + Creates a new chapter either as blank or from a URL. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + name : str + The name of the chapter, used for identification only. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddChapterResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.create( + project_id="21m00Tcm4TlvDq8ikWAM", + name="Chapter 1", + ) + """ + _response = self._raw_client.create(project_id, name=name, from_url=from_url, request_options=request_options) + return _response.data + + def get( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ChapterWithContentResponseModel: + """ + Returns information about a specific chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ChapterWithContentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.get( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get(project_id, chapter_id, request_options=request_options) + return _response.data + + def update( + self, + project_id: str, + chapter_id: str, + *, + name: typing.Optional[str] = OMIT, + content: typing.Optional[ChapterContentInputModel] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> EditChapterResponseModel: + """ + Updates a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + name : typing.Optional[str] + The name of the chapter, used for identification only. + + content : typing.Optional[ChapterContentInputModel] + The chapter content to use. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditChapterResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.update( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.update( + project_id, chapter_id, name=name, content=content, request_options=request_options + ) + return _response.data + + def delete( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteChapterResponseModel: + """ + Deletes a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteChapterResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.delete( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.delete(project_id, chapter_id, request_options=request_options) + return _response.data + + def convert( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConvertChapterResponseModel: + """ + Starts conversion of a specific chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvertChapterResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.convert( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.convert(project_id, chapter_id, request_options=request_options) + return _response.data + + @property + def snapshots(self): + if self._snapshots is None: + from .snapshots.client import SnapshotsClient # noqa: E402 + + self._snapshots = SnapshotsClient(client_wrapper=self._client_wrapper) + return self._snapshots + + +class AsyncChaptersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawChaptersClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._snapshots: typing.Optional[AsyncSnapshotsClient] = None + + @property + def with_raw_response(self) -> AsyncRawChaptersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawChaptersClient + """ + return self._raw_client + + async def list( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetChaptersResponse: + """ + Returns a list of a Studio project's chapters. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetChaptersResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.list( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(project_id, request_options=request_options) + return _response.data + + async def create( + self, + project_id: str, + *, + name: str, + from_url: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddChapterResponseModel: + """ + Creates a new chapter either as blank or from a URL. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + name : str + The name of the chapter, used for identification only. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddChapterResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.create( + project_id="21m00Tcm4TlvDq8ikWAM", + name="Chapter 1", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + project_id, name=name, from_url=from_url, request_options=request_options + ) + return _response.data + + async def get( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ChapterWithContentResponseModel: + """ + Returns information about a specific chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ChapterWithContentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.get( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(project_id, chapter_id, request_options=request_options) + return _response.data + + async def update( + self, + project_id: str, + chapter_id: str, + *, + name: typing.Optional[str] = OMIT, + content: typing.Optional[ChapterContentInputModel] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> EditChapterResponseModel: + """ + Updates a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + name : typing.Optional[str] + The name of the chapter, used for identification only. + + content : typing.Optional[ChapterContentInputModel] + The chapter content to use. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditChapterResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.update( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + project_id, chapter_id, name=name, content=content, request_options=request_options + ) + return _response.data + + async def delete( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteChapterResponseModel: + """ + Deletes a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteChapterResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.delete( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(project_id, chapter_id, request_options=request_options) + return _response.data + + async def convert( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConvertChapterResponseModel: + """ + Starts conversion of a specific chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvertChapterResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.convert( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.convert(project_id, chapter_id, request_options=request_options) + return _response.data + + @property + def snapshots(self): + if self._snapshots is None: + from .snapshots.client import AsyncSnapshotsClient # noqa: E402 + + self._snapshots = AsyncSnapshotsClient(client_wrapper=self._client_wrapper) + return self._snapshots diff --git a/data/src/elevenlabs/studio/projects/chapters/raw_client.py b/data/src/elevenlabs/studio/projects/chapters/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..6361bd5d56aaef464967b9ff4690e0335483509f --- /dev/null +++ b/data/src/elevenlabs/studio/projects/chapters/raw_client.py @@ -0,0 +1,789 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.add_chapter_response_model import AddChapterResponseModel +from ....types.chapter_content_input_model import ChapterContentInputModel +from ....types.chapter_with_content_response_model import ChapterWithContentResponseModel +from ....types.convert_chapter_response_model import ConvertChapterResponseModel +from ....types.delete_chapter_response_model import DeleteChapterResponseModel +from ....types.edit_chapter_response_model import EditChapterResponseModel +from ....types.get_chapters_response import GetChaptersResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawChaptersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetChaptersResponse]: + """ + Returns a list of a Studio project's chapters. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetChaptersResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetChaptersResponse, + construct_type( + type_=GetChaptersResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + project_id: str, + *, + name: str, + from_url: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddChapterResponseModel]: + """ + Creates a new chapter either as blank or from a URL. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + name : str + The name of the chapter, used for identification only. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddChapterResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters", + method="POST", + json={ + "name": name, + "from_url": from_url, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddChapterResponseModel, + construct_type( + type_=AddChapterResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ChapterWithContentResponseModel]: + """ + Returns information about a specific chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ChapterWithContentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ChapterWithContentResponseModel, + construct_type( + type_=ChapterWithContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + project_id: str, + chapter_id: str, + *, + name: typing.Optional[str] = OMIT, + content: typing.Optional[ChapterContentInputModel] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[EditChapterResponseModel]: + """ + Updates a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + name : typing.Optional[str] + The name of the chapter, used for identification only. + + content : typing.Optional[ChapterContentInputModel] + The chapter content to use. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EditChapterResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + method="POST", + json={ + "name": name, + "content": convert_and_respect_annotation_metadata( + object_=content, annotation=ChapterContentInputModel, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditChapterResponseModel, + construct_type( + type_=EditChapterResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteChapterResponseModel]: + """ + Deletes a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteChapterResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteChapterResponseModel, + construct_type( + type_=DeleteChapterResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def convert( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ConvertChapterResponseModel]: + """ + Starts conversion of a specific chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConvertChapterResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/convert", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvertChapterResponseModel, + construct_type( + type_=ConvertChapterResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawChaptersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetChaptersResponse]: + """ + Returns a list of a Studio project's chapters. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetChaptersResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetChaptersResponse, + construct_type( + type_=GetChaptersResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + project_id: str, + *, + name: str, + from_url: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddChapterResponseModel]: + """ + Creates a new chapter either as blank or from a URL. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + name : str + The name of the chapter, used for identification only. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddChapterResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters", + method="POST", + json={ + "name": name, + "from_url": from_url, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddChapterResponseModel, + construct_type( + type_=AddChapterResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ChapterWithContentResponseModel]: + """ + Returns information about a specific chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ChapterWithContentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ChapterWithContentResponseModel, + construct_type( + type_=ChapterWithContentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + project_id: str, + chapter_id: str, + *, + name: typing.Optional[str] = OMIT, + content: typing.Optional[ChapterContentInputModel] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[EditChapterResponseModel]: + """ + Updates a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + name : typing.Optional[str] + The name of the chapter, used for identification only. + + content : typing.Optional[ChapterContentInputModel] + The chapter content to use. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EditChapterResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + method="POST", + json={ + "name": name, + "content": convert_and_respect_annotation_metadata( + object_=content, annotation=ChapterContentInputModel, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditChapterResponseModel, + construct_type( + type_=EditChapterResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteChapterResponseModel]: + """ + Deletes a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteChapterResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteChapterResponseModel, + construct_type( + type_=DeleteChapterResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def convert( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ConvertChapterResponseModel]: + """ + Starts conversion of a specific chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConvertChapterResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/convert", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvertChapterResponseModel, + construct_type( + type_=ConvertChapterResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/studio/projects/chapters/snapshots/__init__.py b/data/src/elevenlabs/studio/projects/chapters/snapshots/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/studio/projects/chapters/snapshots/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/studio/projects/chapters/snapshots/client.py b/data/src/elevenlabs/studio/projects/chapters/snapshots/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a76d04f29cb40a7f89c7e30a1d27868c885d57b8 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/chapters/snapshots/client.py @@ -0,0 +1,349 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.chapter_snapshot_extended_response_model import ChapterSnapshotExtendedResponseModel +from .....types.chapter_snapshots_response import ChapterSnapshotsResponse +from .raw_client import AsyncRawSnapshotsClient, RawSnapshotsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SnapshotsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSnapshotsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSnapshotsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSnapshotsClient + """ + return self._raw_client + + def list( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ChapterSnapshotsResponse: + """ + Gets information about all the snapshots of a chapter. Each snapshot can be downloaded as audio. Whenever a chapter is converted a snapshot will automatically be created. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ChapterSnapshotsResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.snapshots.list( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.list(project_id, chapter_id, request_options=request_options) + return _response.data + + def get( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> ChapterSnapshotExtendedResponseModel: + """ + Returns the chapter snapshot. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + chapter_id : str + The ID of the chapter. + + chapter_snapshot_id : str + The ID of the chapter snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ChapterSnapshotExtendedResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.snapshots.get( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + chapter_snapshot_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get(project_id, chapter_id, chapter_snapshot_id, request_options=request_options) + return _response.data + + def stream( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + convert_to_mpeg: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Stream the audio from a chapter snapshot. Use `GET /v1/studio/projects/{project_id}/chapters/{chapter_id}/snapshots` to return the snapshots of a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + chapter_snapshot_id : str + The ID of the chapter snapshot to be used. You can use the [List project chapter snapshots](/docs/api-reference/studio/get-snapshots) endpoint to list all the available snapshots. + + convert_to_mpeg : typing.Optional[bool] + Whether to convert the audio to mpeg format. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Streaming audio data + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.chapters.snapshots.stream( + project_id="project_id", + chapter_id="chapter_id", + chapter_snapshot_id="chapter_snapshot_id", + ) + """ + with self._raw_client.stream( + project_id, + chapter_id, + chapter_snapshot_id, + convert_to_mpeg=convert_to_mpeg, + request_options=request_options, + ) as r: + yield from r.data + + +class AsyncSnapshotsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSnapshotsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSnapshotsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSnapshotsClient + """ + return self._raw_client + + async def list( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ChapterSnapshotsResponse: + """ + Gets information about all the snapshots of a chapter. Each snapshot can be downloaded as audio. Whenever a chapter is converted a snapshot will automatically be created. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ChapterSnapshotsResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.snapshots.list( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(project_id, chapter_id, request_options=request_options) + return _response.data + + async def get( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> ChapterSnapshotExtendedResponseModel: + """ + Returns the chapter snapshot. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + chapter_id : str + The ID of the chapter. + + chapter_snapshot_id : str + The ID of the chapter snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ChapterSnapshotExtendedResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.snapshots.get( + project_id="21m00Tcm4TlvDq8ikWAM", + chapter_id="21m00Tcm4TlvDq8ikWAM", + chapter_snapshot_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + project_id, chapter_id, chapter_snapshot_id, request_options=request_options + ) + return _response.data + + async def stream( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + convert_to_mpeg: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Stream the audio from a chapter snapshot. Use `GET /v1/studio/projects/{project_id}/chapters/{chapter_id}/snapshots` to return the snapshots of a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + chapter_snapshot_id : str + The ID of the chapter snapshot to be used. You can use the [List project chapter snapshots](/docs/api-reference/studio/get-snapshots) endpoint to list all the available snapshots. + + convert_to_mpeg : typing.Optional[bool] + Whether to convert the audio to mpeg format. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Streaming audio data + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.chapters.snapshots.stream( + project_id="project_id", + chapter_id="chapter_id", + chapter_snapshot_id="chapter_snapshot_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.stream( + project_id, + chapter_id, + chapter_snapshot_id, + convert_to_mpeg=convert_to_mpeg, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/studio/projects/chapters/snapshots/raw_client.py b/data/src/elevenlabs/studio/projects/chapters/snapshots/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..f1cd59c8c1032518b552271630c83c136862911a --- /dev/null +++ b/data/src/elevenlabs/studio/projects/chapters/snapshots/raw_client.py @@ -0,0 +1,441 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.chapter_snapshot_extended_response_model import ChapterSnapshotExtendedResponseModel +from .....types.chapter_snapshots_response import ChapterSnapshotsResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSnapshotsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ChapterSnapshotsResponse]: + """ + Gets information about all the snapshots of a chapter. Each snapshot can be downloaded as audio. Whenever a chapter is converted a snapshot will automatically be created. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ChapterSnapshotsResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ChapterSnapshotsResponse, + construct_type( + type_=ChapterSnapshotsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ChapterSnapshotExtendedResponseModel]: + """ + Returns the chapter snapshot. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + chapter_id : str + The ID of the chapter. + + chapter_snapshot_id : str + The ID of the chapter snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ChapterSnapshotExtendedResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots/{jsonable_encoder(chapter_snapshot_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ChapterSnapshotExtendedResponseModel, + construct_type( + type_=ChapterSnapshotExtendedResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def stream( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + convert_to_mpeg: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Stream the audio from a chapter snapshot. Use `GET /v1/studio/projects/{project_id}/chapters/{chapter_id}/snapshots` to return the snapshots of a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + chapter_snapshot_id : str + The ID of the chapter snapshot to be used. You can use the [List project chapter snapshots](/docs/api-reference/studio/get-snapshots) endpoint to list all the available snapshots. + + convert_to_mpeg : typing.Optional[bool] + Whether to convert the audio to mpeg format. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Streaming audio data + """ + with self._client_wrapper.httpx_client.stream( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots/{jsonable_encoder(chapter_snapshot_id)}/stream", + method="POST", + json={ + "convert_to_mpeg": convert_to_mpeg, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawSnapshotsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, project_id: str, chapter_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ChapterSnapshotsResponse]: + """ + Gets information about all the snapshots of a chapter. Each snapshot can be downloaded as audio. Whenever a chapter is converted a snapshot will automatically be created. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ChapterSnapshotsResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ChapterSnapshotsResponse, + construct_type( + type_=ChapterSnapshotsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ChapterSnapshotExtendedResponseModel]: + """ + Returns the chapter snapshot. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + chapter_id : str + The ID of the chapter. + + chapter_snapshot_id : str + The ID of the chapter snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ChapterSnapshotExtendedResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots/{jsonable_encoder(chapter_snapshot_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ChapterSnapshotExtendedResponseModel, + construct_type( + type_=ChapterSnapshotExtendedResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def stream( + self, + project_id: str, + chapter_id: str, + chapter_snapshot_id: str, + *, + convert_to_mpeg: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Stream the audio from a chapter snapshot. Use `GET /v1/studio/projects/{project_id}/chapters/{chapter_id}/snapshots` to return the snapshots of a chapter. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + chapter_id : str + The ID of the chapter to be used. You can use the [List project chapters](/docs/api-reference/studio/get-chapters) endpoint to list all the available chapters. + + chapter_snapshot_id : str + The ID of the chapter snapshot to be used. You can use the [List project chapter snapshots](/docs/api-reference/studio/get-snapshots) endpoint to list all the available snapshots. + + convert_to_mpeg : typing.Optional[bool] + Whether to convert the audio to mpeg format. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Streaming audio data + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/studio/projects/{jsonable_encoder(project_id)}/chapters/{jsonable_encoder(chapter_id)}/snapshots/{jsonable_encoder(chapter_snapshot_id)}/stream", + method="POST", + json={ + "convert_to_mpeg": convert_to_mpeg, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/studio/projects/client.py b/data/src/elevenlabs/studio/projects/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a86644ad4b66779dce50687f5026a5f7acd48e9f --- /dev/null +++ b/data/src/elevenlabs/studio/projects/client.py @@ -0,0 +1,1182 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ... import core +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.add_project_response_model import AddProjectResponseModel +from ...types.convert_project_response_model import ConvertProjectResponseModel +from ...types.delete_project_response_model import DeleteProjectResponseModel +from ...types.edit_project_response_model import EditProjectResponseModel +from ...types.get_projects_response import GetProjectsResponse +from ...types.project_extended_response import ProjectExtendedResponse +from ...types.project_muted_tracks_response_model import ProjectMutedTracksResponseModel +from ...types.quality_preset_type import QualityPresetType +from .raw_client import AsyncRawProjectsClient, RawProjectsClient +from .types.projects_create_request_apply_text_normalization import ProjectsCreateRequestApplyTextNormalization +from .types.projects_create_request_fiction import ProjectsCreateRequestFiction +from .types.projects_create_request_source_type import ProjectsCreateRequestSourceType +from .types.projects_create_request_target_audience import ProjectsCreateRequestTargetAudience + +if typing.TYPE_CHECKING: + from .chapters.client import AsyncChaptersClient, ChaptersClient + from .content.client import AsyncContentClient, ContentClient + from .pronunciation_dictionaries.client import AsyncPronunciationDictionariesClient, PronunciationDictionariesClient + from .snapshots.client import AsyncSnapshotsClient, SnapshotsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ProjectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawProjectsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._pronunciation_dictionaries: typing.Optional[PronunciationDictionariesClient] = None + self._content: typing.Optional[ContentClient] = None + self._snapshots: typing.Optional[SnapshotsClient] = None + self._chapters: typing.Optional[ChaptersClient] = None + + @property + def with_raw_response(self) -> RawProjectsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawProjectsClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetProjectsResponse: + """ + Returns a list of your Studio projects with metadata. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetProjectsResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def create( + self, + *, + name: str, + default_title_voice_id: typing.Optional[str] = OMIT, + default_paragraph_voice_id: typing.Optional[str] = OMIT, + default_model_id: typing.Optional[str] = OMIT, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + genres: typing.Optional[typing.List[str]] = OMIT, + target_audience: typing.Optional[ProjectsCreateRequestTargetAudience] = OMIT, + language: typing.Optional[str] = OMIT, + content_type: typing.Optional[str] = OMIT, + original_publication_date: typing.Optional[str] = OMIT, + mature_content: typing.Optional[bool] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + acx_volume_normalization: typing.Optional[bool] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + fiction: typing.Optional[ProjectsCreateRequestFiction] = OMIT, + apply_text_normalization: typing.Optional[ProjectsCreateRequestApplyTextNormalization] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_assign_voices: typing.Optional[bool] = OMIT, + source_type: typing.Optional[ProjectsCreateRequestSourceType] = OMIT, + voice_settings: typing.Optional[typing.List[str]] = OMIT, + create_publishing_read: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddProjectResponseModel: + """ + Creates a new Studio project, it can be either initialized as blank, from a document or from a URL. + + Parameters + ---------- + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new paragraphs. + + default_model_id : typing.Optional[str] + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + If not provided, defaults to the highest quality preset available on your subscription tier. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + description : typing.Optional[str] + An optional description of the Studio project. + + genres : typing.Optional[typing.List[str]] + An optional list of genres associated with the Studio project. + + target_audience : typing.Optional[ProjectsCreateRequestTargetAudience] + An optional target audience of the Studio project. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + content_type : typing.Optional[str] + An optional content type of the Studio project. + + original_publication_date : typing.Optional[str] + An optional original publication date of the Studio project, in the format YYYY-MM-DD or YYYY. + + mature_content : typing.Optional[bool] + An optional specification of whether this Studio project contains mature content. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + acx_volume_normalization : typing.Optional[bool] + [Deprecated] When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + fiction : typing.Optional[ProjectsCreateRequestFiction] + An optional specification of whether the content of this Studio project is fiction. + + apply_text_normalization : typing.Optional[ProjectsCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + auto_assign_voices : typing.Optional[bool] + [Alpha Feature] Whether automatically assign voices to phrases in the create Project. + + source_type : typing.Optional[ProjectsCreateRequestSourceType] + The type of Studio project to create. + + voice_settings : typing.Optional[typing.List[str]] + Optional voice settings overrides for the project, encoded as a list of JSON strings. + + Example: + ["{\\"voice_id\\": \\"21m00Tcm4TlvDq8ikWAM\\", \\"stability\\": 0.7, \\"similarity_boost\\": 0.8, \\"style\\": 0.5, \\"speed\\": 1.0, \\"use_speaker_boost\\": true}"] + + + create_publishing_read : typing.Optional[bool] + If true, creates a corresponding read for direct publishing in draft state + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddProjectResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.create( + name="name", + ) + """ + _response = self._raw_client.create( + name=name, + default_title_voice_id=default_title_voice_id, + default_paragraph_voice_id=default_paragraph_voice_id, + default_model_id=default_model_id, + from_url=from_url, + from_document=from_document, + from_content_json=from_content_json, + quality_preset=quality_preset, + title=title, + author=author, + description=description, + genres=genres, + target_audience=target_audience, + language=language, + content_type=content_type, + original_publication_date=original_publication_date, + mature_content=mature_content, + isbn_number=isbn_number, + acx_volume_normalization=acx_volume_normalization, + volume_normalization=volume_normalization, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + callback_url=callback_url, + fiction=fiction, + apply_text_normalization=apply_text_normalization, + auto_convert=auto_convert, + auto_assign_voices=auto_assign_voices, + source_type=source_type, + voice_settings=voice_settings, + create_publishing_read=create_publishing_read, + request_options=request_options, + ) + return _response.data + + def get( + self, + project_id: str, + *, + share_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProjectExtendedResponse: + """ + Returns information about a specific Studio project. This endpoint returns more detailed information about a project than `GET /v1/studio`. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + share_id : typing.Optional[str] + The share ID of the project + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectExtendedResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.get( + project_id="21m00Tcm4TlvDq8ikWAM", + share_id="share_id", + ) + """ + _response = self._raw_client.get(project_id, share_id=share_id, request_options=request_options) + return _response.data + + def update( + self, + project_id: str, + *, + name: str, + default_title_voice_id: str, + default_paragraph_voice_id: str, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> EditProjectResponseModel: + """ + Updates the specified Studio project by setting the values of the parameters passed. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : str + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : str + The voice_id that corresponds to the default voice used for new paragraphs. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditProjectResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.update( + project_id="21m00Tcm4TlvDq8ikWAM", + name="Project 1", + default_title_voice_id="21m00Tcm4TlvDq8ikWAM", + default_paragraph_voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.update( + project_id, + name=name, + default_title_voice_id=default_title_voice_id, + default_paragraph_voice_id=default_paragraph_voice_id, + title=title, + author=author, + isbn_number=isbn_number, + volume_normalization=volume_normalization, + request_options=request_options, + ) + return _response.data + + def delete( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteProjectResponseModel: + """ + Deletes a Studio project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteProjectResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.delete( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.delete(project_id, request_options=request_options) + return _response.data + + def convert( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConvertProjectResponseModel: + """ + Starts conversion of a Studio project and all of its chapters. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvertProjectResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.convert( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.convert(project_id, request_options=request_options) + return _response.data + + def get_muted_tracks( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectMutedTracksResponseModel: + """ + Returns a list of chapter IDs that have muted tracks in a project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectMutedTracksResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.get_muted_tracks( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get_muted_tracks(project_id, request_options=request_options) + return _response.data + + @property + def pronunciation_dictionaries(self): + if self._pronunciation_dictionaries is None: + from .pronunciation_dictionaries.client import PronunciationDictionariesClient # noqa: E402 + + self._pronunciation_dictionaries = PronunciationDictionariesClient(client_wrapper=self._client_wrapper) + return self._pronunciation_dictionaries + + @property + def content(self): + if self._content is None: + from .content.client import ContentClient # noqa: E402 + + self._content = ContentClient(client_wrapper=self._client_wrapper) + return self._content + + @property + def snapshots(self): + if self._snapshots is None: + from .snapshots.client import SnapshotsClient # noqa: E402 + + self._snapshots = SnapshotsClient(client_wrapper=self._client_wrapper) + return self._snapshots + + @property + def chapters(self): + if self._chapters is None: + from .chapters.client import ChaptersClient # noqa: E402 + + self._chapters = ChaptersClient(client_wrapper=self._client_wrapper) + return self._chapters + + +class AsyncProjectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawProjectsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._pronunciation_dictionaries: typing.Optional[AsyncPronunciationDictionariesClient] = None + self._content: typing.Optional[AsyncContentClient] = None + self._snapshots: typing.Optional[AsyncSnapshotsClient] = None + self._chapters: typing.Optional[AsyncChaptersClient] = None + + @property + def with_raw_response(self) -> AsyncRawProjectsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawProjectsClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetProjectsResponse: + """ + Returns a list of your Studio projects with metadata. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetProjectsResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, + *, + name: str, + default_title_voice_id: typing.Optional[str] = OMIT, + default_paragraph_voice_id: typing.Optional[str] = OMIT, + default_model_id: typing.Optional[str] = OMIT, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + genres: typing.Optional[typing.List[str]] = OMIT, + target_audience: typing.Optional[ProjectsCreateRequestTargetAudience] = OMIT, + language: typing.Optional[str] = OMIT, + content_type: typing.Optional[str] = OMIT, + original_publication_date: typing.Optional[str] = OMIT, + mature_content: typing.Optional[bool] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + acx_volume_normalization: typing.Optional[bool] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + fiction: typing.Optional[ProjectsCreateRequestFiction] = OMIT, + apply_text_normalization: typing.Optional[ProjectsCreateRequestApplyTextNormalization] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_assign_voices: typing.Optional[bool] = OMIT, + source_type: typing.Optional[ProjectsCreateRequestSourceType] = OMIT, + voice_settings: typing.Optional[typing.List[str]] = OMIT, + create_publishing_read: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddProjectResponseModel: + """ + Creates a new Studio project, it can be either initialized as blank, from a document or from a URL. + + Parameters + ---------- + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new paragraphs. + + default_model_id : typing.Optional[str] + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + If not provided, defaults to the highest quality preset available on your subscription tier. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + description : typing.Optional[str] + An optional description of the Studio project. + + genres : typing.Optional[typing.List[str]] + An optional list of genres associated with the Studio project. + + target_audience : typing.Optional[ProjectsCreateRequestTargetAudience] + An optional target audience of the Studio project. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + content_type : typing.Optional[str] + An optional content type of the Studio project. + + original_publication_date : typing.Optional[str] + An optional original publication date of the Studio project, in the format YYYY-MM-DD or YYYY. + + mature_content : typing.Optional[bool] + An optional specification of whether this Studio project contains mature content. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + acx_volume_normalization : typing.Optional[bool] + [Deprecated] When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + fiction : typing.Optional[ProjectsCreateRequestFiction] + An optional specification of whether the content of this Studio project is fiction. + + apply_text_normalization : typing.Optional[ProjectsCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + auto_assign_voices : typing.Optional[bool] + [Alpha Feature] Whether automatically assign voices to phrases in the create Project. + + source_type : typing.Optional[ProjectsCreateRequestSourceType] + The type of Studio project to create. + + voice_settings : typing.Optional[typing.List[str]] + Optional voice settings overrides for the project, encoded as a list of JSON strings. + + Example: + ["{\\"voice_id\\": \\"21m00Tcm4TlvDq8ikWAM\\", \\"stability\\": 0.7, \\"similarity_boost\\": 0.8, \\"style\\": 0.5, \\"speed\\": 1.0, \\"use_speaker_boost\\": true}"] + + + create_publishing_read : typing.Optional[bool] + If true, creates a corresponding read for direct publishing in draft state + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddProjectResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.create( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + name=name, + default_title_voice_id=default_title_voice_id, + default_paragraph_voice_id=default_paragraph_voice_id, + default_model_id=default_model_id, + from_url=from_url, + from_document=from_document, + from_content_json=from_content_json, + quality_preset=quality_preset, + title=title, + author=author, + description=description, + genres=genres, + target_audience=target_audience, + language=language, + content_type=content_type, + original_publication_date=original_publication_date, + mature_content=mature_content, + isbn_number=isbn_number, + acx_volume_normalization=acx_volume_normalization, + volume_normalization=volume_normalization, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + callback_url=callback_url, + fiction=fiction, + apply_text_normalization=apply_text_normalization, + auto_convert=auto_convert, + auto_assign_voices=auto_assign_voices, + source_type=source_type, + voice_settings=voice_settings, + create_publishing_read=create_publishing_read, + request_options=request_options, + ) + return _response.data + + async def get( + self, + project_id: str, + *, + share_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> ProjectExtendedResponse: + """ + Returns information about a specific Studio project. This endpoint returns more detailed information about a project than `GET /v1/studio`. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + share_id : typing.Optional[str] + The share ID of the project + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectExtendedResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.get( + project_id="21m00Tcm4TlvDq8ikWAM", + share_id="share_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(project_id, share_id=share_id, request_options=request_options) + return _response.data + + async def update( + self, + project_id: str, + *, + name: str, + default_title_voice_id: str, + default_paragraph_voice_id: str, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> EditProjectResponseModel: + """ + Updates the specified Studio project by setting the values of the parameters passed. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : str + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : str + The voice_id that corresponds to the default voice used for new paragraphs. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditProjectResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.update( + project_id="21m00Tcm4TlvDq8ikWAM", + name="Project 1", + default_title_voice_id="21m00Tcm4TlvDq8ikWAM", + default_paragraph_voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + project_id, + name=name, + default_title_voice_id=default_title_voice_id, + default_paragraph_voice_id=default_paragraph_voice_id, + title=title, + author=author, + isbn_number=isbn_number, + volume_normalization=volume_normalization, + request_options=request_options, + ) + return _response.data + + async def delete( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteProjectResponseModel: + """ + Deletes a Studio project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteProjectResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.delete( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(project_id, request_options=request_options) + return _response.data + + async def convert( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ConvertProjectResponseModel: + """ + Starts conversion of a Studio project and all of its chapters. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ConvertProjectResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.convert( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.convert(project_id, request_options=request_options) + return _response.data + + async def get_muted_tracks( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectMutedTracksResponseModel: + """ + Returns a list of chapter IDs that have muted tracks in a project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectMutedTracksResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.get_muted_tracks( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_muted_tracks(project_id, request_options=request_options) + return _response.data + + @property + def pronunciation_dictionaries(self): + if self._pronunciation_dictionaries is None: + from .pronunciation_dictionaries.client import AsyncPronunciationDictionariesClient # noqa: E402 + + self._pronunciation_dictionaries = AsyncPronunciationDictionariesClient(client_wrapper=self._client_wrapper) + return self._pronunciation_dictionaries + + @property + def content(self): + if self._content is None: + from .content.client import AsyncContentClient # noqa: E402 + + self._content = AsyncContentClient(client_wrapper=self._client_wrapper) + return self._content + + @property + def snapshots(self): + if self._snapshots is None: + from .snapshots.client import AsyncSnapshotsClient # noqa: E402 + + self._snapshots = AsyncSnapshotsClient(client_wrapper=self._client_wrapper) + return self._snapshots + + @property + def chapters(self): + if self._chapters is None: + from .chapters.client import AsyncChaptersClient # noqa: E402 + + self._chapters = AsyncChaptersClient(client_wrapper=self._client_wrapper) + return self._chapters diff --git a/data/src/elevenlabs/studio/projects/content/__init__.py b/data/src/elevenlabs/studio/projects/content/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/studio/projects/content/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/studio/projects/content/client.py b/data/src/elevenlabs/studio/projects/content/client.py new file mode 100644 index 0000000000000000000000000000000000000000..4625abb70495891266c512cde271031c815b46bf --- /dev/null +++ b/data/src/elevenlabs/studio/projects/content/client.py @@ -0,0 +1,180 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .... import core +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.edit_project_response_model import EditProjectResponseModel +from .raw_client import AsyncRawContentClient, RawContentClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ContentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawContentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawContentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawContentClient + """ + return self._raw_client + + def update( + self, + project_id: str, + *, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> EditProjectResponseModel: + """ + Updates Studio project content. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditProjectResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.content.update( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.update( + project_id, + from_url=from_url, + from_document=from_document, + from_content_json=from_content_json, + auto_convert=auto_convert, + request_options=request_options, + ) + return _response.data + + +class AsyncContentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawContentClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawContentClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawContentClient + """ + return self._raw_client + + async def update( + self, + project_id: str, + *, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> EditProjectResponseModel: + """ + Updates Studio project content. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditProjectResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.content.update( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + project_id, + from_url=from_url, + from_document=from_document, + from_content_json=from_content_json, + auto_convert=auto_convert, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/studio/projects/content/raw_client.py b/data/src/elevenlabs/studio/projects/content/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..79d9115f82a2034fe13328c4361959ce3b02c3ab --- /dev/null +++ b/data/src/elevenlabs/studio/projects/content/raw_client.py @@ -0,0 +1,205 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .... import core +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.edit_project_response_model import EditProjectResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawContentClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def update( + self, + project_id: str, + *, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[EditProjectResponseModel]: + """ + Updates Studio project content. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EditProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/content", + method="POST", + data={ + "from_url": from_url, + "from_content_json": from_content_json, + "auto_convert": auto_convert, + }, + files={ + **({"from_document": from_document} if from_document is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditProjectResponseModel, + construct_type( + type_=EditProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawContentClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def update( + self, + project_id: str, + *, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[EditProjectResponseModel]: + """ + Updates Studio project content. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EditProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/content", + method="POST", + data={ + "from_url": from_url, + "from_content_json": from_content_json, + "auto_convert": auto_convert, + }, + files={ + **({"from_document": from_document} if from_document is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditProjectResponseModel, + construct_type( + type_=EditProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/__init__.py b/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/client.py b/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/client.py new file mode 100644 index 0000000000000000000000000000000000000000..1663e49c8ea00e1af8e381c8850f066bb0ec25fb --- /dev/null +++ b/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/client.py @@ -0,0 +1,160 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.create_pronunciation_dictionary_response_model import CreatePronunciationDictionaryResponseModel +from ....types.pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from .raw_client import AsyncRawPronunciationDictionariesClient, RawPronunciationDictionariesClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class PronunciationDictionariesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawPronunciationDictionariesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawPronunciationDictionariesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawPronunciationDictionariesClient + """ + return self._raw_client + + def create( + self, + project_id: str, + *, + pronunciation_dictionary_locators: typing.Sequence[PronunciationDictionaryVersionLocator], + invalidate_affected_text: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreatePronunciationDictionaryResponseModel: + """ + Create a set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + pronunciation_dictionary_locators : typing.Sequence[PronunciationDictionaryVersionLocator] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + invalidate_affected_text : typing.Optional[bool] + This will automatically mark text in this project for reconversion when the new dictionary applies or the old one no longer does. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreatePronunciationDictionaryResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, PronunciationDictionaryVersionLocator + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.pronunciation_dictionaries.create( + project_id="21m00Tcm4TlvDq8ikWAM", + pronunciation_dictionary_locators=[ + PronunciationDictionaryVersionLocator( + pronunciation_dictionary_id="pronunciation_dictionary_id", + ) + ], + ) + """ + _response = self._raw_client.create( + project_id, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + invalidate_affected_text=invalidate_affected_text, + request_options=request_options, + ) + return _response.data + + +class AsyncPronunciationDictionariesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawPronunciationDictionariesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawPronunciationDictionariesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawPronunciationDictionariesClient + """ + return self._raw_client + + async def create( + self, + project_id: str, + *, + pronunciation_dictionary_locators: typing.Sequence[PronunciationDictionaryVersionLocator], + invalidate_affected_text: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreatePronunciationDictionaryResponseModel: + """ + Create a set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + pronunciation_dictionary_locators : typing.Sequence[PronunciationDictionaryVersionLocator] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + invalidate_affected_text : typing.Optional[bool] + This will automatically mark text in this project for reconversion when the new dictionary applies or the old one no longer does. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreatePronunciationDictionaryResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, PronunciationDictionaryVersionLocator + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.pronunciation_dictionaries.create( + project_id="21m00Tcm4TlvDq8ikWAM", + pronunciation_dictionary_locators=[ + PronunciationDictionaryVersionLocator( + pronunciation_dictionary_id="pronunciation_dictionary_id", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + project_id, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + invalidate_affected_text=invalidate_affected_text, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/raw_client.py b/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..81f9d2d05c6a0271bdd2a081fc5c3cccc40ccc3f --- /dev/null +++ b/data/src/elevenlabs/studio/projects/pronunciation_dictionaries/raw_client.py @@ -0,0 +1,184 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.create_pronunciation_dictionary_response_model import CreatePronunciationDictionaryResponseModel +from ....types.pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawPronunciationDictionariesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + project_id: str, + *, + pronunciation_dictionary_locators: typing.Sequence[PronunciationDictionaryVersionLocator], + invalidate_affected_text: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreatePronunciationDictionaryResponseModel]: + """ + Create a set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + pronunciation_dictionary_locators : typing.Sequence[PronunciationDictionaryVersionLocator] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + invalidate_affected_text : typing.Optional[bool] + This will automatically mark text in this project for reconversion when the new dictionary applies or the old one no longer does. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreatePronunciationDictionaryResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/pronunciation-dictionaries", + method="POST", + json={ + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "invalidate_affected_text": invalidate_affected_text, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreatePronunciationDictionaryResponseModel, + construct_type( + type_=CreatePronunciationDictionaryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawPronunciationDictionariesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + project_id: str, + *, + pronunciation_dictionary_locators: typing.Sequence[PronunciationDictionaryVersionLocator], + invalidate_affected_text: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreatePronunciationDictionaryResponseModel]: + """ + Create a set of pronunciation dictionaries acting on a project. This will automatically mark text within this project as requiring reconverting where the new dictionary would apply or the old one no longer does. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + pronunciation_dictionary_locators : typing.Sequence[PronunciationDictionaryVersionLocator] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + invalidate_affected_text : typing.Optional[bool] + This will automatically mark text in this project for reconversion when the new dictionary applies or the old one no longer does. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreatePronunciationDictionaryResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/pronunciation-dictionaries", + method="POST", + json={ + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "invalidate_affected_text": invalidate_affected_text, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreatePronunciationDictionaryResponseModel, + construct_type( + type_=CreatePronunciationDictionaryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/studio/projects/raw_client.py b/data/src/elevenlabs/studio/projects/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..47fc5054da95e7c1081aa48e9c975d725f269f52 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/raw_client.py @@ -0,0 +1,1342 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ... import core +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.add_project_response_model import AddProjectResponseModel +from ...types.convert_project_response_model import ConvertProjectResponseModel +from ...types.delete_project_response_model import DeleteProjectResponseModel +from ...types.edit_project_response_model import EditProjectResponseModel +from ...types.get_projects_response import GetProjectsResponse +from ...types.project_extended_response import ProjectExtendedResponse +from ...types.project_muted_tracks_response_model import ProjectMutedTracksResponseModel +from ...types.quality_preset_type import QualityPresetType +from .types.projects_create_request_apply_text_normalization import ProjectsCreateRequestApplyTextNormalization +from .types.projects_create_request_fiction import ProjectsCreateRequestFiction +from .types.projects_create_request_source_type import ProjectsCreateRequestSourceType +from .types.projects_create_request_target_audience import ProjectsCreateRequestTargetAudience +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawProjectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[GetProjectsResponse]: + """ + Returns a list of your Studio projects with metadata. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetProjectsResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/studio/projects", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetProjectsResponse, + construct_type( + type_=GetProjectsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + name: str, + default_title_voice_id: typing.Optional[str] = OMIT, + default_paragraph_voice_id: typing.Optional[str] = OMIT, + default_model_id: typing.Optional[str] = OMIT, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + genres: typing.Optional[typing.List[str]] = OMIT, + target_audience: typing.Optional[ProjectsCreateRequestTargetAudience] = OMIT, + language: typing.Optional[str] = OMIT, + content_type: typing.Optional[str] = OMIT, + original_publication_date: typing.Optional[str] = OMIT, + mature_content: typing.Optional[bool] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + acx_volume_normalization: typing.Optional[bool] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + fiction: typing.Optional[ProjectsCreateRequestFiction] = OMIT, + apply_text_normalization: typing.Optional[ProjectsCreateRequestApplyTextNormalization] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_assign_voices: typing.Optional[bool] = OMIT, + source_type: typing.Optional[ProjectsCreateRequestSourceType] = OMIT, + voice_settings: typing.Optional[typing.List[str]] = OMIT, + create_publishing_read: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddProjectResponseModel]: + """ + Creates a new Studio project, it can be either initialized as blank, from a document or from a URL. + + Parameters + ---------- + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new paragraphs. + + default_model_id : typing.Optional[str] + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + If not provided, defaults to the highest quality preset available on your subscription tier. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + description : typing.Optional[str] + An optional description of the Studio project. + + genres : typing.Optional[typing.List[str]] + An optional list of genres associated with the Studio project. + + target_audience : typing.Optional[ProjectsCreateRequestTargetAudience] + An optional target audience of the Studio project. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + content_type : typing.Optional[str] + An optional content type of the Studio project. + + original_publication_date : typing.Optional[str] + An optional original publication date of the Studio project, in the format YYYY-MM-DD or YYYY. + + mature_content : typing.Optional[bool] + An optional specification of whether this Studio project contains mature content. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + acx_volume_normalization : typing.Optional[bool] + [Deprecated] When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + fiction : typing.Optional[ProjectsCreateRequestFiction] + An optional specification of whether the content of this Studio project is fiction. + + apply_text_normalization : typing.Optional[ProjectsCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + auto_assign_voices : typing.Optional[bool] + [Alpha Feature] Whether automatically assign voices to phrases in the create Project. + + source_type : typing.Optional[ProjectsCreateRequestSourceType] + The type of Studio project to create. + + voice_settings : typing.Optional[typing.List[str]] + Optional voice settings overrides for the project, encoded as a list of JSON strings. + + Example: + ["{\\"voice_id\\": \\"21m00Tcm4TlvDq8ikWAM\\", \\"stability\\": 0.7, \\"similarity_boost\\": 0.8, \\"style\\": 0.5, \\"speed\\": 1.0, \\"use_speaker_boost\\": true}"] + + + create_publishing_read : typing.Optional[bool] + If true, creates a corresponding read for direct publishing in draft state + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/studio/projects", + method="POST", + data={ + "name": name, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "default_model_id": default_model_id, + "from_url": from_url, + "from_content_json": from_content_json, + "quality_preset": quality_preset, + "title": title, + "author": author, + "description": description, + "genres": genres, + "target_audience": target_audience, + "language": language, + "content_type": content_type, + "original_publication_date": original_publication_date, + "mature_content": mature_content, + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "volume_normalization": volume_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + "callback_url": callback_url, + "fiction": fiction, + "apply_text_normalization": apply_text_normalization, + "auto_convert": auto_convert, + "auto_assign_voices": auto_assign_voices, + "source_type": source_type, + "voice_settings": voice_settings, + "create_publishing_read": create_publishing_read, + }, + files={ + **({"from_document": from_document} if from_document is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddProjectResponseModel, + construct_type( + type_=AddProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + project_id: str, + *, + share_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ProjectExtendedResponse]: + """ + Returns information about a specific Studio project. This endpoint returns more detailed information about a project than `GET /v1/studio`. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + share_id : typing.Optional[str] + The share ID of the project + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProjectExtendedResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="GET", + params={ + "share_id": share_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectExtendedResponse, + construct_type( + type_=ProjectExtendedResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + project_id: str, + *, + name: str, + default_title_voice_id: str, + default_paragraph_voice_id: str, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[EditProjectResponseModel]: + """ + Updates the specified Studio project by setting the values of the parameters passed. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : str + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : str + The voice_id that corresponds to the default voice used for new paragraphs. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EditProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="POST", + json={ + "name": name, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "title": title, + "author": author, + "isbn_number": isbn_number, + "volume_normalization": volume_normalization, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditProjectResponseModel, + construct_type( + type_=EditProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteProjectResponseModel]: + """ + Deletes a Studio project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteProjectResponseModel, + construct_type( + type_=DeleteProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def convert( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ConvertProjectResponseModel]: + """ + Starts conversion of a Studio project and all of its chapters. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ConvertProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/convert", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvertProjectResponseModel, + construct_type( + type_=ConvertProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_muted_tracks( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ProjectMutedTracksResponseModel]: + """ + Returns a list of chapter IDs that have muted tracks in a project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProjectMutedTracksResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/muted-tracks", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectMutedTracksResponseModel, + construct_type( + type_=ProjectMutedTracksResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawProjectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetProjectsResponse]: + """ + Returns a list of your Studio projects with metadata. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetProjectsResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/studio/projects", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetProjectsResponse, + construct_type( + type_=GetProjectsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + name: str, + default_title_voice_id: typing.Optional[str] = OMIT, + default_paragraph_voice_id: typing.Optional[str] = OMIT, + default_model_id: typing.Optional[str] = OMIT, + from_url: typing.Optional[str] = OMIT, + from_document: typing.Optional[core.File] = OMIT, + from_content_json: typing.Optional[str] = OMIT, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + genres: typing.Optional[typing.List[str]] = OMIT, + target_audience: typing.Optional[ProjectsCreateRequestTargetAudience] = OMIT, + language: typing.Optional[str] = OMIT, + content_type: typing.Optional[str] = OMIT, + original_publication_date: typing.Optional[str] = OMIT, + mature_content: typing.Optional[bool] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + acx_volume_normalization: typing.Optional[bool] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + pronunciation_dictionary_locators: typing.Optional[typing.List[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + fiction: typing.Optional[ProjectsCreateRequestFiction] = OMIT, + apply_text_normalization: typing.Optional[ProjectsCreateRequestApplyTextNormalization] = OMIT, + auto_convert: typing.Optional[bool] = OMIT, + auto_assign_voices: typing.Optional[bool] = OMIT, + source_type: typing.Optional[ProjectsCreateRequestSourceType] = OMIT, + voice_settings: typing.Optional[typing.List[str]] = OMIT, + create_publishing_read: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddProjectResponseModel]: + """ + Creates a new Studio project, it can be either initialized as blank, from a document or from a URL. + + Parameters + ---------- + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : typing.Optional[str] + The voice_id that corresponds to the default voice used for new paragraphs. + + default_model_id : typing.Optional[str] + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + from_url : typing.Optional[str] + An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + from_document : typing.Optional[core.File] + See core.File for more documentation + + from_content_json : typing.Optional[str] + + An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank. + + Example: + [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}] + + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + If not provided, defaults to the highest quality preset available on your subscription tier. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + description : typing.Optional[str] + An optional description of the Studio project. + + genres : typing.Optional[typing.List[str]] + An optional list of genres associated with the Studio project. + + target_audience : typing.Optional[ProjectsCreateRequestTargetAudience] + An optional target audience of the Studio project. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + content_type : typing.Optional[str] + An optional content type of the Studio project. + + original_publication_date : typing.Optional[str] + An optional original publication date of the Studio project, in the format YYYY-MM-DD or YYYY. + + mature_content : typing.Optional[bool] + An optional specification of whether this Studio project contains mature content. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + acx_volume_normalization : typing.Optional[bool] + [Deprecated] When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + pronunciation_dictionary_locators : typing.Optional[typing.List[str]] + A list of pronunciation dictionary locators (pronunciation_dictionary_id, version_id) encoded as a list of JSON strings for pronunciation dictionaries to be applied to the text. A list of json encoded strings is required as adding projects may occur through formData as opposed to jsonBody. To specify multiple dictionaries use multiple --form lines in your curl, such as --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"Vmd4Zor6fplcA7WrINey\\",\\"version_id\\":\\"hRPaxjlTdR7wFMhV4w0b\\"}"' --form 'pronunciation_dictionary_locators="{\\"pronunciation_dictionary_id\\":\\"JzWtcGQMJ6bnlWwyMo7e\\",\\"version_id\\":\\"lbmwxiLu4q6txYxgdZqn\\"}"'. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + fiction : typing.Optional[ProjectsCreateRequestFiction] + An optional specification of whether the content of this Studio project is fiction. + + apply_text_normalization : typing.Optional[ProjectsCreateRequestApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + auto_convert : typing.Optional[bool] + Whether to auto convert the Studio project to audio or not. + + auto_assign_voices : typing.Optional[bool] + [Alpha Feature] Whether automatically assign voices to phrases in the create Project. + + source_type : typing.Optional[ProjectsCreateRequestSourceType] + The type of Studio project to create. + + voice_settings : typing.Optional[typing.List[str]] + Optional voice settings overrides for the project, encoded as a list of JSON strings. + + Example: + ["{\\"voice_id\\": \\"21m00Tcm4TlvDq8ikWAM\\", \\"stability\\": 0.7, \\"similarity_boost\\": 0.8, \\"style\\": 0.5, \\"speed\\": 1.0, \\"use_speaker_boost\\": true}"] + + + create_publishing_read : typing.Optional[bool] + If true, creates a corresponding read for direct publishing in draft state + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/studio/projects", + method="POST", + data={ + "name": name, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "default_model_id": default_model_id, + "from_url": from_url, + "from_content_json": from_content_json, + "quality_preset": quality_preset, + "title": title, + "author": author, + "description": description, + "genres": genres, + "target_audience": target_audience, + "language": language, + "content_type": content_type, + "original_publication_date": original_publication_date, + "mature_content": mature_content, + "isbn_number": isbn_number, + "acx_volume_normalization": acx_volume_normalization, + "volume_normalization": volume_normalization, + "pronunciation_dictionary_locators": pronunciation_dictionary_locators, + "callback_url": callback_url, + "fiction": fiction, + "apply_text_normalization": apply_text_normalization, + "auto_convert": auto_convert, + "auto_assign_voices": auto_assign_voices, + "source_type": source_type, + "voice_settings": voice_settings, + "create_publishing_read": create_publishing_read, + }, + files={ + **({"from_document": from_document} if from_document is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddProjectResponseModel, + construct_type( + type_=AddProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + project_id: str, + *, + share_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ProjectExtendedResponse]: + """ + Returns information about a specific Studio project. This endpoint returns more detailed information about a project than `GET /v1/studio`. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + share_id : typing.Optional[str] + The share ID of the project + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProjectExtendedResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="GET", + params={ + "share_id": share_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectExtendedResponse, + construct_type( + type_=ProjectExtendedResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + project_id: str, + *, + name: str, + default_title_voice_id: str, + default_paragraph_voice_id: str, + title: typing.Optional[str] = OMIT, + author: typing.Optional[str] = OMIT, + isbn_number: typing.Optional[str] = OMIT, + volume_normalization: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[EditProjectResponseModel]: + """ + Updates the specified Studio project by setting the values of the parameters passed. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + name : str + The name of the Studio project, used for identification only. + + default_title_voice_id : str + The voice_id that corresponds to the default voice used for new titles. + + default_paragraph_voice_id : str + The voice_id that corresponds to the default voice used for new paragraphs. + + title : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + author : typing.Optional[str] + An optional name of the author of the Studio project, this will be added as metadata to the mp3 file on Studio project or chapter download. + + isbn_number : typing.Optional[str] + An optional ISBN number of the Studio project you want to create, this will be added as metadata to the mp3 file on Studio project or chapter download. + + volume_normalization : typing.Optional[bool] + When the Studio project is downloaded, should the returned audio have postprocessing in order to make it compliant with audiobook normalized volume requirements + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EditProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="POST", + json={ + "name": name, + "default_title_voice_id": default_title_voice_id, + "default_paragraph_voice_id": default_paragraph_voice_id, + "title": title, + "author": author, + "isbn_number": isbn_number, + "volume_normalization": volume_normalization, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditProjectResponseModel, + construct_type( + type_=EditProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteProjectResponseModel]: + """ + Deletes a Studio project. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteProjectResponseModel, + construct_type( + type_=DeleteProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def convert( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ConvertProjectResponseModel]: + """ + Starts conversion of a Studio project and all of its chapters. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ConvertProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/convert", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ConvertProjectResponseModel, + construct_type( + type_=ConvertProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_muted_tracks( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ProjectMutedTracksResponseModel]: + """ + Returns a list of chapter IDs that have muted tracks in a project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProjectMutedTracksResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/muted-tracks", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectMutedTracksResponseModel, + construct_type( + type_=ProjectMutedTracksResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/studio/projects/snapshots/__init__.py b/data/src/elevenlabs/studio/projects/snapshots/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/studio/projects/snapshots/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/studio/projects/snapshots/client.py b/data/src/elevenlabs/studio/projects/snapshots/client.py new file mode 100644 index 0000000000000000000000000000000000000000..e70c238003ec6a883bb7a8b4f89d702333c227a1 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/snapshots/client.py @@ -0,0 +1,388 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.project_snapshot_extended_response_model import ProjectSnapshotExtendedResponseModel +from ....types.project_snapshots_response import ProjectSnapshotsResponse +from .raw_client import AsyncRawSnapshotsClient, RawSnapshotsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SnapshotsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSnapshotsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSnapshotsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSnapshotsClient + """ + return self._raw_client + + def list( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectSnapshotsResponse: + """ + Retrieves a list of snapshots for a Studio project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectSnapshotsResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.snapshots.list( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.list(project_id, request_options=request_options) + return _response.data + + def get( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectSnapshotExtendedResponseModel: + """ + Returns the project snapshot. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectSnapshotExtendedResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.snapshots.get( + project_id="21m00Tcm4TlvDq8ikWAM", + project_snapshot_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get(project_id, project_snapshot_id, request_options=request_options) + return _response.data + + def stream( + self, + project_id: str, + project_snapshot_id: str, + *, + convert_to_mpeg: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Stream the audio from a Studio project snapshot. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + convert_to_mpeg : typing.Optional[bool] + Whether to convert the audio to mpeg format. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.snapshots.stream( + project_id="project_id", + project_snapshot_id="project_snapshot_id", + ) + """ + with self._raw_client.stream( + project_id, project_snapshot_id, convert_to_mpeg=convert_to_mpeg, request_options=request_options + ) as r: + yield from r.data + + def stream_archive( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Returns a compressed archive of the Studio project's audio. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Streaming archive data + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.studio.projects.snapshots.stream_archive( + project_id="project_id", + project_snapshot_id="project_snapshot_id", + ) + """ + with self._raw_client.stream_archive(project_id, project_snapshot_id, request_options=request_options) as r: + yield from r.data + + +class AsyncSnapshotsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSnapshotsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSnapshotsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSnapshotsClient + """ + return self._raw_client + + async def list( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectSnapshotsResponse: + """ + Retrieves a list of snapshots for a Studio project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectSnapshotsResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.snapshots.list( + project_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(project_id, request_options=request_options) + return _response.data + + async def get( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> ProjectSnapshotExtendedResponseModel: + """ + Returns the project snapshot. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProjectSnapshotExtendedResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.snapshots.get( + project_id="21m00Tcm4TlvDq8ikWAM", + project_snapshot_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(project_id, project_snapshot_id, request_options=request_options) + return _response.data + + async def stream( + self, + project_id: str, + project_snapshot_id: str, + *, + convert_to_mpeg: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Stream the audio from a Studio project snapshot. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + convert_to_mpeg : typing.Optional[bool] + Whether to convert the audio to mpeg format. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.snapshots.stream( + project_id="project_id", + project_snapshot_id="project_snapshot_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.stream( + project_id, project_snapshot_id, convert_to_mpeg=convert_to_mpeg, request_options=request_options + ) as r: + async for _chunk in r.data: + yield _chunk + + async def stream_archive( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Returns a compressed archive of the Studio project's audio. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Streaming archive data + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.studio.projects.snapshots.stream_archive( + project_id="project_id", + project_snapshot_id="project_snapshot_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.stream_archive( + project_id, project_snapshot_id, request_options=request_options + ) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/studio/projects/snapshots/raw_client.py b/data/src/elevenlabs/studio/projects/snapshots/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b588ccad924729a72f0436df1f75ea23e5f3a9f8 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/snapshots/raw_client.py @@ -0,0 +1,540 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.project_snapshot_extended_response_model import ProjectSnapshotExtendedResponseModel +from ....types.project_snapshots_response import ProjectSnapshotsResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSnapshotsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ProjectSnapshotsResponse]: + """ + Retrieves a list of snapshots for a Studio project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProjectSnapshotsResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/snapshots", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectSnapshotsResponse, + construct_type( + type_=ProjectSnapshotsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ProjectSnapshotExtendedResponseModel]: + """ + Returns the project snapshot. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ProjectSnapshotExtendedResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/snapshots/{jsonable_encoder(project_snapshot_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectSnapshotExtendedResponseModel, + construct_type( + type_=ProjectSnapshotExtendedResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def stream( + self, + project_id: str, + project_snapshot_id: str, + *, + convert_to_mpeg: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Stream the audio from a Studio project snapshot. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + convert_to_mpeg : typing.Optional[bool] + Whether to convert the audio to mpeg format. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Successful Response + """ + with self._client_wrapper.httpx_client.stream( + f"v1/studio/projects/{jsonable_encoder(project_id)}/snapshots/{jsonable_encoder(project_snapshot_id)}/stream", + method="POST", + json={ + "convert_to_mpeg": convert_to_mpeg, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def stream_archive( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Returns a compressed archive of the Studio project's audio. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Streaming archive data + """ + with self._client_wrapper.httpx_client.stream( + f"v1/studio/projects/{jsonable_encoder(project_id)}/snapshots/{jsonable_encoder(project_snapshot_id)}/archive", + method="POST", + request_options=request_options, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawSnapshotsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, project_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ProjectSnapshotsResponse]: + """ + Retrieves a list of snapshots for a Studio project. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProjectSnapshotsResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/snapshots", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectSnapshotsResponse, + construct_type( + type_=ProjectSnapshotsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ProjectSnapshotExtendedResponseModel]: + """ + Returns the project snapshot. + + Parameters + ---------- + project_id : str + The ID of the Studio project. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ProjectSnapshotExtendedResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/studio/projects/{jsonable_encoder(project_id)}/snapshots/{jsonable_encoder(project_snapshot_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ProjectSnapshotExtendedResponseModel, + construct_type( + type_=ProjectSnapshotExtendedResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def stream( + self, + project_id: str, + project_snapshot_id: str, + *, + convert_to_mpeg: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Stream the audio from a Studio project snapshot. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + convert_to_mpeg : typing.Optional[bool] + Whether to convert the audio to mpeg format. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Successful Response + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/studio/projects/{jsonable_encoder(project_id)}/snapshots/{jsonable_encoder(project_snapshot_id)}/stream", + method="POST", + json={ + "convert_to_mpeg": convert_to_mpeg, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def stream_archive( + self, project_id: str, project_snapshot_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Returns a compressed archive of the Studio project's audio. + + Parameters + ---------- + project_id : str + The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects. + + project_snapshot_id : str + The ID of the Studio project snapshot. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Streaming archive data + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/studio/projects/{jsonable_encoder(project_id)}/snapshots/{jsonable_encoder(project_snapshot_id)}/archive", + method="POST", + request_options=request_options, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/studio/projects/types/__init__.py b/data/src/elevenlabs/studio/projects/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9428f3ac304174398c7a4bbb0cf78272f978bd1c --- /dev/null +++ b/data/src/elevenlabs/studio/projects/types/__init__.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .projects_create_request_apply_text_normalization import ProjectsCreateRequestApplyTextNormalization + from .projects_create_request_fiction import ProjectsCreateRequestFiction + from .projects_create_request_source_type import ProjectsCreateRequestSourceType + from .projects_create_request_target_audience import ProjectsCreateRequestTargetAudience +_dynamic_imports: typing.Dict[str, str] = { + "ProjectsCreateRequestApplyTextNormalization": ".projects_create_request_apply_text_normalization", + "ProjectsCreateRequestFiction": ".projects_create_request_fiction", + "ProjectsCreateRequestSourceType": ".projects_create_request_source_type", + "ProjectsCreateRequestTargetAudience": ".projects_create_request_target_audience", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ProjectsCreateRequestApplyTextNormalization", + "ProjectsCreateRequestFiction", + "ProjectsCreateRequestSourceType", + "ProjectsCreateRequestTargetAudience", +] diff --git a/data/src/elevenlabs/studio/projects/types/projects_create_request_apply_text_normalization.py b/data/src/elevenlabs/studio/projects/types/projects_create_request_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..d09d85ed891f9b907445e4a06da661933c16d501 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/types/projects_create_request_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectsCreateRequestApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off", "apply_english"], typing.Any +] diff --git a/data/src/elevenlabs/studio/projects/types/projects_create_request_fiction.py b/data/src/elevenlabs/studio/projects/types/projects_create_request_fiction.py new file mode 100644 index 0000000000000000000000000000000000000000..2303088ad7b01d392eb80f28f281e6a0d13f4534 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/types/projects_create_request_fiction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectsCreateRequestFiction = typing.Union[typing.Literal["fiction", "non-fiction"], typing.Any] diff --git a/data/src/elevenlabs/studio/projects/types/projects_create_request_source_type.py b/data/src/elevenlabs/studio/projects/types/projects_create_request_source_type.py new file mode 100644 index 0000000000000000000000000000000000000000..57975cc2d82ccab14a1fcb17deeb313806efb1bf --- /dev/null +++ b/data/src/elevenlabs/studio/projects/types/projects_create_request_source_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectsCreateRequestSourceType = typing.Union[ + typing.Literal["blank", "book", "article", "genfm", "video", "screenplay"], typing.Any +] diff --git a/data/src/elevenlabs/studio/projects/types/projects_create_request_target_audience.py b/data/src/elevenlabs/studio/projects/types/projects_create_request_target_audience.py new file mode 100644 index 0000000000000000000000000000000000000000..de38b332db8ff56dd35efac5ac836bc559fa9ff7 --- /dev/null +++ b/data/src/elevenlabs/studio/projects/types/projects_create_request_target_audience.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectsCreateRequestTargetAudience = typing.Union[ + typing.Literal["children", "young adult", "adult", "all ages"], typing.Any +] diff --git a/data/src/elevenlabs/studio/raw_client.py b/data/src/elevenlabs/studio/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c178b07cf0471db356234cc4aa99572125924db5 --- /dev/null +++ b/data/src/elevenlabs/studio/raw_client.py @@ -0,0 +1,427 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.podcast_project_response_model import PodcastProjectResponseModel +from ..types.quality_preset_type import QualityPresetType +from .types.body_create_podcast_v_1_studio_podcasts_post_apply_text_normalization import ( + BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization, +) +from .types.body_create_podcast_v_1_studio_podcasts_post_duration_scale import ( + BodyCreatePodcastV1StudioPodcastsPostDurationScale, +) +from .types.body_create_podcast_v_1_studio_podcasts_post_mode import BodyCreatePodcastV1StudioPodcastsPostMode +from .types.body_create_podcast_v_1_studio_podcasts_post_source import BodyCreatePodcastV1StudioPodcastsPostSource +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawStudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create_podcast( + self, + *, + model_id: str, + mode: BodyCreatePodcastV1StudioPodcastsPostMode, + source: BodyCreatePodcastV1StudioPodcastsPostSource, + safety_identifier: typing.Optional[str] = None, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + duration_scale: typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale] = OMIT, + language: typing.Optional[str] = OMIT, + intro: typing.Optional[str] = OMIT, + outro: typing.Optional[str] = OMIT, + instructions_prompt: typing.Optional[str] = OMIT, + highlights: typing.Optional[typing.Sequence[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + apply_text_normalization: typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[PodcastProjectResponseModel]: + """ + Create and auto-convert a podcast project. Currently, the LLM cost is covered by us but you will still be charged for the audio generation. In the future, you will be charged for both the LLM and audio generation costs. + + Parameters + ---------- + model_id : str + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + mode : BodyCreatePodcastV1StudioPodcastsPostMode + The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue. + + source : BodyCreatePodcastV1StudioPodcastsPostSource + The source content for the Podcast. + + safety_identifier : typing.Optional[str] + Used for moderation. Your workspace must be allowlisted to use this feature. + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + If not provided, defaults to the highest quality preset available on your subscription tier. + + duration_scale : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale] + Duration of the generated podcast. Must be one of: + short - produces podcasts shorter than 3 minutes. + default - produces podcasts roughly between 3-7 minutes. + long - produces podcasts longer than 7 minutes. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + intro : typing.Optional[str] + The intro text that will always be added to the beginning of the podcast. + + outro : typing.Optional[str] + The outro text that will always be added to the end of the podcast. + + instructions_prompt : typing.Optional[str] + Additional instructions prompt for the podcast generation used to adjust the podcast's style and tone. + + highlights : typing.Optional[typing.Sequence[str]] + A brief summary or highlights of the Studio project's content, providing key points or themes. This should be between 10 and 70 characters. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + apply_text_normalization : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PodcastProjectResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/studio/podcasts", + method="POST", + json={ + "model_id": model_id, + "mode": convert_and_respect_annotation_metadata( + object_=mode, annotation=BodyCreatePodcastV1StudioPodcastsPostMode, direction="write" + ), + "source": convert_and_respect_annotation_metadata( + object_=source, annotation=BodyCreatePodcastV1StudioPodcastsPostSource, direction="write" + ), + "quality_preset": quality_preset, + "duration_scale": duration_scale, + "language": language, + "intro": intro, + "outro": outro, + "instructions_prompt": instructions_prompt, + "highlights": highlights, + "callback_url": callback_url, + "apply_text_normalization": apply_text_normalization, + }, + headers={ + "content-type": "application/json", + "safety-identifier": str(safety_identifier) if safety_identifier is not None else None, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PodcastProjectResponseModel, + construct_type( + type_=PodcastProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawStudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create_podcast( + self, + *, + model_id: str, + mode: BodyCreatePodcastV1StudioPodcastsPostMode, + source: BodyCreatePodcastV1StudioPodcastsPostSource, + safety_identifier: typing.Optional[str] = None, + quality_preset: typing.Optional[QualityPresetType] = OMIT, + duration_scale: typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale] = OMIT, + language: typing.Optional[str] = OMIT, + intro: typing.Optional[str] = OMIT, + outro: typing.Optional[str] = OMIT, + instructions_prompt: typing.Optional[str] = OMIT, + highlights: typing.Optional[typing.Sequence[str]] = OMIT, + callback_url: typing.Optional[str] = OMIT, + apply_text_normalization: typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[PodcastProjectResponseModel]: + """ + Create and auto-convert a podcast project. Currently, the LLM cost is covered by us but you will still be charged for the audio generation. In the future, you will be charged for both the LLM and audio generation costs. + + Parameters + ---------- + model_id : str + The ID of the model to be used for this Studio project, you can query GET /v1/models to list all available models. + + mode : BodyCreatePodcastV1StudioPodcastsPostMode + The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue. + + source : BodyCreatePodcastV1StudioPodcastsPostSource + The source content for the Podcast. + + safety_identifier : typing.Optional[str] + Used for moderation. Your workspace must be allowlisted to use this feature. + + quality_preset : typing.Optional[QualityPresetType] + Output quality of the generated audio. Must be one of: + 'standard' - standard output format, 128kbps with 44.1kHz sample rate. + 'high' - high quality output format, 192kbps with 44.1kHz sample rate and major improvements on our side. + 'ultra' - ultra quality output format, 192kbps with 44.1kHz sample rate and highest improvements on our side. + 'ultra_lossless' - ultra quality output format, 705.6kbps with 44.1kHz sample rate and highest improvements on our side in a fully lossless format. + If not provided, defaults to the highest quality preset available on your subscription tier. + + duration_scale : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostDurationScale] + Duration of the generated podcast. Must be one of: + short - produces podcasts shorter than 3 minutes. + default - produces podcasts roughly between 3-7 minutes. + long - produces podcasts longer than 7 minutes. + + language : typing.Optional[str] + An optional language of the Studio project. Two-letter language code (ISO 639-1). + + intro : typing.Optional[str] + The intro text that will always be added to the beginning of the podcast. + + outro : typing.Optional[str] + The outro text that will always be added to the end of the podcast. + + instructions_prompt : typing.Optional[str] + Additional instructions prompt for the podcast generation used to adjust the podcast's style and tone. + + highlights : typing.Optional[typing.Sequence[str]] + A brief summary or highlights of the Studio project's content, providing key points or themes. This should be between 10 and 70 characters. + + callback_url : typing.Optional[str] + + A url that will be called by our service when the Studio project is converted. Request will contain a json blob containing the status of the conversion + Messages: + 1. When project was converted successfully: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "success", + project_snapshot_id: "22m00Tcm4TlvDq8ikMAT", + error_details: None, + } + } + 2. When project conversion failed: + { + type: "project_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + conversion_status: "error", + project_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + 3. When chapter was converted successfully: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "success", + chapter_snapshot_id: "23m00Tcm4TlvDq8ikMAV", + error_details: None, + } + } + 4. When chapter conversion failed: + { + type: "chapter_conversion_status", + event_timestamp: 1234567890, + data: { + request_id: "1234567890", + project_id: "21m00Tcm4TlvDq8ikWAM", + chapter_id: "22m00Tcm4TlvDq8ikMAT", + conversion_status: "error", + chapter_snapshot_id: None, + error_details: "Error details if conversion failed" + } + } + + + apply_text_normalization : typing.Optional[BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization] + + This parameter controls text normalization with four modes: 'auto', 'on', 'apply_english' and 'off'. + When set to 'auto', the system will automatically decide whether to apply text normalization + (e.g., spelling out numbers). With 'on', text normalization will always be applied, while + with 'off', it will be skipped. 'apply_english' is the same as 'on' but will assume that text is in English. + + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PodcastProjectResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/studio/podcasts", + method="POST", + json={ + "model_id": model_id, + "mode": convert_and_respect_annotation_metadata( + object_=mode, annotation=BodyCreatePodcastV1StudioPodcastsPostMode, direction="write" + ), + "source": convert_and_respect_annotation_metadata( + object_=source, annotation=BodyCreatePodcastV1StudioPodcastsPostSource, direction="write" + ), + "quality_preset": quality_preset, + "duration_scale": duration_scale, + "language": language, + "intro": intro, + "outro": outro, + "instructions_prompt": instructions_prompt, + "highlights": highlights, + "callback_url": callback_url, + "apply_text_normalization": apply_text_normalization, + }, + headers={ + "content-type": "application/json", + "safety-identifier": str(safety_identifier) if safety_identifier is not None else None, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PodcastProjectResponseModel, + construct_type( + type_=PodcastProjectResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/studio/types/__init__.py b/data/src/elevenlabs/studio/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5f00969ce3a5a271d4e900a466782e57efa2fe8d --- /dev/null +++ b/data/src/elevenlabs/studio/types/__init__.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_create_podcast_v_1_studio_podcasts_post_apply_text_normalization import ( + BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization, + ) + from .body_create_podcast_v_1_studio_podcasts_post_duration_scale import ( + BodyCreatePodcastV1StudioPodcastsPostDurationScale, + ) + from .body_create_podcast_v_1_studio_podcasts_post_mode import ( + BodyCreatePodcastV1StudioPodcastsPostMode, + BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin, + BodyCreatePodcastV1StudioPodcastsPostMode_Conversation, + ) + from .body_create_podcast_v_1_studio_podcasts_post_source import BodyCreatePodcastV1StudioPodcastsPostSource + from .body_create_podcast_v_1_studio_podcasts_post_source_two_item import ( + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem, + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text, + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization": ".body_create_podcast_v_1_studio_podcasts_post_apply_text_normalization", + "BodyCreatePodcastV1StudioPodcastsPostDurationScale": ".body_create_podcast_v_1_studio_podcasts_post_duration_scale", + "BodyCreatePodcastV1StudioPodcastsPostMode": ".body_create_podcast_v_1_studio_podcasts_post_mode", + "BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin": ".body_create_podcast_v_1_studio_podcasts_post_mode", + "BodyCreatePodcastV1StudioPodcastsPostMode_Conversation": ".body_create_podcast_v_1_studio_podcasts_post_mode", + "BodyCreatePodcastV1StudioPodcastsPostSource": ".body_create_podcast_v_1_studio_podcasts_post_source", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem": ".body_create_podcast_v_1_studio_podcasts_post_source_two_item", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text": ".body_create_podcast_v_1_studio_podcasts_post_source_two_item", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url": ".body_create_podcast_v_1_studio_podcasts_post_source_two_item", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization", + "BodyCreatePodcastV1StudioPodcastsPostDurationScale", + "BodyCreatePodcastV1StudioPodcastsPostMode", + "BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin", + "BodyCreatePodcastV1StudioPodcastsPostMode_Conversation", + "BodyCreatePodcastV1StudioPodcastsPostSource", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text", + "BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url", +] diff --git a/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_apply_text_normalization.py b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..4622eed2489463958953f5b33ac929d96458b707 --- /dev/null +++ b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyCreatePodcastV1StudioPodcastsPostApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off", "apply_english"], typing.Any +] diff --git a/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_duration_scale.py b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_duration_scale.py new file mode 100644 index 0000000000000000000000000000000000000000..97e325ac6dd9903b8194e738bfd75602ee4ca737 --- /dev/null +++ b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_duration_scale.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyCreatePodcastV1StudioPodcastsPostDurationScale = typing.Union[ + typing.Literal["short", "default", "long"], typing.Any +] diff --git a/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_mode.py b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..bfe0e14fe95675107dd5962644f42186ffb307d6 --- /dev/null +++ b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_mode.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ...types.podcast_bulletin_mode_data import PodcastBulletinModeData +from ...types.podcast_conversation_mode_data import PodcastConversationModeData + + +class BodyCreatePodcastV1StudioPodcastsPostMode_Conversation(UncheckedBaseModel): + """ + The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue. + """ + + type: typing.Literal["conversation"] = "conversation" + conversation: PodcastConversationModeData + + 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 + + +class BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin(UncheckedBaseModel): + """ + The type of podcast to generate. Can be 'conversation', an interaction between two voices, or 'bulletin', a monologue. + """ + + type: typing.Literal["bulletin"] = "bulletin" + bulletin: PodcastBulletinModeData + + 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 + + +BodyCreatePodcastV1StudioPodcastsPostMode = typing_extensions.Annotated[ + typing.Union[ + BodyCreatePodcastV1StudioPodcastsPostMode_Conversation, BodyCreatePodcastV1StudioPodcastsPostMode_Bulletin + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_source.py b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_source.py new file mode 100644 index 0000000000000000000000000000000000000000..f1f31c9b25b7ce458dcb7d0cd41ac82af04180f1 --- /dev/null +++ b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_source.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.podcast_text_source import PodcastTextSource +from ...types.podcast_url_source import PodcastUrlSource +from .body_create_podcast_v_1_studio_podcasts_post_source_two_item import ( + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem, +) + +BodyCreatePodcastV1StudioPodcastsPostSource = typing.Union[ + PodcastTextSource, PodcastUrlSource, typing.List[BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem] +] diff --git a/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_source_two_item.py b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_source_two_item.py new file mode 100644 index 0000000000000000000000000000000000000000..788f48565129febf0f4354bf909495dcdec94c10 --- /dev/null +++ b/data/src/elevenlabs/studio/types/body_create_podcast_v_1_studio_podcasts_post_source_two_item.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ...core.pydantic_utilities import IS_PYDANTIC_V2 +from ...core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + text: 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 + + +class BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + url: 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 + + +BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem = typing_extensions.Annotated[ + typing.Union[ + BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Text, BodyCreatePodcastV1StudioPodcastsPostSourceTwoItem_Url + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/text_to_dialogue/__init__.py b/data/src/elevenlabs/text_to_dialogue/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e6635231b4eb27d2b2101b2b153fe3716f098a4d --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/__init__.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + BodyTextToDialogueFullWithTimestampsApplyTextNormalization, + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization, + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization, + BodyTextToDialogueStreamWithTimestampsApplyTextNormalization, + TextToDialogueConvertRequestOutputFormat, + TextToDialogueConvertWithTimestampsRequestOutputFormat, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyTextToDialogueFullWithTimestampsApplyTextNormalization": ".types", + "BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization": ".types", + "BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization": ".types", + "BodyTextToDialogueStreamWithTimestampsApplyTextNormalization": ".types", + "TextToDialogueConvertRequestOutputFormat": ".types", + "TextToDialogueConvertWithTimestampsRequestOutputFormat": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyTextToDialogueFullWithTimestampsApplyTextNormalization", + "BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization", + "BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization", + "BodyTextToDialogueStreamWithTimestampsApplyTextNormalization", + "TextToDialogueConvertRequestOutputFormat", + "TextToDialogueConvertWithTimestampsRequestOutputFormat", +] diff --git a/data/src/elevenlabs/text_to_dialogue/client.py b/data/src/elevenlabs/text_to_dialogue/client.py new file mode 100644 index 0000000000000000000000000000000000000000..0ab1d728dc151bba362f50c775ba732f9e7d2317 --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/client.py @@ -0,0 +1,1084 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.allowed_output_formats import AllowedOutputFormats +from ..types.audio_with_timestamps_and_voice_segments_response_model import ( + AudioWithTimestampsAndVoiceSegmentsResponseModel, +) +from ..types.dialogue_input import DialogueInput +from ..types.effects_spec_input import EffectsSpecInput +from ..types.pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from ..types.streaming_audio_chunk_with_timestamps_and_voice_segments_response_model import ( + StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel, +) +from ..types.to_dialogue_settings_response_model import ToDialogueSettingsResponseModel +from .raw_client import AsyncRawTextToDialogueClient, RawTextToDialogueClient +from .types.body_text_to_dialogue_full_with_timestamps_apply_text_normalization import ( + BodyTextToDialogueFullWithTimestampsApplyTextNormalization, +) +from .types.body_text_to_dialogue_multi_voice_streaming_v_1_text_to_dialogue_stream_post_apply_text_normalization import ( + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization, +) +from .types.body_text_to_dialogue_multi_voice_v_1_text_to_dialogue_post_apply_text_normalization import ( + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization, +) +from .types.body_text_to_dialogue_stream_with_timestamps_apply_text_normalization import ( + BodyTextToDialogueStreamWithTimestampsApplyTextNormalization, +) +from .types.text_to_dialogue_convert_request_output_format import TextToDialogueConvertRequestOutputFormat +from .types.text_to_dialogue_convert_with_timestamps_request_output_format import ( + TextToDialogueConvertWithTimestampsRequestOutputFormat, +) + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TextToDialogueClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTextToDialogueClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTextToDialogueClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTextToDialogueClient + """ + return self._raw_client + + def convert( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[TextToDialogueConvertRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[ + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization + ] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns audio. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[TextToDialogueConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The generated audio file + + Examples + -------- + from elevenlabs import DialogueInput, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_dialogue.convert( + inputs=[ + DialogueInput( + text="[giggling] Knock knock", + voice_id="JBFqnCBsd6RMkjVDRZzb", + ), + DialogueInput( + text="[curious] Who is there?", + voice_id="Aw4FAjKCGjjNkVhN1Xmq", + ), + ], + ) + """ + with self._raw_client.convert( + inputs=inputs, + output_format=output_format, + enable_logging=enable_logging, + model_id=model_id, + language_code=language_code, + settings=settings, + previous_text=previous_text, + future_text=future_text, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + apply_text_normalization=apply_text_normalization, + use_pvc_as_ivc=use_pvc_as_ivc, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + yield from r.data + + def stream( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[ + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization + ] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns an audio stream. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Streaming audio data + + Examples + -------- + from elevenlabs import DialogueInput, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_dialogue.stream( + inputs=[ + DialogueInput( + text="[giggling] Knock knock", + voice_id="JBFqnCBsd6RMkjVDRZzb", + ), + DialogueInput( + text="[curious] Who is there?", + voice_id="Aw4FAjKCGjjNkVhN1Xmq", + ), + ], + ) + """ + with self._raw_client.stream( + inputs=inputs, + output_format=output_format, + enable_logging=enable_logging, + model_id=model_id, + language_code=language_code, + settings=settings, + previous_text=previous_text, + future_text=future_text, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + apply_text_normalization=apply_text_normalization, + use_pvc_as_ivc=use_pvc_as_ivc, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + yield from r.data + + def stream_with_timestamps( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns a stream of JSON blobs containing audio as a base64 encoded string and timestamps + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel] + Stream of transcription chunks + + Examples + -------- + from elevenlabs import DialogueInput, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + response = client.text_to_dialogue.stream_with_timestamps( + output_format="mp3_22050_32", + enable_logging=True, + inputs=[ + DialogueInput( + text="Hello, how are you?", + voice_id="bYTqZQo3Jz7LQtmGTgwi", + ), + DialogueInput( + text="I'm doing well, thank you!", + voice_id="6lCwbsX1yVjD49QmpkTR", + ), + ], + ) + for chunk in response: + yield chunk + """ + with self._raw_client.stream_with_timestamps( + inputs=inputs, + output_format=output_format, + enable_logging=enable_logging, + model_id=model_id, + language_code=language_code, + settings=settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + apply_text_normalization=apply_text_normalization, + use_pvc_as_ivc=use_pvc_as_ivc, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + previous_text=previous_text, + future_text=future_text, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + yield from r.data + + def convert_with_timestamps( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioWithTimestampsAndVoiceSegmentsResponseModel: + """ + Generate dialogue from text with precise character-level timing information for audio-text synchronization. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioWithTimestampsAndVoiceSegmentsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import DialogueInput, ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_dialogue.convert_with_timestamps( + output_format="alaw_8000", + enable_logging=True, + inputs=[ + DialogueInput( + text="Hello, how are you?", + voice_id="bYTqZQo3Jz7LQtmGTgwi", + ), + DialogueInput( + text="I'm doing well, thank you!", + voice_id="6lCwbsX1yVjD49QmpkTR", + ), + ], + ) + """ + _response = self._raw_client.convert_with_timestamps( + inputs=inputs, + output_format=output_format, + enable_logging=enable_logging, + model_id=model_id, + language_code=language_code, + settings=settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + apply_text_normalization=apply_text_normalization, + use_pvc_as_ivc=use_pvc_as_ivc, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + previous_text=previous_text, + future_text=future_text, + audio_effects=audio_effects, + request_options=request_options, + ) + return _response.data + + +class AsyncTextToDialogueClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTextToDialogueClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTextToDialogueClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTextToDialogueClient + """ + return self._raw_client + + async def convert( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[TextToDialogueConvertRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[ + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization + ] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns audio. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[TextToDialogueConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The generated audio file + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, DialogueInput + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_dialogue.convert( + inputs=[ + DialogueInput( + text="[giggling] Knock knock", + voice_id="JBFqnCBsd6RMkjVDRZzb", + ), + DialogueInput( + text="[curious] Who is there?", + voice_id="Aw4FAjKCGjjNkVhN1Xmq", + ), + ], + ) + + + asyncio.run(main()) + """ + async with self._raw_client.convert( + inputs=inputs, + output_format=output_format, + enable_logging=enable_logging, + model_id=model_id, + language_code=language_code, + settings=settings, + previous_text=previous_text, + future_text=future_text, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + apply_text_normalization=apply_text_normalization, + use_pvc_as_ivc=use_pvc_as_ivc, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def stream( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[ + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization + ] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns an audio stream. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Streaming audio data + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, DialogueInput + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_dialogue.stream( + inputs=[ + DialogueInput( + text="[giggling] Knock knock", + voice_id="JBFqnCBsd6RMkjVDRZzb", + ), + DialogueInput( + text="[curious] Who is there?", + voice_id="Aw4FAjKCGjjNkVhN1Xmq", + ), + ], + ) + + + asyncio.run(main()) + """ + async with self._raw_client.stream( + inputs=inputs, + output_format=output_format, + enable_logging=enable_logging, + model_id=model_id, + language_code=language_code, + settings=settings, + previous_text=previous_text, + future_text=future_text, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + apply_text_normalization=apply_text_normalization, + use_pvc_as_ivc=use_pvc_as_ivc, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def stream_with_timestamps( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns a stream of JSON blobs containing audio as a base64 encoded string and timestamps + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel] + Stream of transcription chunks + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, DialogueInput + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + response = await client.text_to_dialogue.stream_with_timestamps( + output_format="mp3_22050_32", + enable_logging=True, + inputs=[ + DialogueInput( + text="Hello, how are you?", + voice_id="bYTqZQo3Jz7LQtmGTgwi", + ), + DialogueInput( + text="I'm doing well, thank you!", + voice_id="6lCwbsX1yVjD49QmpkTR", + ), + ], + ) + async for chunk in response: + yield chunk + + + asyncio.run(main()) + """ + async with self._raw_client.stream_with_timestamps( + inputs=inputs, + output_format=output_format, + enable_logging=enable_logging, + model_id=model_id, + language_code=language_code, + settings=settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + apply_text_normalization=apply_text_normalization, + use_pvc_as_ivc=use_pvc_as_ivc, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + previous_text=previous_text, + future_text=future_text, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def convert_with_timestamps( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioWithTimestampsAndVoiceSegmentsResponseModel: + """ + Generate dialogue from text with precise character-level timing information for audio-text synchronization. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioWithTimestampsAndVoiceSegmentsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, DialogueInput + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_dialogue.convert_with_timestamps( + output_format="alaw_8000", + enable_logging=True, + inputs=[ + DialogueInput( + text="Hello, how are you?", + voice_id="bYTqZQo3Jz7LQtmGTgwi", + ), + DialogueInput( + text="I'm doing well, thank you!", + voice_id="6lCwbsX1yVjD49QmpkTR", + ), + ], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.convert_with_timestamps( + inputs=inputs, + output_format=output_format, + enable_logging=enable_logging, + model_id=model_id, + language_code=language_code, + settings=settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + apply_text_normalization=apply_text_normalization, + use_pvc_as_ivc=use_pvc_as_ivc, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + previous_text=previous_text, + future_text=future_text, + audio_effects=audio_effects, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/text_to_dialogue/raw_client.py b/data/src/elevenlabs/text_to_dialogue/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..466cf44fa0bc259f20fc9825ad019ce0f3e1fcab --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/raw_client.py @@ -0,0 +1,1326 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import json +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.allowed_output_formats import AllowedOutputFormats +from ..types.audio_with_timestamps_and_voice_segments_response_model import ( + AudioWithTimestampsAndVoiceSegmentsResponseModel, +) +from ..types.dialogue_input import DialogueInput +from ..types.effects_spec_input import EffectsSpecInput +from ..types.pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from ..types.streaming_audio_chunk_with_timestamps_and_voice_segments_response_model import ( + StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel, +) +from ..types.to_dialogue_settings_response_model import ToDialogueSettingsResponseModel +from .types.body_text_to_dialogue_full_with_timestamps_apply_text_normalization import ( + BodyTextToDialogueFullWithTimestampsApplyTextNormalization, +) +from .types.body_text_to_dialogue_multi_voice_streaming_v_1_text_to_dialogue_stream_post_apply_text_normalization import ( + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization, +) +from .types.body_text_to_dialogue_multi_voice_v_1_text_to_dialogue_post_apply_text_normalization import ( + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization, +) +from .types.body_text_to_dialogue_stream_with_timestamps_apply_text_normalization import ( + BodyTextToDialogueStreamWithTimestampsApplyTextNormalization, +) +from .types.text_to_dialogue_convert_request_output_format import TextToDialogueConvertRequestOutputFormat +from .types.text_to_dialogue_convert_with_timestamps_request_output_format import ( + TextToDialogueConvertWithTimestampsRequestOutputFormat, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTextToDialogueClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def convert( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[TextToDialogueConvertRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[ + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization + ] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns audio. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[TextToDialogueConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The generated audio file + """ + with self._client_wrapper.httpx_client.stream( + "v1/text-to-dialogue", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Sequence[DialogueInput], direction="write" + ), + "model_id": model_id, + "language_code": language_code, + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=ToDialogueSettingsResponseModel, direction="write" + ), + "previous_text": previous_text, + "future_text": future_text, + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "apply_text_normalization": apply_text_normalization, + "use_pvc_as_ivc": use_pvc_as_ivc, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def stream( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[ + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization + ] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns an audio stream. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Streaming audio data + """ + with self._client_wrapper.httpx_client.stream( + "v1/text-to-dialogue/stream", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Sequence[DialogueInput], direction="write" + ), + "model_id": model_id, + "language_code": language_code, + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=ToDialogueSettingsResponseModel, direction="write" + ), + "previous_text": previous_text, + "future_text": future_text, + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "apply_text_normalization": apply_text_normalization, + "use_pvc_as_ivc": use_pvc_as_ivc, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def stream_with_timestamps( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel]]]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns a stream of JSON blobs containing audio as a base64 encoded string and timestamps + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[HttpResponse[typing.Iterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel]]] + Stream of transcription chunks + """ + with self._client_wrapper.httpx_client.stream( + "v1/text-to-dialogue/stream/with-timestamps", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Sequence[DialogueInput], direction="write" + ), + "model_id": model_id, + "language_code": language_code, + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=ToDialogueSettingsResponseModel, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "apply_text_normalization": apply_text_normalization, + "use_pvc_as_ivc": use_pvc_as_ivc, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "previous_text": previous_text, + "future_text": future_text, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[ + typing.Iterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel] + ]: + try: + if 200 <= _response.status_code < 300: + + def _iter(): + for _text in _response.iter_lines(): + try: + if len(_text) == 0: + continue + yield typing.cast( + StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel, + construct_type( + type_=StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel, # type: ignore + object_=json.loads(_text), + ), + ) + except Exception: + pass + return + + return HttpResponse(response=_response, data=_iter()) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + def convert_with_timestamps( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AudioWithTimestampsAndVoiceSegmentsResponseModel]: + """ + Generate dialogue from text with precise character-level timing information for audio-text synchronization. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioWithTimestampsAndVoiceSegmentsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/text-to-dialogue/with-timestamps", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Sequence[DialogueInput], direction="write" + ), + "model_id": model_id, + "language_code": language_code, + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=ToDialogueSettingsResponseModel, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "apply_text_normalization": apply_text_normalization, + "use_pvc_as_ivc": use_pvc_as_ivc, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "previous_text": previous_text, + "future_text": future_text, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioWithTimestampsAndVoiceSegmentsResponseModel, + construct_type( + type_=AudioWithTimestampsAndVoiceSegmentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTextToDialogueClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def convert( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[TextToDialogueConvertRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[ + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization + ] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns audio. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[TextToDialogueConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The generated audio file + """ + async with self._client_wrapper.httpx_client.stream( + "v1/text-to-dialogue", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Sequence[DialogueInput], direction="write" + ), + "model_id": model_id, + "language_code": language_code, + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=ToDialogueSettingsResponseModel, direction="write" + ), + "previous_text": previous_text, + "future_text": future_text, + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "apply_text_normalization": apply_text_normalization, + "use_pvc_as_ivc": use_pvc_as_ivc, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def stream( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[ + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization + ] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns an audio stream. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Streaming audio data + """ + async with self._client_wrapper.httpx_client.stream( + "v1/text-to-dialogue/stream", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Sequence[DialogueInput], direction="write" + ), + "model_id": model_id, + "language_code": language_code, + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=ToDialogueSettingsResponseModel, direction="write" + ), + "previous_text": previous_text, + "future_text": future_text, + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "apply_text_normalization": apply_text_normalization, + "use_pvc_as_ivc": use_pvc_as_ivc, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def stream_with_timestamps( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[AllowedOutputFormats] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[ + AsyncHttpResponse[typing.AsyncIterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel]] + ]: + """ + Converts a list of text and voice ID pairs into speech (dialogue) and returns a stream of JSON blobs containing audio as a base64 encoded string and timestamps + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueStreamWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel]]] + Stream of transcription chunks + """ + async with self._client_wrapper.httpx_client.stream( + "v1/text-to-dialogue/stream/with-timestamps", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Sequence[DialogueInput], direction="write" + ), + "model_id": model_id, + "language_code": language_code, + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=ToDialogueSettingsResponseModel, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "apply_text_normalization": apply_text_normalization, + "use_pvc_as_ivc": use_pvc_as_ivc, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "previous_text": previous_text, + "future_text": future_text, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[ + typing.AsyncIterator[StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel] + ]: + try: + if 200 <= _response.status_code < 300: + + async def _iter(): + async for _text in _response.aiter_lines(): + try: + if len(_text) == 0: + continue + yield typing.cast( + StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel, + construct_type( + type_=StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel, # type: ignore + object_=json.loads(_text), + ), + ) + except Exception: + pass + return + + return AsyncHttpResponse(response=_response, data=_iter()) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + async def convert_with_timestamps( + self, + *, + inputs: typing.Sequence[DialogueInput], + output_format: typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + settings: typing.Optional[ToDialogueSettingsResponseModel] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + previous_text: typing.Optional[str] = OMIT, + future_text: typing.Optional[str] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AudioWithTimestampsAndVoiceSegmentsResponseModel]: + """ + Generate dialogue from text with precise character-level timing information for audio-text synchronization. + + Parameters + ---------- + inputs : typing.Sequence[DialogueInput] + A list of dialogue inputs, each containing text and a voice ID which will be converted into speech. The maximum number of unique voice IDs is 10. For reliable generation, keep the total character count across all `inputs[].text` values at or below 2,000 characters per request. Longer requests can terminate early in streaming responses or return a validation error. + + output_format : typing.Optional[TextToDialogueConvertWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + settings : typing.Optional[ToDialogueSettingsResponseModel] + Settings controlling the dialogue generation. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + apply_text_normalization : typing.Optional[BodyTextToDialogueFullWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that came before this one. Used to condition the model for continuity when splitting a large task into multiple requests. A maximum of 3 request_ids can be sent. The last request_id is the audio which is closest to the current request. Not supported by every model. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_ids of dialogue generations that come after this one. Useful for maintaining continuity when regenerating a clip in the middle of a sequence. A maximum of 3 request_ids can be sent. The first request_id is the audio which is closest to the current request. Not supported by every model. + + previous_text : typing.Optional[str] + The text that comes immediately before this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + future_text : typing.Optional[str] + The text that comes immediately after this generation, used to condition the model for prosodic continuity. A maximum of 100 characters can be sent. Not supported by every model. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioWithTimestampsAndVoiceSegmentsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/text-to-dialogue/with-timestamps", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "inputs": convert_and_respect_annotation_metadata( + object_=inputs, annotation=typing.Sequence[DialogueInput], direction="write" + ), + "model_id": model_id, + "language_code": language_code, + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=ToDialogueSettingsResponseModel, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "apply_text_normalization": apply_text_normalization, + "use_pvc_as_ivc": use_pvc_as_ivc, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "previous_text": previous_text, + "future_text": future_text, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioWithTimestampsAndVoiceSegmentsResponseModel, + construct_type( + type_=AudioWithTimestampsAndVoiceSegmentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/text_to_dialogue/types/__init__.py b/data/src/elevenlabs/text_to_dialogue/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b58edd94abe58ee6b7602593cacf70c696eaa305 --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/types/__init__.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_text_to_dialogue_full_with_timestamps_apply_text_normalization import ( + BodyTextToDialogueFullWithTimestampsApplyTextNormalization, + ) + from .body_text_to_dialogue_multi_voice_streaming_v_1_text_to_dialogue_stream_post_apply_text_normalization import ( + BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization, + ) + from .body_text_to_dialogue_multi_voice_v_1_text_to_dialogue_post_apply_text_normalization import ( + BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization, + ) + from .body_text_to_dialogue_stream_with_timestamps_apply_text_normalization import ( + BodyTextToDialogueStreamWithTimestampsApplyTextNormalization, + ) + from .text_to_dialogue_convert_request_output_format import TextToDialogueConvertRequestOutputFormat + from .text_to_dialogue_convert_with_timestamps_request_output_format import ( + TextToDialogueConvertWithTimestampsRequestOutputFormat, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyTextToDialogueFullWithTimestampsApplyTextNormalization": ".body_text_to_dialogue_full_with_timestamps_apply_text_normalization", + "BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization": ".body_text_to_dialogue_multi_voice_streaming_v_1_text_to_dialogue_stream_post_apply_text_normalization", + "BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization": ".body_text_to_dialogue_multi_voice_v_1_text_to_dialogue_post_apply_text_normalization", + "BodyTextToDialogueStreamWithTimestampsApplyTextNormalization": ".body_text_to_dialogue_stream_with_timestamps_apply_text_normalization", + "TextToDialogueConvertRequestOutputFormat": ".text_to_dialogue_convert_request_output_format", + "TextToDialogueConvertWithTimestampsRequestOutputFormat": ".text_to_dialogue_convert_with_timestamps_request_output_format", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyTextToDialogueFullWithTimestampsApplyTextNormalization", + "BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization", + "BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization", + "BodyTextToDialogueStreamWithTimestampsApplyTextNormalization", + "TextToDialogueConvertRequestOutputFormat", + "TextToDialogueConvertWithTimestampsRequestOutputFormat", +] diff --git a/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_full_with_timestamps_apply_text_normalization.py b/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_full_with_timestamps_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..4e6ec30c6dec13b94fcbb13fcb8ac2b541f5561a --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_full_with_timestamps_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyTextToDialogueFullWithTimestampsApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off"], typing.Any +] diff --git a/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_multi_voice_streaming_v_1_text_to_dialogue_stream_post_apply_text_normalization.py b/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_multi_voice_streaming_v_1_text_to_dialogue_stream_post_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..66568c8ad53f2329da9a98fa19b814e8334dbe18 --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_multi_voice_streaming_v_1_text_to_dialogue_stream_post_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyTextToDialogueMultiVoiceStreamingV1TextToDialogueStreamPostApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off"], typing.Any +] diff --git a/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_multi_voice_v_1_text_to_dialogue_post_apply_text_normalization.py b/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_multi_voice_v_1_text_to_dialogue_post_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..f9faef0b5ae66925e6df79f65b2dc4c6faace323 --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_multi_voice_v_1_text_to_dialogue_post_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyTextToDialogueMultiVoiceV1TextToDialoguePostApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off"], typing.Any +] diff --git a/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_stream_with_timestamps_apply_text_normalization.py b/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_stream_with_timestamps_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..f9e642a17df03bd67c38839a672eaf64efb46d69 --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/types/body_text_to_dialogue_stream_with_timestamps_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyTextToDialogueStreamWithTimestampsApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off"], typing.Any +] diff --git a/data/src/elevenlabs/text_to_dialogue/types/text_to_dialogue_convert_request_output_format.py b/data/src/elevenlabs/text_to_dialogue/types/text_to_dialogue_convert_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..a684253fabd0ca7aef7c17fd0150734d2c459cbd --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/types/text_to_dialogue_convert_request_output_format.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueConvertRequestOutputFormat = typing.Union[ + typing.Literal[ + "alaw_8000", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_128", + "mp3_44100_192", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "opus_48000_128", + "opus_48000_192", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "pcm_8000", + "ulaw_8000", + "wav_16000", + "wav_22050", + "wav_24000", + "wav_32000", + "wav_44100", + "wav_48000", + "wav_8000", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/text_to_dialogue/types/text_to_dialogue_convert_with_timestamps_request_output_format.py b/data/src/elevenlabs/text_to_dialogue/types/text_to_dialogue_convert_with_timestamps_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..bcdd7a1d61fae1e3d53131130b68739cc314fa17 --- /dev/null +++ b/data/src/elevenlabs/text_to_dialogue/types/text_to_dialogue_convert_with_timestamps_request_output_format.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueConvertWithTimestampsRequestOutputFormat = typing.Union[ + typing.Literal[ + "alaw_8000", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_128", + "mp3_44100_192", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "opus_48000_128", + "opus_48000_192", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "pcm_8000", + "ulaw_8000", + "wav_16000", + "wav_22050", + "wav_24000", + "wav_32000", + "wav_44100", + "wav_48000", + "wav_8000", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/text_to_sound_effects/__init__.py b/data/src/elevenlabs/text_to_sound_effects/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e7566f6df69b603d4e1fb976639cf9e065d255b2 --- /dev/null +++ b/data/src/elevenlabs/text_to_sound_effects/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import TextToSoundEffectsConvertRequestOutputFormat +_dynamic_imports: typing.Dict[str, str] = {"TextToSoundEffectsConvertRequestOutputFormat": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TextToSoundEffectsConvertRequestOutputFormat"] diff --git a/data/src/elevenlabs/text_to_sound_effects/client.py b/data/src/elevenlabs/text_to_sound_effects/client.py new file mode 100644 index 0000000000000000000000000000000000000000..502364e988480ce70be1a846b3f0fd9a342831d3 --- /dev/null +++ b/data/src/elevenlabs/text_to_sound_effects/client.py @@ -0,0 +1,191 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.sfx_model_id import SfxModelId +from .raw_client import AsyncRawTextToSoundEffectsClient, RawTextToSoundEffectsClient +from .types.text_to_sound_effects_convert_request_output_format import TextToSoundEffectsConvertRequestOutputFormat + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TextToSoundEffectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTextToSoundEffectsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTextToSoundEffectsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTextToSoundEffectsClient + """ + return self._raw_client + + def convert( + self, + *, + text: str, + output_format: typing.Optional[TextToSoundEffectsConvertRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + loop: typing.Optional[bool] = OMIT, + duration_seconds: typing.Optional[float] = OMIT, + prompt_influence: typing.Optional[float] = OMIT, + model_id: typing.Optional[SfxModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Turn text into sound effects for your videos, voice-overs or video games using the most advanced sound effects models in the world. + + Parameters + ---------- + text : str + The text that will get converted into a sound effect. + + output_format : typing.Optional[TextToSoundEffectsConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + loop : typing.Optional[bool] + Whether to create a sound effect that loops smoothly. Only available for the 'eleven_text_to_sound_v2 model'. + + duration_seconds : typing.Optional[float] + The duration of the sound which will be generated in seconds. Must be at least 0.5 and at most 30. If set to None we will guess the optimal duration using the prompt. Defaults to None. + + prompt_influence : typing.Optional[float] + A higher prompt influence makes your generation follow the prompt more closely while also making generations less variable. Must be a value between 0 and 1. Defaults to 0.3. + + model_id : typing.Optional[SfxModelId] + The model ID to use for the sound generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The generated sound effect audio, encoded in the specified `output_format`. + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_sound_effects.convert( + text="Spacious braam suitable for high-impact movie trailer moments", + ) + """ + with self._raw_client.convert( + text=text, + output_format=output_format, + enable_logging=enable_logging, + loop=loop, + duration_seconds=duration_seconds, + prompt_influence=prompt_influence, + model_id=model_id, + request_options=request_options, + ) as r: + yield from r.data + + +class AsyncTextToSoundEffectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTextToSoundEffectsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTextToSoundEffectsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTextToSoundEffectsClient + """ + return self._raw_client + + async def convert( + self, + *, + text: str, + output_format: typing.Optional[TextToSoundEffectsConvertRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + loop: typing.Optional[bool] = OMIT, + duration_seconds: typing.Optional[float] = OMIT, + prompt_influence: typing.Optional[float] = OMIT, + model_id: typing.Optional[SfxModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Turn text into sound effects for your videos, voice-overs or video games using the most advanced sound effects models in the world. + + Parameters + ---------- + text : str + The text that will get converted into a sound effect. + + output_format : typing.Optional[TextToSoundEffectsConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + loop : typing.Optional[bool] + Whether to create a sound effect that loops smoothly. Only available for the 'eleven_text_to_sound_v2 model'. + + duration_seconds : typing.Optional[float] + The duration of the sound which will be generated in seconds. Must be at least 0.5 and at most 30. If set to None we will guess the optimal duration using the prompt. Defaults to None. + + prompt_influence : typing.Optional[float] + A higher prompt influence makes your generation follow the prompt more closely while also making generations less variable. Must be a value between 0 and 1. Defaults to 0.3. + + model_id : typing.Optional[SfxModelId] + The model ID to use for the sound generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The generated sound effect audio, encoded in the specified `output_format`. + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_sound_effects.convert( + text="Spacious braam suitable for high-impact movie trailer moments", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.convert( + text=text, + output_format=output_format, + enable_logging=enable_logging, + loop=loop, + duration_seconds=duration_seconds, + prompt_influence=prompt_influence, + model_id=model_id, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/text_to_sound_effects/raw_client.py b/data/src/elevenlabs/text_to_sound_effects/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c8b2ed66bfa4684e7263369e3d48d56fb182d3eb --- /dev/null +++ b/data/src/elevenlabs/text_to_sound_effects/raw_client.py @@ -0,0 +1,236 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.sfx_model_id import SfxModelId +from .types.text_to_sound_effects_convert_request_output_format import TextToSoundEffectsConvertRequestOutputFormat +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTextToSoundEffectsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def convert( + self, + *, + text: str, + output_format: typing.Optional[TextToSoundEffectsConvertRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + loop: typing.Optional[bool] = OMIT, + duration_seconds: typing.Optional[float] = OMIT, + prompt_influence: typing.Optional[float] = OMIT, + model_id: typing.Optional[SfxModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Turn text into sound effects for your videos, voice-overs or video games using the most advanced sound effects models in the world. + + Parameters + ---------- + text : str + The text that will get converted into a sound effect. + + output_format : typing.Optional[TextToSoundEffectsConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + loop : typing.Optional[bool] + Whether to create a sound effect that loops smoothly. Only available for the 'eleven_text_to_sound_v2 model'. + + duration_seconds : typing.Optional[float] + The duration of the sound which will be generated in seconds. Must be at least 0.5 and at most 30. If set to None we will guess the optimal duration using the prompt. Defaults to None. + + prompt_influence : typing.Optional[float] + A higher prompt influence makes your generation follow the prompt more closely while also making generations less variable. Must be a value between 0 and 1. Defaults to 0.3. + + model_id : typing.Optional[SfxModelId] + The model ID to use for the sound generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The generated sound effect audio, encoded in the specified `output_format`. + """ + with self._client_wrapper.httpx_client.stream( + "v1/sound-generation", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "text": text, + "loop": loop, + "duration_seconds": duration_seconds, + "prompt_influence": prompt_influence, + "model_id": model_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawTextToSoundEffectsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def convert( + self, + *, + text: str, + output_format: typing.Optional[TextToSoundEffectsConvertRequestOutputFormat] = None, + enable_logging: typing.Optional[bool] = None, + loop: typing.Optional[bool] = OMIT, + duration_seconds: typing.Optional[float] = OMIT, + prompt_influence: typing.Optional[float] = OMIT, + model_id: typing.Optional[SfxModelId] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Turn text into sound effects for your videos, voice-overs or video games using the most advanced sound effects models in the world. + + Parameters + ---------- + text : str + The text that will get converted into a sound effect. + + output_format : typing.Optional[TextToSoundEffectsConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. Zero retention mode may only be used by enterprise customers. + + loop : typing.Optional[bool] + Whether to create a sound effect that loops smoothly. Only available for the 'eleven_text_to_sound_v2 model'. + + duration_seconds : typing.Optional[float] + The duration of the sound which will be generated in seconds. Must be at least 0.5 and at most 30. If set to None we will guess the optimal duration using the prompt. Defaults to None. + + prompt_influence : typing.Optional[float] + A higher prompt influence makes your generation follow the prompt more closely while also making generations less variable. Must be a value between 0 and 1. Defaults to 0.3. + + model_id : typing.Optional[SfxModelId] + The model ID to use for the sound generation. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The generated sound effect audio, encoded in the specified `output_format`. + """ + async with self._client_wrapper.httpx_client.stream( + "v1/sound-generation", + method="POST", + params={ + "output_format": output_format, + "enable_logging": enable_logging, + }, + json={ + "text": text, + "loop": loop, + "duration_seconds": duration_seconds, + "prompt_influence": prompt_influence, + "model_id": model_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/text_to_sound_effects/types/__init__.py b/data/src/elevenlabs/text_to_sound_effects/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d875efa22a263c8c8ce1740f1382285ce98d8a8b --- /dev/null +++ b/data/src/elevenlabs/text_to_sound_effects/types/__init__.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .text_to_sound_effects_convert_request_output_format import TextToSoundEffectsConvertRequestOutputFormat +_dynamic_imports: typing.Dict[str, str] = { + "TextToSoundEffectsConvertRequestOutputFormat": ".text_to_sound_effects_convert_request_output_format" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["TextToSoundEffectsConvertRequestOutputFormat"] diff --git a/data/src/elevenlabs/text_to_sound_effects/types/text_to_sound_effects_convert_request_output_format.py b/data/src/elevenlabs/text_to_sound_effects/types/text_to_sound_effects_convert_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..535f605801db8f28d7694f4218b8dcd821579b74 --- /dev/null +++ b/data/src/elevenlabs/text_to_sound_effects/types/text_to_sound_effects_convert_request_output_format.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSoundEffectsConvertRequestOutputFormat = typing.Union[ + typing.Literal[ + "alaw_8000", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_128", + "mp3_44100_192", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "opus_48000_128", + "opus_48000_192", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "pcm_8000", + "ulaw_8000", + "wav_16000", + "wav_22050", + "wav_24000", + "wav_32000", + "wav_44100", + "wav_48000", + "wav_8000", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/text_to_speech/__init__.py b/data/src/elevenlabs/text_to_speech/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8140b0bd0a0db04b75aae04ef0d6d61c68507019 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/__init__.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + BodyTextToSpeechFullApplyTextNormalization, + BodyTextToSpeechFullWithTimestampsApplyTextNormalization, + BodyTextToSpeechStreamApplyTextNormalization, + BodyTextToSpeechStreamWithTimestampsApplyTextNormalization, + TextToSpeechConvertRequestOutputFormat, + TextToSpeechConvertWithTimestampsRequestOutputFormat, + TextToSpeechStreamRequestOutputFormat, + TextToSpeechStreamWithTimestampsRequestOutputFormat, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyTextToSpeechFullApplyTextNormalization": ".types", + "BodyTextToSpeechFullWithTimestampsApplyTextNormalization": ".types", + "BodyTextToSpeechStreamApplyTextNormalization": ".types", + "BodyTextToSpeechStreamWithTimestampsApplyTextNormalization": ".types", + "TextToSpeechConvertRequestOutputFormat": ".types", + "TextToSpeechConvertWithTimestampsRequestOutputFormat": ".types", + "TextToSpeechStreamRequestOutputFormat": ".types", + "TextToSpeechStreamWithTimestampsRequestOutputFormat": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyTextToSpeechFullApplyTextNormalization", + "BodyTextToSpeechFullWithTimestampsApplyTextNormalization", + "BodyTextToSpeechStreamApplyTextNormalization", + "BodyTextToSpeechStreamWithTimestampsApplyTextNormalization", + "TextToSpeechConvertRequestOutputFormat", + "TextToSpeechConvertWithTimestampsRequestOutputFormat", + "TextToSpeechStreamRequestOutputFormat", + "TextToSpeechStreamWithTimestampsRequestOutputFormat", +] diff --git a/data/src/elevenlabs/text_to_speech/client.py b/data/src/elevenlabs/text_to_speech/client.py new file mode 100644 index 0000000000000000000000000000000000000000..2d1005986661cc6a386ccec94b31537c3df4bd92 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/client.py @@ -0,0 +1,1192 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.audio_with_timestamps_response import AudioWithTimestampsResponse +from ..types.effects_spec_input import EffectsSpecInput +from ..types.pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from ..types.streaming_audio_chunk_with_timestamps_response import StreamingAudioChunkWithTimestampsResponse +from ..types.voice_settings import VoiceSettings +from .raw_client import AsyncRawTextToSpeechClient, RawTextToSpeechClient +from .types.body_text_to_speech_full_apply_text_normalization import BodyTextToSpeechFullApplyTextNormalization +from .types.body_text_to_speech_full_with_timestamps_apply_text_normalization import ( + BodyTextToSpeechFullWithTimestampsApplyTextNormalization, +) +from .types.body_text_to_speech_stream_apply_text_normalization import BodyTextToSpeechStreamApplyTextNormalization +from .types.body_text_to_speech_stream_with_timestamps_apply_text_normalization import ( + BodyTextToSpeechStreamWithTimestampsApplyTextNormalization, +) +from .types.text_to_speech_convert_request_output_format import TextToSpeechConvertRequestOutputFormat +from .types.text_to_speech_convert_with_timestamps_request_output_format import ( + TextToSpeechConvertWithTimestampsRequestOutputFormat, +) +from .types.text_to_speech_stream_request_output_format import TextToSpeechStreamRequestOutputFormat +from .types.text_to_speech_stream_with_timestamps_request_output_format import ( + TextToSpeechStreamWithTimestampsRequestOutputFormat, +) + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TextToSpeechClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTextToSpeechClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawTextToSpeechClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTextToSpeechClient + """ + return self._raw_client + + def convert( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechConvertRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechFullApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Converts text into speech using a voice of your choice and returns audio. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechFullApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + The generated audio file + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_speech.convert( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", + ) + """ + with self._raw_client.convert( + voice_id, + text=text, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + language_code=language_code, + voice_settings=voice_settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + previous_text=previous_text, + next_text=next_text, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + use_pvc_as_ivc=use_pvc_as_ivc, + apply_text_normalization=apply_text_normalization, + apply_language_text_normalization=apply_language_text_normalization, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + yield from r.data + + def convert_with_timestamps( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioWithTimestampsResponse: + """ + Generate speech from text with precise character-level timing information for audio-text synchronization. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioWithTimestampsResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_speech.convert_with_timestamps( + voice_id="21m00Tcm4TlvDq8ikWAM", + enable_logging=True, + optimize_streaming_latency=1, + output_format="alaw_8000", + text="This is a test for the API of ElevenLabs.", + ) + """ + _response = self._raw_client.convert_with_timestamps( + voice_id, + text=text, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + language_code=language_code, + voice_settings=voice_settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + previous_text=previous_text, + next_text=next_text, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + use_pvc_as_ivc=use_pvc_as_ivc, + apply_text_normalization=apply_text_normalization, + apply_language_text_normalization=apply_language_text_normalization, + audio_effects=audio_effects, + request_options=request_options, + ) + return _response.data + + def stream( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechStreamRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechStreamApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[bytes]: + """ + Converts text into speech using a voice of your choice and returns audio as an audio stream. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechStreamApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Streaming audio data + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_speech.stream( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", + ) + """ + with self._raw_client.stream( + voice_id, + text=text, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + language_code=language_code, + voice_settings=voice_settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + previous_text=previous_text, + next_text=next_text, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + use_pvc_as_ivc=use_pvc_as_ivc, + apply_text_normalization=apply_text_normalization, + apply_language_text_normalization=apply_language_text_normalization, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + yield from r.data + + def stream_with_timestamps( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[StreamingAudioChunkWithTimestampsResponse]: + """ + Converts text into speech using a voice of your choice and returns a stream of JSONs containing audio as a base64 encoded string together with information on when which character was spoken. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[StreamingAudioChunkWithTimestampsResponse] + Stream of transcription chunks + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + response = client.text_to_speech.stream_with_timestamps( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", + ) + for chunk in response: + yield chunk + """ + with self._raw_client.stream_with_timestamps( + voice_id, + text=text, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + language_code=language_code, + voice_settings=voice_settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + previous_text=previous_text, + next_text=next_text, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + use_pvc_as_ivc=use_pvc_as_ivc, + apply_text_normalization=apply_text_normalization, + apply_language_text_normalization=apply_language_text_normalization, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + yield from r.data + + +class AsyncTextToSpeechClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTextToSpeechClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawTextToSpeechClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTextToSpeechClient + """ + return self._raw_client + + async def convert( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechConvertRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechFullApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Converts text into speech using a voice of your choice and returns audio. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechFullApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + The generated audio file + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_speech.convert( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.convert( + voice_id, + text=text, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + language_code=language_code, + voice_settings=voice_settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + previous_text=previous_text, + next_text=next_text, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + use_pvc_as_ivc=use_pvc_as_ivc, + apply_text_normalization=apply_text_normalization, + apply_language_text_normalization=apply_language_text_normalization, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def convert_with_timestamps( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AudioWithTimestampsResponse: + """ + Generate speech from text with precise character-level timing information for audio-text synchronization. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudioWithTimestampsResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_speech.convert_with_timestamps( + voice_id="21m00Tcm4TlvDq8ikWAM", + enable_logging=True, + optimize_streaming_latency=1, + output_format="alaw_8000", + text="This is a test for the API of ElevenLabs.", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.convert_with_timestamps( + voice_id, + text=text, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + language_code=language_code, + voice_settings=voice_settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + previous_text=previous_text, + next_text=next_text, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + use_pvc_as_ivc=use_pvc_as_ivc, + apply_text_normalization=apply_text_normalization, + apply_language_text_normalization=apply_language_text_normalization, + audio_effects=audio_effects, + request_options=request_options, + ) + return _response.data + + async def stream( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechStreamRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechStreamApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[bytes]: + """ + Converts text into speech using a voice of your choice and returns audio as an audio stream. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechStreamApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Streaming audio data + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_speech.stream( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.stream( + voice_id, + text=text, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + language_code=language_code, + voice_settings=voice_settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + previous_text=previous_text, + next_text=next_text, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + use_pvc_as_ivc=use_pvc_as_ivc, + apply_text_normalization=apply_text_normalization, + apply_language_text_normalization=apply_language_text_normalization, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk + + async def stream_with_timestamps( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[StreamingAudioChunkWithTimestampsResponse]: + """ + Converts text into speech using a voice of your choice and returns a stream of JSONs containing audio as a base64 encoded string together with information on when which character was spoken. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[StreamingAudioChunkWithTimestampsResponse] + Stream of transcription chunks + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + response = await client.text_to_speech.stream_with_timestamps( + voice_id="JBFqnCBsd6RMkjVDRZzb", + output_format="mp3_44100_128", + text="The first move is what sets everything in motion.", + model_id="eleven_multilingual_v2", + ) + async for chunk in response: + yield chunk + + + asyncio.run(main()) + """ + async with self._raw_client.stream_with_timestamps( + voice_id, + text=text, + enable_logging=enable_logging, + optimize_streaming_latency=optimize_streaming_latency, + output_format=output_format, + model_id=model_id, + language_code=language_code, + voice_settings=voice_settings, + pronunciation_dictionary_locators=pronunciation_dictionary_locators, + seed=seed, + previous_text=previous_text, + next_text=next_text, + previous_request_ids=previous_request_ids, + next_request_ids=next_request_ids, + use_pvc_as_ivc=use_pvc_as_ivc, + apply_text_normalization=apply_text_normalization, + apply_language_text_normalization=apply_language_text_normalization, + audio_effects=audio_effects, + request_options=request_options, + ) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/text_to_speech/raw_client.py b/data/src/elevenlabs/text_to_speech/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c6213a19f8d6e37a799ec9528b78a2f5c4f0f9e7 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/raw_client.py @@ -0,0 +1,1459 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import json +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.audio_with_timestamps_response import AudioWithTimestampsResponse +from ..types.effects_spec_input import EffectsSpecInput +from ..types.pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from ..types.streaming_audio_chunk_with_timestamps_response import StreamingAudioChunkWithTimestampsResponse +from ..types.voice_settings import VoiceSettings +from .types.body_text_to_speech_full_apply_text_normalization import BodyTextToSpeechFullApplyTextNormalization +from .types.body_text_to_speech_full_with_timestamps_apply_text_normalization import ( + BodyTextToSpeechFullWithTimestampsApplyTextNormalization, +) +from .types.body_text_to_speech_stream_apply_text_normalization import BodyTextToSpeechStreamApplyTextNormalization +from .types.body_text_to_speech_stream_with_timestamps_apply_text_normalization import ( + BodyTextToSpeechStreamWithTimestampsApplyTextNormalization, +) +from .types.text_to_speech_convert_request_output_format import TextToSpeechConvertRequestOutputFormat +from .types.text_to_speech_convert_with_timestamps_request_output_format import ( + TextToSpeechConvertWithTimestampsRequestOutputFormat, +) +from .types.text_to_speech_stream_request_output_format import TextToSpeechStreamRequestOutputFormat +from .types.text_to_speech_stream_with_timestamps_request_output_format import ( + TextToSpeechStreamWithTimestampsRequestOutputFormat, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTextToSpeechClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def convert( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechConvertRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechFullApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Converts text into speech using a voice of your choice and returns audio. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechFullApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + The generated audio file + """ + with self._client_wrapper.httpx_client.stream( + f"v1/text-to-speech/{jsonable_encoder(voice_id)}", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + json={ + "text": text, + "model_id": model_id, + "language_code": language_code, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "previous_text": previous_text, + "next_text": next_text, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "use_pvc_as_ivc": use_pvc_as_ivc, + "apply_text_normalization": apply_text_normalization, + "apply_language_text_normalization": apply_language_text_normalization, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + def convert_with_timestamps( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AudioWithTimestampsResponse]: + """ + Generate speech from text with precise character-level timing information for audio-text synchronization. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AudioWithTimestampsResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/text-to-speech/{jsonable_encoder(voice_id)}/with-timestamps", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + json={ + "text": text, + "model_id": model_id, + "language_code": language_code, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "previous_text": previous_text, + "next_text": next_text, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "use_pvc_as_ivc": use_pvc_as_ivc, + "apply_text_normalization": apply_text_normalization, + "apply_language_text_normalization": apply_language_text_normalization, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioWithTimestampsResponse, + construct_type( + type_=AudioWithTimestampsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.contextmanager + def stream( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechStreamRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechStreamApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Converts text into speech using a voice of your choice and returns audio as an audio stream. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechStreamApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Streaming audio data + """ + with self._client_wrapper.httpx_client.stream( + f"v1/text-to-speech/{jsonable_encoder(voice_id)}/stream", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + json={ + "text": text, + "model_id": model_id, + "language_code": language_code, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "previous_text": previous_text, + "next_text": next_text, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "use_pvc_as_ivc": use_pvc_as_ivc, + "apply_text_normalization": apply_text_normalization, + "apply_language_text_normalization": apply_language_text_normalization, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + @contextlib.contextmanager + def stream_with_timestamps( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Iterator[HttpResponse[typing.Iterator[StreamingAudioChunkWithTimestampsResponse]]]: + """ + Converts text into speech using a voice of your choice and returns a stream of JSONs containing audio as a base64 encoded string together with information on when which character was spoken. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.Iterator[HttpResponse[typing.Iterator[StreamingAudioChunkWithTimestampsResponse]]] + Stream of transcription chunks + """ + with self._client_wrapper.httpx_client.stream( + f"v1/text-to-speech/{jsonable_encoder(voice_id)}/stream/with-timestamps", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + json={ + "text": text, + "model_id": model_id, + "language_code": language_code, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "previous_text": previous_text, + "next_text": next_text, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "use_pvc_as_ivc": use_pvc_as_ivc, + "apply_text_normalization": apply_text_normalization, + "apply_language_text_normalization": apply_language_text_normalization, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[StreamingAudioChunkWithTimestampsResponse]]: + try: + if 200 <= _response.status_code < 300: + + def _iter(): + for _text in _response.iter_lines(): + try: + if len(_text) == 0: + continue + yield typing.cast( + StreamingAudioChunkWithTimestampsResponse, + construct_type( + type_=StreamingAudioChunkWithTimestampsResponse, # type: ignore + object_=json.loads(_text), + ), + ) + except Exception: + pass + return + + return HttpResponse(response=_response, data=_iter()) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawTextToSpeechClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def convert( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechConvertRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechFullApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Converts text into speech using a voice of your choice and returns audio. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechConvertRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechFullApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + The generated audio file + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/text-to-speech/{jsonable_encoder(voice_id)}", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + json={ + "text": text, + "model_id": model_id, + "language_code": language_code, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "previous_text": previous_text, + "next_text": next_text, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "use_pvc_as_ivc": use_pvc_as_ivc, + "apply_text_normalization": apply_text_normalization, + "apply_language_text_normalization": apply_language_text_normalization, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + async def convert_with_timestamps( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AudioWithTimestampsResponse]: + """ + Generate speech from text with precise character-level timing information for audio-text synchronization. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechConvertWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM and WAV formats with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechFullWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AudioWithTimestampsResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/text-to-speech/{jsonable_encoder(voice_id)}/with-timestamps", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + json={ + "text": text, + "model_id": model_id, + "language_code": language_code, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "previous_text": previous_text, + "next_text": next_text, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "use_pvc_as_ivc": use_pvc_as_ivc, + "apply_text_normalization": apply_text_normalization, + "apply_language_text_normalization": apply_language_text_normalization, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AudioWithTimestampsResponse, + construct_type( + type_=AudioWithTimestampsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + @contextlib.asynccontextmanager + async def stream( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechStreamRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechStreamApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Converts text into speech using a voice of your choice and returns audio as an audio stream. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechStreamRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechStreamApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Streaming audio data + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/text-to-speech/{jsonable_encoder(voice_id)}/stream", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + json={ + "text": text, + "model_id": model_id, + "language_code": language_code, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "previous_text": previous_text, + "next_text": next_text, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "use_pvc_as_ivc": use_pvc_as_ivc, + "apply_text_normalization": apply_text_normalization, + "apply_language_text_normalization": apply_language_text_normalization, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() + + @contextlib.asynccontextmanager + async def stream_with_timestamps( + self, + voice_id: str, + *, + text: str, + enable_logging: typing.Optional[bool] = None, + optimize_streaming_latency: typing.Optional[int] = None, + output_format: typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat] = None, + model_id: typing.Optional[str] = OMIT, + language_code: typing.Optional[str] = OMIT, + voice_settings: typing.Optional[VoiceSettings] = OMIT, + pronunciation_dictionary_locators: typing.Optional[ + typing.Sequence[PronunciationDictionaryVersionLocator] + ] = OMIT, + seed: typing.Optional[int] = OMIT, + previous_text: typing.Optional[str] = OMIT, + next_text: typing.Optional[str] = OMIT, + previous_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + next_request_ids: typing.Optional[typing.Sequence[str]] = OMIT, + use_pvc_as_ivc: typing.Optional[bool] = OMIT, + apply_text_normalization: typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization] = OMIT, + apply_language_text_normalization: typing.Optional[bool] = OMIT, + audio_effects: typing.Optional[EffectsSpecInput] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[StreamingAudioChunkWithTimestampsResponse]]]: + """ + Converts text into speech using a voice of your choice and returns a stream of JSONs containing audio as a base64 encoded string together with information on when which character was spoken. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. Use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + text : str + The text that will get converted into speech. + + enable_logging : typing.Optional[bool] + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request, including request stitching. Zero retention mode may only be used by enterprise customers. + + optimize_streaming_latency : typing.Optional[int] + You can turn on latency optimizations at some cost of quality. The best possible final latency varies by model. Possible values: + 0 - default mode (no latency optimizations) + 1 - normal latency optimizations (about 50% of possible latency improvement of option 3) + 2 - strong latency optimizations (about 75% of possible latency improvement of option 3) + 3 - max latency optimizations + 4 - max latency optimizations, but also with text normalizer turned off for even more latency savings (best latency, but can mispronounce eg numbers and dates). + + Defaults to None. + + output_format : typing.Optional[TextToSpeechStreamWithTimestampsRequestOutputFormat] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[str] + Identifier of the model that will be used, you can query them using GET /v1/models. The model needs to have support for text to speech, you can check this using the can_do_text_to_speech property. + + language_code : typing.Optional[str] + Language code (ISO 639-1) used to enforce a language for the model and text normalization. If the model does not support the provided language code, it will be ignored. This parameter is not supported for multilingual_v2 models. + + voice_settings : typing.Optional[VoiceSettings] + Voice settings overriding stored settings for the given voice. They are applied only on the given request. + + pronunciation_dictionary_locators : typing.Optional[typing.Sequence[PronunciationDictionaryVersionLocator]] + A list of pronunciation dictionary locators (id, version_id) to be applied to the text. They will be applied in order. You may have up to 3 locators per request + + seed : typing.Optional[int] + If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed. Must be integer between 0 and 4294967295. + + previous_text : typing.Optional[str] + The text that came before the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + next_text : typing.Optional[str] + The text that comes after the text of the current request. Can be used to improve the speech's continuity when concatenating together multiple generations or to influence the speech's continuity in the current generation. + + previous_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that were generated before this generation. Can be used to improve the speech's continuity when splitting up a large task into multiple requests. The results will be best when the same model is used across the generations. In case both previous_text and previous_request_ids is send, previous_text will be ignored. A maximum of 3 request_ids can be send. + + next_request_ids : typing.Optional[typing.Sequence[str]] + A list of request_id of the samples that come after this generation. next_request_ids is especially useful for maintaining the speech's continuity when regenerating a sample that has had some audio quality issues. For example, if you have generated 3 speech clips, and you want to improve clip 2, passing the request id of clip 3 as a next_request_id (and that of clip 1 as a previous_request_id) will help maintain natural flow in the combined speech. The results will be best when the same model is used across the generations. In case both next_text and next_request_ids is send, next_text will be ignored. A maximum of 3 request_ids can be send. + + use_pvc_as_ivc : typing.Optional[bool] + Whether to use the IVC version of a professional voice. This may improve expressiveness and reduce latency. + + apply_text_normalization : typing.Optional[BodyTextToSpeechStreamWithTimestampsApplyTextNormalization] + This parameter controls text normalization with three modes: 'auto', 'on', and 'off'. When set to 'auto', the system will automatically decide whether to apply text normalization (e.g., spelling out numbers). With 'on', text normalization will always be applied, while with 'off', it will be skipped. + + apply_language_text_normalization : typing.Optional[bool] + This parameter controls language text normalization. This helps with proper pronunciation of text in some supported languages. WARNING: This parameter can heavily increase the latency of the request. Currently only supported for Japanese. + + audio_effects : typing.Optional[EffectsSpecInput] + Audio effects applied to the generated audio. Unknown IDs return 404 with `param` naming the field. Reverb (`environment_id` with `send_level` above 0) and a non-zero `pan` produce stereo audio and are rejected with 400 for `ulaw_*`, `alaw_*`, and `pcm_*` output formats. Effects don't change the cost of the request. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Yields + ------ + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[StreamingAudioChunkWithTimestampsResponse]]] + Stream of transcription chunks + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/text-to-speech/{jsonable_encoder(voice_id)}/stream/with-timestamps", + method="POST", + params={ + "enable_logging": enable_logging, + "optimize_streaming_latency": optimize_streaming_latency, + "output_format": output_format, + }, + json={ + "text": text, + "model_id": model_id, + "language_code": language_code, + "voice_settings": convert_and_respect_annotation_metadata( + object_=voice_settings, annotation=VoiceSettings, direction="write" + ), + "pronunciation_dictionary_locators": convert_and_respect_annotation_metadata( + object_=pronunciation_dictionary_locators, + annotation=typing.Sequence[PronunciationDictionaryVersionLocator], + direction="write", + ), + "seed": seed, + "previous_text": previous_text, + "next_text": next_text, + "previous_request_ids": previous_request_ids, + "next_request_ids": next_request_ids, + "use_pvc_as_ivc": use_pvc_as_ivc, + "apply_text_normalization": apply_text_normalization, + "apply_language_text_normalization": apply_language_text_normalization, + "audio_effects": convert_and_respect_annotation_metadata( + object_=audio_effects, annotation=EffectsSpecInput, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[StreamingAudioChunkWithTimestampsResponse]]: + try: + if 200 <= _response.status_code < 300: + + async def _iter(): + async for _text in _response.aiter_lines(): + try: + if len(_text) == 0: + continue + yield typing.cast( + StreamingAudioChunkWithTimestampsResponse, + construct_type( + type_=StreamingAudioChunkWithTimestampsResponse, # type: ignore + object_=json.loads(_text), + ), + ) + except Exception: + pass + return + + return AsyncHttpResponse(response=_response, data=_iter()) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/text_to_speech/types/__init__.py b/data/src/elevenlabs/text_to_speech/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fdd44c3e42e482fa1b9e3cd304a0ffec94be8f9c --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/__init__.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_text_to_speech_full_apply_text_normalization import BodyTextToSpeechFullApplyTextNormalization + from .body_text_to_speech_full_with_timestamps_apply_text_normalization import ( + BodyTextToSpeechFullWithTimestampsApplyTextNormalization, + ) + from .body_text_to_speech_stream_apply_text_normalization import BodyTextToSpeechStreamApplyTextNormalization + from .body_text_to_speech_stream_with_timestamps_apply_text_normalization import ( + BodyTextToSpeechStreamWithTimestampsApplyTextNormalization, + ) + from .text_to_speech_convert_request_output_format import TextToSpeechConvertRequestOutputFormat + from .text_to_speech_convert_with_timestamps_request_output_format import ( + TextToSpeechConvertWithTimestampsRequestOutputFormat, + ) + from .text_to_speech_stream_request_output_format import TextToSpeechStreamRequestOutputFormat + from .text_to_speech_stream_with_timestamps_request_output_format import ( + TextToSpeechStreamWithTimestampsRequestOutputFormat, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyTextToSpeechFullApplyTextNormalization": ".body_text_to_speech_full_apply_text_normalization", + "BodyTextToSpeechFullWithTimestampsApplyTextNormalization": ".body_text_to_speech_full_with_timestamps_apply_text_normalization", + "BodyTextToSpeechStreamApplyTextNormalization": ".body_text_to_speech_stream_apply_text_normalization", + "BodyTextToSpeechStreamWithTimestampsApplyTextNormalization": ".body_text_to_speech_stream_with_timestamps_apply_text_normalization", + "TextToSpeechConvertRequestOutputFormat": ".text_to_speech_convert_request_output_format", + "TextToSpeechConvertWithTimestampsRequestOutputFormat": ".text_to_speech_convert_with_timestamps_request_output_format", + "TextToSpeechStreamRequestOutputFormat": ".text_to_speech_stream_request_output_format", + "TextToSpeechStreamWithTimestampsRequestOutputFormat": ".text_to_speech_stream_with_timestamps_request_output_format", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "BodyTextToSpeechFullApplyTextNormalization", + "BodyTextToSpeechFullWithTimestampsApplyTextNormalization", + "BodyTextToSpeechStreamApplyTextNormalization", + "BodyTextToSpeechStreamWithTimestampsApplyTextNormalization", + "TextToSpeechConvertRequestOutputFormat", + "TextToSpeechConvertWithTimestampsRequestOutputFormat", + "TextToSpeechStreamRequestOutputFormat", + "TextToSpeechStreamWithTimestampsRequestOutputFormat", +] diff --git a/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_full_apply_text_normalization.py b/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_full_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..46b36e1ae8535a2be9417970c88b6a7bed6192d7 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_full_apply_text_normalization.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyTextToSpeechFullApplyTextNormalization = typing.Union[typing.Literal["auto", "on", "off"], typing.Any] diff --git a/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_full_with_timestamps_apply_text_normalization.py b/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_full_with_timestamps_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..5348a87bfd656d2c7c19a31c9e99c487a1afbc54 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_full_with_timestamps_apply_text_normalization.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyTextToSpeechFullWithTimestampsApplyTextNormalization = typing.Union[typing.Literal["auto", "on", "off"], typing.Any] diff --git a/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_stream_apply_text_normalization.py b/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_stream_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..8ec0eaf7a9f413bda62f6fd93c920f262b657ede --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_stream_apply_text_normalization.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyTextToSpeechStreamApplyTextNormalization = typing.Union[typing.Literal["auto", "on", "off"], typing.Any] diff --git a/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_stream_with_timestamps_apply_text_normalization.py b/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_stream_with_timestamps_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..26bef3df168d57e0cb4268aad889ecc6f2e07ca1 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/body_text_to_speech_stream_with_timestamps_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyTextToSpeechStreamWithTimestampsApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off"], typing.Any +] diff --git a/data/src/elevenlabs/text_to_speech/types/text_to_speech_convert_request_output_format.py b/data/src/elevenlabs/text_to_speech/types/text_to_speech_convert_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..438644222c20be7ca2ac7c623027c6518442e582 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/text_to_speech_convert_request_output_format.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechConvertRequestOutputFormat = typing.Union[ + typing.Literal[ + "alaw_8000", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_128", + "mp3_44100_192", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "opus_48000_128", + "opus_48000_192", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "pcm_8000", + "ulaw_8000", + "wav_16000", + "wav_22050", + "wav_24000", + "wav_32000", + "wav_44100", + "wav_48000", + "wav_8000", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/text_to_speech/types/text_to_speech_convert_with_timestamps_request_output_format.py b/data/src/elevenlabs/text_to_speech/types/text_to_speech_convert_with_timestamps_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..2bdf31e5e17d752d77fade67aa1a14d924dadae5 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/text_to_speech_convert_with_timestamps_request_output_format.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechConvertWithTimestampsRequestOutputFormat = typing.Union[ + typing.Literal[ + "alaw_8000", + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_128", + "mp3_44100_192", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "opus_48000_128", + "opus_48000_192", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "pcm_8000", + "ulaw_8000", + "wav_16000", + "wav_22050", + "wav_24000", + "wav_32000", + "wav_44100", + "wav_48000", + "wav_8000", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/text_to_speech/types/text_to_speech_stream_request_output_format.py b/data/src/elevenlabs/text_to_speech/types/text_to_speech_stream_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..84012c3c0a05f37bc1a5c586bccdd07cf744853e --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/text_to_speech_stream_request_output_format.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechStreamRequestOutputFormat = typing.Union[ + typing.Literal[ + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/text_to_speech/types/text_to_speech_stream_with_timestamps_request_output_format.py b/data/src/elevenlabs/text_to_speech/types/text_to_speech_stream_with_timestamps_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..f13eac4828cb67cdc70c96f962f4f01f9f2960c9 --- /dev/null +++ b/data/src/elevenlabs/text_to_speech/types/text_to_speech_stream_with_timestamps_request_output_format.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechStreamWithTimestampsRequestOutputFormat = typing.Union[ + typing.Literal[ + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/text_to_voice/__init__.py b/data/src/elevenlabs/text_to_voice/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e419f38382fe9cfeb93676424d8af8dc3933675f --- /dev/null +++ b/data/src/elevenlabs/text_to_voice/__init__.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import VoiceDesignRequestModelModelId + from . import preview +_dynamic_imports: typing.Dict[str, str] = {"VoiceDesignRequestModelModelId": ".types", "preview": ".preview"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["VoiceDesignRequestModelModelId", "preview"] diff --git a/data/src/elevenlabs/text_to_voice/client.py b/data/src/elevenlabs/text_to_voice/client.py new file mode 100644 index 0000000000000000000000000000000000000000..2aa7c00f8b6e32a6efaaab55f4bc47306e1ddbff --- /dev/null +++ b/data/src/elevenlabs/text_to_voice/client.py @@ -0,0 +1,796 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.allowed_output_formats import AllowedOutputFormats +from ..types.voice import Voice +from ..types.voice_design_preview_response import VoiceDesignPreviewResponse +from .raw_client import AsyncRawTextToVoiceClient, RawTextToVoiceClient +from .types.voice_design_request_model_model_id import VoiceDesignRequestModelModelId + +if typing.TYPE_CHECKING: + from .preview.client import AsyncPreviewClient, PreviewClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class TextToVoiceClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTextToVoiceClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._preview: typing.Optional[PreviewClient] = None + + @property + def with_raw_response(self) -> RawTextToVoiceClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTextToVoiceClient + """ + return self._raw_client + + def create_previews( + self, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + quality: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + should_enhance: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceDesignPreviewResponse: + """ + Create a voice from a text prompt. + + Parameters + ---------- + voice_description : str + Description to use for the created voice. + + output_format : typing.Optional[AllowedOutputFormats] + The output format of the generated audio. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + quality : typing.Optional[float] + Higher quality results in better voice output but less variety. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + should_enhance : typing.Optional[bool] + Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceDesignPreviewResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_voice.create_previews( + output_format="mp3_22050_32", + voice_description="A sassy squeaky mouse", + ) + """ + _response = self._raw_client.create_previews( + voice_description=voice_description, + output_format=output_format, + text=text, + auto_generate_text=auto_generate_text, + loudness=loudness, + quality=quality, + seed=seed, + guidance_scale=guidance_scale, + should_enhance=should_enhance, + request_options=request_options, + ) + return _response.data + + def create( + self, + *, + voice_name: str, + voice_description: str, + generated_voice_id: str, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + played_not_selected_voice_ids: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Voice: + """ + Create a voice from previously generated voice preview. This endpoint should be called after you fetched a generated_voice_id using POST /v1/text-to-voice/design or POST /v1/text-to-voice/:voice_id/remix. + + Parameters + ---------- + voice_name : str + Name to use for the created voice. + + voice_description : str + Description to use for the created voice. + + generated_voice_id : str + The generated_voice_id to create; obtain it from POST /v1/text-to-voice/design, POST /v1/text-to-voice/:voice_id/remix, or the response headers when generating previews. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Optional, metadata to add to the created voice. Defaults to None. + + played_not_selected_voice_ids : typing.Optional[typing.Sequence[str]] + List of voice ids that the user has played but not selected. Used for RLHF. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Voice + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_voice.create( + voice_name="Sassy squeaky mouse", + voice_description="A sassy squeaky mouse", + generated_voice_id="37HceQefKmEi3bGovXjL", + ) + """ + _response = self._raw_client.create( + voice_name=voice_name, + voice_description=voice_description, + generated_voice_id=generated_voice_id, + labels=labels, + played_not_selected_voice_ids=played_not_selected_voice_ids, + request_options=request_options, + ) + return _response.data + + def design( + self, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + model_id: typing.Optional[VoiceDesignRequestModelModelId] = OMIT, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + stream_previews: typing.Optional[bool] = OMIT, + should_enhance: typing.Optional[bool] = OMIT, + remixing_session_id: typing.Optional[str] = OMIT, + remixing_session_iteration_id: typing.Optional[str] = OMIT, + quality: typing.Optional[float] = OMIT, + reference_audio_base_64: typing.Optional[str] = OMIT, + prompt_strength: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceDesignPreviewResponse: + """ + Design a voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. + + Parameters + ---------- + voice_description : str + Description to use for the created voice. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[VoiceDesignRequestModelModelId] + Model to use for the voice generation. Possible values: eleven_multilingual_ttv_v2, eleven_ttv_v3. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + stream_previews : typing.Optional[bool] + Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + + should_enhance : typing.Optional[bool] + Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + + remixing_session_id : typing.Optional[str] + The remixing session id. + + remixing_session_iteration_id : typing.Optional[str] + The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + + quality : typing.Optional[float] + Higher quality results in better voice output but less variety. + + reference_audio_base_64 : typing.Optional[str] + Reference audio to use for the voice generation. The audio should be base64 encoded. Only supported when using the eleven_ttv_v3 model. + + prompt_strength : typing.Optional[float] + Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceDesignPreviewResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_voice.design( + output_format="mp3_22050_32", + voice_description="A sassy squeaky mouse", + ) + """ + _response = self._raw_client.design( + voice_description=voice_description, + output_format=output_format, + model_id=model_id, + text=text, + auto_generate_text=auto_generate_text, + loudness=loudness, + seed=seed, + guidance_scale=guidance_scale, + stream_previews=stream_previews, + should_enhance=should_enhance, + remixing_session_id=remixing_session_id, + remixing_session_iteration_id=remixing_session_iteration_id, + quality=quality, + reference_audio_base_64=reference_audio_base_64, + prompt_strength=prompt_strength, + request_options=request_options, + ) + return _response.data + + def remix( + self, + voice_id: str, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + stream_previews: typing.Optional[bool] = OMIT, + remixing_session_id: typing.Optional[str] = OMIT, + remixing_session_iteration_id: typing.Optional[str] = OMIT, + prompt_strength: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceDesignPreviewResponse: + """ + Remix an existing voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + voice_description : str + Description of the changes to make to the voice. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + stream_previews : typing.Optional[bool] + Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + + remixing_session_id : typing.Optional[str] + The remixing session id. + + remixing_session_iteration_id : typing.Optional[str] + The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + + prompt_strength : typing.Optional[float] + Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceDesignPreviewResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_voice.remix( + voice_id="21m00Tcm4TlvDq8ikWAM", + output_format="mp3_22050_32", + voice_description="Make the voice have a higher pitch.", + ) + """ + _response = self._raw_client.remix( + voice_id, + voice_description=voice_description, + output_format=output_format, + text=text, + auto_generate_text=auto_generate_text, + loudness=loudness, + seed=seed, + guidance_scale=guidance_scale, + stream_previews=stream_previews, + remixing_session_id=remixing_session_id, + remixing_session_iteration_id=remixing_session_iteration_id, + prompt_strength=prompt_strength, + request_options=request_options, + ) + return _response.data + + @property + def preview(self): + if self._preview is None: + from .preview.client import PreviewClient # noqa: E402 + + self._preview = PreviewClient(client_wrapper=self._client_wrapper) + return self._preview + + +class AsyncTextToVoiceClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTextToVoiceClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._preview: typing.Optional[AsyncPreviewClient] = None + + @property + def with_raw_response(self) -> AsyncRawTextToVoiceClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTextToVoiceClient + """ + return self._raw_client + + async def create_previews( + self, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + quality: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + should_enhance: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceDesignPreviewResponse: + """ + Create a voice from a text prompt. + + Parameters + ---------- + voice_description : str + Description to use for the created voice. + + output_format : typing.Optional[AllowedOutputFormats] + The output format of the generated audio. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + quality : typing.Optional[float] + Higher quality results in better voice output but less variety. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + should_enhance : typing.Optional[bool] + Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceDesignPreviewResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_voice.create_previews( + output_format="mp3_22050_32", + voice_description="A sassy squeaky mouse", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_previews( + voice_description=voice_description, + output_format=output_format, + text=text, + auto_generate_text=auto_generate_text, + loudness=loudness, + quality=quality, + seed=seed, + guidance_scale=guidance_scale, + should_enhance=should_enhance, + request_options=request_options, + ) + return _response.data + + async def create( + self, + *, + voice_name: str, + voice_description: str, + generated_voice_id: str, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + played_not_selected_voice_ids: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> Voice: + """ + Create a voice from previously generated voice preview. This endpoint should be called after you fetched a generated_voice_id using POST /v1/text-to-voice/design or POST /v1/text-to-voice/:voice_id/remix. + + Parameters + ---------- + voice_name : str + Name to use for the created voice. + + voice_description : str + Description to use for the created voice. + + generated_voice_id : str + The generated_voice_id to create; obtain it from POST /v1/text-to-voice/design, POST /v1/text-to-voice/:voice_id/remix, or the response headers when generating previews. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Optional, metadata to add to the created voice. Defaults to None. + + played_not_selected_voice_ids : typing.Optional[typing.Sequence[str]] + List of voice ids that the user has played but not selected. Used for RLHF. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Voice + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_voice.create( + voice_name="Sassy squeaky mouse", + voice_description="A sassy squeaky mouse", + generated_voice_id="37HceQefKmEi3bGovXjL", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + voice_name=voice_name, + voice_description=voice_description, + generated_voice_id=generated_voice_id, + labels=labels, + played_not_selected_voice_ids=played_not_selected_voice_ids, + request_options=request_options, + ) + return _response.data + + async def design( + self, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + model_id: typing.Optional[VoiceDesignRequestModelModelId] = OMIT, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + stream_previews: typing.Optional[bool] = OMIT, + should_enhance: typing.Optional[bool] = OMIT, + remixing_session_id: typing.Optional[str] = OMIT, + remixing_session_iteration_id: typing.Optional[str] = OMIT, + quality: typing.Optional[float] = OMIT, + reference_audio_base_64: typing.Optional[str] = OMIT, + prompt_strength: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceDesignPreviewResponse: + """ + Design a voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. + + Parameters + ---------- + voice_description : str + Description to use for the created voice. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[VoiceDesignRequestModelModelId] + Model to use for the voice generation. Possible values: eleven_multilingual_ttv_v2, eleven_ttv_v3. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + stream_previews : typing.Optional[bool] + Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + + should_enhance : typing.Optional[bool] + Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + + remixing_session_id : typing.Optional[str] + The remixing session id. + + remixing_session_iteration_id : typing.Optional[str] + The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + + quality : typing.Optional[float] + Higher quality results in better voice output but less variety. + + reference_audio_base_64 : typing.Optional[str] + Reference audio to use for the voice generation. The audio should be base64 encoded. Only supported when using the eleven_ttv_v3 model. + + prompt_strength : typing.Optional[float] + Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceDesignPreviewResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_voice.design( + output_format="mp3_22050_32", + voice_description="A sassy squeaky mouse", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.design( + voice_description=voice_description, + output_format=output_format, + model_id=model_id, + text=text, + auto_generate_text=auto_generate_text, + loudness=loudness, + seed=seed, + guidance_scale=guidance_scale, + stream_previews=stream_previews, + should_enhance=should_enhance, + remixing_session_id=remixing_session_id, + remixing_session_iteration_id=remixing_session_iteration_id, + quality=quality, + reference_audio_base_64=reference_audio_base_64, + prompt_strength=prompt_strength, + request_options=request_options, + ) + return _response.data + + async def remix( + self, + voice_id: str, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + stream_previews: typing.Optional[bool] = OMIT, + remixing_session_id: typing.Optional[str] = OMIT, + remixing_session_iteration_id: typing.Optional[str] = OMIT, + prompt_strength: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceDesignPreviewResponse: + """ + Remix an existing voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + voice_description : str + Description of the changes to make to the voice. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + stream_previews : typing.Optional[bool] + Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + + remixing_session_id : typing.Optional[str] + The remixing session id. + + remixing_session_iteration_id : typing.Optional[str] + The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + + prompt_strength : typing.Optional[float] + Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceDesignPreviewResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_voice.remix( + voice_id="21m00Tcm4TlvDq8ikWAM", + output_format="mp3_22050_32", + voice_description="Make the voice have a higher pitch.", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.remix( + voice_id, + voice_description=voice_description, + output_format=output_format, + text=text, + auto_generate_text=auto_generate_text, + loudness=loudness, + seed=seed, + guidance_scale=guidance_scale, + stream_previews=stream_previews, + remixing_session_id=remixing_session_id, + remixing_session_iteration_id=remixing_session_iteration_id, + prompt_strength=prompt_strength, + request_options=request_options, + ) + return _response.data + + @property + def preview(self): + if self._preview is None: + from .preview.client import AsyncPreviewClient # noqa: E402 + + self._preview = AsyncPreviewClient(client_wrapper=self._client_wrapper) + return self._preview diff --git a/data/src/elevenlabs/text_to_voice/preview/__init__.py b/data/src/elevenlabs/text_to_voice/preview/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/text_to_voice/preview/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/text_to_voice/preview/client.py b/data/src/elevenlabs/text_to_voice/preview/client.py new file mode 100644 index 0000000000000000000000000000000000000000..59c8159b331965943183995d8b99c597a686f588 --- /dev/null +++ b/data/src/elevenlabs/text_to_voice/preview/client.py @@ -0,0 +1,114 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from .raw_client import AsyncRawPreviewClient, RawPreviewClient + + +class PreviewClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawPreviewClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawPreviewClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawPreviewClient + """ + return self._raw_client + + def stream( + self, generated_voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Stream a voice preview that was created via the /v1/text-to-voice/design endpoint. + + Parameters + ---------- + generated_voice_id : str + The generated_voice_id to stream. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Streaming audio data + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.text_to_voice.preview.stream( + generated_voice_id="generated_voice_id", + ) + """ + with self._raw_client.stream(generated_voice_id, request_options=request_options) as r: + yield from r.data + + +class AsyncPreviewClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawPreviewClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawPreviewClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawPreviewClient + """ + return self._raw_client + + async def stream( + self, generated_voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Stream a voice preview that was created via the /v1/text-to-voice/design endpoint. + + Parameters + ---------- + generated_voice_id : str + The generated_voice_id to stream. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Streaming audio data + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.text_to_voice.preview.stream( + generated_voice_id="generated_voice_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.stream(generated_voice_id, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/text_to_voice/preview/raw_client.py b/data/src/elevenlabs/text_to_voice/preview/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..298c0ad6a2d0813425d97a3f3edd57722c19eb1c --- /dev/null +++ b/data/src/elevenlabs/text_to_voice/preview/raw_client.py @@ -0,0 +1,148 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from pydantic import ValidationError + + +class RawPreviewClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def stream( + self, generated_voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Stream a voice preview that was created via the /v1/text-to-voice/design endpoint. + + Parameters + ---------- + generated_voice_id : str + The generated_voice_id to stream. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Streaming audio data + """ + with self._client_wrapper.httpx_client.stream( + f"v1/text-to-voice/{jsonable_encoder(generated_voice_id)}/stream", + method="GET", + request_options=request_options, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawPreviewClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def stream( + self, generated_voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Stream a voice preview that was created via the /v1/text-to-voice/design endpoint. + + Parameters + ---------- + generated_voice_id : str + The generated_voice_id to stream. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Streaming audio data + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/text-to-voice/{jsonable_encoder(generated_voice_id)}/stream", + method="GET", + request_options=request_options, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/text_to_voice/raw_client.py b/data/src/elevenlabs/text_to_voice/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8a66f2ab266bdd1f76677378de8958ad28701e62 --- /dev/null +++ b/data/src/elevenlabs/text_to_voice/raw_client.py @@ -0,0 +1,1012 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.conflict_error import ConflictError +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.allowed_output_formats import AllowedOutputFormats +from ..types.voice import Voice +from ..types.voice_design_preview_response import VoiceDesignPreviewResponse +from .types.voice_design_request_model_model_id import VoiceDesignRequestModelModelId +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawTextToVoiceClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create_previews( + self, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + quality: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + should_enhance: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[VoiceDesignPreviewResponse]: + """ + Create a voice from a text prompt. + + Parameters + ---------- + voice_description : str + Description to use for the created voice. + + output_format : typing.Optional[AllowedOutputFormats] + The output format of the generated audio. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + quality : typing.Optional[float] + Higher quality results in better voice output but less variety. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + should_enhance : typing.Optional[bool] + Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[VoiceDesignPreviewResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/text-to-voice/create-previews", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "voice_description": voice_description, + "text": text, + "auto_generate_text": auto_generate_text, + "loudness": loudness, + "quality": quality, + "seed": seed, + "guidance_scale": guidance_scale, + "should_enhance": should_enhance, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceDesignPreviewResponse, + construct_type( + type_=VoiceDesignPreviewResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, + *, + voice_name: str, + voice_description: str, + generated_voice_id: str, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + played_not_selected_voice_ids: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Voice]: + """ + Create a voice from previously generated voice preview. This endpoint should be called after you fetched a generated_voice_id using POST /v1/text-to-voice/design or POST /v1/text-to-voice/:voice_id/remix. + + Parameters + ---------- + voice_name : str + Name to use for the created voice. + + voice_description : str + Description to use for the created voice. + + generated_voice_id : str + The generated_voice_id to create; obtain it from POST /v1/text-to-voice/design, POST /v1/text-to-voice/:voice_id/remix, or the response headers when generating previews. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Optional, metadata to add to the created voice. Defaults to None. + + played_not_selected_voice_ids : typing.Optional[typing.Sequence[str]] + List of voice ids that the user has played but not selected. Used for RLHF. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Voice] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/text-to-voice", + method="POST", + json={ + "voice_name": voice_name, + "voice_description": voice_description, + "generated_voice_id": generated_voice_id, + "labels": labels, + "played_not_selected_voice_ids": played_not_selected_voice_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Voice, + construct_type( + type_=Voice, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def design( + self, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + model_id: typing.Optional[VoiceDesignRequestModelModelId] = OMIT, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + stream_previews: typing.Optional[bool] = OMIT, + should_enhance: typing.Optional[bool] = OMIT, + remixing_session_id: typing.Optional[str] = OMIT, + remixing_session_iteration_id: typing.Optional[str] = OMIT, + quality: typing.Optional[float] = OMIT, + reference_audio_base_64: typing.Optional[str] = OMIT, + prompt_strength: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[VoiceDesignPreviewResponse]: + """ + Design a voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. + + Parameters + ---------- + voice_description : str + Description to use for the created voice. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[VoiceDesignRequestModelModelId] + Model to use for the voice generation. Possible values: eleven_multilingual_ttv_v2, eleven_ttv_v3. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + stream_previews : typing.Optional[bool] + Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + + should_enhance : typing.Optional[bool] + Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + + remixing_session_id : typing.Optional[str] + The remixing session id. + + remixing_session_iteration_id : typing.Optional[str] + The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + + quality : typing.Optional[float] + Higher quality results in better voice output but less variety. + + reference_audio_base_64 : typing.Optional[str] + Reference audio to use for the voice generation. The audio should be base64 encoded. Only supported when using the eleven_ttv_v3 model. + + prompt_strength : typing.Optional[float] + Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[VoiceDesignPreviewResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/text-to-voice/design", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "voice_description": voice_description, + "model_id": model_id, + "text": text, + "auto_generate_text": auto_generate_text, + "loudness": loudness, + "seed": seed, + "guidance_scale": guidance_scale, + "stream_previews": stream_previews, + "should_enhance": should_enhance, + "remixing_session_id": remixing_session_id, + "remixing_session_iteration_id": remixing_session_iteration_id, + "quality": quality, + "reference_audio_base64": reference_audio_base_64, + "prompt_strength": prompt_strength, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceDesignPreviewResponse, + construct_type( + type_=VoiceDesignPreviewResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def remix( + self, + voice_id: str, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + stream_previews: typing.Optional[bool] = OMIT, + remixing_session_id: typing.Optional[str] = OMIT, + remixing_session_iteration_id: typing.Optional[str] = OMIT, + prompt_strength: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[VoiceDesignPreviewResponse]: + """ + Remix an existing voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + voice_description : str + Description of the changes to make to the voice. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + stream_previews : typing.Optional[bool] + Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + + remixing_session_id : typing.Optional[str] + The remixing session id. + + remixing_session_iteration_id : typing.Optional[str] + The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + + prompt_strength : typing.Optional[float] + Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[VoiceDesignPreviewResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/text-to-voice/{jsonable_encoder(voice_id)}/remix", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "voice_description": voice_description, + "text": text, + "auto_generate_text": auto_generate_text, + "loudness": loudness, + "seed": seed, + "guidance_scale": guidance_scale, + "stream_previews": stream_previews, + "remixing_session_id": remixing_session_id, + "remixing_session_iteration_id": remixing_session_iteration_id, + "prompt_strength": prompt_strength, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceDesignPreviewResponse, + construct_type( + type_=VoiceDesignPreviewResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawTextToVoiceClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create_previews( + self, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + quality: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + should_enhance: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[VoiceDesignPreviewResponse]: + """ + Create a voice from a text prompt. + + Parameters + ---------- + voice_description : str + Description to use for the created voice. + + output_format : typing.Optional[AllowedOutputFormats] + The output format of the generated audio. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + quality : typing.Optional[float] + Higher quality results in better voice output but less variety. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + should_enhance : typing.Optional[bool] + Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[VoiceDesignPreviewResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/text-to-voice/create-previews", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "voice_description": voice_description, + "text": text, + "auto_generate_text": auto_generate_text, + "loudness": loudness, + "quality": quality, + "seed": seed, + "guidance_scale": guidance_scale, + "should_enhance": should_enhance, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceDesignPreviewResponse, + construct_type( + type_=VoiceDesignPreviewResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, + *, + voice_name: str, + voice_description: str, + generated_voice_id: str, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + played_not_selected_voice_ids: typing.Optional[typing.Sequence[str]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Voice]: + """ + Create a voice from previously generated voice preview. This endpoint should be called after you fetched a generated_voice_id using POST /v1/text-to-voice/design or POST /v1/text-to-voice/:voice_id/remix. + + Parameters + ---------- + voice_name : str + Name to use for the created voice. + + voice_description : str + Description to use for the created voice. + + generated_voice_id : str + The generated_voice_id to create; obtain it from POST /v1/text-to-voice/design, POST /v1/text-to-voice/:voice_id/remix, or the response headers when generating previews. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Optional, metadata to add to the created voice. Defaults to None. + + played_not_selected_voice_ids : typing.Optional[typing.Sequence[str]] + List of voice ids that the user has played but not selected. Used for RLHF. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Voice] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/text-to-voice", + method="POST", + json={ + "voice_name": voice_name, + "voice_description": voice_description, + "generated_voice_id": generated_voice_id, + "labels": labels, + "played_not_selected_voice_ids": played_not_selected_voice_ids, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Voice, + construct_type( + type_=Voice, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def design( + self, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + model_id: typing.Optional[VoiceDesignRequestModelModelId] = OMIT, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + stream_previews: typing.Optional[bool] = OMIT, + should_enhance: typing.Optional[bool] = OMIT, + remixing_session_id: typing.Optional[str] = OMIT, + remixing_session_iteration_id: typing.Optional[str] = OMIT, + quality: typing.Optional[float] = OMIT, + reference_audio_base_64: typing.Optional[str] = OMIT, + prompt_strength: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[VoiceDesignPreviewResponse]: + """ + Design a voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. + + Parameters + ---------- + voice_description : str + Description to use for the created voice. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + model_id : typing.Optional[VoiceDesignRequestModelModelId] + Model to use for the voice generation. Possible values: eleven_multilingual_ttv_v2, eleven_ttv_v3. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + stream_previews : typing.Optional[bool] + Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + + should_enhance : typing.Optional[bool] + Whether to enhance the voice description using AI to add more detail and improve voice generation quality. When enabled, the system will automatically expand simple prompts into more detailed voice descriptions. Defaults to False + + remixing_session_id : typing.Optional[str] + The remixing session id. + + remixing_session_iteration_id : typing.Optional[str] + The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + + quality : typing.Optional[float] + Higher quality results in better voice output but less variety. + + reference_audio_base_64 : typing.Optional[str] + Reference audio to use for the voice generation. The audio should be base64 encoded. Only supported when using the eleven_ttv_v3 model. + + prompt_strength : typing.Optional[float] + Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[VoiceDesignPreviewResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/text-to-voice/design", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "voice_description": voice_description, + "model_id": model_id, + "text": text, + "auto_generate_text": auto_generate_text, + "loudness": loudness, + "seed": seed, + "guidance_scale": guidance_scale, + "stream_previews": stream_previews, + "should_enhance": should_enhance, + "remixing_session_id": remixing_session_id, + "remixing_session_iteration_id": remixing_session_iteration_id, + "quality": quality, + "reference_audio_base64": reference_audio_base_64, + "prompt_strength": prompt_strength, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceDesignPreviewResponse, + construct_type( + type_=VoiceDesignPreviewResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def remix( + self, + voice_id: str, + *, + voice_description: str, + output_format: typing.Optional[AllowedOutputFormats] = None, + text: typing.Optional[str] = OMIT, + auto_generate_text: typing.Optional[bool] = OMIT, + loudness: typing.Optional[float] = OMIT, + seed: typing.Optional[int] = OMIT, + guidance_scale: typing.Optional[float] = OMIT, + stream_previews: typing.Optional[bool] = OMIT, + remixing_session_id: typing.Optional[str] = OMIT, + remixing_session_iteration_id: typing.Optional[str] = OMIT, + prompt_strength: typing.Optional[float] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[VoiceDesignPreviewResponse]: + """ + Remix an existing voice via a prompt. This method returns a list of voice previews. Each preview has a generated_voice_id and a sample of the voice as base64 encoded mp3 audio. To create a voice use the generated_voice_id of the preferred preview with the /v1/text-to-voice endpoint. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + voice_description : str + Description of the changes to make to the voice. + + output_format : typing.Optional[AllowedOutputFormats] + Output format of the generated audio. Formatted as codec_sample_rate_bitrate. So an mp3 with 22.05kHz sample rate at 32kbs is represented as mp3_22050_32. MP3 with 192kbps bitrate requires you to be subscribed to Creator tier or above. PCM with 44.1kHz sample rate requires you to be subscribed to Pro tier or above. Note that the μ-law format (sometimes written mu-law, often approximated as u-law) is commonly used for Twilio audio inputs. + + text : typing.Optional[str] + Text to generate, text length has to be between 100 and 1000. + + auto_generate_text : typing.Optional[bool] + Whether to automatically generate a text suitable for the voice description. + + loudness : typing.Optional[float] + Controls the volume level of the generated voice. -1 is quietest, 1 is loudest, 0 corresponds to roughly -24 LUFS. + + seed : typing.Optional[int] + Random number that controls the voice generation. Same seed with same inputs produces same voice. + + guidance_scale : typing.Optional[float] + Controls how closely the AI follows the prompt. Lower numbers give the AI more freedom to be creative, while higher numbers force it to stick more to the prompt. High numbers can cause voice to sound artificial or robotic. We recommend to use longer, more detailed prompts at lower Guidance Scale. + + stream_previews : typing.Optional[bool] + Determines whether the Text to Voice previews should be included in the response. If true, only the generated IDs will be returned which can then be streamed via the /v1/text-to-voice/:generated_voice_id/stream endpoint. + + remixing_session_id : typing.Optional[str] + The remixing session id. + + remixing_session_iteration_id : typing.Optional[str] + The id of the remixing session iteration where these generations should be attached to. If not provided, a new iteration will be created. + + prompt_strength : typing.Optional[float] + Controls the balance of prompt versus reference audio when generating voice samples. 0 means almost no prompt influence, 1 means almost no reference audio influence. Only supported when using the eleven_ttv_v3 model. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[VoiceDesignPreviewResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/text-to-voice/{jsonable_encoder(voice_id)}/remix", + method="POST", + params={ + "output_format": output_format, + }, + json={ + "voice_description": voice_description, + "text": text, + "auto_generate_text": auto_generate_text, + "loudness": loudness, + "seed": seed, + "guidance_scale": guidance_scale, + "stream_previews": stream_previews, + "remixing_session_id": remixing_session_id, + "remixing_session_iteration_id": remixing_session_iteration_id, + "prompt_strength": prompt_strength, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceDesignPreviewResponse, + construct_type( + type_=VoiceDesignPreviewResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 409: + raise ConflictError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/text_to_voice/types/__init__.py b/data/src/elevenlabs/text_to_voice/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ba1e2362be3ba1acb13eea875a048f763aa0b71 --- /dev/null +++ b/data/src/elevenlabs/text_to_voice/types/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .voice_design_request_model_model_id import VoiceDesignRequestModelModelId +_dynamic_imports: typing.Dict[str, str] = {"VoiceDesignRequestModelModelId": ".voice_design_request_model_model_id"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["VoiceDesignRequestModelModelId"] diff --git a/data/src/elevenlabs/text_to_voice/types/voice_design_request_model_model_id.py b/data/src/elevenlabs/text_to_voice/types/voice_design_request_model_model_id.py new file mode 100644 index 0000000000000000000000000000000000000000..d0202881f10856128d2d8be3f0c75afaed10b560 --- /dev/null +++ b/data/src/elevenlabs/text_to_voice/types/voice_design_request_model_model_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceDesignRequestModelModelId = typing.Union[typing.Literal["eleven_multilingual_ttv_v2", "eleven_ttv_v3"], typing.Any] diff --git a/data/src/elevenlabs/tokens/__init__.py b/data/src/elevenlabs/tokens/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6dddf03bc8815157d03c5b45fb6afcc12156b6a3 --- /dev/null +++ b/data/src/elevenlabs/tokens/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import single_use +_dynamic_imports: typing.Dict[str, str] = {"single_use": ".single_use"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["single_use"] diff --git a/data/src/elevenlabs/tokens/client.py b/data/src/elevenlabs/tokens/client.py new file mode 100644 index 0000000000000000000000000000000000000000..73166fcffd56ae4778bb2ba2ac1b460e01fef9af --- /dev/null +++ b/data/src/elevenlabs/tokens/client.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .raw_client import AsyncRawTokensClient, RawTokensClient + +if typing.TYPE_CHECKING: + from .single_use.client import AsyncSingleUseClient, SingleUseClient + + +class TokensClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawTokensClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._single_use: typing.Optional[SingleUseClient] = None + + @property + def with_raw_response(self) -> RawTokensClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawTokensClient + """ + return self._raw_client + + @property + def single_use(self): + if self._single_use is None: + from .single_use.client import SingleUseClient # noqa: E402 + + self._single_use = SingleUseClient(client_wrapper=self._client_wrapper) + return self._single_use + + +class AsyncTokensClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawTokensClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._single_use: typing.Optional[AsyncSingleUseClient] = None + + @property + def with_raw_response(self) -> AsyncRawTokensClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawTokensClient + """ + return self._raw_client + + @property + def single_use(self): + if self._single_use is None: + from .single_use.client import AsyncSingleUseClient # noqa: E402 + + self._single_use = AsyncSingleUseClient(client_wrapper=self._client_wrapper) + return self._single_use diff --git a/data/src/elevenlabs/tokens/raw_client.py b/data/src/elevenlabs/tokens/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d45f2534ad1b60be0e8c329bf243f7b80037325a --- /dev/null +++ b/data/src/elevenlabs/tokens/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawTokensClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawTokensClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/data/src/elevenlabs/tokens/single_use/__init__.py b/data/src/elevenlabs/tokens/single_use/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/tokens/single_use/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/tokens/single_use/client.py b/data/src/elevenlabs/tokens/single_use/client.py new file mode 100644 index 0000000000000000000000000000000000000000..6afcedb97eda128de8e5b662367724fa6109e72e --- /dev/null +++ b/data/src/elevenlabs/tokens/single_use/client.py @@ -0,0 +1,113 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.single_use_token_response_model import SingleUseTokenResponseModel +from ...types.single_use_token_type import SingleUseTokenType +from .raw_client import AsyncRawSingleUseClient, RawSingleUseClient + + +class SingleUseClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSingleUseClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSingleUseClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSingleUseClient + """ + return self._raw_client + + def create( + self, token_type: SingleUseTokenType, *, request_options: typing.Optional[RequestOptions] = None + ) -> SingleUseTokenResponseModel: + """ + Generate a time limited single-use token with embedded authentication for frontend clients. + + Parameters + ---------- + token_type : SingleUseTokenType + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SingleUseTokenResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.tokens.single_use.create( + token_type="realtime_scribe", + ) + """ + _response = self._raw_client.create(token_type, request_options=request_options) + return _response.data + + +class AsyncSingleUseClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSingleUseClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSingleUseClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSingleUseClient + """ + return self._raw_client + + async def create( + self, token_type: SingleUseTokenType, *, request_options: typing.Optional[RequestOptions] = None + ) -> SingleUseTokenResponseModel: + """ + Generate a time limited single-use token with embedded authentication for frontend clients. + + Parameters + ---------- + token_type : SingleUseTokenType + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SingleUseTokenResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.tokens.single_use.create( + token_type="realtime_scribe", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(token_type, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/tokens/single_use/raw_client.py b/data/src/elevenlabs/tokens/single_use/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c4500c0847fc66993f93849a4d4f6aa766cbf1f7 --- /dev/null +++ b/data/src/elevenlabs/tokens/single_use/raw_client.py @@ -0,0 +1,132 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.single_use_token_response_model import SingleUseTokenResponseModel +from ...types.single_use_token_type import SingleUseTokenType +from pydantic import ValidationError + + +class RawSingleUseClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, token_type: SingleUseTokenType, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SingleUseTokenResponseModel]: + """ + Generate a time limited single-use token with embedded authentication for frontend clients. + + Parameters + ---------- + token_type : SingleUseTokenType + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SingleUseTokenResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/single-use-token/{jsonable_encoder(token_type)}", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SingleUseTokenResponseModel, + construct_type( + type_=SingleUseTokenResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSingleUseClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, token_type: SingleUseTokenType, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SingleUseTokenResponseModel]: + """ + Generate a time limited single-use token with embedded authentication for frontend clients. + + Parameters + ---------- + token_type : SingleUseTokenType + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SingleUseTokenResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/single-use-token/{jsonable_encoder(token_type)}", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SingleUseTokenResponseModel, + construct_type( + type_=SingleUseTokenResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/types/__init__.py b/data/src/elevenlabs/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..84256ada0d2c5ea25523799993cea206812217ec --- /dev/null +++ b/data/src/elevenlabs/types/__init__.py @@ -0,0 +1,7528 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .account_change_activity_id import AccountChangeActivityId + from .actor_model import ActorModel + from .add_chapter_response_model import AddChapterResponseModel + from .add_knowledge_base_response_model import AddKnowledgeBaseResponseModel + from .add_project_request import AddProjectRequest + from .add_project_response_model import AddProjectResponseModel + from .add_pronunciation_dictionary_response_model import AddPronunciationDictionaryResponseModel + from .add_pronunciation_dictionary_response_model_permission_on_resource import ( + AddPronunciationDictionaryResponseModelPermissionOnResource, + ) + from .add_sharing_voice_request import AddSharingVoiceRequest + from .add_voice_ivc_response_model import AddVoiceIvcResponseModel + from .add_voice_response_model import AddVoiceResponseModel + from .add_voice_to_user_voice_collection_response_model import AddVoiceToUserVoiceCollectionResponseModel + from .add_workspace_group_member_response_model import AddWorkspaceGroupMemberResponseModel + from .add_workspace_invite_response_model import AddWorkspaceInviteResponseModel + from .additional_format_response_model import AdditionalFormatResponseModel + from .additional_formats import AdditionalFormats + from .adhoc_agent_config_override_for_test_request_model import AdhocAgentConfigOverrideForTestRequestModel + from .age import Age + from .agent_analysis_items_input import AgentAnalysisItemsInput + from .agent_analysis_items_input_data_collection_item import ( + AgentAnalysisItemsInputDataCollectionItem, + AgentAnalysisItemsInputDataCollectionItem_System, + AgentAnalysisItemsInputDataCollectionItem_User, + ) + from .agent_analysis_items_input_evaluation_criteria_item import ( + AgentAnalysisItemsInputEvaluationCriteriaItem, + AgentAnalysisItemsInputEvaluationCriteriaItem_System, + AgentAnalysisItemsInputEvaluationCriteriaItem_User, + ) + from .agent_analysis_items_output import AgentAnalysisItemsOutput + from .agent_analysis_items_output_data_collection_item import ( + AgentAnalysisItemsOutputDataCollectionItem, + AgentAnalysisItemsOutputDataCollectionItem_System, + AgentAnalysisItemsOutputDataCollectionItem_User, + ) + from .agent_analysis_items_output_evaluation_criteria_item import ( + AgentAnalysisItemsOutputEvaluationCriteriaItem, + AgentAnalysisItemsOutputEvaluationCriteriaItem_System, + AgentAnalysisItemsOutputEvaluationCriteriaItem_User, + ) + from .agent_branch_basic_info import AgentBranchBasicInfo + from .agent_branch_response import AgentBranchResponse + from .agent_branch_summary import AgentBranchSummary + from .agent_call_limits import AgentCallLimits + from .agent_config import AgentConfig + from .agent_config_api_model_workflow_override_input import AgentConfigApiModelWorkflowOverrideInput + from .agent_config_api_model_workflow_override_output import AgentConfigApiModelWorkflowOverrideOutput + from .agent_config_override_config import AgentConfigOverrideConfig + from .agent_config_override_input import AgentConfigOverrideInput + from .agent_config_override_output import AgentConfigOverrideOutput + from .agent_conversation_ticket_issue_type import AgentConversationTicketIssueType + from .agent_conversation_ticket_priority import AgentConversationTicketPriority + from .agent_conversation_ticket_response_model import AgentConversationTicketResponseModel + from .agent_conversation_ticket_sort_by import AgentConversationTicketSortBy + from .agent_conversation_ticket_source import AgentConversationTicketSource + from .agent_conversation_ticket_status import AgentConversationTicketStatus + from .agent_definition_source import AgentDefinitionSource + from .agent_deployment_history_item import AgentDeploymentHistoryItem + from .agent_deployment_percentage_strategy import AgentDeploymentPercentageStrategy + from .agent_deployment_request import AgentDeploymentRequest + from .agent_deployment_request_item import AgentDeploymentRequestItem + from .agent_deployment_response import AgentDeploymentResponse + from .agent_deployment_source import AgentDeploymentSource + from .agent_failure_response_example import AgentFailureResponseExample + from .agent_hold_audio_config import AgentHoldAudioConfig + from .agent_knowledge_base_rag_chunk_response_model import AgentKnowledgeBaseRagChunkResponseModel + from .agent_knowledge_base_rag_query_request_model import AgentKnowledgeBaseRagQueryRequestModel + from .agent_knowledge_base_rag_query_response_model import AgentKnowledgeBaseRagQueryResponseModel + from .agent_merge_proposal_response import AgentMergeProposalResponse + from .agent_merge_proposal_response_outcome import ( + AgentMergeProposalResponseOutcome, + AgentMergeProposalResponseOutcome_Closed, + AgentMergeProposalResponseOutcome_Merged, + AgentMergeProposalResponseOutcome_Open, + ) + from .agent_metadata import AgentMetadata + from .agent_metadata_db_model import AgentMetadataDbModel + from .agent_metadata_response_model import AgentMetadataResponseModel + from .agent_platform_settings_request_model import AgentPlatformSettingsRequestModel + from .agent_platform_settings_response_model import AgentPlatformSettingsResponseModel + from .agent_queueing_config import AgentQueueingConfig + from .agent_response_payload import AgentResponsePayload + from .agent_simulated_chat_test_response_model import AgentSimulatedChatTestResponseModel + from .agent_smb_metadata import AgentSmbMetadata + from .agent_sort_by import AgentSortBy + from .agent_successful_response_example import AgentSuccessfulResponseExample + from .agent_summary_batch_successful_response_model import AgentSummaryBatchSuccessfulResponseModel + from .agent_summary_response_model import AgentSummaryResponseModel + from .agent_test_entity_type import AgentTestEntityType + from .agent_test_folder_path_segment_response_model import AgentTestFolderPathSegmentResponseModel + from .agent_testing_settings import AgentTestingSettings + from .agent_topic_response_model import AgentTopicResponseModel + from .agent_transfer_input import AgentTransferInput + from .agent_transfer_op import AgentTransferOp, AgentTransferOp_Pop, AgentTransferOp_Push, AgentTransferOp_Replace + from .agent_transfer_op_pop import AgentTransferOpPop + from .agent_transfer_op_push import AgentTransferOpPush + from .agent_transfer_op_replace import AgentTransferOpReplace + from .agent_transfer_output import AgentTransferOutput + from .agent_trust_context import AgentTrustContext + from .agent_version_metadata import AgentVersionMetadata + from .agent_version_parents import AgentVersionParents + from .agent_workflow_request_model import AgentWorkflowRequestModel + from .agent_workflow_request_model_nodes_value import ( + AgentWorkflowRequestModelNodesValue, + AgentWorkflowRequestModelNodesValue_End, + AgentWorkflowRequestModelNodesValue_OverrideAgent, + AgentWorkflowRequestModelNodesValue_PhoneNumber, + AgentWorkflowRequestModelNodesValue_Say, + AgentWorkflowRequestModelNodesValue_StandaloneAgent, + AgentWorkflowRequestModelNodesValue_Start, + AgentWorkflowRequestModelNodesValue_Tool, + AgentWorkflowRequestModelNodesValue_UpdateState, + ) + from .agent_workflow_response_model import AgentWorkflowResponseModel + from .agent_workflow_response_model_nodes_value import ( + AgentWorkflowResponseModelNodesValue, + AgentWorkflowResponseModelNodesValue_End, + AgentWorkflowResponseModelNodesValue_OverrideAgent, + AgentWorkflowResponseModelNodesValue_PhoneNumber, + AgentWorkflowResponseModelNodesValue_Say, + AgentWorkflowResponseModelNodesValue_StandaloneAgent, + AgentWorkflowResponseModelNodesValue_Start, + AgentWorkflowResponseModelNodesValue_Tool, + AgentWorkflowResponseModelNodesValue_UpdateState, + ) + from .agent_workspace_overrides_input import AgentWorkspaceOverridesInput + from .agent_workspace_overrides_output import AgentWorkspaceOverridesOutput + from .alerting_integration_notifier import AlertingIntegrationNotifier + from .alerting_integration_notifier_integration_type import AlertingIntegrationNotifierIntegrationType + from .alerting_integration_notifier_response import AlertingIntegrationNotifierResponse + from .alerting_integration_notifier_response_integration_type import ( + AlertingIntegrationNotifierResponseIntegrationType, + ) + from .alerting_monitor_config import AlertingMonitorConfig + from .alerting_pager_duty_notifier import AlertingPagerDutyNotifier + from .alerting_pager_duty_notifier_response import AlertingPagerDutyNotifierResponse + from .alerting_settings import AlertingSettings + from .alerting_settings_notifiers_item import ( + AlertingSettingsNotifiersItem, + AlertingSettingsNotifiersItem_Integration, + AlertingSettingsNotifiersItem_Webhook, + ) + from .alerting_settings_response import AlertingSettingsResponse + from .alerting_settings_response_notifiers_item import ( + AlertingSettingsResponseNotifiersItem, + AlertingSettingsResponseNotifiersItem_Integration, + AlertingSettingsResponseNotifiersItem_Webhook, + ) + from .alerting_slack_notifier import AlertingSlackNotifier + from .alerting_slack_notifier_response import AlertingSlackNotifierResponse + from .alerting_webhook_header import AlertingWebhookHeader + from .alerting_webhook_method import AlertingWebhookMethod + from .alerting_webhook_notifier import AlertingWebhookNotifier + from .alerting_webhook_notifier_response import AlertingWebhookNotifierResponse + from .alerting_webhook_secret_header_value import AlertingWebhookSecretHeaderValue + from .alignment import Alignment + from .allowed_output_formats import AllowedOutputFormats + from .allowed_values import AllowedValues + from .allowlist_item import AllowlistItem + from .analysis_charging import AnalysisCharging + from .analysis_property import AnalysisProperty + from .analysis_property_constant_value import AnalysisPropertyConstantValue + from .analysis_property_type import AnalysisPropertyType + from .analysis_run_snapshot import AnalysisRunSnapshot + from .analysis_running_total import AnalysisRunningTotal + from .analysis_scope import AnalysisScope + from .analysis_type import AnalysisType + from .api_integration_o_auth_2_auth_code_response import ApiIntegrationOAuth2AuthCodeResponse + from .api_integration_o_auth_2_auth_code_response_scope_separator import ( + ApiIntegrationOAuth2AuthCodeResponseScopeSeparator, + ) + from .api_integration_o_auth_2_custom_app_response import ApiIntegrationOAuth2CustomAppResponse + from .api_integration_o_auth_2_custom_app_response_scope_separator import ( + ApiIntegrationOAuth2CustomAppResponseScopeSeparator, + ) + from .api_integration_webhook_overrides import ApiIntegrationWebhookOverrides + from .api_integration_webhook_overrides_request_headers_value import ( + ApiIntegrationWebhookOverridesRequestHeadersValue, + ) + from .api_integration_webhook_overrides_schema_overrides_value import ( + ApiIntegrationWebhookOverridesSchemaOverridesValue, + ApiIntegrationWebhookOverridesSchemaOverridesValue_Constant, + ApiIntegrationWebhookOverridesSchemaOverridesValue_DynamicVariable, + ApiIntegrationWebhookOverridesSchemaOverridesValue_Llm, + ApiIntegrationWebhookOverridesSchemaOverridesValue_Omit, + ) + from .api_integration_webhook_tool_config_input import ApiIntegrationWebhookToolConfigInput + from .api_integration_webhook_tool_config_output import ApiIntegrationWebhookToolConfigOutput + from .architect_dispatch_response_model import ArchitectDispatchResponseModel + from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput + from .array_json_schema_property_input_items import ArrayJsonSchemaPropertyInputItems + from .array_json_schema_property_input_property_kind import ArrayJsonSchemaPropertyInputPropertyKind + from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput + from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems + from .array_schema import ArraySchema + from .asr_conversational_config import AsrConversationalConfig + from .asr_conversational_config_override import AsrConversationalConfigOverride + from .asr_conversational_config_override_config import AsrConversationalConfigOverrideConfig + from .asr_conversational_config_workflow_override import AsrConversationalConfigWorkflowOverride + from .asr_input_format import AsrInputFormat + from .asr_provider import AsrProvider + from .asr_quality import AsrQuality + from .asset_list_response import AssetListResponse + from .asset_response import AssetResponse + from .asset_transcription import AssetTranscription + from .asset_transcription_data import AssetTranscriptionData + from .asset_transcription_status import AssetTranscriptionStatus + from .assignable_user_response_model import AssignableUserResponseModel + from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput + from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput + from .ast_and_operator_node_input import AstAndOperatorNodeInput + from .ast_and_operator_node_output import AstAndOperatorNodeOutput + from .ast_boolean_node_input import AstBooleanNodeInput + from .ast_boolean_node_output import AstBooleanNodeOutput + from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput + from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput + from .ast_division_operator_node_input import AstDivisionOperatorNodeInput + from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput + from .ast_dynamic_variable_node_input import AstDynamicVariableNodeInput + from .ast_dynamic_variable_node_output import AstDynamicVariableNodeOutput + from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput + from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput + from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput + from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput + from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput + from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput + from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput + from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput + from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput + from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput + from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput + from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput + from .ast_node_input import ( + AstNodeInput, + AstNodeInput_AddOperator, + AstNodeInput_AndOperator, + AstNodeInput_BooleanLiteral, + AstNodeInput_ConditionalOperator, + AstNodeInput_DivOperator, + AstNodeInput_DynamicVariable, + AstNodeInput_EqOperator, + AstNodeInput_GtOperator, + AstNodeInput_GteOperator, + AstNodeInput_Llm, + AstNodeInput_LtOperator, + AstNodeInput_LteOperator, + AstNodeInput_MulOperator, + AstNodeInput_NeqOperator, + AstNodeInput_NullLiteral, + AstNodeInput_NumberLiteral, + AstNodeInput_OrOperator, + AstNodeInput_StringLiteral, + AstNodeInput_SubOperator, + ) + from .ast_node_input_llm import AstNodeInputLlm + from .ast_node_output import ( + AstNodeOutput, + AstNodeOutput_AddOperator, + AstNodeOutput_AndOperator, + AstNodeOutput_BooleanLiteral, + AstNodeOutput_ConditionalOperator, + AstNodeOutput_DivOperator, + AstNodeOutput_DynamicVariable, + AstNodeOutput_EqOperator, + AstNodeOutput_GtOperator, + AstNodeOutput_GteOperator, + AstNodeOutput_Llm, + AstNodeOutput_LtOperator, + AstNodeOutput_LteOperator, + AstNodeOutput_MulOperator, + AstNodeOutput_NeqOperator, + AstNodeOutput_NullLiteral, + AstNodeOutput_NumberLiteral, + AstNodeOutput_OrOperator, + AstNodeOutput_StringLiteral, + AstNodeOutput_SubOperator, + ) + from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput + from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput + from .ast_null_node_input import AstNullNodeInput + from .ast_null_node_output import AstNullNodeOutput + from .ast_number_node_input import AstNumberNodeInput + from .ast_number_node_input_value import AstNumberNodeInputValue + from .ast_number_node_output import AstNumberNodeOutput + from .ast_number_node_output_value import AstNumberNodeOutputValue + from .ast_or_operator_node_input import AstOrOperatorNodeInput + from .ast_or_operator_node_output import AstOrOperatorNodeOutput + from .ast_string_node_input import AstStringNodeInput + from .ast_string_node_output import AstStringNodeOutput + from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput + from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput + from .astllm_node_input import AstllmNodeInput + from .astllm_node_input_prompt import AstllmNodeInputPrompt + from .astllm_node_input_value_schema import AstllmNodeInputValueSchema + from .astllm_node_output import AstllmNodeOutput + from .async_conversation_metadata import AsyncConversationMetadata + from .async_conversation_metadata_delivery_status import AsyncConversationMetadataDeliveryStatus + from .attached_system_data_collection_ref import AttachedSystemDataCollectionRef + from .attached_system_evaluation_ref import AttachedSystemEvaluationRef + from .attached_test_model import AttachedTestModel + from .attached_user_data_collection_ref import AttachedUserDataCollectionRef + from .attached_user_evaluation_ref import AttachedUserEvaluationRef + from .audio_analysis import AudioAnalysis + from .audio_analysis_result import AudioAnalysisResult + from .audio_analysis_status import AudioAnalysisStatus + from .audio_effects_background_noise_response_model import AudioEffectsBackgroundNoiseResponseModel + from .audio_effects_catalog_response_model import AudioEffectsCatalogResponseModel + from .audio_effects_environment_response_model import AudioEffectsEnvironmentResponseModel + from .audio_effects_filter_preset_response_model import AudioEffectsFilterPresetResponseModel + from .audio_format_enum import AudioFormatEnum + from .audio_input_pacing import AudioInputPacing + from .audio_isolation_history_item_response_model import AudioIsolationHistoryItemResponseModel + from .audio_key_moment import AudioKeyMoment + from .audio_native_create_project_response_model import AudioNativeCreateProjectResponseModel + from .audio_native_edit_content_response_model import AudioNativeEditContentResponseModel + from .audio_native_project_settings_response_model import AudioNativeProjectSettingsResponseModel + from .audio_native_project_settings_response_model_status import AudioNativeProjectSettingsResponseModelStatus + from .audio_output import AudioOutput + from .audio_output_multi import AudioOutputMulti + from .audio_ref_chunk import AudioRefChunk + from .audio_reference import ( + AudioReference, + AudioReference_Asset, + AudioReference_Generation, + AudioReference_InlineBase64, + ) + from .audio_schema import AudioSchema + from .audio_segment import AudioSegment + from .audio_with_timestamps_and_voice_segments_response_model import ( + AudioWithTimestampsAndVoiceSegmentsResponseModel, + ) + from .audio_with_timestamps_response import AudioWithTimestampsResponse + from .auth_connection_dependencies import AuthConnectionDependencies + from .auth_connection_dependencies_mcp_servers_item import ( + AuthConnectionDependenciesMcpServersItem, + AuthConnectionDependenciesMcpServersItem_Available, + AuthConnectionDependenciesMcpServersItem_Unknown, + ) + from .auth_connection_dependencies_tools_item import ( + AuthConnectionDependenciesToolsItem, + AuthConnectionDependenciesToolsItem_Available, + AuthConnectionDependenciesToolsItem_Unknown, + ) + from .auth_connection_locator import AuthConnectionLocator + from .auth_connection_status import AuthConnectionStatus + from .auth_settings import AuthSettings + from .authentication_activity_id import AuthenticationActivityId + from .authorization_method import AuthorizationMethod + from .auto_generation_metadata import AutoGenerationMetadata + from .auto_sync_info import AutoSyncInfo + from .avatar_context_response_model import AvatarContextResponseModel + from .background_sound_config import BackgroundSoundConfig + from .background_sound_config_workflow_override import BackgroundSoundConfigWorkflowOverride + from .background_sound_preset_id import BackgroundSoundPresetId + from .background_sound_source_type import BackgroundSoundSourceType + from .backup_llm_default import BackupLlmDefault + from .backup_llm_disabled import BackupLlmDisabled + from .backup_llm_override import BackupLlmOverride + from .bad_request_error_body import BadRequestErrorBody + from .ban_reason_type import BanReasonType + from .base_turn_config import BaseTurnConfig + from .basic_auth_response import BasicAuthResponse + from .batch_call_detailed_response import BatchCallDetailedResponse + from .batch_call_recipient_status import BatchCallRecipientStatus + from .batch_call_response import BatchCallResponse + from .batch_call_status import BatchCallStatus + from .batch_call_whats_app_params import BatchCallWhatsAppParams + from .batch_calling_campaign_information import BatchCallingCampaignInformation + from .batch_failure_response_model import BatchFailureResponseModel + from .bearer_auth_response import BearerAuthResponse + from .behavior_override import BehaviorOverride + from .billing_period import BillingPeriod + from .boolean_schema import BooleanSchema + from .branch_protection_status import BranchProtectionStatus + from .breakdown_types import BreakdownTypes + from .bucketing_status import BucketingStatus + from .built_in_tools_input import BuiltInToolsInput + from .built_in_tools_output import BuiltInToolsOutput + from .built_in_tools_workflow_override_input import BuiltInToolsWorkflowOverrideInput + from .built_in_tools_workflow_override_output import BuiltInToolsWorkflowOverrideOutput + from .bytedance_seedance_25_request import BytedanceSeedance25Request + from .bytedance_seedance_25_request_aspect_ratio import BytedanceSeedance25RequestAspectRatio + from .bytedance_seedance_25_request_resolution import BytedanceSeedance25RequestResolution + from .bytedance_seedance_2_fast_request import BytedanceSeedance2FastRequest + from .bytedance_seedance_2_fast_request_aspect_ratio import BytedanceSeedance2FastRequestAspectRatio + from .bytedance_seedance_2_fast_request_resolution import BytedanceSeedance2FastRequestResolution + from .bytedance_seedance_2_mini_request import BytedanceSeedance2MiniRequest + from .bytedance_seedance_2_mini_request_aspect_ratio import BytedanceSeedance2MiniRequestAspectRatio + from .bytedance_seedance_2_mini_request_resolution import BytedanceSeedance2MiniRequestResolution + from .bytedance_seedance_2_request import BytedanceSeedance2Request + from .bytedance_seedance_2_request_aspect_ratio import BytedanceSeedance2RequestAspectRatio + from .bytedance_seedance_2_request_resolution import BytedanceSeedance2RequestResolution + from .bytedance_seedream_5_lite_request import BytedanceSeedream5LiteRequest + from .bytedance_seedream_5_lite_request_aspect_ratio import BytedanceSeedream5LiteRequestAspectRatio + from .bytedance_seedream_5_lite_request_resolution import BytedanceSeedream5LiteRequestResolution + from .bytedance_seedream_5_pro_request import BytedanceSeedream5ProRequest + from .bytedance_seedream_5_pro_request_aspect_ratio import BytedanceSeedream5ProRequestAspectRatio + from .bytedance_seedream_5_pro_request_resolution import BytedanceSeedream5ProRequestResolution + from .call_result import CallResult + from .campaign_conversation_type import CampaignConversationType + from .cancel_calendar_event_params import CancelCalendarEventParams + from .cancel_group_session_for_all_params import CancelGroupSessionForAllParams + from .cancel_group_session_registration_params import CancelGroupSessionRegistrationParams + from .cancel_order_params import CancelOrderParams + from .canvas_placement import CanvasPlacement + from .caption_style_character_animation_model import CaptionStyleCharacterAnimationModel + from .caption_style_character_animation_model_enter_type import CaptionStyleCharacterAnimationModelEnterType + from .caption_style_character_animation_model_exit_type import CaptionStyleCharacterAnimationModelExitType + from .caption_style_horizontal_placement_model import CaptionStyleHorizontalPlacementModel + from .caption_style_horizontal_placement_model_align import CaptionStyleHorizontalPlacementModelAlign + from .caption_style_model import CaptionStyleModel + from .caption_style_model_text_align import CaptionStyleModelTextAlign + from .caption_style_model_text_blend_mode import CaptionStyleModelTextBlendMode + from .caption_style_model_text_style import CaptionStyleModelTextStyle + from .caption_style_model_text_transform import CaptionStyleModelTextTransform + from .caption_style_model_text_weight import CaptionStyleModelTextWeight + from .caption_style_section_animation_model import CaptionStyleSectionAnimationModel + from .caption_style_section_animation_model_enter_type import CaptionStyleSectionAnimationModelEnterType + from .caption_style_section_animation_model_exit_type import CaptionStyleSectionAnimationModelExitType + from .caption_style_template_model import CaptionStyleTemplateModel + from .caption_style_vertical_placement_model import CaptionStyleVerticalPlacementModel + from .caption_style_vertical_placement_model_align import CaptionStyleVerticalPlacementModelAlign + from .caption_style_word_animation_model import CaptionStyleWordAnimationModel + from .caption_style_word_animation_model_enter_type import CaptionStyleWordAnimationModelEnterType + from .caption_style_word_animation_model_exit_type import CaptionStyleWordAnimationModelExitType + from .chapter_content_block_extendable_node_response_model import ChapterContentBlockExtendableNodeResponseModel + from .chapter_content_block_input_model import ChapterContentBlockInputModel + from .chapter_content_block_input_model_sub_type import ChapterContentBlockInputModelSubType + from .chapter_content_block_response_model import ChapterContentBlockResponseModel + from .chapter_content_block_response_model_nodes_item import ( + ChapterContentBlockResponseModelNodesItem, + ChapterContentBlockResponseModelNodesItem_Other, + ChapterContentBlockResponseModelNodesItem_TtsNode, + ) + from .chapter_content_block_tts_node_response_model import ChapterContentBlockTtsNodeResponseModel + from .chapter_content_input_model import ChapterContentInputModel + from .chapter_content_paragraph_tts_node_input_model import ChapterContentParagraphTtsNodeInputModel + from .chapter_content_response_model import ChapterContentResponseModel + from .chapter_response import ChapterResponse + from .chapter_snapshot_extended_response_model import ChapterSnapshotExtendedResponseModel + from .chapter_snapshot_response import ChapterSnapshotResponse + from .chapter_snapshots_response import ChapterSnapshotsResponse + from .chapter_state import ChapterState + from .chapter_statistics_response import ChapterStatisticsResponse + from .chapter_with_content_response_model import ChapterWithContentResponseModel + from .chapter_with_content_response_model_state import ChapterWithContentResponseModelState + from .character_age import CharacterAge + from .character_alignment_model import CharacterAlignmentModel + from .character_alignment_response_model import CharacterAlignmentResponseModel + from .character_gender import CharacterGender + from .character_metadata_response_model import CharacterMetadataResponseModel + from .character_refresh_period import CharacterRefreshPeriod + from .character_response_model import CharacterResponseModel + from .character_role import CharacterRole + from .character_usage_response import CharacterUsageResponse + from .chat_source_medium import ChatSourceMedium + from .check_service_availability_params import CheckServiceAvailabilityParams + from .client_event import ClientEvent + from .client_secret_response import ClientSecretResponse + from .client_tool_config_input import ClientToolConfigInput + from .client_tool_config_output import ClientToolConfigOutput + from .clip_animation import ClipAnimation + from .clip_animation_enter_effect import ClipAnimationEnterEffect + from .clip_animation_exit_effect import ClipAnimationExitEffect + from .close_connection import CloseConnection + from .close_context import CloseContext + from .close_payload import ClosePayload + from .close_socket import CloseSocket + from .closed_outcome import ClosedOutcome + from .column_filter import ColumnFilter + from .column_filter_operation import ColumnFilterOperation + from .column_filter_values_item import ColumnFilterValuesItem + from .column_unit import ColumnUnit + from .committed_transcript_entities_payload import CommittedTranscriptEntitiesPayload + from .committed_transcript_payload import CommittedTranscriptPayload + from .committed_transcript_with_timestamps_payload import CommittedTranscriptWithTimestampsPayload + from .compaction_settings_workflow_override import CompactionSettingsWorkflowOverride + from .compile_procedures_response_model import CompileProceduresResponseModel + from .compile_procedures_validation_error_response_model import CompileProceduresValidationErrorResponseModel + from .composition_plan import CompositionPlan + from .composition_plan_chunks_item import CompositionPlanChunksItem + from .computed_usage_platform_limit import ComputedUsagePlatformLimit + from .condition_strength import ConditionStrength + from .config_entity_type import ConfigEntityType + from .conflict_section import ConflictSection + from .constant_schema_override import ConstantSchemaOverride + from .constant_schema_override_constant_value import ConstantSchemaOverrideConstantValue + from .content_config import ContentConfig + from .content_format import ContentFormat + from .content_guardrail_input import ContentGuardrailInput + from .content_guardrail_input_trigger_action import ( + ContentGuardrailInputTriggerAction, + ContentGuardrailInputTriggerAction_EndCall, + ContentGuardrailInputTriggerAction_Retry, + ) + from .content_guardrail_output import ContentGuardrailOutput + from .content_guardrail_output_trigger_action import ( + ContentGuardrailOutputTriggerAction, + ContentGuardrailOutputTriggerAction_EndCall, + ContentGuardrailOutputTriggerAction_Retry, + ) + from .content_schema import ( + ContentSchema, + ContentSchema_Array, + ContentSchema_Audio, + ContentSchema_Boolean, + ContentSchema_Image, + ContentSchema_Integer, + ContentSchema_Number, + ContentSchema_Object, + ContentSchema_String, + ContentSchema_Video, + ContentSchema_Voice, + ) + from .content_threshold_guardrail import ContentThresholdGuardrail + from .content_threshold_guardrail_threshold import ContentThresholdGuardrailThreshold + from .contextual_update_info import ContextualUpdateInfo + from .contributor import Contributor + from .conv_ai_dynamic_variable import ConvAiDynamicVariable + from .conv_ai_env_var_locator import ConvAiEnvVarLocator + from .conv_ai_file_upload_response_model import ConvAiFileUploadResponseModel + from .conv_ai_secret_locator import ConvAiSecretLocator + from .conv_ai_stored_secret_dependencies import ConvAiStoredSecretDependencies + from .conv_ai_stored_secret_dependencies_agents_item import ( + ConvAiStoredSecretDependenciesAgentsItem, + ConvAiStoredSecretDependenciesAgentsItem_Available, + ConvAiStoredSecretDependenciesAgentsItem_Unknown, + ) + from .conv_ai_stored_secret_dependencies_mcp_servers_item import ( + ConvAiStoredSecretDependenciesMcpServersItem, + ConvAiStoredSecretDependenciesMcpServersItem_Available, + ConvAiStoredSecretDependenciesMcpServersItem_Unknown, + ) + from .conv_ai_stored_secret_dependencies_tools_item import ( + ConvAiStoredSecretDependenciesToolsItem, + ConvAiStoredSecretDependenciesToolsItem_Available, + ConvAiStoredSecretDependenciesToolsItem_Unknown, + ) + from .conv_ai_user_secret_db_model import ConvAiUserSecretDbModel + from .conv_ai_webhooks import ConvAiWebhooks + from .conv_ai_workspace_stored_secret_config import ConvAiWorkspaceStoredSecretConfig + from .conversation_asr_usage_model import ConversationAsrUsageModel + from .conversation_charging_common_model import ConversationChargingCommonModel + from .conversation_config_client_override_config_input import ConversationConfigClientOverrideConfigInput + from .conversation_config_client_override_config_output import ConversationConfigClientOverrideConfigOutput + from .conversation_config_client_override_input import ConversationConfigClientOverrideInput + from .conversation_config_client_override_output import ConversationConfigClientOverrideOutput + from .conversation_config_input import ConversationConfigInput + from .conversation_config_output import ConversationConfigOutput + from .conversation_config_override import ConversationConfigOverride + from .conversation_config_override_config import ConversationConfigOverrideConfig + from .conversation_config_workflow_override_input import ConversationConfigWorkflowOverrideInput + from .conversation_config_workflow_override_output import ConversationConfigWorkflowOverrideOutput + from .conversation_deletion_settings import ConversationDeletionSettings + from .conversation_error_type import ConversationErrorType + from .conversation_feedback_type import ConversationFeedbackType + from .conversation_history_analysis_common_model import ConversationHistoryAnalysisCommonModel + from .conversation_history_batch_call_model import ConversationHistoryBatchCallModel + from .conversation_history_eleven_assistant_common_model import ConversationHistoryElevenAssistantCommonModel + from .conversation_history_error_common_model import ConversationHistoryErrorCommonModel + from .conversation_history_evaluation_criteria_result_common_model import ( + ConversationHistoryEvaluationCriteriaResultCommonModel, + ) + from .conversation_history_exotel_phone_call_model import ConversationHistoryExotelPhoneCallModel + from .conversation_history_feedback_common_model import ConversationHistoryFeedbackCommonModel + from .conversation_history_metadata_common_model import ConversationHistoryMetadataCommonModel + from .conversation_history_metadata_common_model_phone_call import ( + ConversationHistoryMetadataCommonModelPhoneCall, + ConversationHistoryMetadataCommonModelPhoneCall_Exotel, + ConversationHistoryMetadataCommonModelPhoneCall_SipTrunking, + ConversationHistoryMetadataCommonModelPhoneCall_Twilio, + ) + from .conversation_history_multivoice_message_model import ConversationHistoryMultivoiceMessageModel + from .conversation_history_multivoice_message_part_model import ConversationHistoryMultivoiceMessagePartModel + from .conversation_history_rag_usage_common_model import ConversationHistoryRagUsageCommonModel + from .conversation_history_redaction_config import ConversationHistoryRedactionConfig + from .conversation_history_sip_trunking_phone_call_model import ConversationHistorySipTrunkingPhoneCallModel + from .conversation_history_transcript_api_integration_webhook_tools_result_common_model_input import ( + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput, + ) + from .conversation_history_transcript_api_integration_webhook_tools_result_common_model_output import ( + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput, + ) + from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput + from .conversation_history_transcript_common_model_input_role import ( + ConversationHistoryTranscriptCommonModelInputRole, + ) + from .conversation_history_transcript_common_model_input_tool_results_item import ( + ConversationHistoryTranscriptCommonModelInputToolResultsItem, + ) + from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput + from .conversation_history_transcript_common_model_output_role import ( + ConversationHistoryTranscriptCommonModelOutputRole, + ) + from .conversation_history_transcript_common_model_output_tool_results_item import ( + ConversationHistoryTranscriptCommonModelOutputToolResultsItem, + ) + from .conversation_history_transcript_file_input_response_model import ( + ConversationHistoryTranscriptFileInputResponseModel, + ) + from .conversation_history_transcript_other_tools_result_common_model import ( + ConversationHistoryTranscriptOtherToolsResultCommonModel, + ) + from .conversation_history_transcript_other_tools_result_common_model_type import ( + ConversationHistoryTranscriptOtherToolsResultCommonModelType, + ) + from .conversation_history_transcript_response_model import ConversationHistoryTranscriptResponseModel + from .conversation_history_transcript_response_model_role import ConversationHistoryTranscriptResponseModelRole + from .conversation_history_transcript_response_model_tool_results_item import ( + ConversationHistoryTranscriptResponseModelToolResultsItem, + ) + from .conversation_history_transcript_system_tool_result_common_model_input import ( + ConversationHistoryTranscriptSystemToolResultCommonModelInput, + ) + from .conversation_history_transcript_system_tool_result_common_model_input_result import ( + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_Dummy, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndCallSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseRagSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_LanguageDetectionSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_SkipTurnSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TestingToolResult, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberAmazonConnectSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberExotelSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberSipSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberTwilioSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_VoicemailDetectionSuccess, + ) + from .conversation_history_transcript_system_tool_result_common_model_output import ( + ConversationHistoryTranscriptSystemToolResultCommonModelOutput, + ) + from .conversation_history_transcript_system_tool_result_common_model_output_result import ( + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_Dummy, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndCallSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseRagSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_LanguageDetectionSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_SkipTurnSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TestingToolResult, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberAmazonConnectSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberExotelSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberSipSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberTwilioSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_VoicemailDetectionSuccess, + ) + from .conversation_history_transcript_tool_call_api_integration_webhook_details_input import ( + ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsInput, + ) + from .conversation_history_transcript_tool_call_api_integration_webhook_details_output import ( + ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsOutput, + ) + from .conversation_history_transcript_tool_call_client_details import ( + ConversationHistoryTranscriptToolCallClientDetails, + ) + from .conversation_history_transcript_tool_call_common_model_input import ( + ConversationHistoryTranscriptToolCallCommonModelInput, + ) + from .conversation_history_transcript_tool_call_common_model_input_tool_details import ( + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_ApiIntegrationWebhook, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Client, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Mcp, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Webhook, + ) + from .conversation_history_transcript_tool_call_common_model_output import ( + ConversationHistoryTranscriptToolCallCommonModelOutput, + ) + from .conversation_history_transcript_tool_call_common_model_output_tool_details import ( + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_ApiIntegrationWebhook, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Client, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Mcp, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Webhook, + ) + from .conversation_history_transcript_tool_call_mcp_details import ConversationHistoryTranscriptToolCallMcpDetails + from .conversation_history_transcript_tool_call_webhook_details import ( + ConversationHistoryTranscriptToolCallWebhookDetails, + ) + from .conversation_history_transcript_workflow_tools_result_common_model_input import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, + ) + from .conversation_history_transcript_workflow_tools_result_common_model_output import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, + ) + from .conversation_history_twilio_phone_call_model import ConversationHistoryTwilioPhoneCallModel + from .conversation_initiation_client_data_config_input import ConversationInitiationClientDataConfigInput + from .conversation_initiation_client_data_config_output import ConversationInitiationClientDataConfigOutput + from .conversation_initiation_client_data_internal import ConversationInitiationClientDataInternal + from .conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput + from .conversation_initiation_client_data_request_output import ConversationInitiationClientDataRequestOutput + from .conversation_initiation_client_data_webhook import ConversationInitiationClientDataWebhook + from .conversation_initiation_client_data_webhook_request_headers_value import ( + ConversationInitiationClientDataWebhookRequestHeadersValue, + ) + from .conversation_initiation_source import ConversationInitiationSource + from .conversation_initiation_source_info import ConversationInitiationSourceInfo + from .conversation_product import ConversationProduct + from .conversation_reasoning_model import ConversationReasoningModel + from .conversation_sentiment_analysis import ConversationSentimentAnalysis + from .conversation_sentiment_analysis_overall_label import ConversationSentimentAnalysisOverallLabel + from .conversation_signed_url_response_model import ConversationSignedUrlResponseModel + from .conversation_simulation_specification import ConversationSimulationSpecification + from .conversation_source import ConversationSource + from .conversation_summary_message_model import ConversationSummaryMessageModel + from .conversation_summary_message_model_role import ConversationSummaryMessageModelRole + from .conversation_summary_response_model import ConversationSummaryResponseModel + from .conversation_summary_response_model_status import ConversationSummaryResponseModelStatus + from .conversation_tag_response_model import ConversationTagResponseModel + from .conversation_token_purpose import ConversationTokenPurpose + from .conversation_token_response_model import ConversationTokenResponseModel + from .conversation_tts_usage_model import ConversationTtsUsageModel + from .conversation_turn_metrics import ConversationTurnMetrics + from .conversation_user_response_model import ConversationUserResponseModel + from .conversation_voice_reward_model import ConversationVoiceRewardModel + from .conversation_voice_usage_model import ConversationVoiceUsageModel + from .conversational_config import ConversationalConfig + from .conversational_config_api_model_workflow_override_input import ( + ConversationalConfigApiModelWorkflowOverrideInput, + ) + from .conversational_config_api_model_workflow_override_output import ( + ConversationalConfigApiModelWorkflowOverrideOutput, + ) + from .convert_chapter_response_model import ConvertChapterResponseModel + from .convert_project_response_model import ConvertProjectResponseModel + from .crawl_status import CrawlStatus + from .crawl_type import CrawlType + from .create_agent_branch_response_model import CreateAgentBranchResponseModel + from .create_agent_merge_proposal_response_model import CreateAgentMergeProposalResponseModel + from .create_agent_procedure_params import CreateAgentProcedureParams + from .create_agent_response_model import CreateAgentResponseModel + from .create_agent_rule_params import CreateAgentRuleParams + from .create_agent_test_folder_response_model import CreateAgentTestFolderResponseModel + from .create_agent_test_response_model import CreateAgentTestResponseModel + from .create_asset_params import CreateAssetParams + from .create_audio_native_project_request import CreateAudioNativeProjectRequest + from .create_auth_connection_environment_variable_request import CreateAuthConnectionEnvironmentVariableRequest + from .create_basic_auth_request import CreateBasicAuthRequest + from .create_bearer_auth_request import CreateBearerAuthRequest + from .create_client_appointment_params import CreateClientAppointmentParams + from .create_client_interaction_params import CreateClientInteractionParams + from .create_client_params import CreateClientParams + from .create_client_secret_request import CreateClientSecretRequest + from .create_crawl_job_response_model import CreateCrawlJobResponseModel + from .create_custom_header_auth_request import CreateCustomHeaderAuthRequest + from .create_exotel_phone_number_request import CreateExotelPhoneNumberRequest + from .create_holiday_params import CreateHolidayParams + from .create_location_params import CreateLocationParams + from .create_mtls_auth_request import CreateMtlsAuthRequest + from .create_o_auth_2_client_creds_request import CreateOAuth2ClientCredsRequest + from .create_o_auth_2_jwt_request import CreateOAuth2JwtRequest + from .create_o_auth_2_jwt_request_algorithm import CreateOAuth2JwtRequestAlgorithm + from .create_o_auth_2_jwt_request_token_response_field import CreateOAuth2JwtRequestTokenResponseField + from .create_order_params import CreateOrderParams + from .create_order_request import CreateOrderRequest + from .create_order_response import CreateOrderResponse + from .create_phone_number_response_model import CreatePhoneNumberResponseModel + from .create_previously_generated_voice_request import CreatePreviouslyGeneratedVoiceRequest + from .create_private_key_jwt_request import CreatePrivateKeyJwtRequest + from .create_private_key_jwt_request_algorithm import CreatePrivateKeyJwtRequestAlgorithm + from .create_procedure_request_model import CreateProcedureRequestModel + from .create_procedure_response_model import CreateProcedureResponseModel + from .create_product_params import CreateProductParams + from .create_product_quote_request_params import CreateProductQuoteRequestParams + from .create_pronunciation_dictionary_response_model import CreatePronunciationDictionaryResponseModel + from .create_response_unit_test_request import CreateResponseUnitTestRequest + from .create_secret_environment_variable_request import CreateSecretEnvironmentVariableRequest + from .create_service_params import CreateServiceParams + from .create_service_quote_request_params import CreateServiceQuoteRequestParams + from .create_simulation_test_request import CreateSimulationTestRequest + from .create_sip_trunk_phone_number_request import CreateSipTrunkPhoneNumberRequest + from .create_staff_params import CreateStaffParams + from .create_string_environment_variable_request import CreateStringEnvironmentVariableRequest + from .create_tool_call_unit_test_request import CreateToolCallUnitTestRequest + from .create_transcript_request import CreateTranscriptRequest + from .create_transfer_rule_params import CreateTransferRuleParams + from .create_twilio_phone_number_request import CreateTwilioPhoneNumberRequest + from .creatify_aurora_request import CreatifyAuroraRequest + from .creatify_aurora_request_resolution import CreatifyAuroraRequestResolution + from .criteria_scoring_mode import CriteriaScoringMode + from .cue_options_request import CueOptionsRequest + from .currency import Currency + from .custom_guardrail_config import CustomGuardrailConfig + from .custom_guardrail_config_model import CustomGuardrailConfigModel + from .custom_guardrail_config_trigger_action import ( + CustomGuardrailConfigTriggerAction, + CustomGuardrailConfigTriggerAction_EndCall, + CustomGuardrailConfigTriggerAction_Retry, + ) + from .custom_guardrail_input import CustomGuardrailInput + from .custom_guardrail_output import CustomGuardrailOutput + from .custom_guardrails_config_input import CustomGuardrailsConfigInput + from .custom_guardrails_config_output import CustomGuardrailsConfigOutput + from .custom_header_auth_response import CustomHeaderAuthResponse + from .custom_llm import CustomLlm + from .custom_llm_api_key import CustomLlmApiKey + from .custom_llm_auth_connection import CustomLlmAuthConnection + from .custom_llm_request_headers_value import CustomLlmRequestHeadersValue + from .custom_llmapi_type import CustomLlmapiType + from .custom_sip_header import CustomSipHeader + from .custom_sip_header_with_dynamic_variable import CustomSipHeaderWithDynamicVariable + from .dashboard_call_success_chart_model import DashboardCallSuccessChartModel + from .dashboard_criteria_chart_model import DashboardCriteriaChartModel + from .dashboard_data_collection_chart_model import DashboardDataCollectionChartModel + from .data_collection_result_common_model import DataCollectionResultCommonModel + from .default_sharing_group_config import DefaultSharingGroupConfig + from .default_sharing_group_config_permission_level import DefaultSharingGroupConfigPermissionLevel + from .default_sharing_group_response_model import DefaultSharingGroupResponseModel + from .default_sharing_group_response_model_permission_level import DefaultSharingGroupResponseModelPermissionLevel + from .delete_agent_hold_audio_response_model import DeleteAgentHoldAudioResponseModel + from .delete_agent_procedure_params import DeleteAgentProcedureParams + from .delete_agent_rule_params import DeleteAgentRuleParams + from .delete_asset_params import DeleteAssetParams + from .delete_calendar_event_params import DeleteCalendarEventParams + from .delete_chapter_request import DeleteChapterRequest + from .delete_chapter_response_model import DeleteChapterResponseModel + from .delete_client_interaction_params import DeleteClientInteractionParams + from .delete_client_params import DeleteClientParams + from .delete_dubbing_response_model import DeleteDubbingResponseModel + from .delete_group_session_params import DeleteGroupSessionParams + from .delete_history_item_response import DeleteHistoryItemResponse + from .delete_holiday_params import DeleteHolidayParams + from .delete_location_params import DeleteLocationParams + from .delete_product_params import DeleteProductParams + from .delete_project_request import DeleteProjectRequest + from .delete_project_response_model import DeleteProjectResponseModel + from .delete_sample_response import DeleteSampleResponse + from .delete_service_params import DeleteServiceParams + from .delete_staff_params import DeleteStaffParams + from .delete_transfer_rule_params import DeleteTransferRuleParams + from .delete_user_voice_collection_response_model import DeleteUserVoiceCollectionResponseModel + from .delete_voice_response_model import DeleteVoiceResponseModel + from .delete_voice_sample_response_model import DeleteVoiceSampleResponseModel + from .delete_workspace_group_member_response_model import DeleteWorkspaceGroupMemberResponseModel + from .delete_workspace_invite_response_model import DeleteWorkspaceInviteResponseModel + from .delete_workspace_webhook_response_model import DeleteWorkspaceWebhookResponseModel + from .deliverable_info import DeliverableInfo + from .dependent_available_agent_identifier import DependentAvailableAgentIdentifier + from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + from .dependent_available_mcp_server_identifier import DependentAvailableMcpServerIdentifier + from .dependent_available_mcp_server_identifier_access_level import DependentAvailableMcpServerIdentifierAccessLevel + from .dependent_available_tool_identifier import DependentAvailableToolIdentifier + from .dependent_available_tool_identifier_access_level import DependentAvailableToolIdentifierAccessLevel + from .dependent_branch_info import DependentBranchInfo + from .dependent_integration_connection_identifier import DependentIntegrationConnectionIdentifier + from .dependent_phone_number_identifier import DependentPhoneNumberIdentifier + from .dependent_unknown_agent_identifier import DependentUnknownAgentIdentifier + from .dependent_unknown_mcp_server_identifier import DependentUnknownMcpServerIdentifier + from .dependent_unknown_tool_identifier import DependentUnknownToolIdentifier + from .detailed_music_response import DetailedMusicResponse + from .detailed_music_response_composition_plan import DetailedMusicResponseCompositionPlan + from .detected_entity import DetectedEntity + from .device_model import DeviceModel + from .dialogue_input import DialogueInput + from .dialogue_input_response_model import DialogueInputResponseModel + from .dialogue_text_alignment import DialogueTextAlignment + from .direct_publishing_read_response_model import DirectPublishingReadResponseModel + from .direct_publishing_read_response_model_display_mode import DirectPublishingReadResponseModelDisplayMode + from .direct_publishing_read_response_model_genre_item import DirectPublishingReadResponseModelGenreItem + from .direct_publishing_read_response_model_payout_type import DirectPublishingReadResponseModelPayoutType + from .direct_publishing_read_response_model_target_audience import DirectPublishingReadResponseModelTargetAudience + from .discount_response_model import DiscountResponseModel + from .do_dubbing_response import DoDubbingResponse + from .document_usage_mode_enum import DocumentUsageModeEnum + from .docx_export_options import DocxExportOptions + from .dtmf_input_config import DtmfInputConfig + from .dub_order_item_request import DubOrderItemRequest + from .dubbed_segment import DubbedSegment + from .dubbing_audio import DubbingAudio + from .dubbing_audio_output_error import DubbingAudioOutputError + from .dubbing_auth_error import DubbingAuthError + from .dubbing_bulk_source_segment_update_response import DubbingBulkSourceSegmentUpdateResponse + from .dubbing_bulk_target_segment_update_response import DubbingBulkTargetSegmentUpdateResponse + from .dubbing_committed_transcript import DubbingCommittedTranscript + from .dubbing_end_of_stream import DubbingEndOfStream + from .dubbing_error import DubbingError + from .dubbing_input_audio_chunk import DubbingInputAudioChunk + from .dubbing_input_error import DubbingInputError + from .dubbing_invalid_request_error import DubbingInvalidRequestError + from .dubbing_language_list_response import DubbingLanguageListResponse + from .dubbing_language_outputs import DubbingLanguageOutputs + from .dubbing_language_response import DubbingLanguageResponse + from .dubbing_language_response_status import DubbingLanguageResponseStatus + from .dubbing_media_metadata import DubbingMediaMetadata + from .dubbing_media_reference import DubbingMediaReference + from .dubbing_metadata_page_response_model import DubbingMetadataPageResponseModel + from .dubbing_metadata_response import DubbingMetadataResponse + from .dubbing_partial_transcript import DubbingPartialTranscript + from .dubbing_project_list_response import DubbingProjectListResponse + from .dubbing_project_response import DubbingProjectResponse + from .dubbing_project_response_status import DubbingProjectResponseStatus + from .dubbing_queue_overflow_error import DubbingQueueOverflowError + from .dubbing_rate_limited_error import DubbingRateLimitedError + from .dubbing_regenerate_response import DubbingRegenerateResponse + from .dubbing_release_channel import DubbingReleaseChannel + from .dubbing_render_response_model import DubbingRenderResponseModel + from .dubbing_resource import DubbingResource + from .dubbing_segment_update_request import DubbingSegmentUpdateRequest + from .dubbing_session_started import DubbingSessionStarted + from .dubbing_source_media_info import DubbingSourceMediaInfo + from .dubbing_source_segment_update_response import DubbingSourceSegmentUpdateResponse + from .dubbing_source_transcript_response import DubbingSourceTranscriptResponse + from .dubbing_status import DubbingStatus + from .dubbing_status_status import DubbingStatusStatus + from .dubbing_target_segment_update_request import DubbingTargetSegmentUpdateRequest + from .dubbing_target_segment_update_response import DubbingTargetSegmentUpdateResponse + from .dubbing_target_transcript_response import DubbingTargetTranscriptResponse + from .dubbing_target_transcript_segment import DubbingTargetTranscriptSegment + from .dubbing_transcriber_error import DubbingTranscriberError + from .dubbing_transcript import DubbingTranscript + from .dubbing_transcript_character import DubbingTranscriptCharacter + from .dubbing_transcript_response_model import DubbingTranscriptResponseModel + from .dubbing_transcript_revision_response import DubbingTranscriptRevisionResponse + from .dubbing_transcript_segment import DubbingTranscriptSegment + from .dubbing_transcript_utterance import DubbingTranscriptUtterance + from .dubbing_transcript_word import DubbingTranscriptWord + from .dubbing_transcripts_response_model import DubbingTranscriptsResponseModel + from .dubbing_transcripts_response_model_transcript_format import DubbingTranscriptsResponseModelTranscriptFormat + from .dubbing_translation import DubbingTranslation + from .dubbing_translation_error import DubbingTranslationError + from .dummy_tool_result_model import DummyToolResultModel + from .duplicate_speech_engine_request import DuplicateSpeechEngineRequest + from .dynamic_variable_assignment import DynamicVariableAssignment + from .dynamic_variable_internal_value_type import DynamicVariableInternalValueType + from .dynamic_variable_nested_value_type_input import DynamicVariableNestedValueTypeInput + from .dynamic_variable_nested_value_type_output import DynamicVariableNestedValueTypeOutput + from .dynamic_variable_schema_override import DynamicVariableSchemaOverride + from .dynamic_variable_update_common_model import DynamicVariableUpdateCommonModel + from .dynamic_variables_config import DynamicVariablesConfig + from .dynamic_variables_config_workflow_override import DynamicVariablesConfigWorkflowOverride + from .eagerness import Eagerness + from .edit_chapter_response_model import EditChapterResponseModel + from .edit_project_response_model import EditProjectResponseModel + from .edit_voice_response_model import EditVoiceResponseModel + from .edit_voice_settings_request import EditVoiceSettingsRequest + from .edit_voice_settings_response_model import EditVoiceSettingsResponseModel + from .edited_transcript import EditedTranscript + from .effects_spec_input import EffectsSpecInput + from .effects_spec_output import EffectsSpecOutput + from .eleven_flash_v_25_request import ElevenFlashV25Request + from .eleven_flash_v_25_request_output_format import ElevenFlashV25RequestOutputFormat + from .eleven_flash_v_25_voice_settings import ElevenFlashV25VoiceSettings + from .eleven_multilingual_v_2_request import ElevenMultilingualV2Request + from .eleven_multilingual_v_2_request_output_format import ElevenMultilingualV2RequestOutputFormat + from .eleven_v_3_request import ElevenV3Request + from .eleven_v_3_request_output_format import ElevenV3RequestOutputFormat + from .eleven_v_3_voice_settings import ElevenV3VoiceSettings + from .embed_variant import EmbedVariant + from .embedding_model_enum import EmbeddingModelEnum + from .end_call_tool_config import EndCallToolConfig + from .end_call_tool_result_model import EndCallToolResultModel + from .end_call_trigger_action import EndCallTriggerAction + from .end_procedure_tool_config import EndProcedureToolConfig + from .end_procedure_tool_config_procedures_value import EndProcedureToolConfigProceduresValue + from .end_procedure_tool_error_status import EndProcedureToolErrorStatus + from .end_procedure_tool_result_error_model import EndProcedureToolResultErrorModel + from .end_procedure_tool_result_success_model import EndProcedureToolResultSuccessModel + from .entity_management_activity_id import EntityManagementActivityId + from .entry_behavior import EntryBehavior + from .environment_auth_connection_locator import EnvironmentAuthConnectionLocator + from .environment_response import EnvironmentResponse + from .environment_variable_auth_connection_value import EnvironmentVariableAuthConnectionValue + from .environment_variable_auth_connection_value_request import EnvironmentVariableAuthConnectionValueRequest + from .environment_variable_response import EnvironmentVariableResponse + from .environment_variable_response_type import EnvironmentVariableResponseType + from .environment_variable_response_values import EnvironmentVariableResponseValues + from .environment_variable_secret_value import EnvironmentVariableSecretValue + from .environment_variable_secret_value_request import EnvironmentVariableSecretValueRequest + from .environment_variables_list_response import EnvironmentVariablesListResponse + from .environments_list_response import EnvironmentsListResponse + from .error_payload import ErrorPayload + from .evaluation_criteria_summary_result import EvaluationCriteriaSummaryResult + from .evaluation_result_filter import EvaluationResultFilter + from .evaluation_settings_input import EvaluationSettingsInput + from .evaluation_settings_output import EvaluationSettingsOutput + from .evaluation_success_result import EvaluationSuccessResult + from .exact_parameter_evaluation_strategy import ExactParameterEvaluationStrategy + from .exotel_api_subdomain import ExotelApiSubdomain + from .exotel_outbound_call_response import ExotelOutboundCallResponse + from .experiment_assignment import ExperimentAssignment + from .experiment_assignment_source import ExperimentAssignmentSource + from .expires_after import ExpiresAfter + from .export_options import ( + ExportOptions, + ExportOptions_Docx, + ExportOptions_Html, + ExportOptions_Pdf, + ExportOptions_SegmentedJson, + ExportOptions_Srt, + ExportOptions_Txt, + ) + from .external_file_sync_info import ExternalFileSyncInfo + from .external_folder_sync_info import ExternalFolderSyncInfo + from .external_sync_job_trigger import ExternalSyncJobTrigger + from .external_sync_job_type import ExternalSyncJobType + from .external_sync_provider import ExternalSyncProvider + from .feature_status_common_model import FeatureStatusCommonModel + from .features_usage_common_model import FeaturesUsageCommonModel + from .feedback_item import FeedbackItem + from .field_conflict import FieldConflict + from .file_input_config import FileInputConfig + from .file_input_config_workflow_override import FileInputConfigWorkflowOverride + from .file_refresh_status import FileRefreshStatus + from .final_output import FinalOutput + from .final_output_multi import FinalOutputMulti + from .fine_tuning_response import FineTuningResponse + from .fine_tuning_response_state_value import FineTuningResponseStateValue + from .finetune_created_by import FinetuneCreatedBy + from .finetune_visibility import FinetuneVisibility + from .flush_context import FlushContext + from .focus_guardrail import FocusGuardrail + from .forced_alignment_character_response_model import ForcedAlignmentCharacterResponseModel + from .forced_alignment_response_model import ForcedAlignmentResponseModel + from .forced_alignment_word_response_model import ForcedAlignmentWordResponseModel + from .frustrated_conversation_ref import FrustratedConversationRef + from .frustrated_conversation_ref_overall_label import FrustratedConversationRefOverallLabel + from .gemini_25_flash_image_request import Gemini25FlashImageRequest + from .gemini_25_flash_image_request_aspect_ratio import Gemini25FlashImageRequestAspectRatio + from .gemini_31_flash_image_request import Gemini31FlashImageRequest + from .gemini_31_flash_image_request_aspect_ratio import Gemini31FlashImageRequestAspectRatio + from .gemini_31_flash_image_request_resolution import Gemini31FlashImageRequestResolution + from .gemini_31_flash_lite_image_request import Gemini31FlashLiteImageRequest + from .gemini_31_flash_lite_image_request_aspect_ratio import Gemini31FlashLiteImageRequestAspectRatio + from .gemini_3_pro_image_request import Gemini3ProImageRequest + from .gemini_3_pro_image_request_aspect_ratio import Gemini3ProImageRequestAspectRatio + from .gemini_3_pro_image_request_resolution import Gemini3ProImageRequestResolution + from .gender import Gender + from .generate_voice_request import GenerateVoiceRequest + from .generation_chunk_input import GenerationChunkInput + from .generation_chunk_input_context_adherence import GenerationChunkInputContextAdherence + from .generation_chunk_output import GenerationChunkOutput + from .generation_chunk_output_context_adherence import GenerationChunkOutputContextAdherence + from .generation_config import GenerationConfig + from .generation_reference import GenerationReference + from .generation_source_context import GenerationSourceContext + from .genesys_bot_outcome import GenesysBotOutcome + from .genesys_region import GenesysRegion + from .get_agent_config_params import GetAgentConfigParams + from .get_agent_conversation_tickets_page_response_model import GetAgentConversationTicketsPageResponseModel + from .get_agent_embed_response_model import GetAgentEmbedResponseModel + from .get_agent_knowledgebase_size_response_model import GetAgentKnowledgebaseSizeResponseModel + from .get_agent_link_response_model import GetAgentLinkResponseModel + from .get_agent_response_model import GetAgentResponseModel + from .get_agent_response_model_phone_numbers_item import ( + GetAgentResponseModelPhoneNumbersItem, + GetAgentResponseModelPhoneNumbersItem_Exotel, + GetAgentResponseModelPhoneNumbersItem_SipTrunk, + GetAgentResponseModelPhoneNumbersItem_Twilio, + ) + from .get_agent_test_folder_response_model import GetAgentTestFolderResponseModel + from .get_agent_topics_response_model import GetAgentTopicsResponseModel + from .get_agents_page_response_model import GetAgentsPageResponseModel + from .get_analytics_summary_params import GetAnalyticsSummaryParams + from .get_appointment_by_confirmation_number_params import GetAppointmentByConfirmationNumberParams + from .get_audio_isolation_history_response_model import GetAudioIsolationHistoryResponseModel + from .get_audio_native_project_settings_response_model import GetAudioNativeProjectSettingsResponseModel + from .get_booking_page_settings_params import GetBookingPageSettingsParams + from .get_booking_slug_status_params import GetBookingSlugStatusParams + from .get_chapter_request import GetChapterRequest + from .get_chapter_snapshots_request import GetChapterSnapshotsRequest + from .get_chapters_request import GetChaptersRequest + from .get_chapters_response import GetChaptersResponse + from .get_client_appointments_params import GetClientAppointmentsParams + from .get_client_by_phone_params import GetClientByPhoneParams + from .get_client_orders_params import GetClientOrdersParams + from .get_conv_ai_dashboard_settings_response_model import GetConvAiDashboardSettingsResponseModel + from .get_conv_ai_dashboard_settings_response_model_charts_item import ( + GetConvAiDashboardSettingsResponseModelChartsItem, + GetConvAiDashboardSettingsResponseModelChartsItem_CallSuccess, + GetConvAiDashboardSettingsResponseModelChartsItem_Criteria, + GetConvAiDashboardSettingsResponseModelChartsItem_DataCollection, + ) + from .get_conv_ai_settings_response_model import GetConvAiSettingsResponseModel + from .get_conversation_response_model import GetConversationResponseModel + from .get_conversation_response_model_status import GetConversationResponseModelStatus + from .get_conversation_summary_response_model import GetConversationSummaryResponseModel + from .get_conversation_summary_response_model_status import GetConversationSummaryResponseModelStatus + from .get_conversation_tags_page_response_model import GetConversationTagsPageResponseModel + from .get_conversation_users_page_response_model import GetConversationUsersPageResponseModel + from .get_conversations_page_response_model import GetConversationsPageResponseModel + from .get_crawl_job_response_model import GetCrawlJobResponseModel + from .get_knowledge_base_dependent_agents_response_model import GetKnowledgeBaseDependentAgentsResponseModel + from .get_knowledge_base_dependent_agents_response_model_agents_item import ( + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem, + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Available, + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Unknown, + ) + from .get_knowledge_base_file_response_model import GetKnowledgeBaseFileResponseModel + from .get_knowledge_base_folder_response_model import GetKnowledgeBaseFolderResponseModel + from .get_knowledge_base_list_response_model import GetKnowledgeBaseListResponseModel + from .get_knowledge_base_list_response_model_documents_item import ( + GetKnowledgeBaseListResponseModelDocumentsItem, + GetKnowledgeBaseListResponseModelDocumentsItem_File, + GetKnowledgeBaseListResponseModelDocumentsItem_Folder, + GetKnowledgeBaseListResponseModelDocumentsItem_Text, + GetKnowledgeBaseListResponseModelDocumentsItem_Url, + ) + from .get_knowledge_base_summary_file_response_model import GetKnowledgeBaseSummaryFileResponseModel + from .get_knowledge_base_summary_file_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem, + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Unknown, + ) + from .get_knowledge_base_summary_folder_response_model import GetKnowledgeBaseSummaryFolderResponseModel + from .get_knowledge_base_summary_folder_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem, + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Unknown, + ) + from .get_knowledge_base_summary_text_response_model import GetKnowledgeBaseSummaryTextResponseModel + from .get_knowledge_base_summary_text_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem, + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Unknown, + ) + from .get_knowledge_base_summary_url_response_model import GetKnowledgeBaseSummaryUrlResponseModel + from .get_knowledge_base_summary_url_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem, + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Unknown, + ) + from .get_knowledge_base_text_response_model import GetKnowledgeBaseTextResponseModel + from .get_knowledge_base_url_response_model import GetKnowledgeBaseUrlResponseModel + from .get_library_voices_response import GetLibraryVoicesResponse + from .get_live_count_response import GetLiveCountResponse + from .get_or_create_rag_index_request_model import GetOrCreateRagIndexRequestModel + from .get_order_by_confirmation_number_params import GetOrderByConfirmationNumberParams + from .get_phone_number_exotel_response_model import GetPhoneNumberExotelResponseModel + from .get_phone_number_inbound_sip_trunk_config_response_model import ( + GetPhoneNumberInboundSipTrunkConfigResponseModel, + ) + from .get_phone_number_outbound_sip_trunk_config_response_model import ( + GetPhoneNumberOutboundSipTrunkConfigResponseModel, + ) + from .get_phone_number_response import GetPhoneNumberResponse + from .get_phone_number_sip_trunk_response_model import GetPhoneNumberSipTrunkResponseModel + from .get_phone_number_twilio_response_model import GetPhoneNumberTwilioResponseModel + from .get_phone_numbers_page_response_model import GetPhoneNumbersPageResponseModel + from .get_phone_numbers_page_response_model_phone_numbers_item import ( + GetPhoneNumbersPageResponseModelPhoneNumbersItem, + GetPhoneNumbersPageResponseModelPhoneNumbersItem_Exotel, + GetPhoneNumbersPageResponseModelPhoneNumbersItem_SipTrunk, + GetPhoneNumbersPageResponseModelPhoneNumbersItem_Twilio, + ) + from .get_project_request import GetProjectRequest + from .get_projects_request import GetProjectsRequest + from .get_projects_response import GetProjectsResponse + from .get_pronunciation_dictionaries_metadata_response_model import ( + GetPronunciationDictionariesMetadataResponseModel, + ) + from .get_pronunciation_dictionaries_response import GetPronunciationDictionariesResponse + from .get_pronunciation_dictionary_metadata_response import GetPronunciationDictionaryMetadataResponse + from .get_pronunciation_dictionary_metadata_response_permission_on_resource import ( + GetPronunciationDictionaryMetadataResponsePermissionOnResource, + ) + from .get_pronunciation_dictionary_response import GetPronunciationDictionaryResponse + from .get_pronunciation_dictionary_with_rules_response_model import GetPronunciationDictionaryWithRulesResponseModel + from .get_pronunciation_dictionary_with_rules_response_model_permission_on_resource import ( + GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource, + ) + from .get_pronunciation_dictionary_with_rules_response_model_rules_item import ( + GetPronunciationDictionaryWithRulesResponseModelRulesItem, + GetPronunciationDictionaryWithRulesResponseModelRulesItem_Alias, + GetPronunciationDictionaryWithRulesResponseModelRulesItem_Phoneme, + ) + from .get_response_unit_test_response_model import GetResponseUnitTestResponseModel + from .get_schedule_params import GetScheduleParams + from .get_secret_dependencies_response_model import GetSecretDependenciesResponseModel + from .get_secret_dependencies_response_model_dependencies import GetSecretDependenciesResponseModelDependencies + from .get_secret_dependencies_response_model_dependencies_one_item import ( + GetSecretDependenciesResponseModelDependenciesOneItem, + GetSecretDependenciesResponseModelDependenciesOneItem_Available, + GetSecretDependenciesResponseModelDependenciesOneItem_Unknown, + ) + from .get_secret_dependencies_response_model_dependencies_zero_item import ( + GetSecretDependenciesResponseModelDependenciesZeroItem, + GetSecretDependenciesResponseModelDependenciesZeroItem_Available, + GetSecretDependenciesResponseModelDependenciesZeroItem_Unknown, + ) + from .get_simulation_test_response_model import GetSimulationTestResponseModel + from .get_sip_log_messages_response import GetSipLogMessagesResponse + from .get_speech_history_response import GetSpeechHistoryResponse + from .get_test_invocations_page_response_model import GetTestInvocationsPageResponseModel + from .get_test_suite_invocation_response_model import GetTestSuiteInvocationResponseModel + from .get_tests_page_response_model import GetTestsPageResponseModel + from .get_tests_summaries_by_ids_response_model import GetTestsSummariesByIdsResponseModel + from .get_tool_call_unit_test_response_model import GetToolCallUnitTestResponseModel + from .get_tool_dependent_agents_response_model import GetToolDependentAgentsResponseModel + from .get_tool_dependent_agents_response_model_agents_item import ( + GetToolDependentAgentsResponseModelAgentsItem, + GetToolDependentAgentsResponseModelAgentsItem_Available, + GetToolDependentAgentsResponseModelAgentsItem_Unknown, + ) + from .get_tool_executions_page_response_model import GetToolExecutionsPageResponseModel + from .get_user_voice_collections_response_model import GetUserVoiceCollectionsResponseModel + from .get_voice_accents_response_model import GetVoiceAccentsResponseModel + from .get_voices_response import GetVoicesResponse + from .get_voices_v_2_response import GetVoicesV2Response + from .get_whats_app_account_response import GetWhatsAppAccountResponse + from .get_workspace_plan_params import GetWorkspacePlanParams + from .get_workspace_secrets_response_model import GetWorkspaceSecretsResponseModel + from .gpt_image_15_request import GptImage15Request + from .gpt_image_15_request_aspect_ratio import GptImage15RequestAspectRatio + from .gpt_image_15_request_background import GptImage15RequestBackground + from .gpt_image_15_request_quality import GptImage15RequestQuality + from .gpt_image_1_request import GptImage1Request + from .gpt_image_1_request_aspect_ratio import GptImage1RequestAspectRatio + from .gpt_image_1_request_background import GptImage1RequestBackground + from .gpt_image_1_request_quality import GptImage1RequestQuality + from .gpt_image_25_flare_request import GptImage25FlareRequest + from .gpt_image_25_flare_request_aspect_ratio import GptImage25FlareRequestAspectRatio + from .gpt_image_25_flare_request_quality import GptImage25FlareRequestQuality + from .gpt_image_25_flare_request_resolution import GptImage25FlareRequestResolution + from .gpt_image_25_sunburst_request import GptImage25SunburstRequest + from .gpt_image_25_sunburst_request_aspect_ratio import GptImage25SunburstRequestAspectRatio + from .gpt_image_25_sunburst_request_quality import GptImage25SunburstRequestQuality + from .gpt_image_25_sunburst_request_resolution import GptImage25SunburstRequestResolution + from .gpt_image_2_request import GptImage2Request + from .gpt_image_2_request_aspect_ratio import GptImage2RequestAspectRatio + from .gpt_image_2_request_quality import GptImage2RequestQuality + from .gpt_image_2_request_resolution import GptImage2RequestResolution + from .group_management_activity_id import GroupManagementActivityId + from .guardrail_execution_mode import GuardrailExecutionMode + from .guardrail_type import GuardrailType + from .guardrails_result import GuardrailsResult + from .guardrails_v_1_input import GuardrailsV1Input + from .guardrails_v_1_output import GuardrailsV1Output + from .hiding_reason import HidingReason + from .history_alignment_response_model import HistoryAlignmentResponseModel + from .history_alignments_response_model import HistoryAlignmentsResponseModel + from .history_item_response import HistoryItemResponse + from .html_export_options import HtmlExportOptions + from .http_request_model import HttpRequestModel + from .http_validation_error import HttpValidationError + from .icon import Icon + from .icon_theme import IconTheme + from .image_analysis import ImageAnalysis + from .image_analysis_result import ImageAnalysisResult + from .image_analysis_status import ImageAnalysisStatus + from .image_avatar import ImageAvatar + from .image_generation_request import ( + ImageGenerationRequest, + ImageGenerationRequest_BytedanceSeedream5Lite, + ImageGenerationRequest_BytedanceSeedream5Pro, + ImageGenerationRequest_Gemini25FlashImage, + ImageGenerationRequest_Gemini31FlashImage, + ImageGenerationRequest_Gemini31FlashLiteImage, + ImageGenerationRequest_Gemini3ProImage, + ImageGenerationRequest_GptImage1, + ImageGenerationRequest_GptImage15, + ImageGenerationRequest_GptImage2, + ImageGenerationRequest_GptImage25Flare, + ImageGenerationRequest_GptImage25Sunburst, + ) + from .image_reference import ( + ImageReference, + ImageReference_Asset, + ImageReference_Generation, + ImageReference_InlineBase64, + ) + from .image_schema import ImageSchema + from .image_subject import ImageSubject + from .inbound_sip_trunk_config_request_model import InboundSipTrunkConfigRequestModel + from .init_payload import InitPayload + from .initialise_context import InitialiseContext + from .initialize_connection import InitializeConnection + from .initialize_connection_multi import InitializeConnectionMulti + from .inline_audio_reference import InlineAudioReference + from .inline_audio_reference_mime_type import InlineAudioReferenceMimeType + from .inline_base_64_reference import InlineBase64Reference + from .inline_base_64_reference_mime_type import InlineBase64ReferenceMimeType + from .inline_image_reference import InlineImageReference + from .inline_image_reference_mime_type import InlineImageReferenceMimeType + from .inline_video_reference import InlineVideoReference + from .inline_video_reference_mime_type import InlineVideoReferenceMimeType + from .input_audio_chunk_payload import InputAudioChunkPayload + from .integer_schema import IntegerSchema + from .integration_type import IntegrationType + from .interaction_budget import InteractionBudget + from .internal_alerting_webhook_notifier import InternalAlertingWebhookNotifier + from .internal_sampling_config_response_model import InternalSamplingConfigResponseModel + from .invoice_response import InvoiceResponse + from .invoice_response_payment_intent_status import InvoiceResponsePaymentIntentStatus + from .invoice_response_payment_intent_statusses_item import InvoiceResponsePaymentIntentStatussesItem + from .item_id import ItemId + from .kb_external_sync_job import KbExternalSyncJob + from .keep_context_alive import KeepContextAlive + from .knowledge_base_bulk_delete_successful_response_model import KnowledgeBaseBulkDeleteSuccessfulResponseModel + from .knowledge_base_content_search_response_model import KnowledgeBaseContentSearchResponseModel + from .knowledge_base_content_search_result import KnowledgeBaseContentSearchResult + from .knowledge_base_content_search_result_document import ( + KnowledgeBaseContentSearchResultDocument, + KnowledgeBaseContentSearchResultDocument_File, + KnowledgeBaseContentSearchResultDocument_Folder, + KnowledgeBaseContentSearchResultDocument_Text, + KnowledgeBaseContentSearchResultDocument_Url, + ) + from .knowledge_base_deleted_response_model import KnowledgeBaseDeletedResponseModel + from .knowledge_base_dependent_type import KnowledgeBaseDependentType + from .knowledge_base_document_chunk_response_model import KnowledgeBaseDocumentChunkResponseModel + from .knowledge_base_document_chunks_response_model import KnowledgeBaseDocumentChunksResponseModel + from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel + from .knowledge_base_document_type import KnowledgeBaseDocumentType + from .knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel + from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, + ) + from .knowledge_base_locator import KnowledgeBaseLocator + from .knowledge_base_rag_chunk_model import KnowledgeBaseRagChunkModel + from .knowledge_base_rag_tool_config import KnowledgeBaseRagToolConfig + from .knowledge_base_rag_tool_result_model import KnowledgeBaseRagToolResultModel + from .knowledge_base_rag_tool_status import KnowledgeBaseRagToolStatus + from .knowledge_base_sort_by import KnowledgeBaseSortBy + from .knowledge_base_source_file_url_response_model import KnowledgeBaseSourceFileUrlResponseModel + from .knowledge_base_summary_batch_successful_response_model import KnowledgeBaseSummaryBatchSuccessfulResponseModel + from .knowledge_base_summary_batch_successful_response_model_data import ( + KnowledgeBaseSummaryBatchSuccessfulResponseModelData, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_File, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Folder, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Text, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Url, + ) + from .knowledge_base_tool_config import KnowledgeBaseToolConfig + from .knowledge_base_tool_info import KnowledgeBaseToolInfo + from .knowledge_base_tool_result_model import KnowledgeBaseToolResultModel + from .knowledge_base_tool_status import KnowledgeBaseToolStatus + from .language_added_response import LanguageAddedResponse + from .language_detection_tool_config import LanguageDetectionToolConfig + from .language_detection_tool_result_model import LanguageDetectionToolResultModel + from .language_info import LanguageInfo + from .language_pair_info import LanguagePairInfo + from .language_preset_input import LanguagePresetInput + from .language_preset_output import LanguagePresetOutput + from .language_preset_translation import LanguagePresetTranslation + from .language_response import LanguageResponse + from .languages_response import LanguagesResponse, LanguagesResponse_Pair, LanguagesResponse_Single + from .leave_message_params import LeaveMessageParams + from .library_voice_response import LibraryVoiceResponse + from .library_voice_response_category import LibraryVoiceResponseCategory + from .list_agent_procedures_params import ListAgentProceduresParams + from .list_agent_references_params import ListAgentReferencesParams + from .list_agent_rules_params import ListAgentRulesParams + from .list_assets_params import ListAssetsParams + from .list_auth_connections_response import ListAuthConnectionsResponse + from .list_auth_connections_response_auth_connections_item import ( + ListAuthConnectionsResponseAuthConnectionsItem, + ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2AuthCode, + ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2CustomApp, + ListAuthConnectionsResponseAuthConnectionsItem_BasicAuth, + ListAuthConnectionsResponseAuthConnectionsItem_BearerAuth, + ListAuthConnectionsResponseAuthConnectionsItem_CustomHeaderAuth, + ListAuthConnectionsResponseAuthConnectionsItem_Mtls, + ListAuthConnectionsResponseAuthConnectionsItem_Oauth2ClientCredentials, + ListAuthConnectionsResponseAuthConnectionsItem_Oauth2Jwt, + ListAuthConnectionsResponseAuthConnectionsItem_PrivateKeyJwt, + ListAuthConnectionsResponseAuthConnectionsItem_RefreshTokenAuth, + ListAuthConnectionsResponseAuthConnectionsItem_SlackBotAuth, + ListAuthConnectionsResponseAuthConnectionsItem_UrlSecret, + ListAuthConnectionsResponseAuthConnectionsItem_WhatsappAuth, + ) + from .list_calendar_events_params import ListCalendarEventsParams + from .list_client_interactions_params import ListClientInteractionsParams + from .list_clients_params import ListClientsParams + from .list_crawl_jobs_response_model import ListCrawlJobsResponseModel + from .list_customer_facing_agents_params import ListCustomerFacingAgentsParams + from .list_group_sessions_params import ListGroupSessionsParams + from .list_holidays_params import ListHolidaysParams + from .list_locations_params import ListLocationsParams + from .list_mcp_tools_response_model import ListMcpToolsResponseModel + from .list_orders_response import ListOrdersResponse + from .list_procedures_response_model import ListProceduresResponseModel + from .list_products_params import ListProductsParams + from .list_response_agent_branch_summary import ListResponseAgentBranchSummary + from .list_response_agent_deployment_history_item import ListResponseAgentDeploymentHistoryItem + from .list_response_meta import ListResponseMeta + from .list_services_params import ListServicesParams + from .list_speech_engines_response import ListSpeechEnginesResponse + from .list_staff_params import ListStaffParams + from .list_transfer_rules_params import ListTransferRulesParams + from .list_whats_app_accounts_response import ListWhatsAppAccountsResponse + from .literal_json_schema_property import LiteralJsonSchemaProperty + from .literal_json_schema_property_constant_value import LiteralJsonSchemaPropertyConstantValue + from .literal_json_schema_property_type import LiteralJsonSchemaPropertyType + from .livekit_stack_type import LivekitStackType + from .llm import Llm + from .llm_category_usage import LlmCategoryUsage + from .llm_deprecation_config_model import LlmDeprecationConfigModel + from .llm_deprecation_info_model import LlmDeprecationInfoModel + from .llm_info_model import LlmInfoModel + from .llm_input_output_tokens_usage import LlmInputOutputTokensUsage + from .llm_list_response_model import LlmListResponseModel + from .llm_literal_json_schema_property import LlmLiteralJsonSchemaProperty + from .llm_literal_json_schema_property_type import LlmLiteralJsonSchemaPropertyType + from .llm_parameter_evaluation_strategy import LlmParameterEvaluationStrategy + from .llm_reasoning_effort import LlmReasoningEffort + from .llm_schema_override import LlmSchemaOverride + from .llm_tokens_category_usage import LlmTokensCategoryUsage + from .llm_usage_calculator_llm_response_model import LlmUsageCalculatorLlmResponseModel + from .llm_usage_calculator_response_model import LlmUsageCalculatorResponseModel + from .llm_usage_input import LlmUsageInput + from .llm_usage_output import LlmUsageOutput + from .load_memory_entry_tool_error_status import LoadMemoryEntryToolErrorStatus + from .loadable_memory_entry import LoadableMemoryEntry + from .lock_reason import LockReason + from .manual_source import ManualSource + from .manual_verification_file_response import ManualVerificationFileResponse + from .manual_verification_response import ManualVerificationResponse + from .match_anything_parameter_evaluation_strategy import MatchAnythingParameterEvaluationStrategy + from .mcp_approval_policy import McpApprovalPolicy + from .mcp_approved_tool_definition import McpApprovedToolDefinition + from .mcp_server_config_input import McpServerConfigInput + from .mcp_server_config_input_auth_connection import McpServerConfigInputAuthConnection + from .mcp_server_config_input_request_headers_value import McpServerConfigInputRequestHeadersValue + from .mcp_server_config_input_request_meta_value import McpServerConfigInputRequestMetaValue + from .mcp_server_config_input_secret_token import McpServerConfigInputSecretToken + from .mcp_server_config_input_url import McpServerConfigInputUrl + from .mcp_server_config_output import McpServerConfigOutput + from .mcp_server_config_output_auth_connection import McpServerConfigOutputAuthConnection + from .mcp_server_config_output_request_headers_value import McpServerConfigOutputRequestHeadersValue + from .mcp_server_config_output_request_meta_value import McpServerConfigOutputRequestMetaValue + from .mcp_server_config_output_secret_token import McpServerConfigOutputSecretToken + from .mcp_server_config_output_url import McpServerConfigOutputUrl + from .mcp_server_metadata_response_model import McpServerMetadataResponseModel + from .mcp_server_response_model import McpServerResponseModel + from .mcp_server_response_model_dependent_agents_item import ( + McpServerResponseModelDependentAgentsItem, + McpServerResponseModelDependentAgentsItem_Available, + McpServerResponseModelDependentAgentsItem_Unknown, + ) + from .mcp_server_transport import McpServerTransport + from .mcp_servers_response_model import McpServersResponseModel + from .mcp_tool_approval_hash import McpToolApprovalHash + from .mcp_tool_approval_policy import McpToolApprovalPolicy + from .mcp_tool_approval_state import McpToolApprovalState + from .mcp_tool_approval_status import McpToolApprovalStatus + from .mcp_tool_config_override_input import McpToolConfigOverrideInput + from .mcp_tool_config_override_input_input_overrides_value import ( + McpToolConfigOverrideInputInputOverridesValue, + McpToolConfigOverrideInputInputOverridesValue_Constant, + McpToolConfigOverrideInputInputOverridesValue_DynamicVariable, + McpToolConfigOverrideInputInputOverridesValue_Llm, + McpToolConfigOverrideInputInputOverridesValue_Omit, + ) + from .mcp_tool_config_override_input_tool_call_sound import McpToolConfigOverrideInputToolCallSound + from .mcp_tool_config_override_output import McpToolConfigOverrideOutput + from .mcp_tool_config_override_output_input_overrides_value import ( + McpToolConfigOverrideOutputInputOverridesValue, + McpToolConfigOverrideOutputInputOverridesValue_Constant, + McpToolConfigOverrideOutputInputOverridesValue_DynamicVariable, + McpToolConfigOverrideOutputInputOverridesValue_Llm, + McpToolConfigOverrideOutputInputOverridesValue_Omit, + ) + from .mcp_tool_config_override_output_tool_call_sound import McpToolConfigOverrideOutputToolCallSound + from .media_codec import MediaCodec + from .media_generation_completed_response import MediaGenerationCompletedResponse + from .media_generation_create_response import MediaGenerationCreateResponse + from .media_generation_failed_response import MediaGenerationFailedResponse + from .media_generation_failed_response_failure_reason import MediaGenerationFailedResponseFailureReason + from .media_generation_in_progress_response import MediaGenerationInProgressResponse + from .media_generation_list_response import MediaGenerationListResponse + from .media_generation_response import ( + MediaGenerationResponse, + MediaGenerationResponse_Completed, + MediaGenerationResponse_Failed, + MediaGenerationResponse_Generating, + MediaGenerationResponse_Pending, + ) + from .media_id import MediaId + from .memory_entry_search_result import MemoryEntrySearchResult + from .memory_entry_search_result_source import MemoryEntrySearchResultSource + from .merge_preview_response_model import MergePreviewResponseModel + from .merge_preview_response_model_phone_numbers_item import ( + MergePreviewResponseModelPhoneNumbersItem, + MergePreviewResponseModelPhoneNumbersItem_Exotel, + MergePreviewResponseModelPhoneNumbersItem_SipTrunk, + MergePreviewResponseModelPhoneNumbersItem_Twilio, + ) + from .merge_proposal_close_reason import MergeProposalCloseReason + from .merge_proposal_comment import MergeProposalComment + from .merge_proposal_review import MergeProposalReview + from .merge_proposal_review_reviewer_role import MergeProposalReviewReviewerRole + from .merge_proposal_review_state import MergeProposalReviewState + from .merge_proposal_status import MergeProposalStatus + from .merged_outcome import MergedOutcome + from .message_search_sort_by import MessageSearchSortBy + from .messages_search_response import MessagesSearchResponse + from .messages_search_result import MessagesSearchResult + from .metric_record import MetricRecord + from .metric_type import MetricType + from .mock_no_match_behavior import MockNoMatchBehavior + from .mocking_strategy import MockingStrategy + from .model import Model + from .model_rates_response_model import ModelRatesResponseModel + from .moderation_config import ModerationConfig + from .moderation_guardrail_input import ModerationGuardrailInput + from .moderation_guardrail_output import ModerationGuardrailOutput + from .moderation_status_response_model import ModerationStatusResponseModel + from .moderation_status_response_model_safety_status import ModerationStatusResponseModelSafetyStatus + from .moderation_status_response_model_warning_status import ModerationStatusResponseModelWarningStatus + from .mtls_auth_response import MtlsAuthResponse + from .multichannel_speech_to_text_response_model import MultichannelSpeechToTextResponseModel + from .multipart_music_response import MultipartMusicResponse + from .music_allowed_output_formats import MusicAllowedOutputFormats + from .music_explore_song_source_context import MusicExploreSongSourceContext + from .music_finetune_failure_reason import MusicFinetuneFailureReason + from .music_finetune_page_response_model import MusicFinetunePageResponseModel + from .music_finetune_response_model import MusicFinetuneResponseModel + from .music_finetune_status import MusicFinetuneStatus + from .music_generation_mode import MusicGenerationMode + from .music_model_id import MusicModelId + from .music_only_output_formats import MusicOnlyOutputFormats + from .music_output_format import MusicOutputFormat + from .music_prompt import MusicPrompt + from .music_upload_response import MusicUploadResponse + from .music_upload_response_composition_plan import MusicUploadResponseCompositionPlan + from .non_streaming_output_formats import NonStreamingOutputFormats + from .normalized_alignment import NormalizedAlignment + from .number_schema import NumberSchema + from .numeric_distribution_aggregate import NumericDistributionAggregate + from .o_auth_2_client_creds_response import OAuth2ClientCredsResponse + from .o_auth_2_jwt_response import OAuth2JwtResponse + from .o_auth_2_jwt_response_algorithm import OAuth2JwtResponseAlgorithm + from .o_auth_2_jwt_response_token_response_field import OAuth2JwtResponseTokenResponseField + from .o_tel_attribute import OTelAttribute + from .o_tel_attribute_value_value import OTelAttributeValueValue + from .o_tel_resource import OTelResource + from .o_tel_resource_spans import OTelResourceSpans + from .o_tel_scope import OTelScope + from .o_tel_scope_spans import OTelScopeSpans + from .o_tel_span import OTelSpan + from .o_tel_status import OTelStatus + from .o_tel_trace_payload import OTelTracePayload + from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput + from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue + from .object_json_schema_property_input_property_kind import ObjectJsonSchemaPropertyInputPropertyKind + from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput + from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue + from .object_schema import ObjectSchema + from .omit_schema_override import OmitSchemaOverride + from .open_ai_audio_config_input import OpenAiAudioConfigInput + from .open_ai_audio_config_output import OpenAiAudioConfigOutput + from .open_ai_audio_format import OpenAiAudioFormat + from .open_ai_audio_input_config_input import OpenAiAudioInputConfigInput + from .open_ai_audio_input_config_output import OpenAiAudioInputConfigOutput + from .open_ai_audio_input_format import OpenAiAudioInputFormat + from .open_ai_audio_input_transcription import OpenAiAudioInputTranscription + from .open_ai_audio_output_config_input import OpenAiAudioOutputConfigInput + from .open_ai_audio_output_config_output import OpenAiAudioOutputConfigOutput + from .open_ai_audio_output_format import OpenAiAudioOutputFormat + from .open_ai_function_tool import OpenAiFunctionTool + from .open_ai_session_config_input import OpenAiSessionConfigInput + from .open_ai_session_config_input_max_response_output_tokens import OpenAiSessionConfigInputMaxResponseOutputTokens + from .open_ai_session_config_input_tool_choice import OpenAiSessionConfigInputToolChoice + from .open_ai_session_config_input_tools_item import ( + OpenAiSessionConfigInputToolsItem, + OpenAiSessionConfigInputToolsItem_Function, + OpenAiSessionConfigInputToolsItem_Mcp, + ) + from .open_ai_session_config_input_tracing import OpenAiSessionConfigInputTracing + from .open_ai_session_config_input_truncation import OpenAiSessionConfigInputTruncation + from .open_ai_session_config_input_turn_detection import OpenAiSessionConfigInputTurnDetection + from .open_ai_session_config_output import OpenAiSessionConfigOutput + from .open_ai_session_config_output_max_response_output_tokens import ( + OpenAiSessionConfigOutputMaxResponseOutputTokens, + ) + from .open_ai_session_config_output_tool_choice import OpenAiSessionConfigOutputToolChoice + from .open_ai_session_config_output_tools_item import ( + OpenAiSessionConfigOutputToolsItem, + OpenAiSessionConfigOutputToolsItem_Function, + OpenAiSessionConfigOutputToolsItem_Mcp, + ) + from .open_ai_session_config_output_tracing import OpenAiSessionConfigOutputTracing + from .open_ai_tool_choice_function import OpenAiToolChoiceFunction + from .open_ai_tool_choice_function_inner import OpenAiToolChoiceFunctionInner + from .open_ai_tracing_configuration import OpenAiTracingConfiguration + from .open_ai_turn_detection import OpenAiTurnDetection + from .open_aimcp_tool import OpenAimcpTool + from .open_aimcp_tool_require_approval import OpenAimcpToolRequireApproval + from .open_outcome import OpenOutcome + from .opener_config import OpenerConfig + from .opt_in_sms_reminder_params import OptInSmsReminderParams + from .opt_out_sms_reminder_params import OptOutSmsReminderParams + from .orb_avatar import OrbAvatar + from .orchestrator_tool_mock_behavior_config import OrchestratorToolMockBehaviorConfig + from .order_deliverables_response import OrderDeliverablesResponse + from .order_id import OrderId + from .order_item_info import OrderItemInfo + from .order_item_kind import OrderItemKind + from .order_item_request_input import ( + OrderItemRequestInput, + OrderItemRequestInput_Dub, + OrderItemRequestInput_Subtitles, + OrderItemRequestInput_Transcription, + ) + from .order_item_request_output import ( + OrderItemRequestOutput, + OrderItemRequestOutput_Dub, + OrderItemRequestOutput_Subtitles, + OrderItemRequestOutput_Transcription, + ) + from .order_media_response import OrderMediaResponse + from .order_response import OrderResponse + from .order_state import OrderState + from .order_summary import OrderSummary + from .outbound_call_recipient import OutboundCallRecipient + from .outbound_call_recipient_response_model import OutboundCallRecipientResponseModel + from .outbound_sip_trunk_config_request_model import OutboundSipTrunkConfigRequestModel + from .output_format import OutputFormat + from .paginated_result_agent_merge_proposal_response import PaginatedResultAgentMergeProposalResponse + from .paired_languages_response import PairedLanguagesResponse + from .partial_transcript_payload import PartialTranscriptPayload + from .patch_workspace_webhook_response_model import PatchWorkspaceWebhookResponseModel + from .pdf_export_options import PdfExportOptions + from .pending_blocks_metadata_model import PendingBlocksMetadataModel + from .pending_cancellation_response_model import PendingCancellationResponseModel + from .pending_clip_task import PendingClipTask + from .pending_clip_task_type import PendingClipTaskType + from .pending_external_audios_metadata_model import PendingExternalAudiosMetadataModel + from .pending_subscription_switch_response_model import PendingSubscriptionSwitchResponseModel + from .pending_subscription_switch_response_model_next_tier import PendingSubscriptionSwitchResponseModelNextTier + from .permission_type import PermissionType + from .phone_number_agent_info import PhoneNumberAgentInfo + from .phone_number_dynamic_variable_transfer_destination import PhoneNumberDynamicVariableTransferDestination + from .phone_number_sort_by import PhoneNumberSortBy + from .phone_number_transfer import PhoneNumberTransfer + from .phone_number_transfer_custom_sip_headers_item import ( + PhoneNumberTransferCustomSipHeadersItem, + PhoneNumberTransferCustomSipHeadersItem_Dynamic, + PhoneNumberTransferCustomSipHeadersItem_Static, + ) + from .phone_number_transfer_destination import PhoneNumberTransferDestination + from .phone_number_transfer_post_dial_digits import ( + PhoneNumberTransferPostDialDigits, + PhoneNumberTransferPostDialDigits_Dynamic, + PhoneNumberTransferPostDialDigits_Static, + ) + from .phone_number_transfer_transfer_destination import ( + PhoneNumberTransferTransferDestination, + PhoneNumberTransferTransferDestination_Phone, + PhoneNumberTransferTransferDestination_PhoneDynamicVariable, + PhoneNumberTransferTransferDestination_SipUri, + PhoneNumberTransferTransferDestination_SipUriDynamicVariable, + ) + from .ping_payload import PingPayload + from .platform_category import PlatformCategory + from .platform_category_usage import PlatformCategoryUsage + from .platform_limits import PlatformLimits + from .platform_usage import PlatformUsage + from .play_dtmf_result_error_model import PlayDtmfResultErrorModel + from .play_dtmf_result_success_model import PlayDtmfResultSuccessModel + from .play_dtmf_tool_config import PlayDtmfToolConfig + from .podcast_bulletin_mode import PodcastBulletinMode + from .podcast_bulletin_mode_data import PodcastBulletinModeData + from .podcast_conversation_mode import PodcastConversationMode + from .podcast_conversation_mode_data import PodcastConversationModeData + from .podcast_project_response_model import PodcastProjectResponseModel + from .podcast_text_source import PodcastTextSource + from .podcast_url_source import PodcastUrlSource + from .pong_payload import PongPayload + from .position_input import PositionInput + from .position_output import PositionOutput + from .post_agent_avatar_response_model import PostAgentAvatarResponseModel + from .post_agent_hold_audio_response_model import PostAgentHoldAudioResponseModel + from .post_dial_digits_dynamic_variable import PostDialDigitsDynamicVariable + from .post_dial_digits_static import PostDialDigitsStatic + from .post_workspace_secret_response_model import PostWorkspaceSecretResponseModel + from .pre_tool_speech_mode import PreToolSpeechMode + from .preview_audio_db_model import PreviewAudioDbModel + from .price import Price + from .privacy_config_input import PrivacyConfigInput + from .privacy_config_output import PrivacyConfigOutput + from .private_key_jwt_response import PrivateKeyJwtResponse + from .private_key_jwt_response_algorithm import PrivateKeyJwtResponseAlgorithm + from .procedure_at_version_response_model import ProcedureAtVersionResponseModel + from .procedure_draft_ref import ProcedureDraftRef + from .procedure_draft_response_model import ProcedureDraftResponseModel + from .procedure_list_item_response_model import ProcedureListItemResponseModel + from .procedure_ref_response_model import ProcedureRefResponseModel + from .procedure_type import ProcedureType + from .procedure_validation_error import ProcedureValidationError + from .procedure_version_ref import ProcedureVersionRef + from .project_creation_meta_response_model import ProjectCreationMetaResponseModel + from .project_creation_meta_response_model_status import ProjectCreationMetaResponseModelStatus + from .project_creation_meta_type import ProjectCreationMetaType + from .project_extended_response import ProjectExtendedResponse + from .project_extended_response_access_level import ProjectExtendedResponseAccessLevel + from .project_extended_response_apply_text_normalization import ProjectExtendedResponseApplyTextNormalization + from .project_extended_response_aspect_ratio import ProjectExtendedResponseAspectRatio + from .project_extended_response_assets_item import ( + ProjectExtendedResponseAssetsItem, + ProjectExtendedResponseAssetsItem_Audio, + ProjectExtendedResponseAssetsItem_Image, + ProjectExtendedResponseAssetsItem_Video, + ) + from .project_extended_response_fiction import ProjectExtendedResponseFiction + from .project_extended_response_source_type import ProjectExtendedResponseSourceType + from .project_extended_response_target_audience import ProjectExtendedResponseTargetAudience + from .project_external_audio_response_model import ProjectExternalAudioResponseModel + from .project_external_audio_response_model_source_context import ( + ProjectExternalAudioResponseModelSourceContext, + ProjectExternalAudioResponseModelSourceContext_MusicExploreSong, + ProjectExternalAudioResponseModelSourceContext_Sfx, + ProjectExternalAudioResponseModelSourceContext_Song, + ) + from .project_image_response_model import ProjectImageResponseModel + from .project_muted_tracks_response_model import ProjectMutedTracksResponseModel + from .project_response import ProjectResponse + from .project_response_access_level import ProjectResponseAccessLevel + from .project_response_aspect_ratio import ProjectResponseAspectRatio + from .project_response_fiction import ProjectResponseFiction + from .project_response_source_type import ProjectResponseSourceType + from .project_response_target_audience import ProjectResponseTargetAudience + from .project_snapshot_extended_response_model import ProjectSnapshotExtendedResponseModel + from .project_snapshot_response import ProjectSnapshotResponse + from .project_snapshots_response import ProjectSnapshotsResponse + from .project_state import ProjectState + from .project_video_response_model import ProjectVideoResponseModel + from .project_video_thumbnail_sheet_response_model import ProjectVideoThumbnailSheetResponseModel + from .project_voice_response_model import ProjectVoiceResponseModel + from .prompt_agent import PromptAgent + from .prompt_agent_api_model_input import PromptAgentApiModelInput + from .prompt_agent_api_model_input_backup_llm_config import ( + PromptAgentApiModelInputBackupLlmConfig, + PromptAgentApiModelInputBackupLlmConfig_Default, + PromptAgentApiModelInputBackupLlmConfig_Disabled, + PromptAgentApiModelInputBackupLlmConfig_Override, + ) + from .prompt_agent_api_model_input_tools_item import ( + PromptAgentApiModelInputToolsItem, + PromptAgentApiModelInputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelInputToolsItem_Client, + PromptAgentApiModelInputToolsItem_Mcp, + PromptAgentApiModelInputToolsItem_Smb, + PromptAgentApiModelInputToolsItem_System, + PromptAgentApiModelInputToolsItem_Webhook, + ) + from .prompt_agent_api_model_output import PromptAgentApiModelOutput + from .prompt_agent_api_model_output_backup_llm_config import ( + PromptAgentApiModelOutputBackupLlmConfig, + PromptAgentApiModelOutputBackupLlmConfig_Default, + PromptAgentApiModelOutputBackupLlmConfig_Disabled, + PromptAgentApiModelOutputBackupLlmConfig_Override, + ) + from .prompt_agent_api_model_output_tools_item import ( + PromptAgentApiModelOutputToolsItem, + PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelOutputToolsItem_Client, + PromptAgentApiModelOutputToolsItem_Mcp, + PromptAgentApiModelOutputToolsItem_Smb, + PromptAgentApiModelOutputToolsItem_System, + PromptAgentApiModelOutputToolsItem_Webhook, + ) + from .prompt_agent_api_model_override_config import PromptAgentApiModelOverrideConfig + from .prompt_agent_api_model_override_input import PromptAgentApiModelOverrideInput + from .prompt_agent_api_model_override_output import PromptAgentApiModelOverrideOutput + from .prompt_agent_api_model_workflow_override_input import PromptAgentApiModelWorkflowOverrideInput + from .prompt_agent_api_model_workflow_override_input_backup_llm_config import ( + PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig, + ) + from .prompt_agent_api_model_workflow_override_input_tools_item import ( + PromptAgentApiModelWorkflowOverrideInputToolsItem, + PromptAgentApiModelWorkflowOverrideInputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Client, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Mcp, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Smb, + PromptAgentApiModelWorkflowOverrideInputToolsItem_System, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook, + ) + from .prompt_agent_api_model_workflow_override_output import PromptAgentApiModelWorkflowOverrideOutput + from .prompt_agent_api_model_workflow_override_output_backup_llm_config import ( + PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig, + ) + from .prompt_agent_api_model_workflow_override_output_tools_item import ( + PromptAgentApiModelWorkflowOverrideOutputToolsItem, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Mcp, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Smb, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_System, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook, + ) + from .prompt_agent_db_model import PromptAgentDbModel + from .prompt_evaluation_criteria import PromptEvaluationCriteria + from .prompt_injection_guardrail import PromptInjectionGuardrail + from .pronunciation_dictionary_alias_rule_request_model import PronunciationDictionaryAliasRuleRequestModel + from .pronunciation_dictionary_alias_rule_response_model import PronunciationDictionaryAliasRuleResponseModel + from .pronunciation_dictionary_locator import PronunciationDictionaryLocator + from .pronunciation_dictionary_locator_response_model import PronunciationDictionaryLocatorResponseModel + from .pronunciation_dictionary_phoneme_rule_request_model import PronunciationDictionaryPhonemeRuleRequestModel + from .pronunciation_dictionary_phoneme_rule_response_model import PronunciationDictionaryPhonemeRuleResponseModel + from .pronunciation_dictionary_rules_response_model import PronunciationDictionaryRulesResponseModel + from .pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator + from .pronunciation_dictionary_version_response_model import PronunciationDictionaryVersionResponseModel + from .pronunciation_dictionary_version_response_model_permission_on_resource import ( + PronunciationDictionaryVersionResponseModelPermissionOnResource, + ) + from .pydantic_pronunciation_dictionary_version_locator import PydanticPronunciationDictionaryVersionLocator + from .quality_preset_type import QualityPresetType + from .query_params_json_schema_input import QueryParamsJsonSchemaInput + from .query_params_json_schema_output import QueryParamsJsonSchemaOutput + from .quote_info import QuoteInfo + from .rag_chunk_metadata import RagChunkMetadata + from .rag_config_input import RagConfigInput + from .rag_config_output import RagConfigOutput + from .rag_config_workflow_override_input import RagConfigWorkflowOverrideInput + from .rag_config_workflow_override_output import RagConfigWorkflowOverrideOutput + from .rag_document_index_response_model import RagDocumentIndexResponseModel + from .rag_document_index_usage import RagDocumentIndexUsage + from .rag_document_indexes_response_model import RagDocumentIndexesResponseModel + from .rag_index_batch_successful_response_model import RagIndexBatchSuccessfulResponseModel + from .rag_index_overview_embedding_model_response_model import RagIndexOverviewEmbeddingModelResponseModel + from .rag_index_overview_response_model import RagIndexOverviewResponseModel + from .rag_index_status import RagIndexStatus + from .rag_retrieval_info import RagRetrievalInfo + from .read_legal_terms import ReadLegalTerms + from .read_metadata_chapter_db_model import ReadMetadataChapterDbModel + from .reader_resource_response_model import ReaderResourceResponseModel + from .reader_resource_response_model_resource_type import ReaderResourceResponseModelResourceType + from .realtime_model import RealtimeModel + from .realtime_voice_settings import RealtimeVoiceSettings + from .recording_response import RecordingResponse + from .reference_video import ReferenceVideo + from .referenced_tool_common_model import ReferencedToolCommonModel + from .referenced_tool_common_model_type import ReferencedToolCommonModelType + from .refresh_token_auth_response import RefreshTokenAuthResponse + from .regex_parameter_evaluation_strategy import RegexParameterEvaluationStrategy + from .region_config_request import RegionConfigRequest + from .regional_processing_surcharge_info import RegionalProcessingSurchargeInfo + from .register_for_group_session_params import RegisterForGroupSessionParams + from .register_media_response import RegisterMediaResponse + from .remove_member_from_group_request import RemoveMemberFromGroupRequest + from .remove_order_item_response import RemoveOrderItemResponse + from .remove_voice_from_user_voice_collection_response_model import RemoveVoiceFromUserVoiceCollectionResponseModel + from .render import Render + from .render_status import RenderStatus + from .render_type import RenderType + from .replicate_voice_to_isolated_environment_response_model import ReplicateVoiceToIsolatedEnvironmentResponseModel + from .report_knowledge_gap_params import ReportKnowledgeGapParams + from .request_pvc_manual_verification_response_model import RequestPvcManualVerificationResponseModel + from .required_constraint import RequiredConstraint + from .required_constraints import RequiredConstraints + from .resource_access_info import ResourceAccessInfo + from .resource_access_info_access_source import ResourceAccessInfoAccessSource + from .resource_access_info_anonymous_access_level_override import ResourceAccessInfoAnonymousAccessLevelOverride + from .resource_access_info_role import ResourceAccessInfoRole + from .resource_metadata_response_model import ResourceMetadataResponseModel + from .resource_metadata_response_model_anonymous_access_level_override import ( + ResourceMetadataResponseModelAnonymousAccessLevelOverride, + ) + from .response_conversation_error_type import ResponseConversationErrorType + from .response_filter import ResponseFilter + from .response_filter_mode import ResponseFilterMode + from .response_unit_test_model import ResponseUnitTestModel + from .restore_calendar_event_params import RestoreCalendarEventParams + from .retry_trigger_action import RetryTriggerAction + from .review_response_model import ReviewResponseModel + from .review_response_model_reject_reasons_item import ReviewResponseModelRejectReasonsItem + from .review_response_model_review_status import ReviewResponseModelReviewStatus + from .review_status import ReviewStatus + from .safety_common_model_input import SafetyCommonModelInput + from .safety_common_model_output import SafetyCommonModelOutput + from .safety_evaluation import SafetyEvaluation + from .safety_response_model import SafetyResponseModel + from .safety_rule import SafetyRule + from .sample_config_db_model import SampleConfigDbModel + from .sample_config_db_model_parent_type import SampleConfigDbModelParentType + from .save_voice_preview_request import SaveVoicePreviewRequest + from .say_node_literal_message_input import SayNodeLiteralMessageInput + from .say_node_literal_message_output import SayNodeLiteralMessageOutput + from .say_node_prompt_message_input import SayNodePromptMessageInput + from .say_node_prompt_message_output import SayNodePromptMessageOutput + from .schedule_group_session_params import ScheduleGroupSessionParams + from .scim_group_response_model import ScimGroupResponseModel + from .scoped_analysis_result import ScopedAnalysisResult + from .scribe_auth_error_payload import ScribeAuthErrorPayload + from .scribe_chunk_size_exceeded_error_payload import ScribeChunkSizeExceededErrorPayload + from .scribe_error_payload import ScribeErrorPayload + from .scribe_input_error_payload import ScribeInputErrorPayload + from .scribe_insufficient_audio_activity_error_payload import ScribeInsufficientAudioActivityErrorPayload + from .scribe_invalid_request_error import ScribeInvalidRequestError + from .scribe_queue_overflow_error_payload import ScribeQueueOverflowErrorPayload + from .scribe_quota_exceeded_error_payload import ScribeQuotaExceededErrorPayload + from .scribe_rate_limited_error_payload import ScribeRateLimitedErrorPayload + from .scribe_resource_exhausted_error_payload import ScribeResourceExhaustedErrorPayload + from .scribe_session_time_limit_exceeded_error_payload import ScribeSessionTimeLimitExceededErrorPayload + from .scribe_throttled_error_payload import ScribeThrottledErrorPayload + from .scribe_transcriber_error_payload import ScribeTranscriberErrorPayload + from .scribe_unaccepted_terms_error_payload import ScribeUnacceptedTermsErrorPayload + from .scribe_warning import ScribeWarning + from .search_clients_params import SearchClientsParams + from .search_highlight_segment import SearchHighlightSegment + from .search_strategy import SearchStrategy + from .seat_type import SeatType + from .secret_dependency_resource_type import SecretDependencyResourceType + from .secret_dependency_type import SecretDependencyType + from .section_source import SectionSource + from .segment_create_response import SegmentCreateResponse + from .segment_delete_response import SegmentDeleteResponse + from .segment_dub_response import SegmentDubResponse + from .segment_migration_response import SegmentMigrationResponse + from .segment_subtitle_frame import SegmentSubtitleFrame + from .segment_transcription_response import SegmentTranscriptionResponse + from .segment_translation_response import SegmentTranslationResponse + from .segment_update_response import SegmentUpdateResponse + from .segmented_json_export_options import SegmentedJsonExportOptions + from .send_custom_email_params import SendCustomEmailParams + from .send_text import SendText + from .send_text_multi import SendTextMulti + from .sentiment_aggregate import SentimentAggregate + from .sentiment_analysis_settings import SentimentAnalysisSettings + from .session_started_payload import SessionStartedPayload + from .session_started_payload_config import SessionStartedPayloadConfig + from .session_started_payload_config_commit_strategy import SessionStartedPayloadConfigCommitStrategy + from .set_booking_slug_params import SetBookingSlugParams + from .severity_id import SeverityId + from .sfx_model_id import SfxModelId + from .sfx_source_context import SfxSourceContext + from .share_option_response_model import ShareOptionResponseModel + from .share_option_response_model_type import ShareOptionResponseModelType + from .similar_voice import SimilarVoice + from .similar_voices_for_speaker_response import SimilarVoicesForSpeakerResponse + from .simulation_library_settings import SimulationLibrarySettings + from .simulation_test_model import SimulationTestModel + from .simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig + from .single_languages_response import SingleLanguagesResponse + from .single_test_run_request_model import SingleTestRunRequestModel + from .single_use_token_response_model import SingleUseTokenResponseModel + from .single_use_token_type import SingleUseTokenType + from .sip_log_message import SipLogMessage + from .sip_log_message_direction import SipLogMessageDirection + from .sip_media_encryption_enum import SipMediaEncryptionEnum + from .sip_trunk_credentials_request_model import SipTrunkCredentialsRequestModel + from .sip_trunk_outbound_call_response import SipTrunkOutboundCallResponse + from .sip_trunk_transport_enum import SipTrunkTransportEnum + from .sip_uri_dynamic_variable_transfer_destination import SipUriDynamicVariableTransferDestination + from .sip_uri_transfer_destination import SipUriTransferDestination + from .skip_turn_tool_config import SkipTurnToolConfig + from .skip_turn_tool_response_model import SkipTurnToolResponseModel + from .slack_bot_auth_response import SlackBotAuthResponse + from .smb_agent_type import SmbAgentType + from .smb_client_access_config import SmbClientAccessConfig + from .sms_conversation_info import SmsConversationInfo + from .sms_conversation_info_direction import SmsConversationInfoDirection + from .soft_timeout_config import SoftTimeoutConfig + from .soft_timeout_config_override import SoftTimeoutConfigOverride + from .soft_timeout_config_override_config import SoftTimeoutConfigOverrideConfig + from .soft_timeout_config_workflow_override import SoftTimeoutConfigWorkflowOverride + from .song_metadata import SongMetadata + from .song_section import SongSection + from .song_source_context import SongSourceContext + from .sort_direction import SortDirection + from .speaker_audio_response_model import SpeakerAudioResponseModel + from .speaker_created_response import SpeakerCreatedResponse + from .speaker_response_model import SpeakerResponseModel + from .speaker_segment import SpeakerSegment + from .speaker_separation_response_model import SpeakerSeparationResponseModel + from .speaker_separation_response_model_status import SpeakerSeparationResponseModelStatus + from .speaker_track import SpeakerTrack + from .speaker_updated_response import SpeakerUpdatedResponse + from .speech_engine_config import SpeechEngineConfig + from .speech_engine_config_request_headers_value import SpeechEngineConfigRequestHeadersValue + from .speech_engine_conversation_initiation_client_data_config import ( + SpeechEngineConversationInitiationClientDataConfig, + ) + from .speech_engine_response import SpeechEngineResponse + from .speech_engine_summary_response import SpeechEngineSummaryResponse + from .speech_history_item_response import SpeechHistoryItemResponse + from .speech_history_item_response_source import SpeechHistoryItemResponseSource + from .speech_history_item_response_voice_category import SpeechHistoryItemResponseVoiceCategory + from .speech_to_text_character_response_model import SpeechToTextCharacterResponseModel + from .speech_to_text_chunk_response_model import SpeechToTextChunkResponseModel + from .speech_to_text_chunk_response_model_edited_transcript import ( + SpeechToTextChunkResponseModelEditedTranscript, + SpeechToTextChunkResponseModelEditedTranscript_Error, + SpeechToTextChunkResponseModelEditedTranscript_Transcript, + ) + from .speech_to_text_webhook_response_model import SpeechToTextWebhookResponseModel + from .speech_to_text_word_response_model import SpeechToTextWordResponseModel + from .speech_to_text_word_response_model_type import SpeechToTextWordResponseModelType + from .spelling_patience import SpellingPatience + from .srt_export_options import SrtExportOptions + from .start_procedure_tool_config import StartProcedureToolConfig + from .start_procedure_tool_config_procedures_value import StartProcedureToolConfigProceduresValue + from .start_procedure_tool_error_status import StartProcedureToolErrorStatus + from .start_procedure_tool_result_error_model import StartProcedureToolResultErrorModel + from .start_procedure_tool_result_success_model import StartProcedureToolResultSuccessModel + from .start_pvc_voice_training_response_model import StartPvcVoiceTrainingResponseModel + from .start_speaker_separation_response_model import StartSpeakerSeparationResponseModel + from .static_asset_reference import StaticAssetReference + from .status_id import StatusId + from .stored_usage_platform_limit import StoredUsagePlatformLimit + from .streaming_audio_chunk_with_timestamps_and_voice_segments_response_model import ( + StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel, + ) + from .streaming_audio_chunk_with_timestamps_response import StreamingAudioChunkWithTimestampsResponse + from .string_schema import StringSchema + from .studio_agent_settings_model import StudioAgentSettingsModel + from .studio_agent_tool_settings_model import StudioAgentToolSettingsModel + from .studio_clip_locator import StudioClipLocator + from .studio_clip_locator_clip_type import StudioClipLocatorClipType + from .studio_text_style_outline_model import StudioTextStyleOutlineModel + from .studio_text_style_shadow_model import StudioTextStyleShadowModel + from .submit_business_info_params import SubmitBusinessInfoParams + from .submit_order_response import SubmitOrderResponse + from .subscription import Subscription + from .subscription_extras_response_model import SubscriptionExtrasResponseModel + from .subscription_max_credit_limit_extension import SubscriptionMaxCreditLimitExtension + from .subscription_pending_change import SubscriptionPendingChange + from .subscription_response import SubscriptionResponse + from .subscription_response_max_credit_limit_extension import SubscriptionResponseMaxCreditLimitExtension + from .subscription_status_type import SubscriptionStatusType + from .subscription_usage_response_model import SubscriptionUsageResponseModel + from .subtitle_order_item_request import SubtitleOrderItemRequest + from .suggested_audio_tag import SuggestedAudioTag + from .supported_voice import SupportedVoice + from .system_data_collection_id import SystemDataCollectionId + from .system_evaluation_criteria import SystemEvaluationCriteria + from .system_evaluation_id import SystemEvaluationId + from .system_tool_config_input import SystemToolConfigInput + from .system_tool_config_input_params import ( + SystemToolConfigInputParams, + SystemToolConfigInputParams_EndCall, + SystemToolConfigInputParams_EndProcedure, + SystemToolConfigInputParams_KnowledgeBase, + SystemToolConfigInputParams_KnowledgeBaseRag, + SystemToolConfigInputParams_LanguageDetection, + SystemToolConfigInputParams_PlayKeypadTouchTone, + SystemToolConfigInputParams_SkipTurn, + SystemToolConfigInputParams_StartProcedure, + SystemToolConfigInputParams_TransferToAgent, + SystemToolConfigInputParams_TransferToNumber, + SystemToolConfigInputParams_VoicemailDetection, + ) + from .system_tool_config_output import SystemToolConfigOutput + from .system_tool_config_output_params import ( + SystemToolConfigOutputParams, + SystemToolConfigOutputParams_EndCall, + SystemToolConfigOutputParams_EndProcedure, + SystemToolConfigOutputParams_KnowledgeBase, + SystemToolConfigOutputParams_KnowledgeBaseRag, + SystemToolConfigOutputParams_LanguageDetection, + SystemToolConfigOutputParams_PlayKeypadTouchTone, + SystemToolConfigOutputParams_SkipTurn, + SystemToolConfigOutputParams_StartProcedure, + SystemToolConfigOutputParams_TransferToAgent, + SystemToolConfigOutputParams_TransferToNumber, + SystemToolConfigOutputParams_VoicemailDetection, + ) + from .telephony_call_config_input import TelephonyCallConfigInput + from .telephony_call_config_output import TelephonyCallConfigOutput + from .telephony_direction import TelephonyDirection + from .telephony_provider import TelephonyProvider + from .template_array_output import TemplateArrayOutput + from .template_array_output_failure_reason import TemplateArrayOutputFailureReason + from .template_audio_output import TemplateAudioOutput + from .template_audio_output_failure_reason import TemplateAudioOutputFailureReason + from .template_boolean_output import TemplateBooleanOutput + from .template_boolean_output_failure_reason import TemplateBooleanOutputFailureReason + from .template_image_output import TemplateImageOutput + from .template_image_output_failure_reason import TemplateImageOutputFailureReason + from .template_input_reference import ( + TemplateInputReference, + TemplateInputReference_Asset, + TemplateInputReference_Generation, + TemplateInputReference_InlineBase64, + TemplateInputReference_Voice, + ) + from .template_integer_output import TemplateIntegerOutput + from .template_integer_output_failure_reason import TemplateIntegerOutputFailureReason + from .template_list_response import TemplateListResponse + from .template_number_output import TemplateNumberOutput + from .template_number_output_failure_reason import TemplateNumberOutputFailureReason + from .template_object_output import TemplateObjectOutput + from .template_object_output_failure_reason import TemplateObjectOutputFailureReason + from .template_output import ( + TemplateOutput, + TemplateOutput_Array, + TemplateOutput_Audio, + TemplateOutput_Boolean, + TemplateOutput_Image, + TemplateOutput_Integer, + TemplateOutput_Number, + TemplateOutput_Object, + TemplateOutput_String, + TemplateOutput_Video, + ) + from .template_port import TemplatePort + from .template_run_input import TemplateRunInput + from .template_run_list_response import TemplateRunListResponse + from .template_run_response import TemplateRunResponse + from .template_run_status import TemplateRunStatus + from .template_string_output import TemplateStringOutput + from .template_string_output_failure_reason import TemplateStringOutputFailureReason + from .template_summary import TemplateSummary + from .template_version import TemplateVersion + from .template_video_output import TemplateVideoOutput + from .template_video_output_failure_reason import TemplateVideoOutputFailureReason + from .test_condition_rationale_common_model import TestConditionRationaleCommonModel + from .test_condition_result_common_model import TestConditionResultCommonModel + from .test_from_conversation_metadata_input import TestFromConversationMetadataInput + from .test_from_conversation_metadata_output import TestFromConversationMetadataOutput + from .test_invocation_summary_response_model import TestInvocationSummaryResponseModel + from .test_run_metadata import TestRunMetadata + from .test_run_metadata_test_type import TestRunMetadataTestType + from .test_run_result_bucket import TestRunResultBucket + from .test_run_result_summary import TestRunResultSummary + from .test_run_status import TestRunStatus + from .test_sharing_mode import TestSharingMode + from .test_tool_result_model import TestToolResultModel + from .test_type import TestType + from .tests_feature_usage_common_model import TestsFeatureUsageCommonModel + from .text_normalisation_type import TextNormalisationType + from .text_to_dialogue_websocket_apply_text_normalization_enum import ( + TextToDialogueWebsocketApplyTextNormalizationEnum, + ) + from .text_to_dialogue_websocket_audio_chunk import TextToDialogueWebsocketAudioChunk + from .text_to_dialogue_websocket_audio_chunk_multi import TextToDialogueWebsocketAudioChunkMulti + from .text_to_dialogue_websocket_client_message import TextToDialogueWebsocketClientMessage + from .text_to_dialogue_websocket_client_message_multi import TextToDialogueWebsocketClientMessageMulti + from .text_to_dialogue_websocket_error import TextToDialogueWebsocketError + from .text_to_dialogue_websocket_final import TextToDialogueWebsocketFinal + from .text_to_dialogue_websocket_final_audio_for_turn import TextToDialogueWebsocketFinalAudioForTurn + from .text_to_dialogue_websocket_final_audio_for_turn_multi import TextToDialogueWebsocketFinalAudioForTurnMulti + from .text_to_dialogue_websocket_final_multi import TextToDialogueWebsocketFinalMulti + from .text_to_dialogue_websocket_output_format_enum import TextToDialogueWebsocketOutputFormatEnum + from .text_to_dialogue_websocket_voice_input import TextToDialogueWebsocketVoiceInput + from .text_to_dialogue_websocket_voice_settings import TextToDialogueWebsocketVoiceSettings + from .text_to_speech_apply_text_normalization_enum import TextToSpeechApplyTextNormalizationEnum + from .text_to_speech_generation_request import ( + TextToSpeechGenerationRequest, + TextToSpeechGenerationRequest_ElevenFlashV25, + TextToSpeechGenerationRequest_ElevenMultilingualV2, + TextToSpeechGenerationRequest_ElevenV3, + ) + from .text_to_speech_output_format_enum import TextToSpeechOutputFormatEnum + from .text_to_speech_request import TextToSpeechRequest + from .text_to_speech_stream_request import TextToSpeechStreamRequest + from .text_to_speech_stream_with_timestamps_request import TextToSpeechStreamWithTimestampsRequest + from .text_to_speech_with_timestamps_request import TextToSpeechWithTimestampsRequest + from .threshold_guardrail import ThresholdGuardrail + from .ticket_comment_response_model import TicketCommentResponseModel + from .ticket_merge_proposal_link_response_model import TicketMergeProposalLinkResponseModel + from .ticket_priority_change_response_model import TicketPriorityChangeResponseModel + from .ticket_search_match_field import TicketSearchMatchField + from .ticket_search_match_response_model import TicketSearchMatchResponseModel + from .ticket_status_change_response_model import TicketStatusChangeResponseModel + from .time_range import TimeRange + from .to_dialogue_settings_response_model import ToDialogueSettingsResponseModel + from .token_response_model import TokenResponseModel + from .tool import Tool + from .tool_annotations import ToolAnnotations + from .tool_call_sound_behavior import ToolCallSoundBehavior + from .tool_call_sound_type import ToolCallSoundType + from .tool_call_unit_test_model import ToolCallUnitTestModel + from .tool_error_handling_mode import ToolErrorHandlingMode + from .tool_execution import ToolExecution + from .tool_execution_mode import ToolExecutionMode + from .tool_execution_response_model import ToolExecutionResponseModel + from .tool_execution_response_model_tool_call_details import ( + ToolExecutionResponseModelToolCallDetails, + ToolExecutionResponseModelToolCallDetails_ApiIntegrationWebhook, + ToolExecutionResponseModelToolCallDetails_Client, + ToolExecutionResponseModelToolCallDetails_Mcp, + ToolExecutionResponseModelToolCallDetails_Webhook, + ) + from .tool_execution_task_support import ToolExecutionTaskSupport + from .tool_interruption_mode import ToolInterruptionMode + from .tool_mock_config import ToolMockConfig + from .tool_request_model import ToolRequestModel + from .tool_request_model_tool_config import ( + ToolRequestModelToolConfig, + ToolRequestModelToolConfig_Client, + ToolRequestModelToolConfig_Mcp, + ToolRequestModelToolConfig_System, + ToolRequestModelToolConfig_Webhook, + ) + from .tool_response_mock_config_input import ToolResponseMockConfigInput + from .tool_response_mock_config_output import ToolResponseMockConfigOutput + from .tool_response_model import ToolResponseModel + from .tool_response_model_tool_config import ( + ToolResponseModelToolConfig, + ToolResponseModelToolConfig_Client, + ToolResponseModelToolConfig_Mcp, + ToolResponseModelToolConfig_System, + ToolResponseModelToolConfig_Webhook, + ) + from .tool_sort_by import ToolSortBy + from .tool_type import ToolType + from .tool_type_filter import ToolTypeFilter + from .tool_usage_stats_response_model import ToolUsageStatsResponseModel + from .tools_response_model import ToolsResponseModel + from .topic_discovery_settings import TopicDiscoverySettings + from .topic_evaluation_criteria_aggregate import TopicEvaluationCriteriaAggregate + from .topic_metrics_aggregate import TopicMetricsAggregate + from .topic_sentiment_aggregate import TopicSentimentAggregate + from .topic_sort_by import TopicSortBy + from .transcript_edit_error import TranscriptEditError + from .transcript_message import TranscriptMessage + from .transcript_message_role import TranscriptMessageRole + from .transcript_platform_event import TranscriptPlatformEvent + from .transcription_order_item_request import TranscriptionOrderItemRequest + from .transcription_word import TranscriptionWord + from .transcription_word_type import TranscriptionWordType + from .transfer_branch_info_configured import TransferBranchInfoConfigured + from .transfer_branch_info_defaulting_to_main import TransferBranchInfoDefaultingToMain + from .transfer_branch_info_traffic_split import TransferBranchInfoTrafficSplit + from .transfer_to_agent_tool_config_input import TransferToAgentToolConfigInput + from .transfer_to_agent_tool_config_output import TransferToAgentToolConfigOutput + from .transfer_to_agent_tool_result_error_model import TransferToAgentToolResultErrorModel + from .transfer_to_agent_tool_result_success_model_input import TransferToAgentToolResultSuccessModelInput + from .transfer_to_agent_tool_result_success_model_input_branch_info import ( + TransferToAgentToolResultSuccessModelInputBranchInfo, + TransferToAgentToolResultSuccessModelInputBranchInfo_Configured, + TransferToAgentToolResultSuccessModelInputBranchInfo_DefaultingToMain, + TransferToAgentToolResultSuccessModelInputBranchInfo_TrafficSplit, + ) + from .transfer_to_agent_tool_result_success_model_output import TransferToAgentToolResultSuccessModelOutput + from .transfer_to_agent_tool_result_success_model_output_branch_info import ( + TransferToAgentToolResultSuccessModelOutputBranchInfo, + TransferToAgentToolResultSuccessModelOutputBranchInfo_Configured, + TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain, + TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit, + ) + from .transfer_to_number_result_amazon_connect_success_model import TransferToNumberResultAmazonConnectSuccessModel + from .transfer_to_number_result_error_model import TransferToNumberResultErrorModel + from .transfer_to_number_result_exotel_success_model import TransferToNumberResultExotelSuccessModel + from .transfer_to_number_result_sip_success_model import TransferToNumberResultSipSuccessModel + from .transfer_to_number_result_twilio_success_model import TransferToNumberResultTwilioSuccessModel + from .transfer_to_number_tool_config_input import TransferToNumberToolConfigInput + from .transfer_to_number_tool_config_output import TransferToNumberToolConfigOutput + from .transfer_type_enum import TransferTypeEnum + from .translate_audio_output_error import TranslateAudioOutputError + from .translate_audio_payload import TranslateAudioPayload + from .translate_auth_error import TranslateAuthError + from .translate_end_of_stream_payload import TranslateEndOfStreamPayload + from .translate_error_payload import TranslateErrorPayload + from .translate_final_transcript_payload import TranslateFinalTranscriptPayload + from .translate_input_audio_chunk_payload import TranslateInputAudioChunkPayload + from .translate_input_error import TranslateInputError + from .translate_input_format_enum import TranslateInputFormatEnum + from .translate_output_format_enum import TranslateOutputFormatEnum + from .translate_partial_transcript_payload import TranslatePartialTranscriptPayload + from .translate_payment_issue_error import TranslatePaymentIssueError + from .translate_queue_overflow_error import TranslateQueueOverflowError + from .translate_quota_exceeded_error import TranslateQuotaExceededError + from .translate_rate_limited_error import TranslateRateLimitedError + from .translate_session_started_payload import TranslateSessionStartedPayload + from .translate_status_payload import TranslateStatusPayload + from .translate_transcriber_error import TranslateTranscriberError + from .translate_translation_error import TranslateTranslationError + from .translate_translation_payload import TranslateTranslationPayload + from .translate_unaccepted_terms_error import TranslateUnacceptedTermsError + from .translated_string import TranslatedString + from .trigger_user_verification_params import TriggerUserVerificationParams + from .triggered_guardrail_common_model import TriggeredGuardrailCommonModel + from .tts_conversational_config_input import TtsConversationalConfigInput + from .tts_conversational_config_output import TtsConversationalConfigOutput + from .tts_conversational_config_override import TtsConversationalConfigOverride + from .tts_conversational_config_override_config import TtsConversationalConfigOverrideConfig + from .tts_conversational_config_workflow_override_input import TtsConversationalConfigWorkflowOverrideInput + from .tts_conversational_config_workflow_override_output import TtsConversationalConfigWorkflowOverrideOutput + from .tts_conversational_model import TtsConversationalModel + from .tts_model_family import TtsModelFamily + from .tts_optimize_streaming_latency import TtsOptimizeStreamingLatency + from .tts_output_format import TtsOutputFormat + from .tts_voice_settings import TtsVoiceSettings + from .turn_comment_request_model import TurnCommentRequestModel + from .turn_comment_response_model import TurnCommentResponseModel + from .turn_config import TurnConfig + from .turn_config_override import TurnConfigOverride + from .turn_config_override_config import TurnConfigOverrideConfig + from .turn_config_workflow_override import TurnConfigWorkflowOverride + from .turn_detection_type import TurnDetectionType + from .turn_eagerness import TurnEagerness + from .turn_mode import TurnMode + from .turn_model import TurnModel + from .twilio_answered_by import TwilioAnsweredBy + from .twilio_edge_location import TwilioEdgeLocation + from .twilio_machine_detection_action import TwilioMachineDetectionAction + from .twilio_machine_detection_config import TwilioMachineDetectionConfig + from .twilio_machine_detection_mode import TwilioMachineDetectionMode + from .twilio_machine_detection_rule import TwilioMachineDetectionRule + from .twilio_outbound_call_response import TwilioOutboundCallResponse + from .twilio_region_id import TwilioRegionId + from .txt_export_options import TxtExportOptions + from .unit_test_run_response_model import UnitTestRunResponseModel + from .unit_test_run_response_model_test_info import ( + UnitTestRunResponseModelTestInfo, + UnitTestRunResponseModelTestInfo_Llm, + UnitTestRunResponseModelTestInfo_Simulation, + UnitTestRunResponseModelTestInfo_Tool, + ) + from .unit_test_summary_response_model import UnitTestSummaryResponseModel + from .unit_test_tool_call_evaluation_model_input import UnitTestToolCallEvaluationModelInput + from .unit_test_tool_call_evaluation_model_output import UnitTestToolCallEvaluationModelOutput + from .unit_test_tool_call_parameter import UnitTestToolCallParameter + from .unit_test_tool_call_parameter_eval import ( + UnitTestToolCallParameterEval, + UnitTestToolCallParameterEval_Anything, + UnitTestToolCallParameterEval_Exact, + UnitTestToolCallParameterEval_Llm, + UnitTestToolCallParameterEval_Regex, + ) + from .unit_test_workflow_node_transition_evaluation_node_id import UnitTestWorkflowNodeTransitionEvaluationNodeId + from .update_agent_config_params import UpdateAgentConfigParams + from .update_agent_procedure_params import UpdateAgentProcedureParams + from .update_agent_rule_params import UpdateAgentRuleParams + from .update_asset_params import UpdateAssetParams + from .update_audio_native_project_request import UpdateAudioNativeProjectRequest + from .update_basic_auth_request import UpdateBasicAuthRequest + from .update_bearer_auth_request import UpdateBearerAuthRequest + from .update_booking_page_appearance_params import UpdateBookingPageAppearanceParams + from .update_booking_page_settings_params import UpdateBookingPageSettingsParams + from .update_business_info_params import UpdateBusinessInfoParams + from .update_calendar_event_params import UpdateCalendarEventParams + from .update_chapter_request import UpdateChapterRequest + from .update_client_params import UpdateClientParams + from .update_group_session_seats_params import UpdateGroupSessionSeatsParams + from .update_holiday_params import UpdateHolidayParams + from .update_location_params import UpdateLocationParams + from .update_o_auth_2_client_creds_request import UpdateOAuth2ClientCredsRequest + from .update_o_auth_2_jwt_request import UpdateOAuth2JwtRequest + from .update_o_auth_2_jwt_request_algorithm import UpdateOAuth2JwtRequestAlgorithm + from .update_o_auth_2_jwt_request_token_response_field import UpdateOAuth2JwtRequestTokenResponseField + from .update_order_params import UpdateOrderParams + from .update_order_request import UpdateOrderRequest + from .update_order_response import UpdateOrderResponse + from .update_product_params import UpdateProductParams + from .update_project_request import UpdateProjectRequest + from .update_pronunciation_dictionaries_request import UpdatePronunciationDictionariesRequest + from .update_response_unit_test_request import UpdateResponseUnitTestRequest + from .update_service_params import UpdateServiceParams + from .update_simulation_test_request import UpdateSimulationTestRequest + from .update_staff_params import UpdateStaffParams + from .update_tool_call_unit_test_request import UpdateToolCallUnitTestRequest + from .update_transfer_rule_params import UpdateTransferRuleParams + from .update_workspace_member_response_model import UpdateWorkspaceMemberResponseModel + from .upsert_order_item_request import UpsertOrderItemRequest + from .upsert_order_item_response import UpsertOrderItemResponse + from .url_avatar import UrlAvatar + from .url_model import UrlModel + from .url_secret_auth_response import UrlSecretAuthResponse + from .usage_aggregation_interval import UsageAggregationInterval + from .usage_characters_response_model import UsageCharactersResponseModel + from .user import User + from .user_access_management_activity_id import UserAccessManagementActivityId + from .user_feedback import UserFeedback + from .user_feedback_score import UserFeedbackScore + from .user_model import UserModel + from .user_transcript_payload import UserTranscriptPayload + from .user_type_id import UserTypeId + from .user_voice_collection_response_model import UserVoiceCollectionResponseModel + from .user_voice_collection_response_model_permission_on_resource import ( + UserVoiceCollectionResponseModelPermissionOnResource, + ) + from .users_sort_by import UsersSortBy + from .utterance_response_model import UtteranceResponseModel + from .uui_transfer_config import UuiTransferConfig + from .uui_transfer_config_protocol_discriminator_mode import UuiTransferConfigProtocolDiscriminatorMode + from .vad_config import VadConfig + from .vad_config_workflow_override import VadConfigWorkflowOverride + from .validate_user_verification_code_params import ValidateUserVerificationCodeParams + from .validation_error import ValidationError + from .validation_error_loc_item import ValidationErrorLocItem + from .veo_31_fast_request import Veo31FastRequest + from .veo_31_fast_request_aspect_ratio import Veo31FastRequestAspectRatio + from .veo_31_fast_request_resolution import Veo31FastRequestResolution + from .veo_31_request import Veo31Request + from .veo_31_request_aspect_ratio import Veo31RequestAspectRatio + from .veo_31_request_resolution import Veo31RequestResolution + from .veo_image_reference import VeoImageReference + from .veo_image_reference_role import VeoImageReferenceRole + from .verbosity import Verbosity + from .verification_attempt_response import VerificationAttemptResponse + from .verified_voice_language_response_model import VerifiedVoiceLanguageResponseModel + from .verify_pvc_voice_captcha_response_model import VerifyPvcVoiceCaptchaResponseModel + from .video_analysis import VideoAnalysis + from .video_analysis_result import VideoAnalysisResult + from .video_analysis_status import VideoAnalysisStatus + from .video_generation_request import ( + VideoGenerationRequest, + VideoGenerationRequest_BytedanceSeedanceV2, + VideoGenerationRequest_BytedanceSeedanceV25, + VideoGenerationRequest_BytedanceSeedanceV2Fast, + VideoGenerationRequest_BytedanceSeedanceV2Mini, + VideoGenerationRequest_CreatifyAurora, + VideoGenerationRequest_Veo31FastGenerate001, + VideoGenerationRequest_Veo31Generate001, + ) + from .video_key_moment import VideoKeyMoment + from .video_reference import ( + VideoReference, + VideoReference_Asset, + VideoReference_Generation, + VideoReference_InlineBase64, + ) + from .video_schema import VideoSchema + from .video_segment import VideoSegment + from .video_subject import VideoSubject + from .visited_agent_ref import VisitedAgentRef + from .voice import Voice + from .voice_accent_response_model import VoiceAccentResponseModel + from .voice_category import VoiceCategory + from .voice_design_preview_response import VoiceDesignPreviewResponse + from .voice_generation_parameter_option_response import VoiceGenerationParameterOptionResponse + from .voice_generation_parameter_response import VoiceGenerationParameterResponse + from .voice_labelling_status import VoiceLabellingStatus + from .voice_mail_detection_result_success_model import VoiceMailDetectionResultSuccessModel + from .voice_preview_response_model import VoicePreviewResponseModel + from .voice_recording_quality import VoiceRecordingQuality + from .voice_reference import VoiceReference + from .voice_safety_control import VoiceSafetyControl + from .voice_sample import VoiceSample + from .voice_sample_preview_response_model import VoiceSamplePreviewResponseModel + from .voice_sample_visual_waveform_response_model import VoiceSampleVisualWaveformResponseModel + from .voice_schema import VoiceSchema + from .voice_segment import VoiceSegment + from .voice_settings import VoiceSettings + from .voice_sharing_moderation_check_response_model import VoiceSharingModerationCheckResponseModel + from .voice_sharing_response import VoiceSharingResponse + from .voice_sharing_response_category import VoiceSharingResponseCategory + from .voice_sharing_state import VoiceSharingState + from .voice_statistics_response_model import VoiceStatisticsResponseModel + from .voice_verification_response import VoiceVerificationResponse + from .voicemail_detection_tool_config import VoicemailDetectionToolConfig + from .voices_not_permitted_warning import VoicesNotPermittedWarning + from .webhook_auth_method_type import WebhookAuthMethodType + from .webhook_event_type import WebhookEventType + from .webhook_hmac_settings import WebhookHmacSettings + from .webhook_target import WebhookTarget, WebhookTarget_All, WebhookTarget_Ids + from .webhook_target_all import WebhookTargetAll + from .webhook_target_ids import WebhookTargetIds + from .webhook_tool_api_schema_config_input import WebhookToolApiSchemaConfigInput + from .webhook_tool_api_schema_config_input_auth_connection import WebhookToolApiSchemaConfigInputAuthConnection + from .webhook_tool_api_schema_config_input_content_type import WebhookToolApiSchemaConfigInputContentType + from .webhook_tool_api_schema_config_input_method import WebhookToolApiSchemaConfigInputMethod + from .webhook_tool_api_schema_config_input_request_headers_value import ( + WebhookToolApiSchemaConfigInputRequestHeadersValue, + ) + from .webhook_tool_api_schema_config_output import WebhookToolApiSchemaConfigOutput + from .webhook_tool_api_schema_config_output_auth_connection import WebhookToolApiSchemaConfigOutputAuthConnection + from .webhook_tool_api_schema_config_output_content_type import WebhookToolApiSchemaConfigOutputContentType + from .webhook_tool_api_schema_config_output_method import WebhookToolApiSchemaConfigOutputMethod + from .webhook_tool_api_schema_config_output_request_headers_value import ( + WebhookToolApiSchemaConfigOutputRequestHeadersValue, + ) + from .webhook_tool_config_input import WebhookToolConfigInput + from .webhook_tool_config_output import WebhookToolConfigOutput + from .webhook_transcript_format import WebhookTranscriptFormat + from .webhook_usage_type import WebhookUsageType + from .websocket_tts_client_message_multi import WebsocketTtsClientMessageMulti + from .websocket_tts_server_message_multi import WebsocketTtsServerMessageMulti + from .whats_app_account_type import WhatsAppAccountType + from .whats_app_auth_response import WhatsAppAuthResponse + from .whats_app_call_permission_request import WhatsAppCallPermissionRequest + from .whats_app_call_permission_request_state import WhatsAppCallPermissionRequestState + from .whats_app_conversation_info import WhatsAppConversationInfo + from .whats_app_conversation_info_direction import WhatsAppConversationInfoDirection + from .whats_app_outbound_call_response import WhatsAppOutboundCallResponse + from .whats_app_outbound_message_response import WhatsAppOutboundMessageResponse + from .whats_app_recipient import WhatsAppRecipient + from .whats_app_template_body_component_params import WhatsAppTemplateBodyComponentParams + from .whats_app_template_button_component_params import WhatsAppTemplateButtonComponentParams + from .whats_app_template_document_param import WhatsAppTemplateDocumentParam + from .whats_app_template_document_param_details import WhatsAppTemplateDocumentParamDetails + from .whats_app_template_header_component_params import WhatsAppTemplateHeaderComponentParams + from .whats_app_template_header_component_params_parameters_item import ( + WhatsAppTemplateHeaderComponentParamsParametersItem, + WhatsAppTemplateHeaderComponentParamsParametersItem_Document, + WhatsAppTemplateHeaderComponentParamsParametersItem_Image, + WhatsAppTemplateHeaderComponentParamsParametersItem_Location, + WhatsAppTemplateHeaderComponentParamsParametersItem_Text, + ) + from .whats_app_template_image_param import WhatsAppTemplateImageParam + from .whats_app_template_image_param_details import WhatsAppTemplateImageParamDetails + from .whats_app_template_location_param import WhatsAppTemplateLocationParam + from .whats_app_template_location_param_details import WhatsAppTemplateLocationParamDetails + from .whats_app_template_text_param import WhatsAppTemplateTextParam + from .widget_config import WidgetConfig + from .widget_config_avatar import ( + WidgetConfigAvatar, + WidgetConfigAvatar_Image, + WidgetConfigAvatar_Orb, + WidgetConfigAvatar_Url, + ) + from .widget_config_response import WidgetConfigResponse + from .widget_config_response_avatar import ( + WidgetConfigResponseAvatar, + WidgetConfigResponseAvatar_Image, + WidgetConfigResponseAvatar_Orb, + WidgetConfigResponseAvatar_Url, + ) + from .widget_config_response_syntax_highlight_theme import WidgetConfigResponseSyntaxHighlightTheme + from .widget_config_syntax_highlight_theme import WidgetConfigSyntaxHighlightTheme + from .widget_end_feedback_config import WidgetEndFeedbackConfig + from .widget_end_feedback_type import WidgetEndFeedbackType + from .widget_expandable import WidgetExpandable + from .widget_feedback_mode import WidgetFeedbackMode + from .widget_language_preset import WidgetLanguagePreset + from .widget_language_preset_response import WidgetLanguagePresetResponse + from .widget_placement import WidgetPlacement + from .widget_styles import WidgetStyles + from .widget_terms_translation import WidgetTermsTranslation + from .widget_text_contents import WidgetTextContents + from .widget_text_contents_translation import WidgetTextContentsTranslation + from .word_timestamp import WordTimestamp + from .workflow_edge_model_input import WorkflowEdgeModelInput + from .workflow_edge_model_input_backward_condition import ( + WorkflowEdgeModelInputBackwardCondition, + WorkflowEdgeModelInputBackwardCondition_Expression, + WorkflowEdgeModelInputBackwardCondition_Llm, + WorkflowEdgeModelInputBackwardCondition_Result, + WorkflowEdgeModelInputBackwardCondition_Unconditional, + ) + from .workflow_edge_model_input_forward_condition import ( + WorkflowEdgeModelInputForwardCondition, + WorkflowEdgeModelInputForwardCondition_Expression, + WorkflowEdgeModelInputForwardCondition_Llm, + WorkflowEdgeModelInputForwardCondition_Result, + WorkflowEdgeModelInputForwardCondition_Unconditional, + ) + from .workflow_edge_model_output import WorkflowEdgeModelOutput + from .workflow_edge_model_output_backward_condition import ( + WorkflowEdgeModelOutputBackwardCondition, + WorkflowEdgeModelOutputBackwardCondition_Expression, + WorkflowEdgeModelOutputBackwardCondition_Llm, + WorkflowEdgeModelOutputBackwardCondition_Result, + WorkflowEdgeModelOutputBackwardCondition_Unconditional, + ) + from .workflow_edge_model_output_forward_condition import ( + WorkflowEdgeModelOutputForwardCondition, + WorkflowEdgeModelOutputForwardCondition_Expression, + WorkflowEdgeModelOutputForwardCondition_Llm, + WorkflowEdgeModelOutputForwardCondition_Result, + WorkflowEdgeModelOutputForwardCondition_Unconditional, + ) + from .workflow_end_node_model_input import WorkflowEndNodeModelInput + from .workflow_end_node_model_output import WorkflowEndNodeModelOutput + from .workflow_end_node_outcome import WorkflowEndNodeOutcome + from .workflow_expression_condition_model_input import WorkflowExpressionConditionModelInput + from .workflow_expression_condition_model_output import WorkflowExpressionConditionModelOutput + from .workflow_features_usage_common_model import WorkflowFeaturesUsageCommonModel + from .workflow_llm_condition_model_input import WorkflowLlmConditionModelInput + from .workflow_llm_condition_model_output import WorkflowLlmConditionModelOutput + from .workflow_override_agent_node_model_input import WorkflowOverrideAgentNodeModelInput + from .workflow_override_agent_node_model_output import WorkflowOverrideAgentNodeModelOutput + from .workflow_phone_number_node_model_input import WorkflowPhoneNumberNodeModelInput + from .workflow_phone_number_node_model_input_custom_sip_headers_item import ( + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem, + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Dynamic, + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Static, + ) + from .workflow_phone_number_node_model_input_post_dial_digits import ( + WorkflowPhoneNumberNodeModelInputPostDialDigits, + WorkflowPhoneNumberNodeModelInputPostDialDigits_Dynamic, + WorkflowPhoneNumberNodeModelInputPostDialDigits_Static, + ) + from .workflow_phone_number_node_model_input_transfer_destination import ( + WorkflowPhoneNumberNodeModelInputTransferDestination, + WorkflowPhoneNumberNodeModelInputTransferDestination_Phone, + WorkflowPhoneNumberNodeModelInputTransferDestination_PhoneDynamicVariable, + WorkflowPhoneNumberNodeModelInputTransferDestination_SipUri, + WorkflowPhoneNumberNodeModelInputTransferDestination_SipUriDynamicVariable, + ) + from .workflow_phone_number_node_model_output import WorkflowPhoneNumberNodeModelOutput + from .workflow_phone_number_node_model_output_custom_sip_headers_item import ( + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem, + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Dynamic, + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Static, + ) + from .workflow_phone_number_node_model_output_post_dial_digits import ( + WorkflowPhoneNumberNodeModelOutputPostDialDigits, + WorkflowPhoneNumberNodeModelOutputPostDialDigits_Dynamic, + WorkflowPhoneNumberNodeModelOutputPostDialDigits_Static, + ) + from .workflow_phone_number_node_model_output_transfer_destination import ( + WorkflowPhoneNumberNodeModelOutputTransferDestination, + WorkflowPhoneNumberNodeModelOutputTransferDestination_Phone, + WorkflowPhoneNumberNodeModelOutputTransferDestination_PhoneDynamicVariable, + WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUri, + WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUriDynamicVariable, + ) + from .workflow_result_condition_model_input import WorkflowResultConditionModelInput + from .workflow_result_condition_model_output import WorkflowResultConditionModelOutput + from .workflow_say_node_model_input import WorkflowSayNodeModelInput + from .workflow_say_node_model_input_message import ( + WorkflowSayNodeModelInputMessage, + WorkflowSayNodeModelInputMessage_Literal, + WorkflowSayNodeModelInputMessage_Prompt, + ) + from .workflow_say_node_model_output import WorkflowSayNodeModelOutput + from .workflow_say_node_model_output_message import ( + WorkflowSayNodeModelOutputMessage, + WorkflowSayNodeModelOutputMessage_Literal, + WorkflowSayNodeModelOutputMessage_Prompt, + ) + from .workflow_standalone_agent_node_model_input import WorkflowStandaloneAgentNodeModelInput + from .workflow_standalone_agent_node_model_output import WorkflowStandaloneAgentNodeModelOutput + from .workflow_start_node_model_input import WorkflowStartNodeModelInput + from .workflow_start_node_model_output import WorkflowStartNodeModelOutput + from .workflow_state_update_input import WorkflowStateUpdateInput + from .workflow_state_update_output import WorkflowStateUpdateOutput + from .workflow_tool_edge_step_model import WorkflowToolEdgeStepModel + from .workflow_tool_locator import WorkflowToolLocator + from .workflow_tool_locator_schema_overrides_value import ( + WorkflowToolLocatorSchemaOverridesValue, + WorkflowToolLocatorSchemaOverridesValue_Constant, + WorkflowToolLocatorSchemaOverridesValue_DynamicVariable, + WorkflowToolLocatorSchemaOverridesValue_Llm, + WorkflowToolLocatorSchemaOverridesValue_Omit, + ) + from .workflow_tool_max_iterations_exceeded_step_model import WorkflowToolMaxIterationsExceededStepModel + from .workflow_tool_nested_tools_step_model_input import WorkflowToolNestedToolsStepModelInput + from .workflow_tool_nested_tools_step_model_input_results_item import ( + WorkflowToolNestedToolsStepModelInputResultsItem, + ) + from .workflow_tool_nested_tools_step_model_output import WorkflowToolNestedToolsStepModelOutput + from .workflow_tool_nested_tools_step_model_output_results_item import ( + WorkflowToolNestedToolsStepModelOutputResultsItem, + ) + from .workflow_tool_node_model_input import WorkflowToolNodeModelInput + from .workflow_tool_node_model_output import WorkflowToolNodeModelOutput + from .workflow_tool_response_model_input import WorkflowToolResponseModelInput + from .workflow_tool_response_model_input_steps_item import ( + WorkflowToolResponseModelInputStepsItem, + WorkflowToolResponseModelInputStepsItem_Edge, + WorkflowToolResponseModelInputStepsItem_MaxIterationsExceeded, + WorkflowToolResponseModelInputStepsItem_NestedTools, + ) + from .workflow_tool_response_model_output import WorkflowToolResponseModelOutput + from .workflow_tool_response_model_output_steps_item import ( + WorkflowToolResponseModelOutputStepsItem, + WorkflowToolResponseModelOutputStepsItem_Edge, + WorkflowToolResponseModelOutputStepsItem_MaxIterationsExceeded, + WorkflowToolResponseModelOutputStepsItem_NestedTools, + ) + from .workflow_unconditional_model_input import WorkflowUnconditionalModelInput + from .workflow_unconditional_model_output import WorkflowUnconditionalModelOutput + from .workflow_update_state_node_model_input import WorkflowUpdateStateNodeModelInput + from .workflow_update_state_node_model_output import WorkflowUpdateStateNodeModelOutput + from .workspace_analytics_query_response_model import WorkspaceAnalyticsQueryResponseModel + from .workspace_analytics_query_response_model_column_types_item import ( + WorkspaceAnalyticsQueryResponseModelColumnTypesItem, + ) + from .workspace_analytics_query_response_model_rows_item_item import ( + WorkspaceAnalyticsQueryResponseModelRowsItemItem, + ) + from .workspace_api_key_list_response_model import WorkspaceApiKeyListResponseModel + from .workspace_api_key_response_model import WorkspaceApiKeyResponseModel + from .workspace_audit_log_entry_response import WorkspaceAuditLogEntryResponse + from .workspace_audit_log_entry_response_activity_id import WorkspaceAuditLogEntryResponseActivityId + from .workspace_audit_logs_page_response import WorkspaceAuditLogsPageResponse + from .workspace_batch_calls_response import WorkspaceBatchCallsResponse + from .workspace_create_api_key_response_model import WorkspaceCreateApiKeyResponseModel + from .workspace_create_service_account_response_model import WorkspaceCreateServiceAccountResponseModel + from .workspace_create_webhook_response_model import WorkspaceCreateWebhookResponseModel + from .workspace_group_by_name_response_model import WorkspaceGroupByNameResponseModel + from .workspace_group_permission import WorkspaceGroupPermission + from .workspace_group_response_model import WorkspaceGroupResponseModel + from .workspace_group_response_model_group_concurrency_limit import WorkspaceGroupResponseModelGroupConcurrencyLimit + from .workspace_group_response_model_group_dubbing_concurrency_limit import ( + WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit, + ) + from .workspace_group_response_model_group_music_concurrency_limit import ( + WorkspaceGroupResponseModelGroupMusicConcurrencyLimit, + ) + from .workspace_group_response_model_group_pvc_limit import WorkspaceGroupResponseModelGroupPvcLimit + from .workspace_group_response_model_group_usage_limit import WorkspaceGroupResponseModelGroupUsageLimit + from .workspace_member_response_model import WorkspaceMemberResponseModel + from .workspace_resource_type import WorkspaceResourceType + from .workspace_service_account_list_response_model import WorkspaceServiceAccountListResponseModel + from .workspace_service_account_response_model import WorkspaceServiceAccountResponseModel + from .workspace_webhook_event_type import WorkspaceWebhookEventType + from .workspace_webhook_list_response_model import WorkspaceWebhookListResponseModel + from .workspace_webhook_response_model import WorkspaceWebhookResponseModel + from .workspace_webhook_usage_response_model import WorkspaceWebhookUsageResponseModel +_dynamic_imports: typing.Dict[str, str] = { + "AccountChangeActivityId": ".account_change_activity_id", + "ActorModel": ".actor_model", + "AddChapterResponseModel": ".add_chapter_response_model", + "AddKnowledgeBaseResponseModel": ".add_knowledge_base_response_model", + "AddProjectRequest": ".add_project_request", + "AddProjectResponseModel": ".add_project_response_model", + "AddPronunciationDictionaryResponseModel": ".add_pronunciation_dictionary_response_model", + "AddPronunciationDictionaryResponseModelPermissionOnResource": ".add_pronunciation_dictionary_response_model_permission_on_resource", + "AddSharingVoiceRequest": ".add_sharing_voice_request", + "AddVoiceIvcResponseModel": ".add_voice_ivc_response_model", + "AddVoiceResponseModel": ".add_voice_response_model", + "AddVoiceToUserVoiceCollectionResponseModel": ".add_voice_to_user_voice_collection_response_model", + "AddWorkspaceGroupMemberResponseModel": ".add_workspace_group_member_response_model", + "AddWorkspaceInviteResponseModel": ".add_workspace_invite_response_model", + "AdditionalFormatResponseModel": ".additional_format_response_model", + "AdditionalFormats": ".additional_formats", + "AdhocAgentConfigOverrideForTestRequestModel": ".adhoc_agent_config_override_for_test_request_model", + "Age": ".age", + "AgentAnalysisItemsInput": ".agent_analysis_items_input", + "AgentAnalysisItemsInputDataCollectionItem": ".agent_analysis_items_input_data_collection_item", + "AgentAnalysisItemsInputDataCollectionItem_System": ".agent_analysis_items_input_data_collection_item", + "AgentAnalysisItemsInputDataCollectionItem_User": ".agent_analysis_items_input_data_collection_item", + "AgentAnalysisItemsInputEvaluationCriteriaItem": ".agent_analysis_items_input_evaluation_criteria_item", + "AgentAnalysisItemsInputEvaluationCriteriaItem_System": ".agent_analysis_items_input_evaluation_criteria_item", + "AgentAnalysisItemsInputEvaluationCriteriaItem_User": ".agent_analysis_items_input_evaluation_criteria_item", + "AgentAnalysisItemsOutput": ".agent_analysis_items_output", + "AgentAnalysisItemsOutputDataCollectionItem": ".agent_analysis_items_output_data_collection_item", + "AgentAnalysisItemsOutputDataCollectionItem_System": ".agent_analysis_items_output_data_collection_item", + "AgentAnalysisItemsOutputDataCollectionItem_User": ".agent_analysis_items_output_data_collection_item", + "AgentAnalysisItemsOutputEvaluationCriteriaItem": ".agent_analysis_items_output_evaluation_criteria_item", + "AgentAnalysisItemsOutputEvaluationCriteriaItem_System": ".agent_analysis_items_output_evaluation_criteria_item", + "AgentAnalysisItemsOutputEvaluationCriteriaItem_User": ".agent_analysis_items_output_evaluation_criteria_item", + "AgentBranchBasicInfo": ".agent_branch_basic_info", + "AgentBranchResponse": ".agent_branch_response", + "AgentBranchSummary": ".agent_branch_summary", + "AgentCallLimits": ".agent_call_limits", + "AgentConfig": ".agent_config", + "AgentConfigApiModelWorkflowOverrideInput": ".agent_config_api_model_workflow_override_input", + "AgentConfigApiModelWorkflowOverrideOutput": ".agent_config_api_model_workflow_override_output", + "AgentConfigOverrideConfig": ".agent_config_override_config", + "AgentConfigOverrideInput": ".agent_config_override_input", + "AgentConfigOverrideOutput": ".agent_config_override_output", + "AgentConversationTicketIssueType": ".agent_conversation_ticket_issue_type", + "AgentConversationTicketPriority": ".agent_conversation_ticket_priority", + "AgentConversationTicketResponseModel": ".agent_conversation_ticket_response_model", + "AgentConversationTicketSortBy": ".agent_conversation_ticket_sort_by", + "AgentConversationTicketSource": ".agent_conversation_ticket_source", + "AgentConversationTicketStatus": ".agent_conversation_ticket_status", + "AgentDefinitionSource": ".agent_definition_source", + "AgentDeploymentHistoryItem": ".agent_deployment_history_item", + "AgentDeploymentPercentageStrategy": ".agent_deployment_percentage_strategy", + "AgentDeploymentRequest": ".agent_deployment_request", + "AgentDeploymentRequestItem": ".agent_deployment_request_item", + "AgentDeploymentResponse": ".agent_deployment_response", + "AgentDeploymentSource": ".agent_deployment_source", + "AgentFailureResponseExample": ".agent_failure_response_example", + "AgentHoldAudioConfig": ".agent_hold_audio_config", + "AgentKnowledgeBaseRagChunkResponseModel": ".agent_knowledge_base_rag_chunk_response_model", + "AgentKnowledgeBaseRagQueryRequestModel": ".agent_knowledge_base_rag_query_request_model", + "AgentKnowledgeBaseRagQueryResponseModel": ".agent_knowledge_base_rag_query_response_model", + "AgentMergeProposalResponse": ".agent_merge_proposal_response", + "AgentMergeProposalResponseOutcome": ".agent_merge_proposal_response_outcome", + "AgentMergeProposalResponseOutcome_Closed": ".agent_merge_proposal_response_outcome", + "AgentMergeProposalResponseOutcome_Merged": ".agent_merge_proposal_response_outcome", + "AgentMergeProposalResponseOutcome_Open": ".agent_merge_proposal_response_outcome", + "AgentMetadata": ".agent_metadata", + "AgentMetadataDbModel": ".agent_metadata_db_model", + "AgentMetadataResponseModel": ".agent_metadata_response_model", + "AgentPlatformSettingsRequestModel": ".agent_platform_settings_request_model", + "AgentPlatformSettingsResponseModel": ".agent_platform_settings_response_model", + "AgentQueueingConfig": ".agent_queueing_config", + "AgentResponsePayload": ".agent_response_payload", + "AgentSimulatedChatTestResponseModel": ".agent_simulated_chat_test_response_model", + "AgentSmbMetadata": ".agent_smb_metadata", + "AgentSortBy": ".agent_sort_by", + "AgentSuccessfulResponseExample": ".agent_successful_response_example", + "AgentSummaryBatchSuccessfulResponseModel": ".agent_summary_batch_successful_response_model", + "AgentSummaryResponseModel": ".agent_summary_response_model", + "AgentTestEntityType": ".agent_test_entity_type", + "AgentTestFolderPathSegmentResponseModel": ".agent_test_folder_path_segment_response_model", + "AgentTestingSettings": ".agent_testing_settings", + "AgentTopicResponseModel": ".agent_topic_response_model", + "AgentTransferInput": ".agent_transfer_input", + "AgentTransferOp": ".agent_transfer_op", + "AgentTransferOpPop": ".agent_transfer_op_pop", + "AgentTransferOpPush": ".agent_transfer_op_push", + "AgentTransferOpReplace": ".agent_transfer_op_replace", + "AgentTransferOp_Pop": ".agent_transfer_op", + "AgentTransferOp_Push": ".agent_transfer_op", + "AgentTransferOp_Replace": ".agent_transfer_op", + "AgentTransferOutput": ".agent_transfer_output", + "AgentTrustContext": ".agent_trust_context", + "AgentVersionMetadata": ".agent_version_metadata", + "AgentVersionParents": ".agent_version_parents", + "AgentWorkflowRequestModel": ".agent_workflow_request_model", + "AgentWorkflowRequestModelNodesValue": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowRequestModelNodesValue_End": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowRequestModelNodesValue_OverrideAgent": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowRequestModelNodesValue_PhoneNumber": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowRequestModelNodesValue_Say": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowRequestModelNodesValue_StandaloneAgent": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowRequestModelNodesValue_Start": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowRequestModelNodesValue_Tool": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowRequestModelNodesValue_UpdateState": ".agent_workflow_request_model_nodes_value", + "AgentWorkflowResponseModel": ".agent_workflow_response_model", + "AgentWorkflowResponseModelNodesValue": ".agent_workflow_response_model_nodes_value", + "AgentWorkflowResponseModelNodesValue_End": ".agent_workflow_response_model_nodes_value", + "AgentWorkflowResponseModelNodesValue_OverrideAgent": ".agent_workflow_response_model_nodes_value", + "AgentWorkflowResponseModelNodesValue_PhoneNumber": ".agent_workflow_response_model_nodes_value", + "AgentWorkflowResponseModelNodesValue_Say": ".agent_workflow_response_model_nodes_value", + "AgentWorkflowResponseModelNodesValue_StandaloneAgent": ".agent_workflow_response_model_nodes_value", + "AgentWorkflowResponseModelNodesValue_Start": ".agent_workflow_response_model_nodes_value", + "AgentWorkflowResponseModelNodesValue_Tool": ".agent_workflow_response_model_nodes_value", + "AgentWorkflowResponseModelNodesValue_UpdateState": ".agent_workflow_response_model_nodes_value", + "AgentWorkspaceOverridesInput": ".agent_workspace_overrides_input", + "AgentWorkspaceOverridesOutput": ".agent_workspace_overrides_output", + "AlertingIntegrationNotifier": ".alerting_integration_notifier", + "AlertingIntegrationNotifierIntegrationType": ".alerting_integration_notifier_integration_type", + "AlertingIntegrationNotifierResponse": ".alerting_integration_notifier_response", + "AlertingIntegrationNotifierResponseIntegrationType": ".alerting_integration_notifier_response_integration_type", + "AlertingMonitorConfig": ".alerting_monitor_config", + "AlertingPagerDutyNotifier": ".alerting_pager_duty_notifier", + "AlertingPagerDutyNotifierResponse": ".alerting_pager_duty_notifier_response", + "AlertingSettings": ".alerting_settings", + "AlertingSettingsNotifiersItem": ".alerting_settings_notifiers_item", + "AlertingSettingsNotifiersItem_Integration": ".alerting_settings_notifiers_item", + "AlertingSettingsNotifiersItem_Webhook": ".alerting_settings_notifiers_item", + "AlertingSettingsResponse": ".alerting_settings_response", + "AlertingSettingsResponseNotifiersItem": ".alerting_settings_response_notifiers_item", + "AlertingSettingsResponseNotifiersItem_Integration": ".alerting_settings_response_notifiers_item", + "AlertingSettingsResponseNotifiersItem_Webhook": ".alerting_settings_response_notifiers_item", + "AlertingSlackNotifier": ".alerting_slack_notifier", + "AlertingSlackNotifierResponse": ".alerting_slack_notifier_response", + "AlertingWebhookHeader": ".alerting_webhook_header", + "AlertingWebhookMethod": ".alerting_webhook_method", + "AlertingWebhookNotifier": ".alerting_webhook_notifier", + "AlertingWebhookNotifierResponse": ".alerting_webhook_notifier_response", + "AlertingWebhookSecretHeaderValue": ".alerting_webhook_secret_header_value", + "Alignment": ".alignment", + "AllowedOutputFormats": ".allowed_output_formats", + "AllowedValues": ".allowed_values", + "AllowlistItem": ".allowlist_item", + "AnalysisCharging": ".analysis_charging", + "AnalysisProperty": ".analysis_property", + "AnalysisPropertyConstantValue": ".analysis_property_constant_value", + "AnalysisPropertyType": ".analysis_property_type", + "AnalysisRunSnapshot": ".analysis_run_snapshot", + "AnalysisRunningTotal": ".analysis_running_total", + "AnalysisScope": ".analysis_scope", + "AnalysisType": ".analysis_type", + "ApiIntegrationOAuth2AuthCodeResponse": ".api_integration_o_auth_2_auth_code_response", + "ApiIntegrationOAuth2AuthCodeResponseScopeSeparator": ".api_integration_o_auth_2_auth_code_response_scope_separator", + "ApiIntegrationOAuth2CustomAppResponse": ".api_integration_o_auth_2_custom_app_response", + "ApiIntegrationOAuth2CustomAppResponseScopeSeparator": ".api_integration_o_auth_2_custom_app_response_scope_separator", + "ApiIntegrationWebhookOverrides": ".api_integration_webhook_overrides", + "ApiIntegrationWebhookOverridesRequestHeadersValue": ".api_integration_webhook_overrides_request_headers_value", + "ApiIntegrationWebhookOverridesSchemaOverridesValue": ".api_integration_webhook_overrides_schema_overrides_value", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Constant": ".api_integration_webhook_overrides_schema_overrides_value", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_DynamicVariable": ".api_integration_webhook_overrides_schema_overrides_value", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Llm": ".api_integration_webhook_overrides_schema_overrides_value", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Omit": ".api_integration_webhook_overrides_schema_overrides_value", + "ApiIntegrationWebhookToolConfigInput": ".api_integration_webhook_tool_config_input", + "ApiIntegrationWebhookToolConfigOutput": ".api_integration_webhook_tool_config_output", + "ArchitectDispatchResponseModel": ".architect_dispatch_response_model", + "ArrayJsonSchemaPropertyInput": ".array_json_schema_property_input", + "ArrayJsonSchemaPropertyInputItems": ".array_json_schema_property_input_items", + "ArrayJsonSchemaPropertyInputPropertyKind": ".array_json_schema_property_input_property_kind", + "ArrayJsonSchemaPropertyOutput": ".array_json_schema_property_output", + "ArrayJsonSchemaPropertyOutputItems": ".array_json_schema_property_output_items", + "ArraySchema": ".array_schema", + "AsrConversationalConfig": ".asr_conversational_config", + "AsrConversationalConfigOverride": ".asr_conversational_config_override", + "AsrConversationalConfigOverrideConfig": ".asr_conversational_config_override_config", + "AsrConversationalConfigWorkflowOverride": ".asr_conversational_config_workflow_override", + "AsrInputFormat": ".asr_input_format", + "AsrProvider": ".asr_provider", + "AsrQuality": ".asr_quality", + "AssetListResponse": ".asset_list_response", + "AssetResponse": ".asset_response", + "AssetTranscription": ".asset_transcription", + "AssetTranscriptionData": ".asset_transcription_data", + "AssetTranscriptionStatus": ".asset_transcription_status", + "AssignableUserResponseModel": ".assignable_user_response_model", + "AstAdditionOperatorNodeInput": ".ast_addition_operator_node_input", + "AstAdditionOperatorNodeOutput": ".ast_addition_operator_node_output", + "AstAndOperatorNodeInput": ".ast_and_operator_node_input", + "AstAndOperatorNodeOutput": ".ast_and_operator_node_output", + "AstBooleanNodeInput": ".ast_boolean_node_input", + "AstBooleanNodeOutput": ".ast_boolean_node_output", + "AstConditionalOperatorNodeInput": ".ast_conditional_operator_node_input", + "AstConditionalOperatorNodeOutput": ".ast_conditional_operator_node_output", + "AstDivisionOperatorNodeInput": ".ast_division_operator_node_input", + "AstDivisionOperatorNodeOutput": ".ast_division_operator_node_output", + "AstDynamicVariableNodeInput": ".ast_dynamic_variable_node_input", + "AstDynamicVariableNodeOutput": ".ast_dynamic_variable_node_output", + "AstEqualsOperatorNodeInput": ".ast_equals_operator_node_input", + "AstEqualsOperatorNodeOutput": ".ast_equals_operator_node_output", + "AstGreaterThanOperatorNodeInput": ".ast_greater_than_operator_node_input", + "AstGreaterThanOperatorNodeOutput": ".ast_greater_than_operator_node_output", + "AstGreaterThanOrEqualsOperatorNodeInput": ".ast_greater_than_or_equals_operator_node_input", + "AstGreaterThanOrEqualsOperatorNodeOutput": ".ast_greater_than_or_equals_operator_node_output", + "AstLessThanOperatorNodeInput": ".ast_less_than_operator_node_input", + "AstLessThanOperatorNodeOutput": ".ast_less_than_operator_node_output", + "AstLessThanOrEqualsOperatorNodeInput": ".ast_less_than_or_equals_operator_node_input", + "AstLessThanOrEqualsOperatorNodeOutput": ".ast_less_than_or_equals_operator_node_output", + "AstMultiplicationOperatorNodeInput": ".ast_multiplication_operator_node_input", + "AstMultiplicationOperatorNodeOutput": ".ast_multiplication_operator_node_output", + "AstNodeInput": ".ast_node_input", + "AstNodeInputLlm": ".ast_node_input_llm", + "AstNodeInput_AddOperator": ".ast_node_input", + "AstNodeInput_AndOperator": ".ast_node_input", + "AstNodeInput_BooleanLiteral": ".ast_node_input", + "AstNodeInput_ConditionalOperator": ".ast_node_input", + "AstNodeInput_DivOperator": ".ast_node_input", + "AstNodeInput_DynamicVariable": ".ast_node_input", + "AstNodeInput_EqOperator": ".ast_node_input", + "AstNodeInput_GtOperator": ".ast_node_input", + "AstNodeInput_GteOperator": ".ast_node_input", + "AstNodeInput_Llm": ".ast_node_input", + "AstNodeInput_LtOperator": ".ast_node_input", + "AstNodeInput_LteOperator": ".ast_node_input", + "AstNodeInput_MulOperator": ".ast_node_input", + "AstNodeInput_NeqOperator": ".ast_node_input", + "AstNodeInput_NullLiteral": ".ast_node_input", + "AstNodeInput_NumberLiteral": ".ast_node_input", + "AstNodeInput_OrOperator": ".ast_node_input", + "AstNodeInput_StringLiteral": ".ast_node_input", + "AstNodeInput_SubOperator": ".ast_node_input", + "AstNodeOutput": ".ast_node_output", + "AstNodeOutput_AddOperator": ".ast_node_output", + "AstNodeOutput_AndOperator": ".ast_node_output", + "AstNodeOutput_BooleanLiteral": ".ast_node_output", + "AstNodeOutput_ConditionalOperator": ".ast_node_output", + "AstNodeOutput_DivOperator": ".ast_node_output", + "AstNodeOutput_DynamicVariable": ".ast_node_output", + "AstNodeOutput_EqOperator": ".ast_node_output", + "AstNodeOutput_GtOperator": ".ast_node_output", + "AstNodeOutput_GteOperator": ".ast_node_output", + "AstNodeOutput_Llm": ".ast_node_output", + "AstNodeOutput_LtOperator": ".ast_node_output", + "AstNodeOutput_LteOperator": ".ast_node_output", + "AstNodeOutput_MulOperator": ".ast_node_output", + "AstNodeOutput_NeqOperator": ".ast_node_output", + "AstNodeOutput_NullLiteral": ".ast_node_output", + "AstNodeOutput_NumberLiteral": ".ast_node_output", + "AstNodeOutput_OrOperator": ".ast_node_output", + "AstNodeOutput_StringLiteral": ".ast_node_output", + "AstNodeOutput_SubOperator": ".ast_node_output", + "AstNotEqualsOperatorNodeInput": ".ast_not_equals_operator_node_input", + "AstNotEqualsOperatorNodeOutput": ".ast_not_equals_operator_node_output", + "AstNullNodeInput": ".ast_null_node_input", + "AstNullNodeOutput": ".ast_null_node_output", + "AstNumberNodeInput": ".ast_number_node_input", + "AstNumberNodeInputValue": ".ast_number_node_input_value", + "AstNumberNodeOutput": ".ast_number_node_output", + "AstNumberNodeOutputValue": ".ast_number_node_output_value", + "AstOrOperatorNodeInput": ".ast_or_operator_node_input", + "AstOrOperatorNodeOutput": ".ast_or_operator_node_output", + "AstStringNodeInput": ".ast_string_node_input", + "AstStringNodeOutput": ".ast_string_node_output", + "AstSubtractionOperatorNodeInput": ".ast_subtraction_operator_node_input", + "AstSubtractionOperatorNodeOutput": ".ast_subtraction_operator_node_output", + "AstllmNodeInput": ".astllm_node_input", + "AstllmNodeInputPrompt": ".astllm_node_input_prompt", + "AstllmNodeInputValueSchema": ".astllm_node_input_value_schema", + "AstllmNodeOutput": ".astllm_node_output", + "AsyncConversationMetadata": ".async_conversation_metadata", + "AsyncConversationMetadataDeliveryStatus": ".async_conversation_metadata_delivery_status", + "AttachedSystemDataCollectionRef": ".attached_system_data_collection_ref", + "AttachedSystemEvaluationRef": ".attached_system_evaluation_ref", + "AttachedTestModel": ".attached_test_model", + "AttachedUserDataCollectionRef": ".attached_user_data_collection_ref", + "AttachedUserEvaluationRef": ".attached_user_evaluation_ref", + "AudioAnalysis": ".audio_analysis", + "AudioAnalysisResult": ".audio_analysis_result", + "AudioAnalysisStatus": ".audio_analysis_status", + "AudioEffectsBackgroundNoiseResponseModel": ".audio_effects_background_noise_response_model", + "AudioEffectsCatalogResponseModel": ".audio_effects_catalog_response_model", + "AudioEffectsEnvironmentResponseModel": ".audio_effects_environment_response_model", + "AudioEffectsFilterPresetResponseModel": ".audio_effects_filter_preset_response_model", + "AudioFormatEnum": ".audio_format_enum", + "AudioInputPacing": ".audio_input_pacing", + "AudioIsolationHistoryItemResponseModel": ".audio_isolation_history_item_response_model", + "AudioKeyMoment": ".audio_key_moment", + "AudioNativeCreateProjectResponseModel": ".audio_native_create_project_response_model", + "AudioNativeEditContentResponseModel": ".audio_native_edit_content_response_model", + "AudioNativeProjectSettingsResponseModel": ".audio_native_project_settings_response_model", + "AudioNativeProjectSettingsResponseModelStatus": ".audio_native_project_settings_response_model_status", + "AudioOutput": ".audio_output", + "AudioOutputMulti": ".audio_output_multi", + "AudioRefChunk": ".audio_ref_chunk", + "AudioReference": ".audio_reference", + "AudioReference_Asset": ".audio_reference", + "AudioReference_Generation": ".audio_reference", + "AudioReference_InlineBase64": ".audio_reference", + "AudioSchema": ".audio_schema", + "AudioSegment": ".audio_segment", + "AudioWithTimestampsAndVoiceSegmentsResponseModel": ".audio_with_timestamps_and_voice_segments_response_model", + "AudioWithTimestampsResponse": ".audio_with_timestamps_response", + "AuthConnectionDependencies": ".auth_connection_dependencies", + "AuthConnectionDependenciesMcpServersItem": ".auth_connection_dependencies_mcp_servers_item", + "AuthConnectionDependenciesMcpServersItem_Available": ".auth_connection_dependencies_mcp_servers_item", + "AuthConnectionDependenciesMcpServersItem_Unknown": ".auth_connection_dependencies_mcp_servers_item", + "AuthConnectionDependenciesToolsItem": ".auth_connection_dependencies_tools_item", + "AuthConnectionDependenciesToolsItem_Available": ".auth_connection_dependencies_tools_item", + "AuthConnectionDependenciesToolsItem_Unknown": ".auth_connection_dependencies_tools_item", + "AuthConnectionLocator": ".auth_connection_locator", + "AuthConnectionStatus": ".auth_connection_status", + "AuthSettings": ".auth_settings", + "AuthenticationActivityId": ".authentication_activity_id", + "AuthorizationMethod": ".authorization_method", + "AutoGenerationMetadata": ".auto_generation_metadata", + "AutoSyncInfo": ".auto_sync_info", + "AvatarContextResponseModel": ".avatar_context_response_model", + "BackgroundSoundConfig": ".background_sound_config", + "BackgroundSoundConfigWorkflowOverride": ".background_sound_config_workflow_override", + "BackgroundSoundPresetId": ".background_sound_preset_id", + "BackgroundSoundSourceType": ".background_sound_source_type", + "BackupLlmDefault": ".backup_llm_default", + "BackupLlmDisabled": ".backup_llm_disabled", + "BackupLlmOverride": ".backup_llm_override", + "BadRequestErrorBody": ".bad_request_error_body", + "BanReasonType": ".ban_reason_type", + "BaseTurnConfig": ".base_turn_config", + "BasicAuthResponse": ".basic_auth_response", + "BatchCallDetailedResponse": ".batch_call_detailed_response", + "BatchCallRecipientStatus": ".batch_call_recipient_status", + "BatchCallResponse": ".batch_call_response", + "BatchCallStatus": ".batch_call_status", + "BatchCallWhatsAppParams": ".batch_call_whats_app_params", + "BatchCallingCampaignInformation": ".batch_calling_campaign_information", + "BatchFailureResponseModel": ".batch_failure_response_model", + "BearerAuthResponse": ".bearer_auth_response", + "BehaviorOverride": ".behavior_override", + "BillingPeriod": ".billing_period", + "BooleanSchema": ".boolean_schema", + "BranchProtectionStatus": ".branch_protection_status", + "BreakdownTypes": ".breakdown_types", + "BucketingStatus": ".bucketing_status", + "BuiltInToolsInput": ".built_in_tools_input", + "BuiltInToolsOutput": ".built_in_tools_output", + "BuiltInToolsWorkflowOverrideInput": ".built_in_tools_workflow_override_input", + "BuiltInToolsWorkflowOverrideOutput": ".built_in_tools_workflow_override_output", + "BytedanceSeedance25Request": ".bytedance_seedance_25_request", + "BytedanceSeedance25RequestAspectRatio": ".bytedance_seedance_25_request_aspect_ratio", + "BytedanceSeedance25RequestResolution": ".bytedance_seedance_25_request_resolution", + "BytedanceSeedance2FastRequest": ".bytedance_seedance_2_fast_request", + "BytedanceSeedance2FastRequestAspectRatio": ".bytedance_seedance_2_fast_request_aspect_ratio", + "BytedanceSeedance2FastRequestResolution": ".bytedance_seedance_2_fast_request_resolution", + "BytedanceSeedance2MiniRequest": ".bytedance_seedance_2_mini_request", + "BytedanceSeedance2MiniRequestAspectRatio": ".bytedance_seedance_2_mini_request_aspect_ratio", + "BytedanceSeedance2MiniRequestResolution": ".bytedance_seedance_2_mini_request_resolution", + "BytedanceSeedance2Request": ".bytedance_seedance_2_request", + "BytedanceSeedance2RequestAspectRatio": ".bytedance_seedance_2_request_aspect_ratio", + "BytedanceSeedance2RequestResolution": ".bytedance_seedance_2_request_resolution", + "BytedanceSeedream5LiteRequest": ".bytedance_seedream_5_lite_request", + "BytedanceSeedream5LiteRequestAspectRatio": ".bytedance_seedream_5_lite_request_aspect_ratio", + "BytedanceSeedream5LiteRequestResolution": ".bytedance_seedream_5_lite_request_resolution", + "BytedanceSeedream5ProRequest": ".bytedance_seedream_5_pro_request", + "BytedanceSeedream5ProRequestAspectRatio": ".bytedance_seedream_5_pro_request_aspect_ratio", + "BytedanceSeedream5ProRequestResolution": ".bytedance_seedream_5_pro_request_resolution", + "CallResult": ".call_result", + "CampaignConversationType": ".campaign_conversation_type", + "CancelCalendarEventParams": ".cancel_calendar_event_params", + "CancelGroupSessionForAllParams": ".cancel_group_session_for_all_params", + "CancelGroupSessionRegistrationParams": ".cancel_group_session_registration_params", + "CancelOrderParams": ".cancel_order_params", + "CanvasPlacement": ".canvas_placement", + "CaptionStyleCharacterAnimationModel": ".caption_style_character_animation_model", + "CaptionStyleCharacterAnimationModelEnterType": ".caption_style_character_animation_model_enter_type", + "CaptionStyleCharacterAnimationModelExitType": ".caption_style_character_animation_model_exit_type", + "CaptionStyleHorizontalPlacementModel": ".caption_style_horizontal_placement_model", + "CaptionStyleHorizontalPlacementModelAlign": ".caption_style_horizontal_placement_model_align", + "CaptionStyleModel": ".caption_style_model", + "CaptionStyleModelTextAlign": ".caption_style_model_text_align", + "CaptionStyleModelTextBlendMode": ".caption_style_model_text_blend_mode", + "CaptionStyleModelTextStyle": ".caption_style_model_text_style", + "CaptionStyleModelTextTransform": ".caption_style_model_text_transform", + "CaptionStyleModelTextWeight": ".caption_style_model_text_weight", + "CaptionStyleSectionAnimationModel": ".caption_style_section_animation_model", + "CaptionStyleSectionAnimationModelEnterType": ".caption_style_section_animation_model_enter_type", + "CaptionStyleSectionAnimationModelExitType": ".caption_style_section_animation_model_exit_type", + "CaptionStyleTemplateModel": ".caption_style_template_model", + "CaptionStyleVerticalPlacementModel": ".caption_style_vertical_placement_model", + "CaptionStyleVerticalPlacementModelAlign": ".caption_style_vertical_placement_model_align", + "CaptionStyleWordAnimationModel": ".caption_style_word_animation_model", + "CaptionStyleWordAnimationModelEnterType": ".caption_style_word_animation_model_enter_type", + "CaptionStyleWordAnimationModelExitType": ".caption_style_word_animation_model_exit_type", + "ChapterContentBlockExtendableNodeResponseModel": ".chapter_content_block_extendable_node_response_model", + "ChapterContentBlockInputModel": ".chapter_content_block_input_model", + "ChapterContentBlockInputModelSubType": ".chapter_content_block_input_model_sub_type", + "ChapterContentBlockResponseModel": ".chapter_content_block_response_model", + "ChapterContentBlockResponseModelNodesItem": ".chapter_content_block_response_model_nodes_item", + "ChapterContentBlockResponseModelNodesItem_Other": ".chapter_content_block_response_model_nodes_item", + "ChapterContentBlockResponseModelNodesItem_TtsNode": ".chapter_content_block_response_model_nodes_item", + "ChapterContentBlockTtsNodeResponseModel": ".chapter_content_block_tts_node_response_model", + "ChapterContentInputModel": ".chapter_content_input_model", + "ChapterContentParagraphTtsNodeInputModel": ".chapter_content_paragraph_tts_node_input_model", + "ChapterContentResponseModel": ".chapter_content_response_model", + "ChapterResponse": ".chapter_response", + "ChapterSnapshotExtendedResponseModel": ".chapter_snapshot_extended_response_model", + "ChapterSnapshotResponse": ".chapter_snapshot_response", + "ChapterSnapshotsResponse": ".chapter_snapshots_response", + "ChapterState": ".chapter_state", + "ChapterStatisticsResponse": ".chapter_statistics_response", + "ChapterWithContentResponseModel": ".chapter_with_content_response_model", + "ChapterWithContentResponseModelState": ".chapter_with_content_response_model_state", + "CharacterAge": ".character_age", + "CharacterAlignmentModel": ".character_alignment_model", + "CharacterAlignmentResponseModel": ".character_alignment_response_model", + "CharacterGender": ".character_gender", + "CharacterMetadataResponseModel": ".character_metadata_response_model", + "CharacterRefreshPeriod": ".character_refresh_period", + "CharacterResponseModel": ".character_response_model", + "CharacterRole": ".character_role", + "CharacterUsageResponse": ".character_usage_response", + "ChatSourceMedium": ".chat_source_medium", + "CheckServiceAvailabilityParams": ".check_service_availability_params", + "ClientEvent": ".client_event", + "ClientSecretResponse": ".client_secret_response", + "ClientToolConfigInput": ".client_tool_config_input", + "ClientToolConfigOutput": ".client_tool_config_output", + "ClipAnimation": ".clip_animation", + "ClipAnimationEnterEffect": ".clip_animation_enter_effect", + "ClipAnimationExitEffect": ".clip_animation_exit_effect", + "CloseConnection": ".close_connection", + "CloseContext": ".close_context", + "ClosePayload": ".close_payload", + "CloseSocket": ".close_socket", + "ClosedOutcome": ".closed_outcome", + "ColumnFilter": ".column_filter", + "ColumnFilterOperation": ".column_filter_operation", + "ColumnFilterValuesItem": ".column_filter_values_item", + "ColumnUnit": ".column_unit", + "CommittedTranscriptEntitiesPayload": ".committed_transcript_entities_payload", + "CommittedTranscriptPayload": ".committed_transcript_payload", + "CommittedTranscriptWithTimestampsPayload": ".committed_transcript_with_timestamps_payload", + "CompactionSettingsWorkflowOverride": ".compaction_settings_workflow_override", + "CompileProceduresResponseModel": ".compile_procedures_response_model", + "CompileProceduresValidationErrorResponseModel": ".compile_procedures_validation_error_response_model", + "CompositionPlan": ".composition_plan", + "CompositionPlanChunksItem": ".composition_plan_chunks_item", + "ComputedUsagePlatformLimit": ".computed_usage_platform_limit", + "ConditionStrength": ".condition_strength", + "ConfigEntityType": ".config_entity_type", + "ConflictSection": ".conflict_section", + "ConstantSchemaOverride": ".constant_schema_override", + "ConstantSchemaOverrideConstantValue": ".constant_schema_override_constant_value", + "ContentConfig": ".content_config", + "ContentFormat": ".content_format", + "ContentGuardrailInput": ".content_guardrail_input", + "ContentGuardrailInputTriggerAction": ".content_guardrail_input_trigger_action", + "ContentGuardrailInputTriggerAction_EndCall": ".content_guardrail_input_trigger_action", + "ContentGuardrailInputTriggerAction_Retry": ".content_guardrail_input_trigger_action", + "ContentGuardrailOutput": ".content_guardrail_output", + "ContentGuardrailOutputTriggerAction": ".content_guardrail_output_trigger_action", + "ContentGuardrailOutputTriggerAction_EndCall": ".content_guardrail_output_trigger_action", + "ContentGuardrailOutputTriggerAction_Retry": ".content_guardrail_output_trigger_action", + "ContentSchema": ".content_schema", + "ContentSchema_Array": ".content_schema", + "ContentSchema_Audio": ".content_schema", + "ContentSchema_Boolean": ".content_schema", + "ContentSchema_Image": ".content_schema", + "ContentSchema_Integer": ".content_schema", + "ContentSchema_Number": ".content_schema", + "ContentSchema_Object": ".content_schema", + "ContentSchema_String": ".content_schema", + "ContentSchema_Video": ".content_schema", + "ContentSchema_Voice": ".content_schema", + "ContentThresholdGuardrail": ".content_threshold_guardrail", + "ContentThresholdGuardrailThreshold": ".content_threshold_guardrail_threshold", + "ContextualUpdateInfo": ".contextual_update_info", + "Contributor": ".contributor", + "ConvAiDynamicVariable": ".conv_ai_dynamic_variable", + "ConvAiEnvVarLocator": ".conv_ai_env_var_locator", + "ConvAiFileUploadResponseModel": ".conv_ai_file_upload_response_model", + "ConvAiSecretLocator": ".conv_ai_secret_locator", + "ConvAiStoredSecretDependencies": ".conv_ai_stored_secret_dependencies", + "ConvAiStoredSecretDependenciesAgentsItem": ".conv_ai_stored_secret_dependencies_agents_item", + "ConvAiStoredSecretDependenciesAgentsItem_Available": ".conv_ai_stored_secret_dependencies_agents_item", + "ConvAiStoredSecretDependenciesAgentsItem_Unknown": ".conv_ai_stored_secret_dependencies_agents_item", + "ConvAiStoredSecretDependenciesMcpServersItem": ".conv_ai_stored_secret_dependencies_mcp_servers_item", + "ConvAiStoredSecretDependenciesMcpServersItem_Available": ".conv_ai_stored_secret_dependencies_mcp_servers_item", + "ConvAiStoredSecretDependenciesMcpServersItem_Unknown": ".conv_ai_stored_secret_dependencies_mcp_servers_item", + "ConvAiStoredSecretDependenciesToolsItem": ".conv_ai_stored_secret_dependencies_tools_item", + "ConvAiStoredSecretDependenciesToolsItem_Available": ".conv_ai_stored_secret_dependencies_tools_item", + "ConvAiStoredSecretDependenciesToolsItem_Unknown": ".conv_ai_stored_secret_dependencies_tools_item", + "ConvAiUserSecretDbModel": ".conv_ai_user_secret_db_model", + "ConvAiWebhooks": ".conv_ai_webhooks", + "ConvAiWorkspaceStoredSecretConfig": ".conv_ai_workspace_stored_secret_config", + "ConversationAsrUsageModel": ".conversation_asr_usage_model", + "ConversationChargingCommonModel": ".conversation_charging_common_model", + "ConversationConfigClientOverrideConfigInput": ".conversation_config_client_override_config_input", + "ConversationConfigClientOverrideConfigOutput": ".conversation_config_client_override_config_output", + "ConversationConfigClientOverrideInput": ".conversation_config_client_override_input", + "ConversationConfigClientOverrideOutput": ".conversation_config_client_override_output", + "ConversationConfigInput": ".conversation_config_input", + "ConversationConfigOutput": ".conversation_config_output", + "ConversationConfigOverride": ".conversation_config_override", + "ConversationConfigOverrideConfig": ".conversation_config_override_config", + "ConversationConfigWorkflowOverrideInput": ".conversation_config_workflow_override_input", + "ConversationConfigWorkflowOverrideOutput": ".conversation_config_workflow_override_output", + "ConversationDeletionSettings": ".conversation_deletion_settings", + "ConversationErrorType": ".conversation_error_type", + "ConversationFeedbackType": ".conversation_feedback_type", + "ConversationHistoryAnalysisCommonModel": ".conversation_history_analysis_common_model", + "ConversationHistoryBatchCallModel": ".conversation_history_batch_call_model", + "ConversationHistoryElevenAssistantCommonModel": ".conversation_history_eleven_assistant_common_model", + "ConversationHistoryErrorCommonModel": ".conversation_history_error_common_model", + "ConversationHistoryEvaluationCriteriaResultCommonModel": ".conversation_history_evaluation_criteria_result_common_model", + "ConversationHistoryExotelPhoneCallModel": ".conversation_history_exotel_phone_call_model", + "ConversationHistoryFeedbackCommonModel": ".conversation_history_feedback_common_model", + "ConversationHistoryMetadataCommonModel": ".conversation_history_metadata_common_model", + "ConversationHistoryMetadataCommonModelPhoneCall": ".conversation_history_metadata_common_model_phone_call", + "ConversationHistoryMetadataCommonModelPhoneCall_Exotel": ".conversation_history_metadata_common_model_phone_call", + "ConversationHistoryMetadataCommonModelPhoneCall_SipTrunking": ".conversation_history_metadata_common_model_phone_call", + "ConversationHistoryMetadataCommonModelPhoneCall_Twilio": ".conversation_history_metadata_common_model_phone_call", + "ConversationHistoryMultivoiceMessageModel": ".conversation_history_multivoice_message_model", + "ConversationHistoryMultivoiceMessagePartModel": ".conversation_history_multivoice_message_part_model", + "ConversationHistoryRagUsageCommonModel": ".conversation_history_rag_usage_common_model", + "ConversationHistoryRedactionConfig": ".conversation_history_redaction_config", + "ConversationHistorySipTrunkingPhoneCallModel": ".conversation_history_sip_trunking_phone_call_model", + "ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput": ".conversation_history_transcript_api_integration_webhook_tools_result_common_model_input", + "ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput": ".conversation_history_transcript_api_integration_webhook_tools_result_common_model_output", + "ConversationHistoryTranscriptCommonModelInput": ".conversation_history_transcript_common_model_input", + "ConversationHistoryTranscriptCommonModelInputRole": ".conversation_history_transcript_common_model_input_role", + "ConversationHistoryTranscriptCommonModelInputToolResultsItem": ".conversation_history_transcript_common_model_input_tool_results_item", + "ConversationHistoryTranscriptCommonModelOutput": ".conversation_history_transcript_common_model_output", + "ConversationHistoryTranscriptCommonModelOutputRole": ".conversation_history_transcript_common_model_output_role", + "ConversationHistoryTranscriptCommonModelOutputToolResultsItem": ".conversation_history_transcript_common_model_output_tool_results_item", + "ConversationHistoryTranscriptFileInputResponseModel": ".conversation_history_transcript_file_input_response_model", + "ConversationHistoryTranscriptOtherToolsResultCommonModel": ".conversation_history_transcript_other_tools_result_common_model", + "ConversationHistoryTranscriptOtherToolsResultCommonModelType": ".conversation_history_transcript_other_tools_result_common_model_type", + "ConversationHistoryTranscriptResponseModel": ".conversation_history_transcript_response_model", + "ConversationHistoryTranscriptResponseModelRole": ".conversation_history_transcript_response_model_role", + "ConversationHistoryTranscriptResponseModelToolResultsItem": ".conversation_history_transcript_response_model_tool_results_item", + "ConversationHistoryTranscriptSystemToolResultCommonModelInput": ".conversation_history_transcript_system_tool_result_common_model_input", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_Dummy": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndCallSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureError": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseRagSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_LanguageDetectionSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfError": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_SkipTurnSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureError": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TestingToolResult": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentError": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberAmazonConnectSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberError": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberExotelSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberSipSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberTwilioSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_VoicemailDetectionSuccess": ".conversation_history_transcript_system_tool_result_common_model_input_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutput": ".conversation_history_transcript_system_tool_result_common_model_output", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_Dummy": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndCallSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureError": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseRagSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_LanguageDetectionSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfError": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_SkipTurnSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureError": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TestingToolResult": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentError": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberAmazonConnectSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberError": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberExotelSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberSipSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberTwilioSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_VoicemailDetectionSuccess": ".conversation_history_transcript_system_tool_result_common_model_output_result", + "ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsInput": ".conversation_history_transcript_tool_call_api_integration_webhook_details_input", + "ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsOutput": ".conversation_history_transcript_tool_call_api_integration_webhook_details_output", + "ConversationHistoryTranscriptToolCallClientDetails": ".conversation_history_transcript_tool_call_client_details", + "ConversationHistoryTranscriptToolCallCommonModelInput": ".conversation_history_transcript_tool_call_common_model_input", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails": ".conversation_history_transcript_tool_call_common_model_input_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_ApiIntegrationWebhook": ".conversation_history_transcript_tool_call_common_model_input_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Client": ".conversation_history_transcript_tool_call_common_model_input_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Mcp": ".conversation_history_transcript_tool_call_common_model_input_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Webhook": ".conversation_history_transcript_tool_call_common_model_input_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelOutput": ".conversation_history_transcript_tool_call_common_model_output", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails": ".conversation_history_transcript_tool_call_common_model_output_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_ApiIntegrationWebhook": ".conversation_history_transcript_tool_call_common_model_output_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Client": ".conversation_history_transcript_tool_call_common_model_output_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Mcp": ".conversation_history_transcript_tool_call_common_model_output_tool_details", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Webhook": ".conversation_history_transcript_tool_call_common_model_output_tool_details", + "ConversationHistoryTranscriptToolCallMcpDetails": ".conversation_history_transcript_tool_call_mcp_details", + "ConversationHistoryTranscriptToolCallWebhookDetails": ".conversation_history_transcript_tool_call_webhook_details", + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput": ".conversation_history_transcript_workflow_tools_result_common_model_input", + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput": ".conversation_history_transcript_workflow_tools_result_common_model_output", + "ConversationHistoryTwilioPhoneCallModel": ".conversation_history_twilio_phone_call_model", + "ConversationInitiationClientDataConfigInput": ".conversation_initiation_client_data_config_input", + "ConversationInitiationClientDataConfigOutput": ".conversation_initiation_client_data_config_output", + "ConversationInitiationClientDataInternal": ".conversation_initiation_client_data_internal", + "ConversationInitiationClientDataRequestInput": ".conversation_initiation_client_data_request_input", + "ConversationInitiationClientDataRequestOutput": ".conversation_initiation_client_data_request_output", + "ConversationInitiationClientDataWebhook": ".conversation_initiation_client_data_webhook", + "ConversationInitiationClientDataWebhookRequestHeadersValue": ".conversation_initiation_client_data_webhook_request_headers_value", + "ConversationInitiationSource": ".conversation_initiation_source", + "ConversationInitiationSourceInfo": ".conversation_initiation_source_info", + "ConversationProduct": ".conversation_product", + "ConversationReasoningModel": ".conversation_reasoning_model", + "ConversationSentimentAnalysis": ".conversation_sentiment_analysis", + "ConversationSentimentAnalysisOverallLabel": ".conversation_sentiment_analysis_overall_label", + "ConversationSignedUrlResponseModel": ".conversation_signed_url_response_model", + "ConversationSimulationSpecification": ".conversation_simulation_specification", + "ConversationSource": ".conversation_source", + "ConversationSummaryMessageModel": ".conversation_summary_message_model", + "ConversationSummaryMessageModelRole": ".conversation_summary_message_model_role", + "ConversationSummaryResponseModel": ".conversation_summary_response_model", + "ConversationSummaryResponseModelStatus": ".conversation_summary_response_model_status", + "ConversationTagResponseModel": ".conversation_tag_response_model", + "ConversationTokenPurpose": ".conversation_token_purpose", + "ConversationTokenResponseModel": ".conversation_token_response_model", + "ConversationTtsUsageModel": ".conversation_tts_usage_model", + "ConversationTurnMetrics": ".conversation_turn_metrics", + "ConversationUserResponseModel": ".conversation_user_response_model", + "ConversationVoiceRewardModel": ".conversation_voice_reward_model", + "ConversationVoiceUsageModel": ".conversation_voice_usage_model", + "ConversationalConfig": ".conversational_config", + "ConversationalConfigApiModelWorkflowOverrideInput": ".conversational_config_api_model_workflow_override_input", + "ConversationalConfigApiModelWorkflowOverrideOutput": ".conversational_config_api_model_workflow_override_output", + "ConvertChapterResponseModel": ".convert_chapter_response_model", + "ConvertProjectResponseModel": ".convert_project_response_model", + "CrawlStatus": ".crawl_status", + "CrawlType": ".crawl_type", + "CreateAgentBranchResponseModel": ".create_agent_branch_response_model", + "CreateAgentMergeProposalResponseModel": ".create_agent_merge_proposal_response_model", + "CreateAgentProcedureParams": ".create_agent_procedure_params", + "CreateAgentResponseModel": ".create_agent_response_model", + "CreateAgentRuleParams": ".create_agent_rule_params", + "CreateAgentTestFolderResponseModel": ".create_agent_test_folder_response_model", + "CreateAgentTestResponseModel": ".create_agent_test_response_model", + "CreateAssetParams": ".create_asset_params", + "CreateAudioNativeProjectRequest": ".create_audio_native_project_request", + "CreateAuthConnectionEnvironmentVariableRequest": ".create_auth_connection_environment_variable_request", + "CreateBasicAuthRequest": ".create_basic_auth_request", + "CreateBearerAuthRequest": ".create_bearer_auth_request", + "CreateClientAppointmentParams": ".create_client_appointment_params", + "CreateClientInteractionParams": ".create_client_interaction_params", + "CreateClientParams": ".create_client_params", + "CreateClientSecretRequest": ".create_client_secret_request", + "CreateCrawlJobResponseModel": ".create_crawl_job_response_model", + "CreateCustomHeaderAuthRequest": ".create_custom_header_auth_request", + "CreateExotelPhoneNumberRequest": ".create_exotel_phone_number_request", + "CreateHolidayParams": ".create_holiday_params", + "CreateLocationParams": ".create_location_params", + "CreateMtlsAuthRequest": ".create_mtls_auth_request", + "CreateOAuth2ClientCredsRequest": ".create_o_auth_2_client_creds_request", + "CreateOAuth2JwtRequest": ".create_o_auth_2_jwt_request", + "CreateOAuth2JwtRequestAlgorithm": ".create_o_auth_2_jwt_request_algorithm", + "CreateOAuth2JwtRequestTokenResponseField": ".create_o_auth_2_jwt_request_token_response_field", + "CreateOrderParams": ".create_order_params", + "CreateOrderRequest": ".create_order_request", + "CreateOrderResponse": ".create_order_response", + "CreatePhoneNumberResponseModel": ".create_phone_number_response_model", + "CreatePreviouslyGeneratedVoiceRequest": ".create_previously_generated_voice_request", + "CreatePrivateKeyJwtRequest": ".create_private_key_jwt_request", + "CreatePrivateKeyJwtRequestAlgorithm": ".create_private_key_jwt_request_algorithm", + "CreateProcedureRequestModel": ".create_procedure_request_model", + "CreateProcedureResponseModel": ".create_procedure_response_model", + "CreateProductParams": ".create_product_params", + "CreateProductQuoteRequestParams": ".create_product_quote_request_params", + "CreatePronunciationDictionaryResponseModel": ".create_pronunciation_dictionary_response_model", + "CreateResponseUnitTestRequest": ".create_response_unit_test_request", + "CreateSecretEnvironmentVariableRequest": ".create_secret_environment_variable_request", + "CreateServiceParams": ".create_service_params", + "CreateServiceQuoteRequestParams": ".create_service_quote_request_params", + "CreateSimulationTestRequest": ".create_simulation_test_request", + "CreateSipTrunkPhoneNumberRequest": ".create_sip_trunk_phone_number_request", + "CreateStaffParams": ".create_staff_params", + "CreateStringEnvironmentVariableRequest": ".create_string_environment_variable_request", + "CreateToolCallUnitTestRequest": ".create_tool_call_unit_test_request", + "CreateTranscriptRequest": ".create_transcript_request", + "CreateTransferRuleParams": ".create_transfer_rule_params", + "CreateTwilioPhoneNumberRequest": ".create_twilio_phone_number_request", + "CreatifyAuroraRequest": ".creatify_aurora_request", + "CreatifyAuroraRequestResolution": ".creatify_aurora_request_resolution", + "CriteriaScoringMode": ".criteria_scoring_mode", + "CueOptionsRequest": ".cue_options_request", + "Currency": ".currency", + "CustomGuardrailConfig": ".custom_guardrail_config", + "CustomGuardrailConfigModel": ".custom_guardrail_config_model", + "CustomGuardrailConfigTriggerAction": ".custom_guardrail_config_trigger_action", + "CustomGuardrailConfigTriggerAction_EndCall": ".custom_guardrail_config_trigger_action", + "CustomGuardrailConfigTriggerAction_Retry": ".custom_guardrail_config_trigger_action", + "CustomGuardrailInput": ".custom_guardrail_input", + "CustomGuardrailOutput": ".custom_guardrail_output", + "CustomGuardrailsConfigInput": ".custom_guardrails_config_input", + "CustomGuardrailsConfigOutput": ".custom_guardrails_config_output", + "CustomHeaderAuthResponse": ".custom_header_auth_response", + "CustomLlm": ".custom_llm", + "CustomLlmApiKey": ".custom_llm_api_key", + "CustomLlmAuthConnection": ".custom_llm_auth_connection", + "CustomLlmRequestHeadersValue": ".custom_llm_request_headers_value", + "CustomLlmapiType": ".custom_llmapi_type", + "CustomSipHeader": ".custom_sip_header", + "CustomSipHeaderWithDynamicVariable": ".custom_sip_header_with_dynamic_variable", + "DashboardCallSuccessChartModel": ".dashboard_call_success_chart_model", + "DashboardCriteriaChartModel": ".dashboard_criteria_chart_model", + "DashboardDataCollectionChartModel": ".dashboard_data_collection_chart_model", + "DataCollectionResultCommonModel": ".data_collection_result_common_model", + "DefaultSharingGroupConfig": ".default_sharing_group_config", + "DefaultSharingGroupConfigPermissionLevel": ".default_sharing_group_config_permission_level", + "DefaultSharingGroupResponseModel": ".default_sharing_group_response_model", + "DefaultSharingGroupResponseModelPermissionLevel": ".default_sharing_group_response_model_permission_level", + "DeleteAgentHoldAudioResponseModel": ".delete_agent_hold_audio_response_model", + "DeleteAgentProcedureParams": ".delete_agent_procedure_params", + "DeleteAgentRuleParams": ".delete_agent_rule_params", + "DeleteAssetParams": ".delete_asset_params", + "DeleteCalendarEventParams": ".delete_calendar_event_params", + "DeleteChapterRequest": ".delete_chapter_request", + "DeleteChapterResponseModel": ".delete_chapter_response_model", + "DeleteClientInteractionParams": ".delete_client_interaction_params", + "DeleteClientParams": ".delete_client_params", + "DeleteDubbingResponseModel": ".delete_dubbing_response_model", + "DeleteGroupSessionParams": ".delete_group_session_params", + "DeleteHistoryItemResponse": ".delete_history_item_response", + "DeleteHolidayParams": ".delete_holiday_params", + "DeleteLocationParams": ".delete_location_params", + "DeleteProductParams": ".delete_product_params", + "DeleteProjectRequest": ".delete_project_request", + "DeleteProjectResponseModel": ".delete_project_response_model", + "DeleteSampleResponse": ".delete_sample_response", + "DeleteServiceParams": ".delete_service_params", + "DeleteStaffParams": ".delete_staff_params", + "DeleteTransferRuleParams": ".delete_transfer_rule_params", + "DeleteUserVoiceCollectionResponseModel": ".delete_user_voice_collection_response_model", + "DeleteVoiceResponseModel": ".delete_voice_response_model", + "DeleteVoiceSampleResponseModel": ".delete_voice_sample_response_model", + "DeleteWorkspaceGroupMemberResponseModel": ".delete_workspace_group_member_response_model", + "DeleteWorkspaceInviteResponseModel": ".delete_workspace_invite_response_model", + "DeleteWorkspaceWebhookResponseModel": ".delete_workspace_webhook_response_model", + "DeliverableInfo": ".deliverable_info", + "DependentAvailableAgentIdentifier": ".dependent_available_agent_identifier", + "DependentAvailableAgentIdentifierAccessLevel": ".dependent_available_agent_identifier_access_level", + "DependentAvailableMcpServerIdentifier": ".dependent_available_mcp_server_identifier", + "DependentAvailableMcpServerIdentifierAccessLevel": ".dependent_available_mcp_server_identifier_access_level", + "DependentAvailableToolIdentifier": ".dependent_available_tool_identifier", + "DependentAvailableToolIdentifierAccessLevel": ".dependent_available_tool_identifier_access_level", + "DependentBranchInfo": ".dependent_branch_info", + "DependentIntegrationConnectionIdentifier": ".dependent_integration_connection_identifier", + "DependentPhoneNumberIdentifier": ".dependent_phone_number_identifier", + "DependentUnknownAgentIdentifier": ".dependent_unknown_agent_identifier", + "DependentUnknownMcpServerIdentifier": ".dependent_unknown_mcp_server_identifier", + "DependentUnknownToolIdentifier": ".dependent_unknown_tool_identifier", + "DetailedMusicResponse": ".detailed_music_response", + "DetailedMusicResponseCompositionPlan": ".detailed_music_response_composition_plan", + "DetectedEntity": ".detected_entity", + "DeviceModel": ".device_model", + "DialogueInput": ".dialogue_input", + "DialogueInputResponseModel": ".dialogue_input_response_model", + "DialogueTextAlignment": ".dialogue_text_alignment", + "DirectPublishingReadResponseModel": ".direct_publishing_read_response_model", + "DirectPublishingReadResponseModelDisplayMode": ".direct_publishing_read_response_model_display_mode", + "DirectPublishingReadResponseModelGenreItem": ".direct_publishing_read_response_model_genre_item", + "DirectPublishingReadResponseModelPayoutType": ".direct_publishing_read_response_model_payout_type", + "DirectPublishingReadResponseModelTargetAudience": ".direct_publishing_read_response_model_target_audience", + "DiscountResponseModel": ".discount_response_model", + "DoDubbingResponse": ".do_dubbing_response", + "DocumentUsageModeEnum": ".document_usage_mode_enum", + "DocxExportOptions": ".docx_export_options", + "DtmfInputConfig": ".dtmf_input_config", + "DubOrderItemRequest": ".dub_order_item_request", + "DubbedSegment": ".dubbed_segment", + "DubbingAudio": ".dubbing_audio", + "DubbingAudioOutputError": ".dubbing_audio_output_error", + "DubbingAuthError": ".dubbing_auth_error", + "DubbingBulkSourceSegmentUpdateResponse": ".dubbing_bulk_source_segment_update_response", + "DubbingBulkTargetSegmentUpdateResponse": ".dubbing_bulk_target_segment_update_response", + "DubbingCommittedTranscript": ".dubbing_committed_transcript", + "DubbingEndOfStream": ".dubbing_end_of_stream", + "DubbingError": ".dubbing_error", + "DubbingInputAudioChunk": ".dubbing_input_audio_chunk", + "DubbingInputError": ".dubbing_input_error", + "DubbingInvalidRequestError": ".dubbing_invalid_request_error", + "DubbingLanguageListResponse": ".dubbing_language_list_response", + "DubbingLanguageOutputs": ".dubbing_language_outputs", + "DubbingLanguageResponse": ".dubbing_language_response", + "DubbingLanguageResponseStatus": ".dubbing_language_response_status", + "DubbingMediaMetadata": ".dubbing_media_metadata", + "DubbingMediaReference": ".dubbing_media_reference", + "DubbingMetadataPageResponseModel": ".dubbing_metadata_page_response_model", + "DubbingMetadataResponse": ".dubbing_metadata_response", + "DubbingPartialTranscript": ".dubbing_partial_transcript", + "DubbingProjectListResponse": ".dubbing_project_list_response", + "DubbingProjectResponse": ".dubbing_project_response", + "DubbingProjectResponseStatus": ".dubbing_project_response_status", + "DubbingQueueOverflowError": ".dubbing_queue_overflow_error", + "DubbingRateLimitedError": ".dubbing_rate_limited_error", + "DubbingRegenerateResponse": ".dubbing_regenerate_response", + "DubbingReleaseChannel": ".dubbing_release_channel", + "DubbingRenderResponseModel": ".dubbing_render_response_model", + "DubbingResource": ".dubbing_resource", + "DubbingSegmentUpdateRequest": ".dubbing_segment_update_request", + "DubbingSessionStarted": ".dubbing_session_started", + "DubbingSourceMediaInfo": ".dubbing_source_media_info", + "DubbingSourceSegmentUpdateResponse": ".dubbing_source_segment_update_response", + "DubbingSourceTranscriptResponse": ".dubbing_source_transcript_response", + "DubbingStatus": ".dubbing_status", + "DubbingStatusStatus": ".dubbing_status_status", + "DubbingTargetSegmentUpdateRequest": ".dubbing_target_segment_update_request", + "DubbingTargetSegmentUpdateResponse": ".dubbing_target_segment_update_response", + "DubbingTargetTranscriptResponse": ".dubbing_target_transcript_response", + "DubbingTargetTranscriptSegment": ".dubbing_target_transcript_segment", + "DubbingTranscriberError": ".dubbing_transcriber_error", + "DubbingTranscript": ".dubbing_transcript", + "DubbingTranscriptCharacter": ".dubbing_transcript_character", + "DubbingTranscriptResponseModel": ".dubbing_transcript_response_model", + "DubbingTranscriptRevisionResponse": ".dubbing_transcript_revision_response", + "DubbingTranscriptSegment": ".dubbing_transcript_segment", + "DubbingTranscriptUtterance": ".dubbing_transcript_utterance", + "DubbingTranscriptWord": ".dubbing_transcript_word", + "DubbingTranscriptsResponseModel": ".dubbing_transcripts_response_model", + "DubbingTranscriptsResponseModelTranscriptFormat": ".dubbing_transcripts_response_model_transcript_format", + "DubbingTranslation": ".dubbing_translation", + "DubbingTranslationError": ".dubbing_translation_error", + "DummyToolResultModel": ".dummy_tool_result_model", + "DuplicateSpeechEngineRequest": ".duplicate_speech_engine_request", + "DynamicVariableAssignment": ".dynamic_variable_assignment", + "DynamicVariableInternalValueType": ".dynamic_variable_internal_value_type", + "DynamicVariableNestedValueTypeInput": ".dynamic_variable_nested_value_type_input", + "DynamicVariableNestedValueTypeOutput": ".dynamic_variable_nested_value_type_output", + "DynamicVariableSchemaOverride": ".dynamic_variable_schema_override", + "DynamicVariableUpdateCommonModel": ".dynamic_variable_update_common_model", + "DynamicVariablesConfig": ".dynamic_variables_config", + "DynamicVariablesConfigWorkflowOverride": ".dynamic_variables_config_workflow_override", + "Eagerness": ".eagerness", + "EditChapterResponseModel": ".edit_chapter_response_model", + "EditProjectResponseModel": ".edit_project_response_model", + "EditVoiceResponseModel": ".edit_voice_response_model", + "EditVoiceSettingsRequest": ".edit_voice_settings_request", + "EditVoiceSettingsResponseModel": ".edit_voice_settings_response_model", + "EditedTranscript": ".edited_transcript", + "EffectsSpecInput": ".effects_spec_input", + "EffectsSpecOutput": ".effects_spec_output", + "ElevenFlashV25Request": ".eleven_flash_v_25_request", + "ElevenFlashV25RequestOutputFormat": ".eleven_flash_v_25_request_output_format", + "ElevenFlashV25VoiceSettings": ".eleven_flash_v_25_voice_settings", + "ElevenMultilingualV2Request": ".eleven_multilingual_v_2_request", + "ElevenMultilingualV2RequestOutputFormat": ".eleven_multilingual_v_2_request_output_format", + "ElevenV3Request": ".eleven_v_3_request", + "ElevenV3RequestOutputFormat": ".eleven_v_3_request_output_format", + "ElevenV3VoiceSettings": ".eleven_v_3_voice_settings", + "EmbedVariant": ".embed_variant", + "EmbeddingModelEnum": ".embedding_model_enum", + "EndCallToolConfig": ".end_call_tool_config", + "EndCallToolResultModel": ".end_call_tool_result_model", + "EndCallTriggerAction": ".end_call_trigger_action", + "EndProcedureToolConfig": ".end_procedure_tool_config", + "EndProcedureToolConfigProceduresValue": ".end_procedure_tool_config_procedures_value", + "EndProcedureToolErrorStatus": ".end_procedure_tool_error_status", + "EndProcedureToolResultErrorModel": ".end_procedure_tool_result_error_model", + "EndProcedureToolResultSuccessModel": ".end_procedure_tool_result_success_model", + "EntityManagementActivityId": ".entity_management_activity_id", + "EntryBehavior": ".entry_behavior", + "EnvironmentAuthConnectionLocator": ".environment_auth_connection_locator", + "EnvironmentResponse": ".environment_response", + "EnvironmentVariableAuthConnectionValue": ".environment_variable_auth_connection_value", + "EnvironmentVariableAuthConnectionValueRequest": ".environment_variable_auth_connection_value_request", + "EnvironmentVariableResponse": ".environment_variable_response", + "EnvironmentVariableResponseType": ".environment_variable_response_type", + "EnvironmentVariableResponseValues": ".environment_variable_response_values", + "EnvironmentVariableSecretValue": ".environment_variable_secret_value", + "EnvironmentVariableSecretValueRequest": ".environment_variable_secret_value_request", + "EnvironmentVariablesListResponse": ".environment_variables_list_response", + "EnvironmentsListResponse": ".environments_list_response", + "ErrorPayload": ".error_payload", + "EvaluationCriteriaSummaryResult": ".evaluation_criteria_summary_result", + "EvaluationResultFilter": ".evaluation_result_filter", + "EvaluationSettingsInput": ".evaluation_settings_input", + "EvaluationSettingsOutput": ".evaluation_settings_output", + "EvaluationSuccessResult": ".evaluation_success_result", + "ExactParameterEvaluationStrategy": ".exact_parameter_evaluation_strategy", + "ExotelApiSubdomain": ".exotel_api_subdomain", + "ExotelOutboundCallResponse": ".exotel_outbound_call_response", + "ExperimentAssignment": ".experiment_assignment", + "ExperimentAssignmentSource": ".experiment_assignment_source", + "ExpiresAfter": ".expires_after", + "ExportOptions": ".export_options", + "ExportOptions_Docx": ".export_options", + "ExportOptions_Html": ".export_options", + "ExportOptions_Pdf": ".export_options", + "ExportOptions_SegmentedJson": ".export_options", + "ExportOptions_Srt": ".export_options", + "ExportOptions_Txt": ".export_options", + "ExternalFileSyncInfo": ".external_file_sync_info", + "ExternalFolderSyncInfo": ".external_folder_sync_info", + "ExternalSyncJobTrigger": ".external_sync_job_trigger", + "ExternalSyncJobType": ".external_sync_job_type", + "ExternalSyncProvider": ".external_sync_provider", + "FeatureStatusCommonModel": ".feature_status_common_model", + "FeaturesUsageCommonModel": ".features_usage_common_model", + "FeedbackItem": ".feedback_item", + "FieldConflict": ".field_conflict", + "FileInputConfig": ".file_input_config", + "FileInputConfigWorkflowOverride": ".file_input_config_workflow_override", + "FileRefreshStatus": ".file_refresh_status", + "FinalOutput": ".final_output", + "FinalOutputMulti": ".final_output_multi", + "FineTuningResponse": ".fine_tuning_response", + "FineTuningResponseStateValue": ".fine_tuning_response_state_value", + "FinetuneCreatedBy": ".finetune_created_by", + "FinetuneVisibility": ".finetune_visibility", + "FlushContext": ".flush_context", + "FocusGuardrail": ".focus_guardrail", + "ForcedAlignmentCharacterResponseModel": ".forced_alignment_character_response_model", + "ForcedAlignmentResponseModel": ".forced_alignment_response_model", + "ForcedAlignmentWordResponseModel": ".forced_alignment_word_response_model", + "FrustratedConversationRef": ".frustrated_conversation_ref", + "FrustratedConversationRefOverallLabel": ".frustrated_conversation_ref_overall_label", + "Gemini25FlashImageRequest": ".gemini_25_flash_image_request", + "Gemini25FlashImageRequestAspectRatio": ".gemini_25_flash_image_request_aspect_ratio", + "Gemini31FlashImageRequest": ".gemini_31_flash_image_request", + "Gemini31FlashImageRequestAspectRatio": ".gemini_31_flash_image_request_aspect_ratio", + "Gemini31FlashImageRequestResolution": ".gemini_31_flash_image_request_resolution", + "Gemini31FlashLiteImageRequest": ".gemini_31_flash_lite_image_request", + "Gemini31FlashLiteImageRequestAspectRatio": ".gemini_31_flash_lite_image_request_aspect_ratio", + "Gemini3ProImageRequest": ".gemini_3_pro_image_request", + "Gemini3ProImageRequestAspectRatio": ".gemini_3_pro_image_request_aspect_ratio", + "Gemini3ProImageRequestResolution": ".gemini_3_pro_image_request_resolution", + "Gender": ".gender", + "GenerateVoiceRequest": ".generate_voice_request", + "GenerationChunkInput": ".generation_chunk_input", + "GenerationChunkInputContextAdherence": ".generation_chunk_input_context_adherence", + "GenerationChunkOutput": ".generation_chunk_output", + "GenerationChunkOutputContextAdherence": ".generation_chunk_output_context_adherence", + "GenerationConfig": ".generation_config", + "GenerationReference": ".generation_reference", + "GenerationSourceContext": ".generation_source_context", + "GenesysBotOutcome": ".genesys_bot_outcome", + "GenesysRegion": ".genesys_region", + "GetAgentConfigParams": ".get_agent_config_params", + "GetAgentConversationTicketsPageResponseModel": ".get_agent_conversation_tickets_page_response_model", + "GetAgentEmbedResponseModel": ".get_agent_embed_response_model", + "GetAgentKnowledgebaseSizeResponseModel": ".get_agent_knowledgebase_size_response_model", + "GetAgentLinkResponseModel": ".get_agent_link_response_model", + "GetAgentResponseModel": ".get_agent_response_model", + "GetAgentResponseModelPhoneNumbersItem": ".get_agent_response_model_phone_numbers_item", + "GetAgentResponseModelPhoneNumbersItem_Exotel": ".get_agent_response_model_phone_numbers_item", + "GetAgentResponseModelPhoneNumbersItem_SipTrunk": ".get_agent_response_model_phone_numbers_item", + "GetAgentResponseModelPhoneNumbersItem_Twilio": ".get_agent_response_model_phone_numbers_item", + "GetAgentTestFolderResponseModel": ".get_agent_test_folder_response_model", + "GetAgentTopicsResponseModel": ".get_agent_topics_response_model", + "GetAgentsPageResponseModel": ".get_agents_page_response_model", + "GetAnalyticsSummaryParams": ".get_analytics_summary_params", + "GetAppointmentByConfirmationNumberParams": ".get_appointment_by_confirmation_number_params", + "GetAudioIsolationHistoryResponseModel": ".get_audio_isolation_history_response_model", + "GetAudioNativeProjectSettingsResponseModel": ".get_audio_native_project_settings_response_model", + "GetBookingPageSettingsParams": ".get_booking_page_settings_params", + "GetBookingSlugStatusParams": ".get_booking_slug_status_params", + "GetChapterRequest": ".get_chapter_request", + "GetChapterSnapshotsRequest": ".get_chapter_snapshots_request", + "GetChaptersRequest": ".get_chapters_request", + "GetChaptersResponse": ".get_chapters_response", + "GetClientAppointmentsParams": ".get_client_appointments_params", + "GetClientByPhoneParams": ".get_client_by_phone_params", + "GetClientOrdersParams": ".get_client_orders_params", + "GetConvAiDashboardSettingsResponseModel": ".get_conv_ai_dashboard_settings_response_model", + "GetConvAiDashboardSettingsResponseModelChartsItem": ".get_conv_ai_dashboard_settings_response_model_charts_item", + "GetConvAiDashboardSettingsResponseModelChartsItem_CallSuccess": ".get_conv_ai_dashboard_settings_response_model_charts_item", + "GetConvAiDashboardSettingsResponseModelChartsItem_Criteria": ".get_conv_ai_dashboard_settings_response_model_charts_item", + "GetConvAiDashboardSettingsResponseModelChartsItem_DataCollection": ".get_conv_ai_dashboard_settings_response_model_charts_item", + "GetConvAiSettingsResponseModel": ".get_conv_ai_settings_response_model", + "GetConversationResponseModel": ".get_conversation_response_model", + "GetConversationResponseModelStatus": ".get_conversation_response_model_status", + "GetConversationSummaryResponseModel": ".get_conversation_summary_response_model", + "GetConversationSummaryResponseModelStatus": ".get_conversation_summary_response_model_status", + "GetConversationTagsPageResponseModel": ".get_conversation_tags_page_response_model", + "GetConversationUsersPageResponseModel": ".get_conversation_users_page_response_model", + "GetConversationsPageResponseModel": ".get_conversations_page_response_model", + "GetCrawlJobResponseModel": ".get_crawl_job_response_model", + "GetKnowledgeBaseDependentAgentsResponseModel": ".get_knowledge_base_dependent_agents_response_model", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem": ".get_knowledge_base_dependent_agents_response_model_agents_item", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Available": ".get_knowledge_base_dependent_agents_response_model_agents_item", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Unknown": ".get_knowledge_base_dependent_agents_response_model_agents_item", + "GetKnowledgeBaseFileResponseModel": ".get_knowledge_base_file_response_model", + "GetKnowledgeBaseFolderResponseModel": ".get_knowledge_base_folder_response_model", + "GetKnowledgeBaseListResponseModel": ".get_knowledge_base_list_response_model", + "GetKnowledgeBaseListResponseModelDocumentsItem": ".get_knowledge_base_list_response_model_documents_item", + "GetKnowledgeBaseListResponseModelDocumentsItem_File": ".get_knowledge_base_list_response_model_documents_item", + "GetKnowledgeBaseListResponseModelDocumentsItem_Folder": ".get_knowledge_base_list_response_model_documents_item", + "GetKnowledgeBaseListResponseModelDocumentsItem_Text": ".get_knowledge_base_list_response_model_documents_item", + "GetKnowledgeBaseListResponseModelDocumentsItem_Url": ".get_knowledge_base_list_response_model_documents_item", + "GetKnowledgeBaseSummaryFileResponseModel": ".get_knowledge_base_summary_file_response_model", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem": ".get_knowledge_base_summary_file_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Available": ".get_knowledge_base_summary_file_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Unknown": ".get_knowledge_base_summary_file_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryFolderResponseModel": ".get_knowledge_base_summary_folder_response_model", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem": ".get_knowledge_base_summary_folder_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Available": ".get_knowledge_base_summary_folder_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Unknown": ".get_knowledge_base_summary_folder_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryTextResponseModel": ".get_knowledge_base_summary_text_response_model", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem": ".get_knowledge_base_summary_text_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Available": ".get_knowledge_base_summary_text_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Unknown": ".get_knowledge_base_summary_text_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryUrlResponseModel": ".get_knowledge_base_summary_url_response_model", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem": ".get_knowledge_base_summary_url_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Available": ".get_knowledge_base_summary_url_response_model_dependent_agents_item", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Unknown": ".get_knowledge_base_summary_url_response_model_dependent_agents_item", + "GetKnowledgeBaseTextResponseModel": ".get_knowledge_base_text_response_model", + "GetKnowledgeBaseUrlResponseModel": ".get_knowledge_base_url_response_model", + "GetLibraryVoicesResponse": ".get_library_voices_response", + "GetLiveCountResponse": ".get_live_count_response", + "GetOrCreateRagIndexRequestModel": ".get_or_create_rag_index_request_model", + "GetOrderByConfirmationNumberParams": ".get_order_by_confirmation_number_params", + "GetPhoneNumberExotelResponseModel": ".get_phone_number_exotel_response_model", + "GetPhoneNumberInboundSipTrunkConfigResponseModel": ".get_phone_number_inbound_sip_trunk_config_response_model", + "GetPhoneNumberOutboundSipTrunkConfigResponseModel": ".get_phone_number_outbound_sip_trunk_config_response_model", + "GetPhoneNumberResponse": ".get_phone_number_response", + "GetPhoneNumberSipTrunkResponseModel": ".get_phone_number_sip_trunk_response_model", + "GetPhoneNumberTwilioResponseModel": ".get_phone_number_twilio_response_model", + "GetPhoneNumbersPageResponseModel": ".get_phone_numbers_page_response_model", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem": ".get_phone_numbers_page_response_model_phone_numbers_item", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_Exotel": ".get_phone_numbers_page_response_model_phone_numbers_item", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_SipTrunk": ".get_phone_numbers_page_response_model_phone_numbers_item", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_Twilio": ".get_phone_numbers_page_response_model_phone_numbers_item", + "GetProjectRequest": ".get_project_request", + "GetProjectsRequest": ".get_projects_request", + "GetProjectsResponse": ".get_projects_response", + "GetPronunciationDictionariesMetadataResponseModel": ".get_pronunciation_dictionaries_metadata_response_model", + "GetPronunciationDictionariesResponse": ".get_pronunciation_dictionaries_response", + "GetPronunciationDictionaryMetadataResponse": ".get_pronunciation_dictionary_metadata_response", + "GetPronunciationDictionaryMetadataResponsePermissionOnResource": ".get_pronunciation_dictionary_metadata_response_permission_on_resource", + "GetPronunciationDictionaryResponse": ".get_pronunciation_dictionary_response", + "GetPronunciationDictionaryWithRulesResponseModel": ".get_pronunciation_dictionary_with_rules_response_model", + "GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource": ".get_pronunciation_dictionary_with_rules_response_model_permission_on_resource", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem": ".get_pronunciation_dictionary_with_rules_response_model_rules_item", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem_Alias": ".get_pronunciation_dictionary_with_rules_response_model_rules_item", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem_Phoneme": ".get_pronunciation_dictionary_with_rules_response_model_rules_item", + "GetResponseUnitTestResponseModel": ".get_response_unit_test_response_model", + "GetScheduleParams": ".get_schedule_params", + "GetSecretDependenciesResponseModel": ".get_secret_dependencies_response_model", + "GetSecretDependenciesResponseModelDependencies": ".get_secret_dependencies_response_model_dependencies", + "GetSecretDependenciesResponseModelDependenciesOneItem": ".get_secret_dependencies_response_model_dependencies_one_item", + "GetSecretDependenciesResponseModelDependenciesOneItem_Available": ".get_secret_dependencies_response_model_dependencies_one_item", + "GetSecretDependenciesResponseModelDependenciesOneItem_Unknown": ".get_secret_dependencies_response_model_dependencies_one_item", + "GetSecretDependenciesResponseModelDependenciesZeroItem": ".get_secret_dependencies_response_model_dependencies_zero_item", + "GetSecretDependenciesResponseModelDependenciesZeroItem_Available": ".get_secret_dependencies_response_model_dependencies_zero_item", + "GetSecretDependenciesResponseModelDependenciesZeroItem_Unknown": ".get_secret_dependencies_response_model_dependencies_zero_item", + "GetSimulationTestResponseModel": ".get_simulation_test_response_model", + "GetSipLogMessagesResponse": ".get_sip_log_messages_response", + "GetSpeechHistoryResponse": ".get_speech_history_response", + "GetTestInvocationsPageResponseModel": ".get_test_invocations_page_response_model", + "GetTestSuiteInvocationResponseModel": ".get_test_suite_invocation_response_model", + "GetTestsPageResponseModel": ".get_tests_page_response_model", + "GetTestsSummariesByIdsResponseModel": ".get_tests_summaries_by_ids_response_model", + "GetToolCallUnitTestResponseModel": ".get_tool_call_unit_test_response_model", + "GetToolDependentAgentsResponseModel": ".get_tool_dependent_agents_response_model", + "GetToolDependentAgentsResponseModelAgentsItem": ".get_tool_dependent_agents_response_model_agents_item", + "GetToolDependentAgentsResponseModelAgentsItem_Available": ".get_tool_dependent_agents_response_model_agents_item", + "GetToolDependentAgentsResponseModelAgentsItem_Unknown": ".get_tool_dependent_agents_response_model_agents_item", + "GetToolExecutionsPageResponseModel": ".get_tool_executions_page_response_model", + "GetUserVoiceCollectionsResponseModel": ".get_user_voice_collections_response_model", + "GetVoiceAccentsResponseModel": ".get_voice_accents_response_model", + "GetVoicesResponse": ".get_voices_response", + "GetVoicesV2Response": ".get_voices_v_2_response", + "GetWhatsAppAccountResponse": ".get_whats_app_account_response", + "GetWorkspacePlanParams": ".get_workspace_plan_params", + "GetWorkspaceSecretsResponseModel": ".get_workspace_secrets_response_model", + "GptImage15Request": ".gpt_image_15_request", + "GptImage15RequestAspectRatio": ".gpt_image_15_request_aspect_ratio", + "GptImage15RequestBackground": ".gpt_image_15_request_background", + "GptImage15RequestQuality": ".gpt_image_15_request_quality", + "GptImage1Request": ".gpt_image_1_request", + "GptImage1RequestAspectRatio": ".gpt_image_1_request_aspect_ratio", + "GptImage1RequestBackground": ".gpt_image_1_request_background", + "GptImage1RequestQuality": ".gpt_image_1_request_quality", + "GptImage25FlareRequest": ".gpt_image_25_flare_request", + "GptImage25FlareRequestAspectRatio": ".gpt_image_25_flare_request_aspect_ratio", + "GptImage25FlareRequestQuality": ".gpt_image_25_flare_request_quality", + "GptImage25FlareRequestResolution": ".gpt_image_25_flare_request_resolution", + "GptImage25SunburstRequest": ".gpt_image_25_sunburst_request", + "GptImage25SunburstRequestAspectRatio": ".gpt_image_25_sunburst_request_aspect_ratio", + "GptImage25SunburstRequestQuality": ".gpt_image_25_sunburst_request_quality", + "GptImage25SunburstRequestResolution": ".gpt_image_25_sunburst_request_resolution", + "GptImage2Request": ".gpt_image_2_request", + "GptImage2RequestAspectRatio": ".gpt_image_2_request_aspect_ratio", + "GptImage2RequestQuality": ".gpt_image_2_request_quality", + "GptImage2RequestResolution": ".gpt_image_2_request_resolution", + "GroupManagementActivityId": ".group_management_activity_id", + "GuardrailExecutionMode": ".guardrail_execution_mode", + "GuardrailType": ".guardrail_type", + "GuardrailsResult": ".guardrails_result", + "GuardrailsV1Input": ".guardrails_v_1_input", + "GuardrailsV1Output": ".guardrails_v_1_output", + "HidingReason": ".hiding_reason", + "HistoryAlignmentResponseModel": ".history_alignment_response_model", + "HistoryAlignmentsResponseModel": ".history_alignments_response_model", + "HistoryItemResponse": ".history_item_response", + "HtmlExportOptions": ".html_export_options", + "HttpRequestModel": ".http_request_model", + "HttpValidationError": ".http_validation_error", + "Icon": ".icon", + "IconTheme": ".icon_theme", + "ImageAnalysis": ".image_analysis", + "ImageAnalysisResult": ".image_analysis_result", + "ImageAnalysisStatus": ".image_analysis_status", + "ImageAvatar": ".image_avatar", + "ImageGenerationRequest": ".image_generation_request", + "ImageGenerationRequest_BytedanceSeedream5Lite": ".image_generation_request", + "ImageGenerationRequest_BytedanceSeedream5Pro": ".image_generation_request", + "ImageGenerationRequest_Gemini25FlashImage": ".image_generation_request", + "ImageGenerationRequest_Gemini31FlashImage": ".image_generation_request", + "ImageGenerationRequest_Gemini31FlashLiteImage": ".image_generation_request", + "ImageGenerationRequest_Gemini3ProImage": ".image_generation_request", + "ImageGenerationRequest_GptImage1": ".image_generation_request", + "ImageGenerationRequest_GptImage15": ".image_generation_request", + "ImageGenerationRequest_GptImage2": ".image_generation_request", + "ImageGenerationRequest_GptImage25Flare": ".image_generation_request", + "ImageGenerationRequest_GptImage25Sunburst": ".image_generation_request", + "ImageReference": ".image_reference", + "ImageReference_Asset": ".image_reference", + "ImageReference_Generation": ".image_reference", + "ImageReference_InlineBase64": ".image_reference", + "ImageSchema": ".image_schema", + "ImageSubject": ".image_subject", + "InboundSipTrunkConfigRequestModel": ".inbound_sip_trunk_config_request_model", + "InitPayload": ".init_payload", + "InitialiseContext": ".initialise_context", + "InitializeConnection": ".initialize_connection", + "InitializeConnectionMulti": ".initialize_connection_multi", + "InlineAudioReference": ".inline_audio_reference", + "InlineAudioReferenceMimeType": ".inline_audio_reference_mime_type", + "InlineBase64Reference": ".inline_base_64_reference", + "InlineBase64ReferenceMimeType": ".inline_base_64_reference_mime_type", + "InlineImageReference": ".inline_image_reference", + "InlineImageReferenceMimeType": ".inline_image_reference_mime_type", + "InlineVideoReference": ".inline_video_reference", + "InlineVideoReferenceMimeType": ".inline_video_reference_mime_type", + "InputAudioChunkPayload": ".input_audio_chunk_payload", + "IntegerSchema": ".integer_schema", + "IntegrationType": ".integration_type", + "InteractionBudget": ".interaction_budget", + "InternalAlertingWebhookNotifier": ".internal_alerting_webhook_notifier", + "InternalSamplingConfigResponseModel": ".internal_sampling_config_response_model", + "InvoiceResponse": ".invoice_response", + "InvoiceResponsePaymentIntentStatus": ".invoice_response_payment_intent_status", + "InvoiceResponsePaymentIntentStatussesItem": ".invoice_response_payment_intent_statusses_item", + "ItemId": ".item_id", + "KbExternalSyncJob": ".kb_external_sync_job", + "KeepContextAlive": ".keep_context_alive", + "KnowledgeBaseBulkDeleteSuccessfulResponseModel": ".knowledge_base_bulk_delete_successful_response_model", + "KnowledgeBaseContentSearchResponseModel": ".knowledge_base_content_search_response_model", + "KnowledgeBaseContentSearchResult": ".knowledge_base_content_search_result", + "KnowledgeBaseContentSearchResultDocument": ".knowledge_base_content_search_result_document", + "KnowledgeBaseContentSearchResultDocument_File": ".knowledge_base_content_search_result_document", + "KnowledgeBaseContentSearchResultDocument_Folder": ".knowledge_base_content_search_result_document", + "KnowledgeBaseContentSearchResultDocument_Text": ".knowledge_base_content_search_result_document", + "KnowledgeBaseContentSearchResultDocument_Url": ".knowledge_base_content_search_result_document", + "KnowledgeBaseDeletedResponseModel": ".knowledge_base_deleted_response_model", + "KnowledgeBaseDependentType": ".knowledge_base_dependent_type", + "KnowledgeBaseDocumentChunkResponseModel": ".knowledge_base_document_chunk_response_model", + "KnowledgeBaseDocumentChunksResponseModel": ".knowledge_base_document_chunks_response_model", + "KnowledgeBaseDocumentMetadataResponseModel": ".knowledge_base_document_metadata_response_model", + "KnowledgeBaseDocumentType": ".knowledge_base_document_type", + "KnowledgeBaseFolderPathSegmentResponseModel": ".knowledge_base_folder_path_segment_response_model", + "KnowledgeBaseFolderPathSegmentSummaryResponseModel": ".knowledge_base_folder_path_segment_summary_response_model", + "KnowledgeBaseLocator": ".knowledge_base_locator", + "KnowledgeBaseRagChunkModel": ".knowledge_base_rag_chunk_model", + "KnowledgeBaseRagToolConfig": ".knowledge_base_rag_tool_config", + "KnowledgeBaseRagToolResultModel": ".knowledge_base_rag_tool_result_model", + "KnowledgeBaseRagToolStatus": ".knowledge_base_rag_tool_status", + "KnowledgeBaseSortBy": ".knowledge_base_sort_by", + "KnowledgeBaseSourceFileUrlResponseModel": ".knowledge_base_source_file_url_response_model", + "KnowledgeBaseSummaryBatchSuccessfulResponseModel": ".knowledge_base_summary_batch_successful_response_model", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData": ".knowledge_base_summary_batch_successful_response_model_data", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_File": ".knowledge_base_summary_batch_successful_response_model_data", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Folder": ".knowledge_base_summary_batch_successful_response_model_data", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Text": ".knowledge_base_summary_batch_successful_response_model_data", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Url": ".knowledge_base_summary_batch_successful_response_model_data", + "KnowledgeBaseToolConfig": ".knowledge_base_tool_config", + "KnowledgeBaseToolInfo": ".knowledge_base_tool_info", + "KnowledgeBaseToolResultModel": ".knowledge_base_tool_result_model", + "KnowledgeBaseToolStatus": ".knowledge_base_tool_status", + "LanguageAddedResponse": ".language_added_response", + "LanguageDetectionToolConfig": ".language_detection_tool_config", + "LanguageDetectionToolResultModel": ".language_detection_tool_result_model", + "LanguageInfo": ".language_info", + "LanguagePairInfo": ".language_pair_info", + "LanguagePresetInput": ".language_preset_input", + "LanguagePresetOutput": ".language_preset_output", + "LanguagePresetTranslation": ".language_preset_translation", + "LanguageResponse": ".language_response", + "LanguagesResponse": ".languages_response", + "LanguagesResponse_Pair": ".languages_response", + "LanguagesResponse_Single": ".languages_response", + "LeaveMessageParams": ".leave_message_params", + "LibraryVoiceResponse": ".library_voice_response", + "LibraryVoiceResponseCategory": ".library_voice_response_category", + "ListAgentProceduresParams": ".list_agent_procedures_params", + "ListAgentReferencesParams": ".list_agent_references_params", + "ListAgentRulesParams": ".list_agent_rules_params", + "ListAssetsParams": ".list_assets_params", + "ListAuthConnectionsResponse": ".list_auth_connections_response", + "ListAuthConnectionsResponseAuthConnectionsItem": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2AuthCode": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2CustomApp": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_BasicAuth": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_BearerAuth": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_CustomHeaderAuth": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_Mtls": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_Oauth2ClientCredentials": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_Oauth2Jwt": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_PrivateKeyJwt": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_RefreshTokenAuth": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_SlackBotAuth": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_UrlSecret": ".list_auth_connections_response_auth_connections_item", + "ListAuthConnectionsResponseAuthConnectionsItem_WhatsappAuth": ".list_auth_connections_response_auth_connections_item", + "ListCalendarEventsParams": ".list_calendar_events_params", + "ListClientInteractionsParams": ".list_client_interactions_params", + "ListClientsParams": ".list_clients_params", + "ListCrawlJobsResponseModel": ".list_crawl_jobs_response_model", + "ListCustomerFacingAgentsParams": ".list_customer_facing_agents_params", + "ListGroupSessionsParams": ".list_group_sessions_params", + "ListHolidaysParams": ".list_holidays_params", + "ListLocationsParams": ".list_locations_params", + "ListMcpToolsResponseModel": ".list_mcp_tools_response_model", + "ListOrdersResponse": ".list_orders_response", + "ListProceduresResponseModel": ".list_procedures_response_model", + "ListProductsParams": ".list_products_params", + "ListResponseAgentBranchSummary": ".list_response_agent_branch_summary", + "ListResponseAgentDeploymentHistoryItem": ".list_response_agent_deployment_history_item", + "ListResponseMeta": ".list_response_meta", + "ListServicesParams": ".list_services_params", + "ListSpeechEnginesResponse": ".list_speech_engines_response", + "ListStaffParams": ".list_staff_params", + "ListTransferRulesParams": ".list_transfer_rules_params", + "ListWhatsAppAccountsResponse": ".list_whats_app_accounts_response", + "LiteralJsonSchemaProperty": ".literal_json_schema_property", + "LiteralJsonSchemaPropertyConstantValue": ".literal_json_schema_property_constant_value", + "LiteralJsonSchemaPropertyType": ".literal_json_schema_property_type", + "LivekitStackType": ".livekit_stack_type", + "Llm": ".llm", + "LlmCategoryUsage": ".llm_category_usage", + "LlmDeprecationConfigModel": ".llm_deprecation_config_model", + "LlmDeprecationInfoModel": ".llm_deprecation_info_model", + "LlmInfoModel": ".llm_info_model", + "LlmInputOutputTokensUsage": ".llm_input_output_tokens_usage", + "LlmListResponseModel": ".llm_list_response_model", + "LlmLiteralJsonSchemaProperty": ".llm_literal_json_schema_property", + "LlmLiteralJsonSchemaPropertyType": ".llm_literal_json_schema_property_type", + "LlmParameterEvaluationStrategy": ".llm_parameter_evaluation_strategy", + "LlmReasoningEffort": ".llm_reasoning_effort", + "LlmSchemaOverride": ".llm_schema_override", + "LlmTokensCategoryUsage": ".llm_tokens_category_usage", + "LlmUsageCalculatorLlmResponseModel": ".llm_usage_calculator_llm_response_model", + "LlmUsageCalculatorResponseModel": ".llm_usage_calculator_response_model", + "LlmUsageInput": ".llm_usage_input", + "LlmUsageOutput": ".llm_usage_output", + "LoadMemoryEntryToolErrorStatus": ".load_memory_entry_tool_error_status", + "LoadableMemoryEntry": ".loadable_memory_entry", + "LockReason": ".lock_reason", + "ManualSource": ".manual_source", + "ManualVerificationFileResponse": ".manual_verification_file_response", + "ManualVerificationResponse": ".manual_verification_response", + "MatchAnythingParameterEvaluationStrategy": ".match_anything_parameter_evaluation_strategy", + "McpApprovalPolicy": ".mcp_approval_policy", + "McpApprovedToolDefinition": ".mcp_approved_tool_definition", + "McpServerConfigInput": ".mcp_server_config_input", + "McpServerConfigInputAuthConnection": ".mcp_server_config_input_auth_connection", + "McpServerConfigInputRequestHeadersValue": ".mcp_server_config_input_request_headers_value", + "McpServerConfigInputRequestMetaValue": ".mcp_server_config_input_request_meta_value", + "McpServerConfigInputSecretToken": ".mcp_server_config_input_secret_token", + "McpServerConfigInputUrl": ".mcp_server_config_input_url", + "McpServerConfigOutput": ".mcp_server_config_output", + "McpServerConfigOutputAuthConnection": ".mcp_server_config_output_auth_connection", + "McpServerConfigOutputRequestHeadersValue": ".mcp_server_config_output_request_headers_value", + "McpServerConfigOutputRequestMetaValue": ".mcp_server_config_output_request_meta_value", + "McpServerConfigOutputSecretToken": ".mcp_server_config_output_secret_token", + "McpServerConfigOutputUrl": ".mcp_server_config_output_url", + "McpServerMetadataResponseModel": ".mcp_server_metadata_response_model", + "McpServerResponseModel": ".mcp_server_response_model", + "McpServerResponseModelDependentAgentsItem": ".mcp_server_response_model_dependent_agents_item", + "McpServerResponseModelDependentAgentsItem_Available": ".mcp_server_response_model_dependent_agents_item", + "McpServerResponseModelDependentAgentsItem_Unknown": ".mcp_server_response_model_dependent_agents_item", + "McpServerTransport": ".mcp_server_transport", + "McpServersResponseModel": ".mcp_servers_response_model", + "McpToolApprovalHash": ".mcp_tool_approval_hash", + "McpToolApprovalPolicy": ".mcp_tool_approval_policy", + "McpToolApprovalState": ".mcp_tool_approval_state", + "McpToolApprovalStatus": ".mcp_tool_approval_status", + "McpToolConfigOverrideInput": ".mcp_tool_config_override_input", + "McpToolConfigOverrideInputInputOverridesValue": ".mcp_tool_config_override_input_input_overrides_value", + "McpToolConfigOverrideInputInputOverridesValue_Constant": ".mcp_tool_config_override_input_input_overrides_value", + "McpToolConfigOverrideInputInputOverridesValue_DynamicVariable": ".mcp_tool_config_override_input_input_overrides_value", + "McpToolConfigOverrideInputInputOverridesValue_Llm": ".mcp_tool_config_override_input_input_overrides_value", + "McpToolConfigOverrideInputInputOverridesValue_Omit": ".mcp_tool_config_override_input_input_overrides_value", + "McpToolConfigOverrideInputToolCallSound": ".mcp_tool_config_override_input_tool_call_sound", + "McpToolConfigOverrideOutput": ".mcp_tool_config_override_output", + "McpToolConfigOverrideOutputInputOverridesValue": ".mcp_tool_config_override_output_input_overrides_value", + "McpToolConfigOverrideOutputInputOverridesValue_Constant": ".mcp_tool_config_override_output_input_overrides_value", + "McpToolConfigOverrideOutputInputOverridesValue_DynamicVariable": ".mcp_tool_config_override_output_input_overrides_value", + "McpToolConfigOverrideOutputInputOverridesValue_Llm": ".mcp_tool_config_override_output_input_overrides_value", + "McpToolConfigOverrideOutputInputOverridesValue_Omit": ".mcp_tool_config_override_output_input_overrides_value", + "McpToolConfigOverrideOutputToolCallSound": ".mcp_tool_config_override_output_tool_call_sound", + "MediaCodec": ".media_codec", + "MediaGenerationCompletedResponse": ".media_generation_completed_response", + "MediaGenerationCreateResponse": ".media_generation_create_response", + "MediaGenerationFailedResponse": ".media_generation_failed_response", + "MediaGenerationFailedResponseFailureReason": ".media_generation_failed_response_failure_reason", + "MediaGenerationInProgressResponse": ".media_generation_in_progress_response", + "MediaGenerationListResponse": ".media_generation_list_response", + "MediaGenerationResponse": ".media_generation_response", + "MediaGenerationResponse_Completed": ".media_generation_response", + "MediaGenerationResponse_Failed": ".media_generation_response", + "MediaGenerationResponse_Generating": ".media_generation_response", + "MediaGenerationResponse_Pending": ".media_generation_response", + "MediaId": ".media_id", + "MemoryEntrySearchResult": ".memory_entry_search_result", + "MemoryEntrySearchResultSource": ".memory_entry_search_result_source", + "MergePreviewResponseModel": ".merge_preview_response_model", + "MergePreviewResponseModelPhoneNumbersItem": ".merge_preview_response_model_phone_numbers_item", + "MergePreviewResponseModelPhoneNumbersItem_Exotel": ".merge_preview_response_model_phone_numbers_item", + "MergePreviewResponseModelPhoneNumbersItem_SipTrunk": ".merge_preview_response_model_phone_numbers_item", + "MergePreviewResponseModelPhoneNumbersItem_Twilio": ".merge_preview_response_model_phone_numbers_item", + "MergeProposalCloseReason": ".merge_proposal_close_reason", + "MergeProposalComment": ".merge_proposal_comment", + "MergeProposalReview": ".merge_proposal_review", + "MergeProposalReviewReviewerRole": ".merge_proposal_review_reviewer_role", + "MergeProposalReviewState": ".merge_proposal_review_state", + "MergeProposalStatus": ".merge_proposal_status", + "MergedOutcome": ".merged_outcome", + "MessageSearchSortBy": ".message_search_sort_by", + "MessagesSearchResponse": ".messages_search_response", + "MessagesSearchResult": ".messages_search_result", + "MetricRecord": ".metric_record", + "MetricType": ".metric_type", + "MockNoMatchBehavior": ".mock_no_match_behavior", + "MockingStrategy": ".mocking_strategy", + "Model": ".model", + "ModelRatesResponseModel": ".model_rates_response_model", + "ModerationConfig": ".moderation_config", + "ModerationGuardrailInput": ".moderation_guardrail_input", + "ModerationGuardrailOutput": ".moderation_guardrail_output", + "ModerationStatusResponseModel": ".moderation_status_response_model", + "ModerationStatusResponseModelSafetyStatus": ".moderation_status_response_model_safety_status", + "ModerationStatusResponseModelWarningStatus": ".moderation_status_response_model_warning_status", + "MtlsAuthResponse": ".mtls_auth_response", + "MultichannelSpeechToTextResponseModel": ".multichannel_speech_to_text_response_model", + "MultipartMusicResponse": ".multipart_music_response", + "MusicAllowedOutputFormats": ".music_allowed_output_formats", + "MusicExploreSongSourceContext": ".music_explore_song_source_context", + "MusicFinetuneFailureReason": ".music_finetune_failure_reason", + "MusicFinetunePageResponseModel": ".music_finetune_page_response_model", + "MusicFinetuneResponseModel": ".music_finetune_response_model", + "MusicFinetuneStatus": ".music_finetune_status", + "MusicGenerationMode": ".music_generation_mode", + "MusicModelId": ".music_model_id", + "MusicOnlyOutputFormats": ".music_only_output_formats", + "MusicOutputFormat": ".music_output_format", + "MusicPrompt": ".music_prompt", + "MusicUploadResponse": ".music_upload_response", + "MusicUploadResponseCompositionPlan": ".music_upload_response_composition_plan", + "NonStreamingOutputFormats": ".non_streaming_output_formats", + "NormalizedAlignment": ".normalized_alignment", + "NumberSchema": ".number_schema", + "NumericDistributionAggregate": ".numeric_distribution_aggregate", + "OAuth2ClientCredsResponse": ".o_auth_2_client_creds_response", + "OAuth2JwtResponse": ".o_auth_2_jwt_response", + "OAuth2JwtResponseAlgorithm": ".o_auth_2_jwt_response_algorithm", + "OAuth2JwtResponseTokenResponseField": ".o_auth_2_jwt_response_token_response_field", + "OTelAttribute": ".o_tel_attribute", + "OTelAttributeValueValue": ".o_tel_attribute_value_value", + "OTelResource": ".o_tel_resource", + "OTelResourceSpans": ".o_tel_resource_spans", + "OTelScope": ".o_tel_scope", + "OTelScopeSpans": ".o_tel_scope_spans", + "OTelSpan": ".o_tel_span", + "OTelStatus": ".o_tel_status", + "OTelTracePayload": ".o_tel_trace_payload", + "ObjectJsonSchemaPropertyInput": ".object_json_schema_property_input", + "ObjectJsonSchemaPropertyInputPropertiesValue": ".object_json_schema_property_input_properties_value", + "ObjectJsonSchemaPropertyInputPropertyKind": ".object_json_schema_property_input_property_kind", + "ObjectJsonSchemaPropertyOutput": ".object_json_schema_property_output", + "ObjectJsonSchemaPropertyOutputPropertiesValue": ".object_json_schema_property_output_properties_value", + "ObjectSchema": ".object_schema", + "OmitSchemaOverride": ".omit_schema_override", + "OpenAiAudioConfigInput": ".open_ai_audio_config_input", + "OpenAiAudioConfigOutput": ".open_ai_audio_config_output", + "OpenAiAudioFormat": ".open_ai_audio_format", + "OpenAiAudioInputConfigInput": ".open_ai_audio_input_config_input", + "OpenAiAudioInputConfigOutput": ".open_ai_audio_input_config_output", + "OpenAiAudioInputFormat": ".open_ai_audio_input_format", + "OpenAiAudioInputTranscription": ".open_ai_audio_input_transcription", + "OpenAiAudioOutputConfigInput": ".open_ai_audio_output_config_input", + "OpenAiAudioOutputConfigOutput": ".open_ai_audio_output_config_output", + "OpenAiAudioOutputFormat": ".open_ai_audio_output_format", + "OpenAiFunctionTool": ".open_ai_function_tool", + "OpenAiSessionConfigInput": ".open_ai_session_config_input", + "OpenAiSessionConfigInputMaxResponseOutputTokens": ".open_ai_session_config_input_max_response_output_tokens", + "OpenAiSessionConfigInputToolChoice": ".open_ai_session_config_input_tool_choice", + "OpenAiSessionConfigInputToolsItem": ".open_ai_session_config_input_tools_item", + "OpenAiSessionConfigInputToolsItem_Function": ".open_ai_session_config_input_tools_item", + "OpenAiSessionConfigInputToolsItem_Mcp": ".open_ai_session_config_input_tools_item", + "OpenAiSessionConfigInputTracing": ".open_ai_session_config_input_tracing", + "OpenAiSessionConfigInputTruncation": ".open_ai_session_config_input_truncation", + "OpenAiSessionConfigInputTurnDetection": ".open_ai_session_config_input_turn_detection", + "OpenAiSessionConfigOutput": ".open_ai_session_config_output", + "OpenAiSessionConfigOutputMaxResponseOutputTokens": ".open_ai_session_config_output_max_response_output_tokens", + "OpenAiSessionConfigOutputToolChoice": ".open_ai_session_config_output_tool_choice", + "OpenAiSessionConfigOutputToolsItem": ".open_ai_session_config_output_tools_item", + "OpenAiSessionConfigOutputToolsItem_Function": ".open_ai_session_config_output_tools_item", + "OpenAiSessionConfigOutputToolsItem_Mcp": ".open_ai_session_config_output_tools_item", + "OpenAiSessionConfigOutputTracing": ".open_ai_session_config_output_tracing", + "OpenAiToolChoiceFunction": ".open_ai_tool_choice_function", + "OpenAiToolChoiceFunctionInner": ".open_ai_tool_choice_function_inner", + "OpenAiTracingConfiguration": ".open_ai_tracing_configuration", + "OpenAiTurnDetection": ".open_ai_turn_detection", + "OpenAimcpTool": ".open_aimcp_tool", + "OpenAimcpToolRequireApproval": ".open_aimcp_tool_require_approval", + "OpenOutcome": ".open_outcome", + "OpenerConfig": ".opener_config", + "OptInSmsReminderParams": ".opt_in_sms_reminder_params", + "OptOutSmsReminderParams": ".opt_out_sms_reminder_params", + "OrbAvatar": ".orb_avatar", + "OrchestratorToolMockBehaviorConfig": ".orchestrator_tool_mock_behavior_config", + "OrderDeliverablesResponse": ".order_deliverables_response", + "OrderId": ".order_id", + "OrderItemInfo": ".order_item_info", + "OrderItemKind": ".order_item_kind", + "OrderItemRequestInput": ".order_item_request_input", + "OrderItemRequestInput_Dub": ".order_item_request_input", + "OrderItemRequestInput_Subtitles": ".order_item_request_input", + "OrderItemRequestInput_Transcription": ".order_item_request_input", + "OrderItemRequestOutput": ".order_item_request_output", + "OrderItemRequestOutput_Dub": ".order_item_request_output", + "OrderItemRequestOutput_Subtitles": ".order_item_request_output", + "OrderItemRequestOutput_Transcription": ".order_item_request_output", + "OrderMediaResponse": ".order_media_response", + "OrderResponse": ".order_response", + "OrderState": ".order_state", + "OrderSummary": ".order_summary", + "OutboundCallRecipient": ".outbound_call_recipient", + "OutboundCallRecipientResponseModel": ".outbound_call_recipient_response_model", + "OutboundSipTrunkConfigRequestModel": ".outbound_sip_trunk_config_request_model", + "OutputFormat": ".output_format", + "PaginatedResultAgentMergeProposalResponse": ".paginated_result_agent_merge_proposal_response", + "PairedLanguagesResponse": ".paired_languages_response", + "PartialTranscriptPayload": ".partial_transcript_payload", + "PatchWorkspaceWebhookResponseModel": ".patch_workspace_webhook_response_model", + "PdfExportOptions": ".pdf_export_options", + "PendingBlocksMetadataModel": ".pending_blocks_metadata_model", + "PendingCancellationResponseModel": ".pending_cancellation_response_model", + "PendingClipTask": ".pending_clip_task", + "PendingClipTaskType": ".pending_clip_task_type", + "PendingExternalAudiosMetadataModel": ".pending_external_audios_metadata_model", + "PendingSubscriptionSwitchResponseModel": ".pending_subscription_switch_response_model", + "PendingSubscriptionSwitchResponseModelNextTier": ".pending_subscription_switch_response_model_next_tier", + "PermissionType": ".permission_type", + "PhoneNumberAgentInfo": ".phone_number_agent_info", + "PhoneNumberDynamicVariableTransferDestination": ".phone_number_dynamic_variable_transfer_destination", + "PhoneNumberSortBy": ".phone_number_sort_by", + "PhoneNumberTransfer": ".phone_number_transfer", + "PhoneNumberTransferCustomSipHeadersItem": ".phone_number_transfer_custom_sip_headers_item", + "PhoneNumberTransferCustomSipHeadersItem_Dynamic": ".phone_number_transfer_custom_sip_headers_item", + "PhoneNumberTransferCustomSipHeadersItem_Static": ".phone_number_transfer_custom_sip_headers_item", + "PhoneNumberTransferDestination": ".phone_number_transfer_destination", + "PhoneNumberTransferPostDialDigits": ".phone_number_transfer_post_dial_digits", + "PhoneNumberTransferPostDialDigits_Dynamic": ".phone_number_transfer_post_dial_digits", + "PhoneNumberTransferPostDialDigits_Static": ".phone_number_transfer_post_dial_digits", + "PhoneNumberTransferTransferDestination": ".phone_number_transfer_transfer_destination", + "PhoneNumberTransferTransferDestination_Phone": ".phone_number_transfer_transfer_destination", + "PhoneNumberTransferTransferDestination_PhoneDynamicVariable": ".phone_number_transfer_transfer_destination", + "PhoneNumberTransferTransferDestination_SipUri": ".phone_number_transfer_transfer_destination", + "PhoneNumberTransferTransferDestination_SipUriDynamicVariable": ".phone_number_transfer_transfer_destination", + "PingPayload": ".ping_payload", + "PlatformCategory": ".platform_category", + "PlatformCategoryUsage": ".platform_category_usage", + "PlatformLimits": ".platform_limits", + "PlatformUsage": ".platform_usage", + "PlayDtmfResultErrorModel": ".play_dtmf_result_error_model", + "PlayDtmfResultSuccessModel": ".play_dtmf_result_success_model", + "PlayDtmfToolConfig": ".play_dtmf_tool_config", + "PodcastBulletinMode": ".podcast_bulletin_mode", + "PodcastBulletinModeData": ".podcast_bulletin_mode_data", + "PodcastConversationMode": ".podcast_conversation_mode", + "PodcastConversationModeData": ".podcast_conversation_mode_data", + "PodcastProjectResponseModel": ".podcast_project_response_model", + "PodcastTextSource": ".podcast_text_source", + "PodcastUrlSource": ".podcast_url_source", + "PongPayload": ".pong_payload", + "PositionInput": ".position_input", + "PositionOutput": ".position_output", + "PostAgentAvatarResponseModel": ".post_agent_avatar_response_model", + "PostAgentHoldAudioResponseModel": ".post_agent_hold_audio_response_model", + "PostDialDigitsDynamicVariable": ".post_dial_digits_dynamic_variable", + "PostDialDigitsStatic": ".post_dial_digits_static", + "PostWorkspaceSecretResponseModel": ".post_workspace_secret_response_model", + "PreToolSpeechMode": ".pre_tool_speech_mode", + "PreviewAudioDbModel": ".preview_audio_db_model", + "Price": ".price", + "PrivacyConfigInput": ".privacy_config_input", + "PrivacyConfigOutput": ".privacy_config_output", + "PrivateKeyJwtResponse": ".private_key_jwt_response", + "PrivateKeyJwtResponseAlgorithm": ".private_key_jwt_response_algorithm", + "ProcedureAtVersionResponseModel": ".procedure_at_version_response_model", + "ProcedureDraftRef": ".procedure_draft_ref", + "ProcedureDraftResponseModel": ".procedure_draft_response_model", + "ProcedureListItemResponseModel": ".procedure_list_item_response_model", + "ProcedureRefResponseModel": ".procedure_ref_response_model", + "ProcedureType": ".procedure_type", + "ProcedureValidationError": ".procedure_validation_error", + "ProcedureVersionRef": ".procedure_version_ref", + "ProjectCreationMetaResponseModel": ".project_creation_meta_response_model", + "ProjectCreationMetaResponseModelStatus": ".project_creation_meta_response_model_status", + "ProjectCreationMetaType": ".project_creation_meta_type", + "ProjectExtendedResponse": ".project_extended_response", + "ProjectExtendedResponseAccessLevel": ".project_extended_response_access_level", + "ProjectExtendedResponseApplyTextNormalization": ".project_extended_response_apply_text_normalization", + "ProjectExtendedResponseAspectRatio": ".project_extended_response_aspect_ratio", + "ProjectExtendedResponseAssetsItem": ".project_extended_response_assets_item", + "ProjectExtendedResponseAssetsItem_Audio": ".project_extended_response_assets_item", + "ProjectExtendedResponseAssetsItem_Image": ".project_extended_response_assets_item", + "ProjectExtendedResponseAssetsItem_Video": ".project_extended_response_assets_item", + "ProjectExtendedResponseFiction": ".project_extended_response_fiction", + "ProjectExtendedResponseSourceType": ".project_extended_response_source_type", + "ProjectExtendedResponseTargetAudience": ".project_extended_response_target_audience", + "ProjectExternalAudioResponseModel": ".project_external_audio_response_model", + "ProjectExternalAudioResponseModelSourceContext": ".project_external_audio_response_model_source_context", + "ProjectExternalAudioResponseModelSourceContext_MusicExploreSong": ".project_external_audio_response_model_source_context", + "ProjectExternalAudioResponseModelSourceContext_Sfx": ".project_external_audio_response_model_source_context", + "ProjectExternalAudioResponseModelSourceContext_Song": ".project_external_audio_response_model_source_context", + "ProjectImageResponseModel": ".project_image_response_model", + "ProjectMutedTracksResponseModel": ".project_muted_tracks_response_model", + "ProjectResponse": ".project_response", + "ProjectResponseAccessLevel": ".project_response_access_level", + "ProjectResponseAspectRatio": ".project_response_aspect_ratio", + "ProjectResponseFiction": ".project_response_fiction", + "ProjectResponseSourceType": ".project_response_source_type", + "ProjectResponseTargetAudience": ".project_response_target_audience", + "ProjectSnapshotExtendedResponseModel": ".project_snapshot_extended_response_model", + "ProjectSnapshotResponse": ".project_snapshot_response", + "ProjectSnapshotsResponse": ".project_snapshots_response", + "ProjectState": ".project_state", + "ProjectVideoResponseModel": ".project_video_response_model", + "ProjectVideoThumbnailSheetResponseModel": ".project_video_thumbnail_sheet_response_model", + "ProjectVoiceResponseModel": ".project_voice_response_model", + "PromptAgent": ".prompt_agent", + "PromptAgentApiModelInput": ".prompt_agent_api_model_input", + "PromptAgentApiModelInputBackupLlmConfig": ".prompt_agent_api_model_input_backup_llm_config", + "PromptAgentApiModelInputBackupLlmConfig_Default": ".prompt_agent_api_model_input_backup_llm_config", + "PromptAgentApiModelInputBackupLlmConfig_Disabled": ".prompt_agent_api_model_input_backup_llm_config", + "PromptAgentApiModelInputBackupLlmConfig_Override": ".prompt_agent_api_model_input_backup_llm_config", + "PromptAgentApiModelInputToolsItem": ".prompt_agent_api_model_input_tools_item", + "PromptAgentApiModelInputToolsItem_ApiIntegrationWebhook": ".prompt_agent_api_model_input_tools_item", + "PromptAgentApiModelInputToolsItem_Client": ".prompt_agent_api_model_input_tools_item", + "PromptAgentApiModelInputToolsItem_Mcp": ".prompt_agent_api_model_input_tools_item", + "PromptAgentApiModelInputToolsItem_Smb": ".prompt_agent_api_model_input_tools_item", + "PromptAgentApiModelInputToolsItem_System": ".prompt_agent_api_model_input_tools_item", + "PromptAgentApiModelInputToolsItem_Webhook": ".prompt_agent_api_model_input_tools_item", + "PromptAgentApiModelOutput": ".prompt_agent_api_model_output", + "PromptAgentApiModelOutputBackupLlmConfig": ".prompt_agent_api_model_output_backup_llm_config", + "PromptAgentApiModelOutputBackupLlmConfig_Default": ".prompt_agent_api_model_output_backup_llm_config", + "PromptAgentApiModelOutputBackupLlmConfig_Disabled": ".prompt_agent_api_model_output_backup_llm_config", + "PromptAgentApiModelOutputBackupLlmConfig_Override": ".prompt_agent_api_model_output_backup_llm_config", + "PromptAgentApiModelOutputToolsItem": ".prompt_agent_api_model_output_tools_item", + "PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook": ".prompt_agent_api_model_output_tools_item", + "PromptAgentApiModelOutputToolsItem_Client": ".prompt_agent_api_model_output_tools_item", + "PromptAgentApiModelOutputToolsItem_Mcp": ".prompt_agent_api_model_output_tools_item", + "PromptAgentApiModelOutputToolsItem_Smb": ".prompt_agent_api_model_output_tools_item", + "PromptAgentApiModelOutputToolsItem_System": ".prompt_agent_api_model_output_tools_item", + "PromptAgentApiModelOutputToolsItem_Webhook": ".prompt_agent_api_model_output_tools_item", + "PromptAgentApiModelOverrideConfig": ".prompt_agent_api_model_override_config", + "PromptAgentApiModelOverrideInput": ".prompt_agent_api_model_override_input", + "PromptAgentApiModelOverrideOutput": ".prompt_agent_api_model_override_output", + "PromptAgentApiModelWorkflowOverrideInput": ".prompt_agent_api_model_workflow_override_input", + "PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig": ".prompt_agent_api_model_workflow_override_input_backup_llm_config", + "PromptAgentApiModelWorkflowOverrideInputToolsItem": ".prompt_agent_api_model_workflow_override_input_tools_item", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_ApiIntegrationWebhook": ".prompt_agent_api_model_workflow_override_input_tools_item", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Client": ".prompt_agent_api_model_workflow_override_input_tools_item", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Mcp": ".prompt_agent_api_model_workflow_override_input_tools_item", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Smb": ".prompt_agent_api_model_workflow_override_input_tools_item", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_System": ".prompt_agent_api_model_workflow_override_input_tools_item", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook": ".prompt_agent_api_model_workflow_override_input_tools_item", + "PromptAgentApiModelWorkflowOverrideOutput": ".prompt_agent_api_model_workflow_override_output", + "PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig": ".prompt_agent_api_model_workflow_override_output_backup_llm_config", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem": ".prompt_agent_api_model_workflow_override_output_tools_item", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_ApiIntegrationWebhook": ".prompt_agent_api_model_workflow_override_output_tools_item", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client": ".prompt_agent_api_model_workflow_override_output_tools_item", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Mcp": ".prompt_agent_api_model_workflow_override_output_tools_item", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Smb": ".prompt_agent_api_model_workflow_override_output_tools_item", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_System": ".prompt_agent_api_model_workflow_override_output_tools_item", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook": ".prompt_agent_api_model_workflow_override_output_tools_item", + "PromptAgentDbModel": ".prompt_agent_db_model", + "PromptEvaluationCriteria": ".prompt_evaluation_criteria", + "PromptInjectionGuardrail": ".prompt_injection_guardrail", + "PronunciationDictionaryAliasRuleRequestModel": ".pronunciation_dictionary_alias_rule_request_model", + "PronunciationDictionaryAliasRuleResponseModel": ".pronunciation_dictionary_alias_rule_response_model", + "PronunciationDictionaryLocator": ".pronunciation_dictionary_locator", + "PronunciationDictionaryLocatorResponseModel": ".pronunciation_dictionary_locator_response_model", + "PronunciationDictionaryPhonemeRuleRequestModel": ".pronunciation_dictionary_phoneme_rule_request_model", + "PronunciationDictionaryPhonemeRuleResponseModel": ".pronunciation_dictionary_phoneme_rule_response_model", + "PronunciationDictionaryRulesResponseModel": ".pronunciation_dictionary_rules_response_model", + "PronunciationDictionaryVersionLocator": ".pronunciation_dictionary_version_locator", + "PronunciationDictionaryVersionResponseModel": ".pronunciation_dictionary_version_response_model", + "PronunciationDictionaryVersionResponseModelPermissionOnResource": ".pronunciation_dictionary_version_response_model_permission_on_resource", + "PydanticPronunciationDictionaryVersionLocator": ".pydantic_pronunciation_dictionary_version_locator", + "QualityPresetType": ".quality_preset_type", + "QueryParamsJsonSchemaInput": ".query_params_json_schema_input", + "QueryParamsJsonSchemaOutput": ".query_params_json_schema_output", + "QuoteInfo": ".quote_info", + "RagChunkMetadata": ".rag_chunk_metadata", + "RagConfigInput": ".rag_config_input", + "RagConfigOutput": ".rag_config_output", + "RagConfigWorkflowOverrideInput": ".rag_config_workflow_override_input", + "RagConfigWorkflowOverrideOutput": ".rag_config_workflow_override_output", + "RagDocumentIndexResponseModel": ".rag_document_index_response_model", + "RagDocumentIndexUsage": ".rag_document_index_usage", + "RagDocumentIndexesResponseModel": ".rag_document_indexes_response_model", + "RagIndexBatchSuccessfulResponseModel": ".rag_index_batch_successful_response_model", + "RagIndexOverviewEmbeddingModelResponseModel": ".rag_index_overview_embedding_model_response_model", + "RagIndexOverviewResponseModel": ".rag_index_overview_response_model", + "RagIndexStatus": ".rag_index_status", + "RagRetrievalInfo": ".rag_retrieval_info", + "ReadLegalTerms": ".read_legal_terms", + "ReadMetadataChapterDbModel": ".read_metadata_chapter_db_model", + "ReaderResourceResponseModel": ".reader_resource_response_model", + "ReaderResourceResponseModelResourceType": ".reader_resource_response_model_resource_type", + "RealtimeModel": ".realtime_model", + "RealtimeVoiceSettings": ".realtime_voice_settings", + "RecordingResponse": ".recording_response", + "ReferenceVideo": ".reference_video", + "ReferencedToolCommonModel": ".referenced_tool_common_model", + "ReferencedToolCommonModelType": ".referenced_tool_common_model_type", + "RefreshTokenAuthResponse": ".refresh_token_auth_response", + "RegexParameterEvaluationStrategy": ".regex_parameter_evaluation_strategy", + "RegionConfigRequest": ".region_config_request", + "RegionalProcessingSurchargeInfo": ".regional_processing_surcharge_info", + "RegisterForGroupSessionParams": ".register_for_group_session_params", + "RegisterMediaResponse": ".register_media_response", + "RemoveMemberFromGroupRequest": ".remove_member_from_group_request", + "RemoveOrderItemResponse": ".remove_order_item_response", + "RemoveVoiceFromUserVoiceCollectionResponseModel": ".remove_voice_from_user_voice_collection_response_model", + "Render": ".render", + "RenderStatus": ".render_status", + "RenderType": ".render_type", + "ReplicateVoiceToIsolatedEnvironmentResponseModel": ".replicate_voice_to_isolated_environment_response_model", + "ReportKnowledgeGapParams": ".report_knowledge_gap_params", + "RequestPvcManualVerificationResponseModel": ".request_pvc_manual_verification_response_model", + "RequiredConstraint": ".required_constraint", + "RequiredConstraints": ".required_constraints", + "ResourceAccessInfo": ".resource_access_info", + "ResourceAccessInfoAccessSource": ".resource_access_info_access_source", + "ResourceAccessInfoAnonymousAccessLevelOverride": ".resource_access_info_anonymous_access_level_override", + "ResourceAccessInfoRole": ".resource_access_info_role", + "ResourceMetadataResponseModel": ".resource_metadata_response_model", + "ResourceMetadataResponseModelAnonymousAccessLevelOverride": ".resource_metadata_response_model_anonymous_access_level_override", + "ResponseConversationErrorType": ".response_conversation_error_type", + "ResponseFilter": ".response_filter", + "ResponseFilterMode": ".response_filter_mode", + "ResponseUnitTestModel": ".response_unit_test_model", + "RestoreCalendarEventParams": ".restore_calendar_event_params", + "RetryTriggerAction": ".retry_trigger_action", + "ReviewResponseModel": ".review_response_model", + "ReviewResponseModelRejectReasonsItem": ".review_response_model_reject_reasons_item", + "ReviewResponseModelReviewStatus": ".review_response_model_review_status", + "ReviewStatus": ".review_status", + "SafetyCommonModelInput": ".safety_common_model_input", + "SafetyCommonModelOutput": ".safety_common_model_output", + "SafetyEvaluation": ".safety_evaluation", + "SafetyResponseModel": ".safety_response_model", + "SafetyRule": ".safety_rule", + "SampleConfigDbModel": ".sample_config_db_model", + "SampleConfigDbModelParentType": ".sample_config_db_model_parent_type", + "SaveVoicePreviewRequest": ".save_voice_preview_request", + "SayNodeLiteralMessageInput": ".say_node_literal_message_input", + "SayNodeLiteralMessageOutput": ".say_node_literal_message_output", + "SayNodePromptMessageInput": ".say_node_prompt_message_input", + "SayNodePromptMessageOutput": ".say_node_prompt_message_output", + "ScheduleGroupSessionParams": ".schedule_group_session_params", + "ScimGroupResponseModel": ".scim_group_response_model", + "ScopedAnalysisResult": ".scoped_analysis_result", + "ScribeAuthErrorPayload": ".scribe_auth_error_payload", + "ScribeChunkSizeExceededErrorPayload": ".scribe_chunk_size_exceeded_error_payload", + "ScribeErrorPayload": ".scribe_error_payload", + "ScribeInputErrorPayload": ".scribe_input_error_payload", + "ScribeInsufficientAudioActivityErrorPayload": ".scribe_insufficient_audio_activity_error_payload", + "ScribeInvalidRequestError": ".scribe_invalid_request_error", + "ScribeQueueOverflowErrorPayload": ".scribe_queue_overflow_error_payload", + "ScribeQuotaExceededErrorPayload": ".scribe_quota_exceeded_error_payload", + "ScribeRateLimitedErrorPayload": ".scribe_rate_limited_error_payload", + "ScribeResourceExhaustedErrorPayload": ".scribe_resource_exhausted_error_payload", + "ScribeSessionTimeLimitExceededErrorPayload": ".scribe_session_time_limit_exceeded_error_payload", + "ScribeThrottledErrorPayload": ".scribe_throttled_error_payload", + "ScribeTranscriberErrorPayload": ".scribe_transcriber_error_payload", + "ScribeUnacceptedTermsErrorPayload": ".scribe_unaccepted_terms_error_payload", + "ScribeWarning": ".scribe_warning", + "SearchClientsParams": ".search_clients_params", + "SearchHighlightSegment": ".search_highlight_segment", + "SearchStrategy": ".search_strategy", + "SeatType": ".seat_type", + "SecretDependencyResourceType": ".secret_dependency_resource_type", + "SecretDependencyType": ".secret_dependency_type", + "SectionSource": ".section_source", + "SegmentCreateResponse": ".segment_create_response", + "SegmentDeleteResponse": ".segment_delete_response", + "SegmentDubResponse": ".segment_dub_response", + "SegmentMigrationResponse": ".segment_migration_response", + "SegmentSubtitleFrame": ".segment_subtitle_frame", + "SegmentTranscriptionResponse": ".segment_transcription_response", + "SegmentTranslationResponse": ".segment_translation_response", + "SegmentUpdateResponse": ".segment_update_response", + "SegmentedJsonExportOptions": ".segmented_json_export_options", + "SendCustomEmailParams": ".send_custom_email_params", + "SendText": ".send_text", + "SendTextMulti": ".send_text_multi", + "SentimentAggregate": ".sentiment_aggregate", + "SentimentAnalysisSettings": ".sentiment_analysis_settings", + "SessionStartedPayload": ".session_started_payload", + "SessionStartedPayloadConfig": ".session_started_payload_config", + "SessionStartedPayloadConfigCommitStrategy": ".session_started_payload_config_commit_strategy", + "SetBookingSlugParams": ".set_booking_slug_params", + "SeverityId": ".severity_id", + "SfxModelId": ".sfx_model_id", + "SfxSourceContext": ".sfx_source_context", + "ShareOptionResponseModel": ".share_option_response_model", + "ShareOptionResponseModelType": ".share_option_response_model_type", + "SimilarVoice": ".similar_voice", + "SimilarVoicesForSpeakerResponse": ".similar_voices_for_speaker_response", + "SimulationLibrarySettings": ".simulation_library_settings", + "SimulationTestModel": ".simulation_test_model", + "SimulationToolMockBehaviorConfig": ".simulation_tool_mock_behavior_config", + "SingleLanguagesResponse": ".single_languages_response", + "SingleTestRunRequestModel": ".single_test_run_request_model", + "SingleUseTokenResponseModel": ".single_use_token_response_model", + "SingleUseTokenType": ".single_use_token_type", + "SipLogMessage": ".sip_log_message", + "SipLogMessageDirection": ".sip_log_message_direction", + "SipMediaEncryptionEnum": ".sip_media_encryption_enum", + "SipTrunkCredentialsRequestModel": ".sip_trunk_credentials_request_model", + "SipTrunkOutboundCallResponse": ".sip_trunk_outbound_call_response", + "SipTrunkTransportEnum": ".sip_trunk_transport_enum", + "SipUriDynamicVariableTransferDestination": ".sip_uri_dynamic_variable_transfer_destination", + "SipUriTransferDestination": ".sip_uri_transfer_destination", + "SkipTurnToolConfig": ".skip_turn_tool_config", + "SkipTurnToolResponseModel": ".skip_turn_tool_response_model", + "SlackBotAuthResponse": ".slack_bot_auth_response", + "SmbAgentType": ".smb_agent_type", + "SmbClientAccessConfig": ".smb_client_access_config", + "SmsConversationInfo": ".sms_conversation_info", + "SmsConversationInfoDirection": ".sms_conversation_info_direction", + "SoftTimeoutConfig": ".soft_timeout_config", + "SoftTimeoutConfigOverride": ".soft_timeout_config_override", + "SoftTimeoutConfigOverrideConfig": ".soft_timeout_config_override_config", + "SoftTimeoutConfigWorkflowOverride": ".soft_timeout_config_workflow_override", + "SongMetadata": ".song_metadata", + "SongSection": ".song_section", + "SongSourceContext": ".song_source_context", + "SortDirection": ".sort_direction", + "SpeakerAudioResponseModel": ".speaker_audio_response_model", + "SpeakerCreatedResponse": ".speaker_created_response", + "SpeakerResponseModel": ".speaker_response_model", + "SpeakerSegment": ".speaker_segment", + "SpeakerSeparationResponseModel": ".speaker_separation_response_model", + "SpeakerSeparationResponseModelStatus": ".speaker_separation_response_model_status", + "SpeakerTrack": ".speaker_track", + "SpeakerUpdatedResponse": ".speaker_updated_response", + "SpeechEngineConfig": ".speech_engine_config", + "SpeechEngineConfigRequestHeadersValue": ".speech_engine_config_request_headers_value", + "SpeechEngineConversationInitiationClientDataConfig": ".speech_engine_conversation_initiation_client_data_config", + "SpeechEngineResponse": ".speech_engine_response", + "SpeechEngineSummaryResponse": ".speech_engine_summary_response", + "SpeechHistoryItemResponse": ".speech_history_item_response", + "SpeechHistoryItemResponseSource": ".speech_history_item_response_source", + "SpeechHistoryItemResponseVoiceCategory": ".speech_history_item_response_voice_category", + "SpeechToTextCharacterResponseModel": ".speech_to_text_character_response_model", + "SpeechToTextChunkResponseModel": ".speech_to_text_chunk_response_model", + "SpeechToTextChunkResponseModelEditedTranscript": ".speech_to_text_chunk_response_model_edited_transcript", + "SpeechToTextChunkResponseModelEditedTranscript_Error": ".speech_to_text_chunk_response_model_edited_transcript", + "SpeechToTextChunkResponseModelEditedTranscript_Transcript": ".speech_to_text_chunk_response_model_edited_transcript", + "SpeechToTextWebhookResponseModel": ".speech_to_text_webhook_response_model", + "SpeechToTextWordResponseModel": ".speech_to_text_word_response_model", + "SpeechToTextWordResponseModelType": ".speech_to_text_word_response_model_type", + "SpellingPatience": ".spelling_patience", + "SrtExportOptions": ".srt_export_options", + "StartProcedureToolConfig": ".start_procedure_tool_config", + "StartProcedureToolConfigProceduresValue": ".start_procedure_tool_config_procedures_value", + "StartProcedureToolErrorStatus": ".start_procedure_tool_error_status", + "StartProcedureToolResultErrorModel": ".start_procedure_tool_result_error_model", + "StartProcedureToolResultSuccessModel": ".start_procedure_tool_result_success_model", + "StartPvcVoiceTrainingResponseModel": ".start_pvc_voice_training_response_model", + "StartSpeakerSeparationResponseModel": ".start_speaker_separation_response_model", + "StaticAssetReference": ".static_asset_reference", + "StatusId": ".status_id", + "StoredUsagePlatformLimit": ".stored_usage_platform_limit", + "StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel": ".streaming_audio_chunk_with_timestamps_and_voice_segments_response_model", + "StreamingAudioChunkWithTimestampsResponse": ".streaming_audio_chunk_with_timestamps_response", + "StringSchema": ".string_schema", + "StudioAgentSettingsModel": ".studio_agent_settings_model", + "StudioAgentToolSettingsModel": ".studio_agent_tool_settings_model", + "StudioClipLocator": ".studio_clip_locator", + "StudioClipLocatorClipType": ".studio_clip_locator_clip_type", + "StudioTextStyleOutlineModel": ".studio_text_style_outline_model", + "StudioTextStyleShadowModel": ".studio_text_style_shadow_model", + "SubmitBusinessInfoParams": ".submit_business_info_params", + "SubmitOrderResponse": ".submit_order_response", + "Subscription": ".subscription", + "SubscriptionExtrasResponseModel": ".subscription_extras_response_model", + "SubscriptionMaxCreditLimitExtension": ".subscription_max_credit_limit_extension", + "SubscriptionPendingChange": ".subscription_pending_change", + "SubscriptionResponse": ".subscription_response", + "SubscriptionResponseMaxCreditLimitExtension": ".subscription_response_max_credit_limit_extension", + "SubscriptionStatusType": ".subscription_status_type", + "SubscriptionUsageResponseModel": ".subscription_usage_response_model", + "SubtitleOrderItemRequest": ".subtitle_order_item_request", + "SuggestedAudioTag": ".suggested_audio_tag", + "SupportedVoice": ".supported_voice", + "SystemDataCollectionId": ".system_data_collection_id", + "SystemEvaluationCriteria": ".system_evaluation_criteria", + "SystemEvaluationId": ".system_evaluation_id", + "SystemToolConfigInput": ".system_tool_config_input", + "SystemToolConfigInputParams": ".system_tool_config_input_params", + "SystemToolConfigInputParams_EndCall": ".system_tool_config_input_params", + "SystemToolConfigInputParams_EndProcedure": ".system_tool_config_input_params", + "SystemToolConfigInputParams_KnowledgeBase": ".system_tool_config_input_params", + "SystemToolConfigInputParams_KnowledgeBaseRag": ".system_tool_config_input_params", + "SystemToolConfigInputParams_LanguageDetection": ".system_tool_config_input_params", + "SystemToolConfigInputParams_PlayKeypadTouchTone": ".system_tool_config_input_params", + "SystemToolConfigInputParams_SkipTurn": ".system_tool_config_input_params", + "SystemToolConfigInputParams_StartProcedure": ".system_tool_config_input_params", + "SystemToolConfigInputParams_TransferToAgent": ".system_tool_config_input_params", + "SystemToolConfigInputParams_TransferToNumber": ".system_tool_config_input_params", + "SystemToolConfigInputParams_VoicemailDetection": ".system_tool_config_input_params", + "SystemToolConfigOutput": ".system_tool_config_output", + "SystemToolConfigOutputParams": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_EndCall": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_EndProcedure": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_KnowledgeBase": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_KnowledgeBaseRag": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_LanguageDetection": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_PlayKeypadTouchTone": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_SkipTurn": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_StartProcedure": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_TransferToAgent": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_TransferToNumber": ".system_tool_config_output_params", + "SystemToolConfigOutputParams_VoicemailDetection": ".system_tool_config_output_params", + "TelephonyCallConfigInput": ".telephony_call_config_input", + "TelephonyCallConfigOutput": ".telephony_call_config_output", + "TelephonyDirection": ".telephony_direction", + "TelephonyProvider": ".telephony_provider", + "TemplateArrayOutput": ".template_array_output", + "TemplateArrayOutputFailureReason": ".template_array_output_failure_reason", + "TemplateAudioOutput": ".template_audio_output", + "TemplateAudioOutputFailureReason": ".template_audio_output_failure_reason", + "TemplateBooleanOutput": ".template_boolean_output", + "TemplateBooleanOutputFailureReason": ".template_boolean_output_failure_reason", + "TemplateImageOutput": ".template_image_output", + "TemplateImageOutputFailureReason": ".template_image_output_failure_reason", + "TemplateInputReference": ".template_input_reference", + "TemplateInputReference_Asset": ".template_input_reference", + "TemplateInputReference_Generation": ".template_input_reference", + "TemplateInputReference_InlineBase64": ".template_input_reference", + "TemplateInputReference_Voice": ".template_input_reference", + "TemplateIntegerOutput": ".template_integer_output", + "TemplateIntegerOutputFailureReason": ".template_integer_output_failure_reason", + "TemplateListResponse": ".template_list_response", + "TemplateNumberOutput": ".template_number_output", + "TemplateNumberOutputFailureReason": ".template_number_output_failure_reason", + "TemplateObjectOutput": ".template_object_output", + "TemplateObjectOutputFailureReason": ".template_object_output_failure_reason", + "TemplateOutput": ".template_output", + "TemplateOutput_Array": ".template_output", + "TemplateOutput_Audio": ".template_output", + "TemplateOutput_Boolean": ".template_output", + "TemplateOutput_Image": ".template_output", + "TemplateOutput_Integer": ".template_output", + "TemplateOutput_Number": ".template_output", + "TemplateOutput_Object": ".template_output", + "TemplateOutput_String": ".template_output", + "TemplateOutput_Video": ".template_output", + "TemplatePort": ".template_port", + "TemplateRunInput": ".template_run_input", + "TemplateRunListResponse": ".template_run_list_response", + "TemplateRunResponse": ".template_run_response", + "TemplateRunStatus": ".template_run_status", + "TemplateStringOutput": ".template_string_output", + "TemplateStringOutputFailureReason": ".template_string_output_failure_reason", + "TemplateSummary": ".template_summary", + "TemplateVersion": ".template_version", + "TemplateVideoOutput": ".template_video_output", + "TemplateVideoOutputFailureReason": ".template_video_output_failure_reason", + "TestConditionRationaleCommonModel": ".test_condition_rationale_common_model", + "TestConditionResultCommonModel": ".test_condition_result_common_model", + "TestFromConversationMetadataInput": ".test_from_conversation_metadata_input", + "TestFromConversationMetadataOutput": ".test_from_conversation_metadata_output", + "TestInvocationSummaryResponseModel": ".test_invocation_summary_response_model", + "TestRunMetadata": ".test_run_metadata", + "TestRunMetadataTestType": ".test_run_metadata_test_type", + "TestRunResultBucket": ".test_run_result_bucket", + "TestRunResultSummary": ".test_run_result_summary", + "TestRunStatus": ".test_run_status", + "TestSharingMode": ".test_sharing_mode", + "TestToolResultModel": ".test_tool_result_model", + "TestType": ".test_type", + "TestsFeatureUsageCommonModel": ".tests_feature_usage_common_model", + "TextNormalisationType": ".text_normalisation_type", + "TextToDialogueWebsocketApplyTextNormalizationEnum": ".text_to_dialogue_websocket_apply_text_normalization_enum", + "TextToDialogueWebsocketAudioChunk": ".text_to_dialogue_websocket_audio_chunk", + "TextToDialogueWebsocketAudioChunkMulti": ".text_to_dialogue_websocket_audio_chunk_multi", + "TextToDialogueWebsocketClientMessage": ".text_to_dialogue_websocket_client_message", + "TextToDialogueWebsocketClientMessageMulti": ".text_to_dialogue_websocket_client_message_multi", + "TextToDialogueWebsocketError": ".text_to_dialogue_websocket_error", + "TextToDialogueWebsocketFinal": ".text_to_dialogue_websocket_final", + "TextToDialogueWebsocketFinalAudioForTurn": ".text_to_dialogue_websocket_final_audio_for_turn", + "TextToDialogueWebsocketFinalAudioForTurnMulti": ".text_to_dialogue_websocket_final_audio_for_turn_multi", + "TextToDialogueWebsocketFinalMulti": ".text_to_dialogue_websocket_final_multi", + "TextToDialogueWebsocketOutputFormatEnum": ".text_to_dialogue_websocket_output_format_enum", + "TextToDialogueWebsocketVoiceInput": ".text_to_dialogue_websocket_voice_input", + "TextToDialogueWebsocketVoiceSettings": ".text_to_dialogue_websocket_voice_settings", + "TextToSpeechApplyTextNormalizationEnum": ".text_to_speech_apply_text_normalization_enum", + "TextToSpeechGenerationRequest": ".text_to_speech_generation_request", + "TextToSpeechGenerationRequest_ElevenFlashV25": ".text_to_speech_generation_request", + "TextToSpeechGenerationRequest_ElevenMultilingualV2": ".text_to_speech_generation_request", + "TextToSpeechGenerationRequest_ElevenV3": ".text_to_speech_generation_request", + "TextToSpeechOutputFormatEnum": ".text_to_speech_output_format_enum", + "TextToSpeechRequest": ".text_to_speech_request", + "TextToSpeechStreamRequest": ".text_to_speech_stream_request", + "TextToSpeechStreamWithTimestampsRequest": ".text_to_speech_stream_with_timestamps_request", + "TextToSpeechWithTimestampsRequest": ".text_to_speech_with_timestamps_request", + "ThresholdGuardrail": ".threshold_guardrail", + "TicketCommentResponseModel": ".ticket_comment_response_model", + "TicketMergeProposalLinkResponseModel": ".ticket_merge_proposal_link_response_model", + "TicketPriorityChangeResponseModel": ".ticket_priority_change_response_model", + "TicketSearchMatchField": ".ticket_search_match_field", + "TicketSearchMatchResponseModel": ".ticket_search_match_response_model", + "TicketStatusChangeResponseModel": ".ticket_status_change_response_model", + "TimeRange": ".time_range", + "ToDialogueSettingsResponseModel": ".to_dialogue_settings_response_model", + "TokenResponseModel": ".token_response_model", + "Tool": ".tool", + "ToolAnnotations": ".tool_annotations", + "ToolCallSoundBehavior": ".tool_call_sound_behavior", + "ToolCallSoundType": ".tool_call_sound_type", + "ToolCallUnitTestModel": ".tool_call_unit_test_model", + "ToolErrorHandlingMode": ".tool_error_handling_mode", + "ToolExecution": ".tool_execution", + "ToolExecutionMode": ".tool_execution_mode", + "ToolExecutionResponseModel": ".tool_execution_response_model", + "ToolExecutionResponseModelToolCallDetails": ".tool_execution_response_model_tool_call_details", + "ToolExecutionResponseModelToolCallDetails_ApiIntegrationWebhook": ".tool_execution_response_model_tool_call_details", + "ToolExecutionResponseModelToolCallDetails_Client": ".tool_execution_response_model_tool_call_details", + "ToolExecutionResponseModelToolCallDetails_Mcp": ".tool_execution_response_model_tool_call_details", + "ToolExecutionResponseModelToolCallDetails_Webhook": ".tool_execution_response_model_tool_call_details", + "ToolExecutionTaskSupport": ".tool_execution_task_support", + "ToolInterruptionMode": ".tool_interruption_mode", + "ToolMockConfig": ".tool_mock_config", + "ToolRequestModel": ".tool_request_model", + "ToolRequestModelToolConfig": ".tool_request_model_tool_config", + "ToolRequestModelToolConfig_Client": ".tool_request_model_tool_config", + "ToolRequestModelToolConfig_Mcp": ".tool_request_model_tool_config", + "ToolRequestModelToolConfig_System": ".tool_request_model_tool_config", + "ToolRequestModelToolConfig_Webhook": ".tool_request_model_tool_config", + "ToolResponseMockConfigInput": ".tool_response_mock_config_input", + "ToolResponseMockConfigOutput": ".tool_response_mock_config_output", + "ToolResponseModel": ".tool_response_model", + "ToolResponseModelToolConfig": ".tool_response_model_tool_config", + "ToolResponseModelToolConfig_Client": ".tool_response_model_tool_config", + "ToolResponseModelToolConfig_Mcp": ".tool_response_model_tool_config", + "ToolResponseModelToolConfig_System": ".tool_response_model_tool_config", + "ToolResponseModelToolConfig_Webhook": ".tool_response_model_tool_config", + "ToolSortBy": ".tool_sort_by", + "ToolType": ".tool_type", + "ToolTypeFilter": ".tool_type_filter", + "ToolUsageStatsResponseModel": ".tool_usage_stats_response_model", + "ToolsResponseModel": ".tools_response_model", + "TopicDiscoverySettings": ".topic_discovery_settings", + "TopicEvaluationCriteriaAggregate": ".topic_evaluation_criteria_aggregate", + "TopicMetricsAggregate": ".topic_metrics_aggregate", + "TopicSentimentAggregate": ".topic_sentiment_aggregate", + "TopicSortBy": ".topic_sort_by", + "TranscriptEditError": ".transcript_edit_error", + "TranscriptMessage": ".transcript_message", + "TranscriptMessageRole": ".transcript_message_role", + "TranscriptPlatformEvent": ".transcript_platform_event", + "TranscriptionOrderItemRequest": ".transcription_order_item_request", + "TranscriptionWord": ".transcription_word", + "TranscriptionWordType": ".transcription_word_type", + "TransferBranchInfoConfigured": ".transfer_branch_info_configured", + "TransferBranchInfoDefaultingToMain": ".transfer_branch_info_defaulting_to_main", + "TransferBranchInfoTrafficSplit": ".transfer_branch_info_traffic_split", + "TransferToAgentToolConfigInput": ".transfer_to_agent_tool_config_input", + "TransferToAgentToolConfigOutput": ".transfer_to_agent_tool_config_output", + "TransferToAgentToolResultErrorModel": ".transfer_to_agent_tool_result_error_model", + "TransferToAgentToolResultSuccessModelInput": ".transfer_to_agent_tool_result_success_model_input", + "TransferToAgentToolResultSuccessModelInputBranchInfo": ".transfer_to_agent_tool_result_success_model_input_branch_info", + "TransferToAgentToolResultSuccessModelInputBranchInfo_Configured": ".transfer_to_agent_tool_result_success_model_input_branch_info", + "TransferToAgentToolResultSuccessModelInputBranchInfo_DefaultingToMain": ".transfer_to_agent_tool_result_success_model_input_branch_info", + "TransferToAgentToolResultSuccessModelInputBranchInfo_TrafficSplit": ".transfer_to_agent_tool_result_success_model_input_branch_info", + "TransferToAgentToolResultSuccessModelOutput": ".transfer_to_agent_tool_result_success_model_output", + "TransferToAgentToolResultSuccessModelOutputBranchInfo": ".transfer_to_agent_tool_result_success_model_output_branch_info", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_Configured": ".transfer_to_agent_tool_result_success_model_output_branch_info", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain": ".transfer_to_agent_tool_result_success_model_output_branch_info", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit": ".transfer_to_agent_tool_result_success_model_output_branch_info", + "TransferToNumberResultAmazonConnectSuccessModel": ".transfer_to_number_result_amazon_connect_success_model", + "TransferToNumberResultErrorModel": ".transfer_to_number_result_error_model", + "TransferToNumberResultExotelSuccessModel": ".transfer_to_number_result_exotel_success_model", + "TransferToNumberResultSipSuccessModel": ".transfer_to_number_result_sip_success_model", + "TransferToNumberResultTwilioSuccessModel": ".transfer_to_number_result_twilio_success_model", + "TransferToNumberToolConfigInput": ".transfer_to_number_tool_config_input", + "TransferToNumberToolConfigOutput": ".transfer_to_number_tool_config_output", + "TransferTypeEnum": ".transfer_type_enum", + "TranslateAudioOutputError": ".translate_audio_output_error", + "TranslateAudioPayload": ".translate_audio_payload", + "TranslateAuthError": ".translate_auth_error", + "TranslateEndOfStreamPayload": ".translate_end_of_stream_payload", + "TranslateErrorPayload": ".translate_error_payload", + "TranslateFinalTranscriptPayload": ".translate_final_transcript_payload", + "TranslateInputAudioChunkPayload": ".translate_input_audio_chunk_payload", + "TranslateInputError": ".translate_input_error", + "TranslateInputFormatEnum": ".translate_input_format_enum", + "TranslateOutputFormatEnum": ".translate_output_format_enum", + "TranslatePartialTranscriptPayload": ".translate_partial_transcript_payload", + "TranslatePaymentIssueError": ".translate_payment_issue_error", + "TranslateQueueOverflowError": ".translate_queue_overflow_error", + "TranslateQuotaExceededError": ".translate_quota_exceeded_error", + "TranslateRateLimitedError": ".translate_rate_limited_error", + "TranslateSessionStartedPayload": ".translate_session_started_payload", + "TranslateStatusPayload": ".translate_status_payload", + "TranslateTranscriberError": ".translate_transcriber_error", + "TranslateTranslationError": ".translate_translation_error", + "TranslateTranslationPayload": ".translate_translation_payload", + "TranslateUnacceptedTermsError": ".translate_unaccepted_terms_error", + "TranslatedString": ".translated_string", + "TriggerUserVerificationParams": ".trigger_user_verification_params", + "TriggeredGuardrailCommonModel": ".triggered_guardrail_common_model", + "TtsConversationalConfigInput": ".tts_conversational_config_input", + "TtsConversationalConfigOutput": ".tts_conversational_config_output", + "TtsConversationalConfigOverride": ".tts_conversational_config_override", + "TtsConversationalConfigOverrideConfig": ".tts_conversational_config_override_config", + "TtsConversationalConfigWorkflowOverrideInput": ".tts_conversational_config_workflow_override_input", + "TtsConversationalConfigWorkflowOverrideOutput": ".tts_conversational_config_workflow_override_output", + "TtsConversationalModel": ".tts_conversational_model", + "TtsModelFamily": ".tts_model_family", + "TtsOptimizeStreamingLatency": ".tts_optimize_streaming_latency", + "TtsOutputFormat": ".tts_output_format", + "TtsVoiceSettings": ".tts_voice_settings", + "TurnCommentRequestModel": ".turn_comment_request_model", + "TurnCommentResponseModel": ".turn_comment_response_model", + "TurnConfig": ".turn_config", + "TurnConfigOverride": ".turn_config_override", + "TurnConfigOverrideConfig": ".turn_config_override_config", + "TurnConfigWorkflowOverride": ".turn_config_workflow_override", + "TurnDetectionType": ".turn_detection_type", + "TurnEagerness": ".turn_eagerness", + "TurnMode": ".turn_mode", + "TurnModel": ".turn_model", + "TwilioAnsweredBy": ".twilio_answered_by", + "TwilioEdgeLocation": ".twilio_edge_location", + "TwilioMachineDetectionAction": ".twilio_machine_detection_action", + "TwilioMachineDetectionConfig": ".twilio_machine_detection_config", + "TwilioMachineDetectionMode": ".twilio_machine_detection_mode", + "TwilioMachineDetectionRule": ".twilio_machine_detection_rule", + "TwilioOutboundCallResponse": ".twilio_outbound_call_response", + "TwilioRegionId": ".twilio_region_id", + "TxtExportOptions": ".txt_export_options", + "UnitTestRunResponseModel": ".unit_test_run_response_model", + "UnitTestRunResponseModelTestInfo": ".unit_test_run_response_model_test_info", + "UnitTestRunResponseModelTestInfo_Llm": ".unit_test_run_response_model_test_info", + "UnitTestRunResponseModelTestInfo_Simulation": ".unit_test_run_response_model_test_info", + "UnitTestRunResponseModelTestInfo_Tool": ".unit_test_run_response_model_test_info", + "UnitTestSummaryResponseModel": ".unit_test_summary_response_model", + "UnitTestToolCallEvaluationModelInput": ".unit_test_tool_call_evaluation_model_input", + "UnitTestToolCallEvaluationModelOutput": ".unit_test_tool_call_evaluation_model_output", + "UnitTestToolCallParameter": ".unit_test_tool_call_parameter", + "UnitTestToolCallParameterEval": ".unit_test_tool_call_parameter_eval", + "UnitTestToolCallParameterEval_Anything": ".unit_test_tool_call_parameter_eval", + "UnitTestToolCallParameterEval_Exact": ".unit_test_tool_call_parameter_eval", + "UnitTestToolCallParameterEval_Llm": ".unit_test_tool_call_parameter_eval", + "UnitTestToolCallParameterEval_Regex": ".unit_test_tool_call_parameter_eval", + "UnitTestWorkflowNodeTransitionEvaluationNodeId": ".unit_test_workflow_node_transition_evaluation_node_id", + "UpdateAgentConfigParams": ".update_agent_config_params", + "UpdateAgentProcedureParams": ".update_agent_procedure_params", + "UpdateAgentRuleParams": ".update_agent_rule_params", + "UpdateAssetParams": ".update_asset_params", + "UpdateAudioNativeProjectRequest": ".update_audio_native_project_request", + "UpdateBasicAuthRequest": ".update_basic_auth_request", + "UpdateBearerAuthRequest": ".update_bearer_auth_request", + "UpdateBookingPageAppearanceParams": ".update_booking_page_appearance_params", + "UpdateBookingPageSettingsParams": ".update_booking_page_settings_params", + "UpdateBusinessInfoParams": ".update_business_info_params", + "UpdateCalendarEventParams": ".update_calendar_event_params", + "UpdateChapterRequest": ".update_chapter_request", + "UpdateClientParams": ".update_client_params", + "UpdateGroupSessionSeatsParams": ".update_group_session_seats_params", + "UpdateHolidayParams": ".update_holiday_params", + "UpdateLocationParams": ".update_location_params", + "UpdateOAuth2ClientCredsRequest": ".update_o_auth_2_client_creds_request", + "UpdateOAuth2JwtRequest": ".update_o_auth_2_jwt_request", + "UpdateOAuth2JwtRequestAlgorithm": ".update_o_auth_2_jwt_request_algorithm", + "UpdateOAuth2JwtRequestTokenResponseField": ".update_o_auth_2_jwt_request_token_response_field", + "UpdateOrderParams": ".update_order_params", + "UpdateOrderRequest": ".update_order_request", + "UpdateOrderResponse": ".update_order_response", + "UpdateProductParams": ".update_product_params", + "UpdateProjectRequest": ".update_project_request", + "UpdatePronunciationDictionariesRequest": ".update_pronunciation_dictionaries_request", + "UpdateResponseUnitTestRequest": ".update_response_unit_test_request", + "UpdateServiceParams": ".update_service_params", + "UpdateSimulationTestRequest": ".update_simulation_test_request", + "UpdateStaffParams": ".update_staff_params", + "UpdateToolCallUnitTestRequest": ".update_tool_call_unit_test_request", + "UpdateTransferRuleParams": ".update_transfer_rule_params", + "UpdateWorkspaceMemberResponseModel": ".update_workspace_member_response_model", + "UpsertOrderItemRequest": ".upsert_order_item_request", + "UpsertOrderItemResponse": ".upsert_order_item_response", + "UrlAvatar": ".url_avatar", + "UrlModel": ".url_model", + "UrlSecretAuthResponse": ".url_secret_auth_response", + "UsageAggregationInterval": ".usage_aggregation_interval", + "UsageCharactersResponseModel": ".usage_characters_response_model", + "User": ".user", + "UserAccessManagementActivityId": ".user_access_management_activity_id", + "UserFeedback": ".user_feedback", + "UserFeedbackScore": ".user_feedback_score", + "UserModel": ".user_model", + "UserTranscriptPayload": ".user_transcript_payload", + "UserTypeId": ".user_type_id", + "UserVoiceCollectionResponseModel": ".user_voice_collection_response_model", + "UserVoiceCollectionResponseModelPermissionOnResource": ".user_voice_collection_response_model_permission_on_resource", + "UsersSortBy": ".users_sort_by", + "UtteranceResponseModel": ".utterance_response_model", + "UuiTransferConfig": ".uui_transfer_config", + "UuiTransferConfigProtocolDiscriminatorMode": ".uui_transfer_config_protocol_discriminator_mode", + "VadConfig": ".vad_config", + "VadConfigWorkflowOverride": ".vad_config_workflow_override", + "ValidateUserVerificationCodeParams": ".validate_user_verification_code_params", + "ValidationError": ".validation_error", + "ValidationErrorLocItem": ".validation_error_loc_item", + "Veo31FastRequest": ".veo_31_fast_request", + "Veo31FastRequestAspectRatio": ".veo_31_fast_request_aspect_ratio", + "Veo31FastRequestResolution": ".veo_31_fast_request_resolution", + "Veo31Request": ".veo_31_request", + "Veo31RequestAspectRatio": ".veo_31_request_aspect_ratio", + "Veo31RequestResolution": ".veo_31_request_resolution", + "VeoImageReference": ".veo_image_reference", + "VeoImageReferenceRole": ".veo_image_reference_role", + "Verbosity": ".verbosity", + "VerificationAttemptResponse": ".verification_attempt_response", + "VerifiedVoiceLanguageResponseModel": ".verified_voice_language_response_model", + "VerifyPvcVoiceCaptchaResponseModel": ".verify_pvc_voice_captcha_response_model", + "VideoAnalysis": ".video_analysis", + "VideoAnalysisResult": ".video_analysis_result", + "VideoAnalysisStatus": ".video_analysis_status", + "VideoGenerationRequest": ".video_generation_request", + "VideoGenerationRequest_BytedanceSeedanceV2": ".video_generation_request", + "VideoGenerationRequest_BytedanceSeedanceV25": ".video_generation_request", + "VideoGenerationRequest_BytedanceSeedanceV2Fast": ".video_generation_request", + "VideoGenerationRequest_BytedanceSeedanceV2Mini": ".video_generation_request", + "VideoGenerationRequest_CreatifyAurora": ".video_generation_request", + "VideoGenerationRequest_Veo31FastGenerate001": ".video_generation_request", + "VideoGenerationRequest_Veo31Generate001": ".video_generation_request", + "VideoKeyMoment": ".video_key_moment", + "VideoReference": ".video_reference", + "VideoReference_Asset": ".video_reference", + "VideoReference_Generation": ".video_reference", + "VideoReference_InlineBase64": ".video_reference", + "VideoSchema": ".video_schema", + "VideoSegment": ".video_segment", + "VideoSubject": ".video_subject", + "VisitedAgentRef": ".visited_agent_ref", + "Voice": ".voice", + "VoiceAccentResponseModel": ".voice_accent_response_model", + "VoiceCategory": ".voice_category", + "VoiceDesignPreviewResponse": ".voice_design_preview_response", + "VoiceGenerationParameterOptionResponse": ".voice_generation_parameter_option_response", + "VoiceGenerationParameterResponse": ".voice_generation_parameter_response", + "VoiceLabellingStatus": ".voice_labelling_status", + "VoiceMailDetectionResultSuccessModel": ".voice_mail_detection_result_success_model", + "VoicePreviewResponseModel": ".voice_preview_response_model", + "VoiceRecordingQuality": ".voice_recording_quality", + "VoiceReference": ".voice_reference", + "VoiceSafetyControl": ".voice_safety_control", + "VoiceSample": ".voice_sample", + "VoiceSamplePreviewResponseModel": ".voice_sample_preview_response_model", + "VoiceSampleVisualWaveformResponseModel": ".voice_sample_visual_waveform_response_model", + "VoiceSchema": ".voice_schema", + "VoiceSegment": ".voice_segment", + "VoiceSettings": ".voice_settings", + "VoiceSharingModerationCheckResponseModel": ".voice_sharing_moderation_check_response_model", + "VoiceSharingResponse": ".voice_sharing_response", + "VoiceSharingResponseCategory": ".voice_sharing_response_category", + "VoiceSharingState": ".voice_sharing_state", + "VoiceStatisticsResponseModel": ".voice_statistics_response_model", + "VoiceVerificationResponse": ".voice_verification_response", + "VoicemailDetectionToolConfig": ".voicemail_detection_tool_config", + "VoicesNotPermittedWarning": ".voices_not_permitted_warning", + "WebhookAuthMethodType": ".webhook_auth_method_type", + "WebhookEventType": ".webhook_event_type", + "WebhookHmacSettings": ".webhook_hmac_settings", + "WebhookTarget": ".webhook_target", + "WebhookTargetAll": ".webhook_target_all", + "WebhookTargetIds": ".webhook_target_ids", + "WebhookTarget_All": ".webhook_target", + "WebhookTarget_Ids": ".webhook_target", + "WebhookToolApiSchemaConfigInput": ".webhook_tool_api_schema_config_input", + "WebhookToolApiSchemaConfigInputAuthConnection": ".webhook_tool_api_schema_config_input_auth_connection", + "WebhookToolApiSchemaConfigInputContentType": ".webhook_tool_api_schema_config_input_content_type", + "WebhookToolApiSchemaConfigInputMethod": ".webhook_tool_api_schema_config_input_method", + "WebhookToolApiSchemaConfigInputRequestHeadersValue": ".webhook_tool_api_schema_config_input_request_headers_value", + "WebhookToolApiSchemaConfigOutput": ".webhook_tool_api_schema_config_output", + "WebhookToolApiSchemaConfigOutputAuthConnection": ".webhook_tool_api_schema_config_output_auth_connection", + "WebhookToolApiSchemaConfigOutputContentType": ".webhook_tool_api_schema_config_output_content_type", + "WebhookToolApiSchemaConfigOutputMethod": ".webhook_tool_api_schema_config_output_method", + "WebhookToolApiSchemaConfigOutputRequestHeadersValue": ".webhook_tool_api_schema_config_output_request_headers_value", + "WebhookToolConfigInput": ".webhook_tool_config_input", + "WebhookToolConfigOutput": ".webhook_tool_config_output", + "WebhookTranscriptFormat": ".webhook_transcript_format", + "WebhookUsageType": ".webhook_usage_type", + "WebsocketTtsClientMessageMulti": ".websocket_tts_client_message_multi", + "WebsocketTtsServerMessageMulti": ".websocket_tts_server_message_multi", + "WhatsAppAccountType": ".whats_app_account_type", + "WhatsAppAuthResponse": ".whats_app_auth_response", + "WhatsAppCallPermissionRequest": ".whats_app_call_permission_request", + "WhatsAppCallPermissionRequestState": ".whats_app_call_permission_request_state", + "WhatsAppConversationInfo": ".whats_app_conversation_info", + "WhatsAppConversationInfoDirection": ".whats_app_conversation_info_direction", + "WhatsAppOutboundCallResponse": ".whats_app_outbound_call_response", + "WhatsAppOutboundMessageResponse": ".whats_app_outbound_message_response", + "WhatsAppRecipient": ".whats_app_recipient", + "WhatsAppTemplateBodyComponentParams": ".whats_app_template_body_component_params", + "WhatsAppTemplateButtonComponentParams": ".whats_app_template_button_component_params", + "WhatsAppTemplateDocumentParam": ".whats_app_template_document_param", + "WhatsAppTemplateDocumentParamDetails": ".whats_app_template_document_param_details", + "WhatsAppTemplateHeaderComponentParams": ".whats_app_template_header_component_params", + "WhatsAppTemplateHeaderComponentParamsParametersItem": ".whats_app_template_header_component_params_parameters_item", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Document": ".whats_app_template_header_component_params_parameters_item", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Image": ".whats_app_template_header_component_params_parameters_item", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Location": ".whats_app_template_header_component_params_parameters_item", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Text": ".whats_app_template_header_component_params_parameters_item", + "WhatsAppTemplateImageParam": ".whats_app_template_image_param", + "WhatsAppTemplateImageParamDetails": ".whats_app_template_image_param_details", + "WhatsAppTemplateLocationParam": ".whats_app_template_location_param", + "WhatsAppTemplateLocationParamDetails": ".whats_app_template_location_param_details", + "WhatsAppTemplateTextParam": ".whats_app_template_text_param", + "WidgetConfig": ".widget_config", + "WidgetConfigAvatar": ".widget_config_avatar", + "WidgetConfigAvatar_Image": ".widget_config_avatar", + "WidgetConfigAvatar_Orb": ".widget_config_avatar", + "WidgetConfigAvatar_Url": ".widget_config_avatar", + "WidgetConfigResponse": ".widget_config_response", + "WidgetConfigResponseAvatar": ".widget_config_response_avatar", + "WidgetConfigResponseAvatar_Image": ".widget_config_response_avatar", + "WidgetConfigResponseAvatar_Orb": ".widget_config_response_avatar", + "WidgetConfigResponseAvatar_Url": ".widget_config_response_avatar", + "WidgetConfigResponseSyntaxHighlightTheme": ".widget_config_response_syntax_highlight_theme", + "WidgetConfigSyntaxHighlightTheme": ".widget_config_syntax_highlight_theme", + "WidgetEndFeedbackConfig": ".widget_end_feedback_config", + "WidgetEndFeedbackType": ".widget_end_feedback_type", + "WidgetExpandable": ".widget_expandable", + "WidgetFeedbackMode": ".widget_feedback_mode", + "WidgetLanguagePreset": ".widget_language_preset", + "WidgetLanguagePresetResponse": ".widget_language_preset_response", + "WidgetPlacement": ".widget_placement", + "WidgetStyles": ".widget_styles", + "WidgetTermsTranslation": ".widget_terms_translation", + "WidgetTextContents": ".widget_text_contents", + "WidgetTextContentsTranslation": ".widget_text_contents_translation", + "WordTimestamp": ".word_timestamp", + "WorkflowEdgeModelInput": ".workflow_edge_model_input", + "WorkflowEdgeModelInputBackwardCondition": ".workflow_edge_model_input_backward_condition", + "WorkflowEdgeModelInputBackwardCondition_Expression": ".workflow_edge_model_input_backward_condition", + "WorkflowEdgeModelInputBackwardCondition_Llm": ".workflow_edge_model_input_backward_condition", + "WorkflowEdgeModelInputBackwardCondition_Result": ".workflow_edge_model_input_backward_condition", + "WorkflowEdgeModelInputBackwardCondition_Unconditional": ".workflow_edge_model_input_backward_condition", + "WorkflowEdgeModelInputForwardCondition": ".workflow_edge_model_input_forward_condition", + "WorkflowEdgeModelInputForwardCondition_Expression": ".workflow_edge_model_input_forward_condition", + "WorkflowEdgeModelInputForwardCondition_Llm": ".workflow_edge_model_input_forward_condition", + "WorkflowEdgeModelInputForwardCondition_Result": ".workflow_edge_model_input_forward_condition", + "WorkflowEdgeModelInputForwardCondition_Unconditional": ".workflow_edge_model_input_forward_condition", + "WorkflowEdgeModelOutput": ".workflow_edge_model_output", + "WorkflowEdgeModelOutputBackwardCondition": ".workflow_edge_model_output_backward_condition", + "WorkflowEdgeModelOutputBackwardCondition_Expression": ".workflow_edge_model_output_backward_condition", + "WorkflowEdgeModelOutputBackwardCondition_Llm": ".workflow_edge_model_output_backward_condition", + "WorkflowEdgeModelOutputBackwardCondition_Result": ".workflow_edge_model_output_backward_condition", + "WorkflowEdgeModelOutputBackwardCondition_Unconditional": ".workflow_edge_model_output_backward_condition", + "WorkflowEdgeModelOutputForwardCondition": ".workflow_edge_model_output_forward_condition", + "WorkflowEdgeModelOutputForwardCondition_Expression": ".workflow_edge_model_output_forward_condition", + "WorkflowEdgeModelOutputForwardCondition_Llm": ".workflow_edge_model_output_forward_condition", + "WorkflowEdgeModelOutputForwardCondition_Result": ".workflow_edge_model_output_forward_condition", + "WorkflowEdgeModelOutputForwardCondition_Unconditional": ".workflow_edge_model_output_forward_condition", + "WorkflowEndNodeModelInput": ".workflow_end_node_model_input", + "WorkflowEndNodeModelOutput": ".workflow_end_node_model_output", + "WorkflowEndNodeOutcome": ".workflow_end_node_outcome", + "WorkflowExpressionConditionModelInput": ".workflow_expression_condition_model_input", + "WorkflowExpressionConditionModelOutput": ".workflow_expression_condition_model_output", + "WorkflowFeaturesUsageCommonModel": ".workflow_features_usage_common_model", + "WorkflowLlmConditionModelInput": ".workflow_llm_condition_model_input", + "WorkflowLlmConditionModelOutput": ".workflow_llm_condition_model_output", + "WorkflowOverrideAgentNodeModelInput": ".workflow_override_agent_node_model_input", + "WorkflowOverrideAgentNodeModelOutput": ".workflow_override_agent_node_model_output", + "WorkflowPhoneNumberNodeModelInput": ".workflow_phone_number_node_model_input", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem": ".workflow_phone_number_node_model_input_custom_sip_headers_item", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Dynamic": ".workflow_phone_number_node_model_input_custom_sip_headers_item", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Static": ".workflow_phone_number_node_model_input_custom_sip_headers_item", + "WorkflowPhoneNumberNodeModelInputPostDialDigits": ".workflow_phone_number_node_model_input_post_dial_digits", + "WorkflowPhoneNumberNodeModelInputPostDialDigits_Dynamic": ".workflow_phone_number_node_model_input_post_dial_digits", + "WorkflowPhoneNumberNodeModelInputPostDialDigits_Static": ".workflow_phone_number_node_model_input_post_dial_digits", + "WorkflowPhoneNumberNodeModelInputTransferDestination": ".workflow_phone_number_node_model_input_transfer_destination", + "WorkflowPhoneNumberNodeModelInputTransferDestination_Phone": ".workflow_phone_number_node_model_input_transfer_destination", + "WorkflowPhoneNumberNodeModelInputTransferDestination_PhoneDynamicVariable": ".workflow_phone_number_node_model_input_transfer_destination", + "WorkflowPhoneNumberNodeModelInputTransferDestination_SipUri": ".workflow_phone_number_node_model_input_transfer_destination", + "WorkflowPhoneNumberNodeModelInputTransferDestination_SipUriDynamicVariable": ".workflow_phone_number_node_model_input_transfer_destination", + "WorkflowPhoneNumberNodeModelOutput": ".workflow_phone_number_node_model_output", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem": ".workflow_phone_number_node_model_output_custom_sip_headers_item", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Dynamic": ".workflow_phone_number_node_model_output_custom_sip_headers_item", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Static": ".workflow_phone_number_node_model_output_custom_sip_headers_item", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits": ".workflow_phone_number_node_model_output_post_dial_digits", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits_Dynamic": ".workflow_phone_number_node_model_output_post_dial_digits", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits_Static": ".workflow_phone_number_node_model_output_post_dial_digits", + "WorkflowPhoneNumberNodeModelOutputTransferDestination": ".workflow_phone_number_node_model_output_transfer_destination", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_Phone": ".workflow_phone_number_node_model_output_transfer_destination", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_PhoneDynamicVariable": ".workflow_phone_number_node_model_output_transfer_destination", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUri": ".workflow_phone_number_node_model_output_transfer_destination", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUriDynamicVariable": ".workflow_phone_number_node_model_output_transfer_destination", + "WorkflowResultConditionModelInput": ".workflow_result_condition_model_input", + "WorkflowResultConditionModelOutput": ".workflow_result_condition_model_output", + "WorkflowSayNodeModelInput": ".workflow_say_node_model_input", + "WorkflowSayNodeModelInputMessage": ".workflow_say_node_model_input_message", + "WorkflowSayNodeModelInputMessage_Literal": ".workflow_say_node_model_input_message", + "WorkflowSayNodeModelInputMessage_Prompt": ".workflow_say_node_model_input_message", + "WorkflowSayNodeModelOutput": ".workflow_say_node_model_output", + "WorkflowSayNodeModelOutputMessage": ".workflow_say_node_model_output_message", + "WorkflowSayNodeModelOutputMessage_Literal": ".workflow_say_node_model_output_message", + "WorkflowSayNodeModelOutputMessage_Prompt": ".workflow_say_node_model_output_message", + "WorkflowStandaloneAgentNodeModelInput": ".workflow_standalone_agent_node_model_input", + "WorkflowStandaloneAgentNodeModelOutput": ".workflow_standalone_agent_node_model_output", + "WorkflowStartNodeModelInput": ".workflow_start_node_model_input", + "WorkflowStartNodeModelOutput": ".workflow_start_node_model_output", + "WorkflowStateUpdateInput": ".workflow_state_update_input", + "WorkflowStateUpdateOutput": ".workflow_state_update_output", + "WorkflowToolEdgeStepModel": ".workflow_tool_edge_step_model", + "WorkflowToolLocator": ".workflow_tool_locator", + "WorkflowToolLocatorSchemaOverridesValue": ".workflow_tool_locator_schema_overrides_value", + "WorkflowToolLocatorSchemaOverridesValue_Constant": ".workflow_tool_locator_schema_overrides_value", + "WorkflowToolLocatorSchemaOverridesValue_DynamicVariable": ".workflow_tool_locator_schema_overrides_value", + "WorkflowToolLocatorSchemaOverridesValue_Llm": ".workflow_tool_locator_schema_overrides_value", + "WorkflowToolLocatorSchemaOverridesValue_Omit": ".workflow_tool_locator_schema_overrides_value", + "WorkflowToolMaxIterationsExceededStepModel": ".workflow_tool_max_iterations_exceeded_step_model", + "WorkflowToolNestedToolsStepModelInput": ".workflow_tool_nested_tools_step_model_input", + "WorkflowToolNestedToolsStepModelInputResultsItem": ".workflow_tool_nested_tools_step_model_input_results_item", + "WorkflowToolNestedToolsStepModelOutput": ".workflow_tool_nested_tools_step_model_output", + "WorkflowToolNestedToolsStepModelOutputResultsItem": ".workflow_tool_nested_tools_step_model_output_results_item", + "WorkflowToolNodeModelInput": ".workflow_tool_node_model_input", + "WorkflowToolNodeModelOutput": ".workflow_tool_node_model_output", + "WorkflowToolResponseModelInput": ".workflow_tool_response_model_input", + "WorkflowToolResponseModelInputStepsItem": ".workflow_tool_response_model_input_steps_item", + "WorkflowToolResponseModelInputStepsItem_Edge": ".workflow_tool_response_model_input_steps_item", + "WorkflowToolResponseModelInputStepsItem_MaxIterationsExceeded": ".workflow_tool_response_model_input_steps_item", + "WorkflowToolResponseModelInputStepsItem_NestedTools": ".workflow_tool_response_model_input_steps_item", + "WorkflowToolResponseModelOutput": ".workflow_tool_response_model_output", + "WorkflowToolResponseModelOutputStepsItem": ".workflow_tool_response_model_output_steps_item", + "WorkflowToolResponseModelOutputStepsItem_Edge": ".workflow_tool_response_model_output_steps_item", + "WorkflowToolResponseModelOutputStepsItem_MaxIterationsExceeded": ".workflow_tool_response_model_output_steps_item", + "WorkflowToolResponseModelOutputStepsItem_NestedTools": ".workflow_tool_response_model_output_steps_item", + "WorkflowUnconditionalModelInput": ".workflow_unconditional_model_input", + "WorkflowUnconditionalModelOutput": ".workflow_unconditional_model_output", + "WorkflowUpdateStateNodeModelInput": ".workflow_update_state_node_model_input", + "WorkflowUpdateStateNodeModelOutput": ".workflow_update_state_node_model_output", + "WorkspaceAnalyticsQueryResponseModel": ".workspace_analytics_query_response_model", + "WorkspaceAnalyticsQueryResponseModelColumnTypesItem": ".workspace_analytics_query_response_model_column_types_item", + "WorkspaceAnalyticsQueryResponseModelRowsItemItem": ".workspace_analytics_query_response_model_rows_item_item", + "WorkspaceApiKeyListResponseModel": ".workspace_api_key_list_response_model", + "WorkspaceApiKeyResponseModel": ".workspace_api_key_response_model", + "WorkspaceAuditLogEntryResponse": ".workspace_audit_log_entry_response", + "WorkspaceAuditLogEntryResponseActivityId": ".workspace_audit_log_entry_response_activity_id", + "WorkspaceAuditLogsPageResponse": ".workspace_audit_logs_page_response", + "WorkspaceBatchCallsResponse": ".workspace_batch_calls_response", + "WorkspaceCreateApiKeyResponseModel": ".workspace_create_api_key_response_model", + "WorkspaceCreateServiceAccountResponseModel": ".workspace_create_service_account_response_model", + "WorkspaceCreateWebhookResponseModel": ".workspace_create_webhook_response_model", + "WorkspaceGroupByNameResponseModel": ".workspace_group_by_name_response_model", + "WorkspaceGroupPermission": ".workspace_group_permission", + "WorkspaceGroupResponseModel": ".workspace_group_response_model", + "WorkspaceGroupResponseModelGroupConcurrencyLimit": ".workspace_group_response_model_group_concurrency_limit", + "WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit": ".workspace_group_response_model_group_dubbing_concurrency_limit", + "WorkspaceGroupResponseModelGroupMusicConcurrencyLimit": ".workspace_group_response_model_group_music_concurrency_limit", + "WorkspaceGroupResponseModelGroupPvcLimit": ".workspace_group_response_model_group_pvc_limit", + "WorkspaceGroupResponseModelGroupUsageLimit": ".workspace_group_response_model_group_usage_limit", + "WorkspaceMemberResponseModel": ".workspace_member_response_model", + "WorkspaceResourceType": ".workspace_resource_type", + "WorkspaceServiceAccountListResponseModel": ".workspace_service_account_list_response_model", + "WorkspaceServiceAccountResponseModel": ".workspace_service_account_response_model", + "WorkspaceWebhookEventType": ".workspace_webhook_event_type", + "WorkspaceWebhookListResponseModel": ".workspace_webhook_list_response_model", + "WorkspaceWebhookResponseModel": ".workspace_webhook_response_model", + "WorkspaceWebhookUsageResponseModel": ".workspace_webhook_usage_response_model", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AccountChangeActivityId", + "ActorModel", + "AddChapterResponseModel", + "AddKnowledgeBaseResponseModel", + "AddProjectRequest", + "AddProjectResponseModel", + "AddPronunciationDictionaryResponseModel", + "AddPronunciationDictionaryResponseModelPermissionOnResource", + "AddSharingVoiceRequest", + "AddVoiceIvcResponseModel", + "AddVoiceResponseModel", + "AddVoiceToUserVoiceCollectionResponseModel", + "AddWorkspaceGroupMemberResponseModel", + "AddWorkspaceInviteResponseModel", + "AdditionalFormatResponseModel", + "AdditionalFormats", + "AdhocAgentConfigOverrideForTestRequestModel", + "Age", + "AgentAnalysisItemsInput", + "AgentAnalysisItemsInputDataCollectionItem", + "AgentAnalysisItemsInputDataCollectionItem_System", + "AgentAnalysisItemsInputDataCollectionItem_User", + "AgentAnalysisItemsInputEvaluationCriteriaItem", + "AgentAnalysisItemsInputEvaluationCriteriaItem_System", + "AgentAnalysisItemsInputEvaluationCriteriaItem_User", + "AgentAnalysisItemsOutput", + "AgentAnalysisItemsOutputDataCollectionItem", + "AgentAnalysisItemsOutputDataCollectionItem_System", + "AgentAnalysisItemsOutputDataCollectionItem_User", + "AgentAnalysisItemsOutputEvaluationCriteriaItem", + "AgentAnalysisItemsOutputEvaluationCriteriaItem_System", + "AgentAnalysisItemsOutputEvaluationCriteriaItem_User", + "AgentBranchBasicInfo", + "AgentBranchResponse", + "AgentBranchSummary", + "AgentCallLimits", + "AgentConfig", + "AgentConfigApiModelWorkflowOverrideInput", + "AgentConfigApiModelWorkflowOverrideOutput", + "AgentConfigOverrideConfig", + "AgentConfigOverrideInput", + "AgentConfigOverrideOutput", + "AgentConversationTicketIssueType", + "AgentConversationTicketPriority", + "AgentConversationTicketResponseModel", + "AgentConversationTicketSortBy", + "AgentConversationTicketSource", + "AgentConversationTicketStatus", + "AgentDefinitionSource", + "AgentDeploymentHistoryItem", + "AgentDeploymentPercentageStrategy", + "AgentDeploymentRequest", + "AgentDeploymentRequestItem", + "AgentDeploymentResponse", + "AgentDeploymentSource", + "AgentFailureResponseExample", + "AgentHoldAudioConfig", + "AgentKnowledgeBaseRagChunkResponseModel", + "AgentKnowledgeBaseRagQueryRequestModel", + "AgentKnowledgeBaseRagQueryResponseModel", + "AgentMergeProposalResponse", + "AgentMergeProposalResponseOutcome", + "AgentMergeProposalResponseOutcome_Closed", + "AgentMergeProposalResponseOutcome_Merged", + "AgentMergeProposalResponseOutcome_Open", + "AgentMetadata", + "AgentMetadataDbModel", + "AgentMetadataResponseModel", + "AgentPlatformSettingsRequestModel", + "AgentPlatformSettingsResponseModel", + "AgentQueueingConfig", + "AgentResponsePayload", + "AgentSimulatedChatTestResponseModel", + "AgentSmbMetadata", + "AgentSortBy", + "AgentSuccessfulResponseExample", + "AgentSummaryBatchSuccessfulResponseModel", + "AgentSummaryResponseModel", + "AgentTestEntityType", + "AgentTestFolderPathSegmentResponseModel", + "AgentTestingSettings", + "AgentTopicResponseModel", + "AgentTransferInput", + "AgentTransferOp", + "AgentTransferOpPop", + "AgentTransferOpPush", + "AgentTransferOpReplace", + "AgentTransferOp_Pop", + "AgentTransferOp_Push", + "AgentTransferOp_Replace", + "AgentTransferOutput", + "AgentTrustContext", + "AgentVersionMetadata", + "AgentVersionParents", + "AgentWorkflowRequestModel", + "AgentWorkflowRequestModelNodesValue", + "AgentWorkflowRequestModelNodesValue_End", + "AgentWorkflowRequestModelNodesValue_OverrideAgent", + "AgentWorkflowRequestModelNodesValue_PhoneNumber", + "AgentWorkflowRequestModelNodesValue_Say", + "AgentWorkflowRequestModelNodesValue_StandaloneAgent", + "AgentWorkflowRequestModelNodesValue_Start", + "AgentWorkflowRequestModelNodesValue_Tool", + "AgentWorkflowRequestModelNodesValue_UpdateState", + "AgentWorkflowResponseModel", + "AgentWorkflowResponseModelNodesValue", + "AgentWorkflowResponseModelNodesValue_End", + "AgentWorkflowResponseModelNodesValue_OverrideAgent", + "AgentWorkflowResponseModelNodesValue_PhoneNumber", + "AgentWorkflowResponseModelNodesValue_Say", + "AgentWorkflowResponseModelNodesValue_StandaloneAgent", + "AgentWorkflowResponseModelNodesValue_Start", + "AgentWorkflowResponseModelNodesValue_Tool", + "AgentWorkflowResponseModelNodesValue_UpdateState", + "AgentWorkspaceOverridesInput", + "AgentWorkspaceOverridesOutput", + "AlertingIntegrationNotifier", + "AlertingIntegrationNotifierIntegrationType", + "AlertingIntegrationNotifierResponse", + "AlertingIntegrationNotifierResponseIntegrationType", + "AlertingMonitorConfig", + "AlertingPagerDutyNotifier", + "AlertingPagerDutyNotifierResponse", + "AlertingSettings", + "AlertingSettingsNotifiersItem", + "AlertingSettingsNotifiersItem_Integration", + "AlertingSettingsNotifiersItem_Webhook", + "AlertingSettingsResponse", + "AlertingSettingsResponseNotifiersItem", + "AlertingSettingsResponseNotifiersItem_Integration", + "AlertingSettingsResponseNotifiersItem_Webhook", + "AlertingSlackNotifier", + "AlertingSlackNotifierResponse", + "AlertingWebhookHeader", + "AlertingWebhookMethod", + "AlertingWebhookNotifier", + "AlertingWebhookNotifierResponse", + "AlertingWebhookSecretHeaderValue", + "Alignment", + "AllowedOutputFormats", + "AllowedValues", + "AllowlistItem", + "AnalysisCharging", + "AnalysisProperty", + "AnalysisPropertyConstantValue", + "AnalysisPropertyType", + "AnalysisRunSnapshot", + "AnalysisRunningTotal", + "AnalysisScope", + "AnalysisType", + "ApiIntegrationOAuth2AuthCodeResponse", + "ApiIntegrationOAuth2AuthCodeResponseScopeSeparator", + "ApiIntegrationOAuth2CustomAppResponse", + "ApiIntegrationOAuth2CustomAppResponseScopeSeparator", + "ApiIntegrationWebhookOverrides", + "ApiIntegrationWebhookOverridesRequestHeadersValue", + "ApiIntegrationWebhookOverridesSchemaOverridesValue", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Constant", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_DynamicVariable", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Llm", + "ApiIntegrationWebhookOverridesSchemaOverridesValue_Omit", + "ApiIntegrationWebhookToolConfigInput", + "ApiIntegrationWebhookToolConfigOutput", + "ArchitectDispatchResponseModel", + "ArrayJsonSchemaPropertyInput", + "ArrayJsonSchemaPropertyInputItems", + "ArrayJsonSchemaPropertyInputPropertyKind", + "ArrayJsonSchemaPropertyOutput", + "ArrayJsonSchemaPropertyOutputItems", + "ArraySchema", + "AsrConversationalConfig", + "AsrConversationalConfigOverride", + "AsrConversationalConfigOverrideConfig", + "AsrConversationalConfigWorkflowOverride", + "AsrInputFormat", + "AsrProvider", + "AsrQuality", + "AssetListResponse", + "AssetResponse", + "AssetTranscription", + "AssetTranscriptionData", + "AssetTranscriptionStatus", + "AssignableUserResponseModel", + "AstAdditionOperatorNodeInput", + "AstAdditionOperatorNodeOutput", + "AstAndOperatorNodeInput", + "AstAndOperatorNodeOutput", + "AstBooleanNodeInput", + "AstBooleanNodeOutput", + "AstConditionalOperatorNodeInput", + "AstConditionalOperatorNodeOutput", + "AstDivisionOperatorNodeInput", + "AstDivisionOperatorNodeOutput", + "AstDynamicVariableNodeInput", + "AstDynamicVariableNodeOutput", + "AstEqualsOperatorNodeInput", + "AstEqualsOperatorNodeOutput", + "AstGreaterThanOperatorNodeInput", + "AstGreaterThanOperatorNodeOutput", + "AstGreaterThanOrEqualsOperatorNodeInput", + "AstGreaterThanOrEqualsOperatorNodeOutput", + "AstLessThanOperatorNodeInput", + "AstLessThanOperatorNodeOutput", + "AstLessThanOrEqualsOperatorNodeInput", + "AstLessThanOrEqualsOperatorNodeOutput", + "AstMultiplicationOperatorNodeInput", + "AstMultiplicationOperatorNodeOutput", + "AstNodeInput", + "AstNodeInputLlm", + "AstNodeInput_AddOperator", + "AstNodeInput_AndOperator", + "AstNodeInput_BooleanLiteral", + "AstNodeInput_ConditionalOperator", + "AstNodeInput_DivOperator", + "AstNodeInput_DynamicVariable", + "AstNodeInput_EqOperator", + "AstNodeInput_GtOperator", + "AstNodeInput_GteOperator", + "AstNodeInput_Llm", + "AstNodeInput_LtOperator", + "AstNodeInput_LteOperator", + "AstNodeInput_MulOperator", + "AstNodeInput_NeqOperator", + "AstNodeInput_NullLiteral", + "AstNodeInput_NumberLiteral", + "AstNodeInput_OrOperator", + "AstNodeInput_StringLiteral", + "AstNodeInput_SubOperator", + "AstNodeOutput", + "AstNodeOutput_AddOperator", + "AstNodeOutput_AndOperator", + "AstNodeOutput_BooleanLiteral", + "AstNodeOutput_ConditionalOperator", + "AstNodeOutput_DivOperator", + "AstNodeOutput_DynamicVariable", + "AstNodeOutput_EqOperator", + "AstNodeOutput_GtOperator", + "AstNodeOutput_GteOperator", + "AstNodeOutput_Llm", + "AstNodeOutput_LtOperator", + "AstNodeOutput_LteOperator", + "AstNodeOutput_MulOperator", + "AstNodeOutput_NeqOperator", + "AstNodeOutput_NullLiteral", + "AstNodeOutput_NumberLiteral", + "AstNodeOutput_OrOperator", + "AstNodeOutput_StringLiteral", + "AstNodeOutput_SubOperator", + "AstNotEqualsOperatorNodeInput", + "AstNotEqualsOperatorNodeOutput", + "AstNullNodeInput", + "AstNullNodeOutput", + "AstNumberNodeInput", + "AstNumberNodeInputValue", + "AstNumberNodeOutput", + "AstNumberNodeOutputValue", + "AstOrOperatorNodeInput", + "AstOrOperatorNodeOutput", + "AstStringNodeInput", + "AstStringNodeOutput", + "AstSubtractionOperatorNodeInput", + "AstSubtractionOperatorNodeOutput", + "AstllmNodeInput", + "AstllmNodeInputPrompt", + "AstllmNodeInputValueSchema", + "AstllmNodeOutput", + "AsyncConversationMetadata", + "AsyncConversationMetadataDeliveryStatus", + "AttachedSystemDataCollectionRef", + "AttachedSystemEvaluationRef", + "AttachedTestModel", + "AttachedUserDataCollectionRef", + "AttachedUserEvaluationRef", + "AudioAnalysis", + "AudioAnalysisResult", + "AudioAnalysisStatus", + "AudioEffectsBackgroundNoiseResponseModel", + "AudioEffectsCatalogResponseModel", + "AudioEffectsEnvironmentResponseModel", + "AudioEffectsFilterPresetResponseModel", + "AudioFormatEnum", + "AudioInputPacing", + "AudioIsolationHistoryItemResponseModel", + "AudioKeyMoment", + "AudioNativeCreateProjectResponseModel", + "AudioNativeEditContentResponseModel", + "AudioNativeProjectSettingsResponseModel", + "AudioNativeProjectSettingsResponseModelStatus", + "AudioOutput", + "AudioOutputMulti", + "AudioRefChunk", + "AudioReference", + "AudioReference_Asset", + "AudioReference_Generation", + "AudioReference_InlineBase64", + "AudioSchema", + "AudioSegment", + "AudioWithTimestampsAndVoiceSegmentsResponseModel", + "AudioWithTimestampsResponse", + "AuthConnectionDependencies", + "AuthConnectionDependenciesMcpServersItem", + "AuthConnectionDependenciesMcpServersItem_Available", + "AuthConnectionDependenciesMcpServersItem_Unknown", + "AuthConnectionDependenciesToolsItem", + "AuthConnectionDependenciesToolsItem_Available", + "AuthConnectionDependenciesToolsItem_Unknown", + "AuthConnectionLocator", + "AuthConnectionStatus", + "AuthSettings", + "AuthenticationActivityId", + "AuthorizationMethod", + "AutoGenerationMetadata", + "AutoSyncInfo", + "AvatarContextResponseModel", + "BackgroundSoundConfig", + "BackgroundSoundConfigWorkflowOverride", + "BackgroundSoundPresetId", + "BackgroundSoundSourceType", + "BackupLlmDefault", + "BackupLlmDisabled", + "BackupLlmOverride", + "BadRequestErrorBody", + "BanReasonType", + "BaseTurnConfig", + "BasicAuthResponse", + "BatchCallDetailedResponse", + "BatchCallRecipientStatus", + "BatchCallResponse", + "BatchCallStatus", + "BatchCallWhatsAppParams", + "BatchCallingCampaignInformation", + "BatchFailureResponseModel", + "BearerAuthResponse", + "BehaviorOverride", + "BillingPeriod", + "BooleanSchema", + "BranchProtectionStatus", + "BreakdownTypes", + "BucketingStatus", + "BuiltInToolsInput", + "BuiltInToolsOutput", + "BuiltInToolsWorkflowOverrideInput", + "BuiltInToolsWorkflowOverrideOutput", + "BytedanceSeedance25Request", + "BytedanceSeedance25RequestAspectRatio", + "BytedanceSeedance25RequestResolution", + "BytedanceSeedance2FastRequest", + "BytedanceSeedance2FastRequestAspectRatio", + "BytedanceSeedance2FastRequestResolution", + "BytedanceSeedance2MiniRequest", + "BytedanceSeedance2MiniRequestAspectRatio", + "BytedanceSeedance2MiniRequestResolution", + "BytedanceSeedance2Request", + "BytedanceSeedance2RequestAspectRatio", + "BytedanceSeedance2RequestResolution", + "BytedanceSeedream5LiteRequest", + "BytedanceSeedream5LiteRequestAspectRatio", + "BytedanceSeedream5LiteRequestResolution", + "BytedanceSeedream5ProRequest", + "BytedanceSeedream5ProRequestAspectRatio", + "BytedanceSeedream5ProRequestResolution", + "CallResult", + "CampaignConversationType", + "CancelCalendarEventParams", + "CancelGroupSessionForAllParams", + "CancelGroupSessionRegistrationParams", + "CancelOrderParams", + "CanvasPlacement", + "CaptionStyleCharacterAnimationModel", + "CaptionStyleCharacterAnimationModelEnterType", + "CaptionStyleCharacterAnimationModelExitType", + "CaptionStyleHorizontalPlacementModel", + "CaptionStyleHorizontalPlacementModelAlign", + "CaptionStyleModel", + "CaptionStyleModelTextAlign", + "CaptionStyleModelTextBlendMode", + "CaptionStyleModelTextStyle", + "CaptionStyleModelTextTransform", + "CaptionStyleModelTextWeight", + "CaptionStyleSectionAnimationModel", + "CaptionStyleSectionAnimationModelEnterType", + "CaptionStyleSectionAnimationModelExitType", + "CaptionStyleTemplateModel", + "CaptionStyleVerticalPlacementModel", + "CaptionStyleVerticalPlacementModelAlign", + "CaptionStyleWordAnimationModel", + "CaptionStyleWordAnimationModelEnterType", + "CaptionStyleWordAnimationModelExitType", + "ChapterContentBlockExtendableNodeResponseModel", + "ChapterContentBlockInputModel", + "ChapterContentBlockInputModelSubType", + "ChapterContentBlockResponseModel", + "ChapterContentBlockResponseModelNodesItem", + "ChapterContentBlockResponseModelNodesItem_Other", + "ChapterContentBlockResponseModelNodesItem_TtsNode", + "ChapterContentBlockTtsNodeResponseModel", + "ChapterContentInputModel", + "ChapterContentParagraphTtsNodeInputModel", + "ChapterContentResponseModel", + "ChapterResponse", + "ChapterSnapshotExtendedResponseModel", + "ChapterSnapshotResponse", + "ChapterSnapshotsResponse", + "ChapterState", + "ChapterStatisticsResponse", + "ChapterWithContentResponseModel", + "ChapterWithContentResponseModelState", + "CharacterAge", + "CharacterAlignmentModel", + "CharacterAlignmentResponseModel", + "CharacterGender", + "CharacterMetadataResponseModel", + "CharacterRefreshPeriod", + "CharacterResponseModel", + "CharacterRole", + "CharacterUsageResponse", + "ChatSourceMedium", + "CheckServiceAvailabilityParams", + "ClientEvent", + "ClientSecretResponse", + "ClientToolConfigInput", + "ClientToolConfigOutput", + "ClipAnimation", + "ClipAnimationEnterEffect", + "ClipAnimationExitEffect", + "CloseConnection", + "CloseContext", + "ClosePayload", + "CloseSocket", + "ClosedOutcome", + "ColumnFilter", + "ColumnFilterOperation", + "ColumnFilterValuesItem", + "ColumnUnit", + "CommittedTranscriptEntitiesPayload", + "CommittedTranscriptPayload", + "CommittedTranscriptWithTimestampsPayload", + "CompactionSettingsWorkflowOverride", + "CompileProceduresResponseModel", + "CompileProceduresValidationErrorResponseModel", + "CompositionPlan", + "CompositionPlanChunksItem", + "ComputedUsagePlatformLimit", + "ConditionStrength", + "ConfigEntityType", + "ConflictSection", + "ConstantSchemaOverride", + "ConstantSchemaOverrideConstantValue", + "ContentConfig", + "ContentFormat", + "ContentGuardrailInput", + "ContentGuardrailInputTriggerAction", + "ContentGuardrailInputTriggerAction_EndCall", + "ContentGuardrailInputTriggerAction_Retry", + "ContentGuardrailOutput", + "ContentGuardrailOutputTriggerAction", + "ContentGuardrailOutputTriggerAction_EndCall", + "ContentGuardrailOutputTriggerAction_Retry", + "ContentSchema", + "ContentSchema_Array", + "ContentSchema_Audio", + "ContentSchema_Boolean", + "ContentSchema_Image", + "ContentSchema_Integer", + "ContentSchema_Number", + "ContentSchema_Object", + "ContentSchema_String", + "ContentSchema_Video", + "ContentSchema_Voice", + "ContentThresholdGuardrail", + "ContentThresholdGuardrailThreshold", + "ContextualUpdateInfo", + "Contributor", + "ConvAiDynamicVariable", + "ConvAiEnvVarLocator", + "ConvAiFileUploadResponseModel", + "ConvAiSecretLocator", + "ConvAiStoredSecretDependencies", + "ConvAiStoredSecretDependenciesAgentsItem", + "ConvAiStoredSecretDependenciesAgentsItem_Available", + "ConvAiStoredSecretDependenciesAgentsItem_Unknown", + "ConvAiStoredSecretDependenciesMcpServersItem", + "ConvAiStoredSecretDependenciesMcpServersItem_Available", + "ConvAiStoredSecretDependenciesMcpServersItem_Unknown", + "ConvAiStoredSecretDependenciesToolsItem", + "ConvAiStoredSecretDependenciesToolsItem_Available", + "ConvAiStoredSecretDependenciesToolsItem_Unknown", + "ConvAiUserSecretDbModel", + "ConvAiWebhooks", + "ConvAiWorkspaceStoredSecretConfig", + "ConversationAsrUsageModel", + "ConversationChargingCommonModel", + "ConversationConfigClientOverrideConfigInput", + "ConversationConfigClientOverrideConfigOutput", + "ConversationConfigClientOverrideInput", + "ConversationConfigClientOverrideOutput", + "ConversationConfigInput", + "ConversationConfigOutput", + "ConversationConfigOverride", + "ConversationConfigOverrideConfig", + "ConversationConfigWorkflowOverrideInput", + "ConversationConfigWorkflowOverrideOutput", + "ConversationDeletionSettings", + "ConversationErrorType", + "ConversationFeedbackType", + "ConversationHistoryAnalysisCommonModel", + "ConversationHistoryBatchCallModel", + "ConversationHistoryElevenAssistantCommonModel", + "ConversationHistoryErrorCommonModel", + "ConversationHistoryEvaluationCriteriaResultCommonModel", + "ConversationHistoryExotelPhoneCallModel", + "ConversationHistoryFeedbackCommonModel", + "ConversationHistoryMetadataCommonModel", + "ConversationHistoryMetadataCommonModelPhoneCall", + "ConversationHistoryMetadataCommonModelPhoneCall_Exotel", + "ConversationHistoryMetadataCommonModelPhoneCall_SipTrunking", + "ConversationHistoryMetadataCommonModelPhoneCall_Twilio", + "ConversationHistoryMultivoiceMessageModel", + "ConversationHistoryMultivoiceMessagePartModel", + "ConversationHistoryRagUsageCommonModel", + "ConversationHistoryRedactionConfig", + "ConversationHistorySipTrunkingPhoneCallModel", + "ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput", + "ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput", + "ConversationHistoryTranscriptCommonModelInput", + "ConversationHistoryTranscriptCommonModelInputRole", + "ConversationHistoryTranscriptCommonModelInputToolResultsItem", + "ConversationHistoryTranscriptCommonModelOutput", + "ConversationHistoryTranscriptCommonModelOutputRole", + "ConversationHistoryTranscriptCommonModelOutputToolResultsItem", + "ConversationHistoryTranscriptFileInputResponseModel", + "ConversationHistoryTranscriptOtherToolsResultCommonModel", + "ConversationHistoryTranscriptOtherToolsResultCommonModelType", + "ConversationHistoryTranscriptResponseModel", + "ConversationHistoryTranscriptResponseModelRole", + "ConversationHistoryTranscriptResponseModelToolResultsItem", + "ConversationHistoryTranscriptSystemToolResultCommonModelInput", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_Dummy", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndCallSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseRagSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_LanguageDetectionSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_SkipTurnSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TestingToolResult", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberAmazonConnectSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberError", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberExotelSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberSipSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberTwilioSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_VoicemailDetectionSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutput", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_Dummy", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndCallSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseRagSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_LanguageDetectionSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_SkipTurnSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TestingToolResult", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberAmazonConnectSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberError", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberExotelSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberSipSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberTwilioSuccess", + "ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_VoicemailDetectionSuccess", + "ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsInput", + "ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsOutput", + "ConversationHistoryTranscriptToolCallClientDetails", + "ConversationHistoryTranscriptToolCallCommonModelInput", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_ApiIntegrationWebhook", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Client", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Mcp", + "ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Webhook", + "ConversationHistoryTranscriptToolCallCommonModelOutput", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_ApiIntegrationWebhook", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Client", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Mcp", + "ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Webhook", + "ConversationHistoryTranscriptToolCallMcpDetails", + "ConversationHistoryTranscriptToolCallWebhookDetails", + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput", + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput", + "ConversationHistoryTwilioPhoneCallModel", + "ConversationInitiationClientDataConfigInput", + "ConversationInitiationClientDataConfigOutput", + "ConversationInitiationClientDataInternal", + "ConversationInitiationClientDataRequestInput", + "ConversationInitiationClientDataRequestOutput", + "ConversationInitiationClientDataWebhook", + "ConversationInitiationClientDataWebhookRequestHeadersValue", + "ConversationInitiationSource", + "ConversationInitiationSourceInfo", + "ConversationProduct", + "ConversationReasoningModel", + "ConversationSentimentAnalysis", + "ConversationSentimentAnalysisOverallLabel", + "ConversationSignedUrlResponseModel", + "ConversationSimulationSpecification", + "ConversationSource", + "ConversationSummaryMessageModel", + "ConversationSummaryMessageModelRole", + "ConversationSummaryResponseModel", + "ConversationSummaryResponseModelStatus", + "ConversationTagResponseModel", + "ConversationTokenPurpose", + "ConversationTokenResponseModel", + "ConversationTtsUsageModel", + "ConversationTurnMetrics", + "ConversationUserResponseModel", + "ConversationVoiceRewardModel", + "ConversationVoiceUsageModel", + "ConversationalConfig", + "ConversationalConfigApiModelWorkflowOverrideInput", + "ConversationalConfigApiModelWorkflowOverrideOutput", + "ConvertChapterResponseModel", + "ConvertProjectResponseModel", + "CrawlStatus", + "CrawlType", + "CreateAgentBranchResponseModel", + "CreateAgentMergeProposalResponseModel", + "CreateAgentProcedureParams", + "CreateAgentResponseModel", + "CreateAgentRuleParams", + "CreateAgentTestFolderResponseModel", + "CreateAgentTestResponseModel", + "CreateAssetParams", + "CreateAudioNativeProjectRequest", + "CreateAuthConnectionEnvironmentVariableRequest", + "CreateBasicAuthRequest", + "CreateBearerAuthRequest", + "CreateClientAppointmentParams", + "CreateClientInteractionParams", + "CreateClientParams", + "CreateClientSecretRequest", + "CreateCrawlJobResponseModel", + "CreateCustomHeaderAuthRequest", + "CreateExotelPhoneNumberRequest", + "CreateHolidayParams", + "CreateLocationParams", + "CreateMtlsAuthRequest", + "CreateOAuth2ClientCredsRequest", + "CreateOAuth2JwtRequest", + "CreateOAuth2JwtRequestAlgorithm", + "CreateOAuth2JwtRequestTokenResponseField", + "CreateOrderParams", + "CreateOrderRequest", + "CreateOrderResponse", + "CreatePhoneNumberResponseModel", + "CreatePreviouslyGeneratedVoiceRequest", + "CreatePrivateKeyJwtRequest", + "CreatePrivateKeyJwtRequestAlgorithm", + "CreateProcedureRequestModel", + "CreateProcedureResponseModel", + "CreateProductParams", + "CreateProductQuoteRequestParams", + "CreatePronunciationDictionaryResponseModel", + "CreateResponseUnitTestRequest", + "CreateSecretEnvironmentVariableRequest", + "CreateServiceParams", + "CreateServiceQuoteRequestParams", + "CreateSimulationTestRequest", + "CreateSipTrunkPhoneNumberRequest", + "CreateStaffParams", + "CreateStringEnvironmentVariableRequest", + "CreateToolCallUnitTestRequest", + "CreateTranscriptRequest", + "CreateTransferRuleParams", + "CreateTwilioPhoneNumberRequest", + "CreatifyAuroraRequest", + "CreatifyAuroraRequestResolution", + "CriteriaScoringMode", + "CueOptionsRequest", + "Currency", + "CustomGuardrailConfig", + "CustomGuardrailConfigModel", + "CustomGuardrailConfigTriggerAction", + "CustomGuardrailConfigTriggerAction_EndCall", + "CustomGuardrailConfigTriggerAction_Retry", + "CustomGuardrailInput", + "CustomGuardrailOutput", + "CustomGuardrailsConfigInput", + "CustomGuardrailsConfigOutput", + "CustomHeaderAuthResponse", + "CustomLlm", + "CustomLlmApiKey", + "CustomLlmAuthConnection", + "CustomLlmRequestHeadersValue", + "CustomLlmapiType", + "CustomSipHeader", + "CustomSipHeaderWithDynamicVariable", + "DashboardCallSuccessChartModel", + "DashboardCriteriaChartModel", + "DashboardDataCollectionChartModel", + "DataCollectionResultCommonModel", + "DefaultSharingGroupConfig", + "DefaultSharingGroupConfigPermissionLevel", + "DefaultSharingGroupResponseModel", + "DefaultSharingGroupResponseModelPermissionLevel", + "DeleteAgentHoldAudioResponseModel", + "DeleteAgentProcedureParams", + "DeleteAgentRuleParams", + "DeleteAssetParams", + "DeleteCalendarEventParams", + "DeleteChapterRequest", + "DeleteChapterResponseModel", + "DeleteClientInteractionParams", + "DeleteClientParams", + "DeleteDubbingResponseModel", + "DeleteGroupSessionParams", + "DeleteHistoryItemResponse", + "DeleteHolidayParams", + "DeleteLocationParams", + "DeleteProductParams", + "DeleteProjectRequest", + "DeleteProjectResponseModel", + "DeleteSampleResponse", + "DeleteServiceParams", + "DeleteStaffParams", + "DeleteTransferRuleParams", + "DeleteUserVoiceCollectionResponseModel", + "DeleteVoiceResponseModel", + "DeleteVoiceSampleResponseModel", + "DeleteWorkspaceGroupMemberResponseModel", + "DeleteWorkspaceInviteResponseModel", + "DeleteWorkspaceWebhookResponseModel", + "DeliverableInfo", + "DependentAvailableAgentIdentifier", + "DependentAvailableAgentIdentifierAccessLevel", + "DependentAvailableMcpServerIdentifier", + "DependentAvailableMcpServerIdentifierAccessLevel", + "DependentAvailableToolIdentifier", + "DependentAvailableToolIdentifierAccessLevel", + "DependentBranchInfo", + "DependentIntegrationConnectionIdentifier", + "DependentPhoneNumberIdentifier", + "DependentUnknownAgentIdentifier", + "DependentUnknownMcpServerIdentifier", + "DependentUnknownToolIdentifier", + "DetailedMusicResponse", + "DetailedMusicResponseCompositionPlan", + "DetectedEntity", + "DeviceModel", + "DialogueInput", + "DialogueInputResponseModel", + "DialogueTextAlignment", + "DirectPublishingReadResponseModel", + "DirectPublishingReadResponseModelDisplayMode", + "DirectPublishingReadResponseModelGenreItem", + "DirectPublishingReadResponseModelPayoutType", + "DirectPublishingReadResponseModelTargetAudience", + "DiscountResponseModel", + "DoDubbingResponse", + "DocumentUsageModeEnum", + "DocxExportOptions", + "DtmfInputConfig", + "DubOrderItemRequest", + "DubbedSegment", + "DubbingAudio", + "DubbingAudioOutputError", + "DubbingAuthError", + "DubbingBulkSourceSegmentUpdateResponse", + "DubbingBulkTargetSegmentUpdateResponse", + "DubbingCommittedTranscript", + "DubbingEndOfStream", + "DubbingError", + "DubbingInputAudioChunk", + "DubbingInputError", + "DubbingInvalidRequestError", + "DubbingLanguageListResponse", + "DubbingLanguageOutputs", + "DubbingLanguageResponse", + "DubbingLanguageResponseStatus", + "DubbingMediaMetadata", + "DubbingMediaReference", + "DubbingMetadataPageResponseModel", + "DubbingMetadataResponse", + "DubbingPartialTranscript", + "DubbingProjectListResponse", + "DubbingProjectResponse", + "DubbingProjectResponseStatus", + "DubbingQueueOverflowError", + "DubbingRateLimitedError", + "DubbingRegenerateResponse", + "DubbingReleaseChannel", + "DubbingRenderResponseModel", + "DubbingResource", + "DubbingSegmentUpdateRequest", + "DubbingSessionStarted", + "DubbingSourceMediaInfo", + "DubbingSourceSegmentUpdateResponse", + "DubbingSourceTranscriptResponse", + "DubbingStatus", + "DubbingStatusStatus", + "DubbingTargetSegmentUpdateRequest", + "DubbingTargetSegmentUpdateResponse", + "DubbingTargetTranscriptResponse", + "DubbingTargetTranscriptSegment", + "DubbingTranscriberError", + "DubbingTranscript", + "DubbingTranscriptCharacter", + "DubbingTranscriptResponseModel", + "DubbingTranscriptRevisionResponse", + "DubbingTranscriptSegment", + "DubbingTranscriptUtterance", + "DubbingTranscriptWord", + "DubbingTranscriptsResponseModel", + "DubbingTranscriptsResponseModelTranscriptFormat", + "DubbingTranslation", + "DubbingTranslationError", + "DummyToolResultModel", + "DuplicateSpeechEngineRequest", + "DynamicVariableAssignment", + "DynamicVariableInternalValueType", + "DynamicVariableNestedValueTypeInput", + "DynamicVariableNestedValueTypeOutput", + "DynamicVariableSchemaOverride", + "DynamicVariableUpdateCommonModel", + "DynamicVariablesConfig", + "DynamicVariablesConfigWorkflowOverride", + "Eagerness", + "EditChapterResponseModel", + "EditProjectResponseModel", + "EditVoiceResponseModel", + "EditVoiceSettingsRequest", + "EditVoiceSettingsResponseModel", + "EditedTranscript", + "EffectsSpecInput", + "EffectsSpecOutput", + "ElevenFlashV25Request", + "ElevenFlashV25RequestOutputFormat", + "ElevenFlashV25VoiceSettings", + "ElevenMultilingualV2Request", + "ElevenMultilingualV2RequestOutputFormat", + "ElevenV3Request", + "ElevenV3RequestOutputFormat", + "ElevenV3VoiceSettings", + "EmbedVariant", + "EmbeddingModelEnum", + "EndCallToolConfig", + "EndCallToolResultModel", + "EndCallTriggerAction", + "EndProcedureToolConfig", + "EndProcedureToolConfigProceduresValue", + "EndProcedureToolErrorStatus", + "EndProcedureToolResultErrorModel", + "EndProcedureToolResultSuccessModel", + "EntityManagementActivityId", + "EntryBehavior", + "EnvironmentAuthConnectionLocator", + "EnvironmentResponse", + "EnvironmentVariableAuthConnectionValue", + "EnvironmentVariableAuthConnectionValueRequest", + "EnvironmentVariableResponse", + "EnvironmentVariableResponseType", + "EnvironmentVariableResponseValues", + "EnvironmentVariableSecretValue", + "EnvironmentVariableSecretValueRequest", + "EnvironmentVariablesListResponse", + "EnvironmentsListResponse", + "ErrorPayload", + "EvaluationCriteriaSummaryResult", + "EvaluationResultFilter", + "EvaluationSettingsInput", + "EvaluationSettingsOutput", + "EvaluationSuccessResult", + "ExactParameterEvaluationStrategy", + "ExotelApiSubdomain", + "ExotelOutboundCallResponse", + "ExperimentAssignment", + "ExperimentAssignmentSource", + "ExpiresAfter", + "ExportOptions", + "ExportOptions_Docx", + "ExportOptions_Html", + "ExportOptions_Pdf", + "ExportOptions_SegmentedJson", + "ExportOptions_Srt", + "ExportOptions_Txt", + "ExternalFileSyncInfo", + "ExternalFolderSyncInfo", + "ExternalSyncJobTrigger", + "ExternalSyncJobType", + "ExternalSyncProvider", + "FeatureStatusCommonModel", + "FeaturesUsageCommonModel", + "FeedbackItem", + "FieldConflict", + "FileInputConfig", + "FileInputConfigWorkflowOverride", + "FileRefreshStatus", + "FinalOutput", + "FinalOutputMulti", + "FineTuningResponse", + "FineTuningResponseStateValue", + "FinetuneCreatedBy", + "FinetuneVisibility", + "FlushContext", + "FocusGuardrail", + "ForcedAlignmentCharacterResponseModel", + "ForcedAlignmentResponseModel", + "ForcedAlignmentWordResponseModel", + "FrustratedConversationRef", + "FrustratedConversationRefOverallLabel", + "Gemini25FlashImageRequest", + "Gemini25FlashImageRequestAspectRatio", + "Gemini31FlashImageRequest", + "Gemini31FlashImageRequestAspectRatio", + "Gemini31FlashImageRequestResolution", + "Gemini31FlashLiteImageRequest", + "Gemini31FlashLiteImageRequestAspectRatio", + "Gemini3ProImageRequest", + "Gemini3ProImageRequestAspectRatio", + "Gemini3ProImageRequestResolution", + "Gender", + "GenerateVoiceRequest", + "GenerationChunkInput", + "GenerationChunkInputContextAdherence", + "GenerationChunkOutput", + "GenerationChunkOutputContextAdherence", + "GenerationConfig", + "GenerationReference", + "GenerationSourceContext", + "GenesysBotOutcome", + "GenesysRegion", + "GetAgentConfigParams", + "GetAgentConversationTicketsPageResponseModel", + "GetAgentEmbedResponseModel", + "GetAgentKnowledgebaseSizeResponseModel", + "GetAgentLinkResponseModel", + "GetAgentResponseModel", + "GetAgentResponseModelPhoneNumbersItem", + "GetAgentResponseModelPhoneNumbersItem_Exotel", + "GetAgentResponseModelPhoneNumbersItem_SipTrunk", + "GetAgentResponseModelPhoneNumbersItem_Twilio", + "GetAgentTestFolderResponseModel", + "GetAgentTopicsResponseModel", + "GetAgentsPageResponseModel", + "GetAnalyticsSummaryParams", + "GetAppointmentByConfirmationNumberParams", + "GetAudioIsolationHistoryResponseModel", + "GetAudioNativeProjectSettingsResponseModel", + "GetBookingPageSettingsParams", + "GetBookingSlugStatusParams", + "GetChapterRequest", + "GetChapterSnapshotsRequest", + "GetChaptersRequest", + "GetChaptersResponse", + "GetClientAppointmentsParams", + "GetClientByPhoneParams", + "GetClientOrdersParams", + "GetConvAiDashboardSettingsResponseModel", + "GetConvAiDashboardSettingsResponseModelChartsItem", + "GetConvAiDashboardSettingsResponseModelChartsItem_CallSuccess", + "GetConvAiDashboardSettingsResponseModelChartsItem_Criteria", + "GetConvAiDashboardSettingsResponseModelChartsItem_DataCollection", + "GetConvAiSettingsResponseModel", + "GetConversationResponseModel", + "GetConversationResponseModelStatus", + "GetConversationSummaryResponseModel", + "GetConversationSummaryResponseModelStatus", + "GetConversationTagsPageResponseModel", + "GetConversationUsersPageResponseModel", + "GetConversationsPageResponseModel", + "GetCrawlJobResponseModel", + "GetKnowledgeBaseDependentAgentsResponseModel", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Available", + "GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Unknown", + "GetKnowledgeBaseFileResponseModel", + "GetKnowledgeBaseFolderResponseModel", + "GetKnowledgeBaseListResponseModel", + "GetKnowledgeBaseListResponseModelDocumentsItem", + "GetKnowledgeBaseListResponseModelDocumentsItem_File", + "GetKnowledgeBaseListResponseModelDocumentsItem_Folder", + "GetKnowledgeBaseListResponseModelDocumentsItem_Text", + "GetKnowledgeBaseListResponseModelDocumentsItem_Url", + "GetKnowledgeBaseSummaryFileResponseModel", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Available", + "GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Unknown", + "GetKnowledgeBaseSummaryFolderResponseModel", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Available", + "GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Unknown", + "GetKnowledgeBaseSummaryTextResponseModel", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Available", + "GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Unknown", + "GetKnowledgeBaseSummaryUrlResponseModel", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Available", + "GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Unknown", + "GetKnowledgeBaseTextResponseModel", + "GetKnowledgeBaseUrlResponseModel", + "GetLibraryVoicesResponse", + "GetLiveCountResponse", + "GetOrCreateRagIndexRequestModel", + "GetOrderByConfirmationNumberParams", + "GetPhoneNumberExotelResponseModel", + "GetPhoneNumberInboundSipTrunkConfigResponseModel", + "GetPhoneNumberOutboundSipTrunkConfigResponseModel", + "GetPhoneNumberResponse", + "GetPhoneNumberSipTrunkResponseModel", + "GetPhoneNumberTwilioResponseModel", + "GetPhoneNumbersPageResponseModel", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_Exotel", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_SipTrunk", + "GetPhoneNumbersPageResponseModelPhoneNumbersItem_Twilio", + "GetProjectRequest", + "GetProjectsRequest", + "GetProjectsResponse", + "GetPronunciationDictionariesMetadataResponseModel", + "GetPronunciationDictionariesResponse", + "GetPronunciationDictionaryMetadataResponse", + "GetPronunciationDictionaryMetadataResponsePermissionOnResource", + "GetPronunciationDictionaryResponse", + "GetPronunciationDictionaryWithRulesResponseModel", + "GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem_Alias", + "GetPronunciationDictionaryWithRulesResponseModelRulesItem_Phoneme", + "GetResponseUnitTestResponseModel", + "GetScheduleParams", + "GetSecretDependenciesResponseModel", + "GetSecretDependenciesResponseModelDependencies", + "GetSecretDependenciesResponseModelDependenciesOneItem", + "GetSecretDependenciesResponseModelDependenciesOneItem_Available", + "GetSecretDependenciesResponseModelDependenciesOneItem_Unknown", + "GetSecretDependenciesResponseModelDependenciesZeroItem", + "GetSecretDependenciesResponseModelDependenciesZeroItem_Available", + "GetSecretDependenciesResponseModelDependenciesZeroItem_Unknown", + "GetSimulationTestResponseModel", + "GetSipLogMessagesResponse", + "GetSpeechHistoryResponse", + "GetTestInvocationsPageResponseModel", + "GetTestSuiteInvocationResponseModel", + "GetTestsPageResponseModel", + "GetTestsSummariesByIdsResponseModel", + "GetToolCallUnitTestResponseModel", + "GetToolDependentAgentsResponseModel", + "GetToolDependentAgentsResponseModelAgentsItem", + "GetToolDependentAgentsResponseModelAgentsItem_Available", + "GetToolDependentAgentsResponseModelAgentsItem_Unknown", + "GetToolExecutionsPageResponseModel", + "GetUserVoiceCollectionsResponseModel", + "GetVoiceAccentsResponseModel", + "GetVoicesResponse", + "GetVoicesV2Response", + "GetWhatsAppAccountResponse", + "GetWorkspacePlanParams", + "GetWorkspaceSecretsResponseModel", + "GptImage15Request", + "GptImage15RequestAspectRatio", + "GptImage15RequestBackground", + "GptImage15RequestQuality", + "GptImage1Request", + "GptImage1RequestAspectRatio", + "GptImage1RequestBackground", + "GptImage1RequestQuality", + "GptImage25FlareRequest", + "GptImage25FlareRequestAspectRatio", + "GptImage25FlareRequestQuality", + "GptImage25FlareRequestResolution", + "GptImage25SunburstRequest", + "GptImage25SunburstRequestAspectRatio", + "GptImage25SunburstRequestQuality", + "GptImage25SunburstRequestResolution", + "GptImage2Request", + "GptImage2RequestAspectRatio", + "GptImage2RequestQuality", + "GptImage2RequestResolution", + "GroupManagementActivityId", + "GuardrailExecutionMode", + "GuardrailType", + "GuardrailsResult", + "GuardrailsV1Input", + "GuardrailsV1Output", + "HidingReason", + "HistoryAlignmentResponseModel", + "HistoryAlignmentsResponseModel", + "HistoryItemResponse", + "HtmlExportOptions", + "HttpRequestModel", + "HttpValidationError", + "Icon", + "IconTheme", + "ImageAnalysis", + "ImageAnalysisResult", + "ImageAnalysisStatus", + "ImageAvatar", + "ImageGenerationRequest", + "ImageGenerationRequest_BytedanceSeedream5Lite", + "ImageGenerationRequest_BytedanceSeedream5Pro", + "ImageGenerationRequest_Gemini25FlashImage", + "ImageGenerationRequest_Gemini31FlashImage", + "ImageGenerationRequest_Gemini31FlashLiteImage", + "ImageGenerationRequest_Gemini3ProImage", + "ImageGenerationRequest_GptImage1", + "ImageGenerationRequest_GptImage15", + "ImageGenerationRequest_GptImage2", + "ImageGenerationRequest_GptImage25Flare", + "ImageGenerationRequest_GptImage25Sunburst", + "ImageReference", + "ImageReference_Asset", + "ImageReference_Generation", + "ImageReference_InlineBase64", + "ImageSchema", + "ImageSubject", + "InboundSipTrunkConfigRequestModel", + "InitPayload", + "InitialiseContext", + "InitializeConnection", + "InitializeConnectionMulti", + "InlineAudioReference", + "InlineAudioReferenceMimeType", + "InlineBase64Reference", + "InlineBase64ReferenceMimeType", + "InlineImageReference", + "InlineImageReferenceMimeType", + "InlineVideoReference", + "InlineVideoReferenceMimeType", + "InputAudioChunkPayload", + "IntegerSchema", + "IntegrationType", + "InteractionBudget", + "InternalAlertingWebhookNotifier", + "InternalSamplingConfigResponseModel", + "InvoiceResponse", + "InvoiceResponsePaymentIntentStatus", + "InvoiceResponsePaymentIntentStatussesItem", + "ItemId", + "KbExternalSyncJob", + "KeepContextAlive", + "KnowledgeBaseBulkDeleteSuccessfulResponseModel", + "KnowledgeBaseContentSearchResponseModel", + "KnowledgeBaseContentSearchResult", + "KnowledgeBaseContentSearchResultDocument", + "KnowledgeBaseContentSearchResultDocument_File", + "KnowledgeBaseContentSearchResultDocument_Folder", + "KnowledgeBaseContentSearchResultDocument_Text", + "KnowledgeBaseContentSearchResultDocument_Url", + "KnowledgeBaseDeletedResponseModel", + "KnowledgeBaseDependentType", + "KnowledgeBaseDocumentChunkResponseModel", + "KnowledgeBaseDocumentChunksResponseModel", + "KnowledgeBaseDocumentMetadataResponseModel", + "KnowledgeBaseDocumentType", + "KnowledgeBaseFolderPathSegmentResponseModel", + "KnowledgeBaseFolderPathSegmentSummaryResponseModel", + "KnowledgeBaseLocator", + "KnowledgeBaseRagChunkModel", + "KnowledgeBaseRagToolConfig", + "KnowledgeBaseRagToolResultModel", + "KnowledgeBaseRagToolStatus", + "KnowledgeBaseSortBy", + "KnowledgeBaseSourceFileUrlResponseModel", + "KnowledgeBaseSummaryBatchSuccessfulResponseModel", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_File", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Folder", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Text", + "KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Url", + "KnowledgeBaseToolConfig", + "KnowledgeBaseToolInfo", + "KnowledgeBaseToolResultModel", + "KnowledgeBaseToolStatus", + "LanguageAddedResponse", + "LanguageDetectionToolConfig", + "LanguageDetectionToolResultModel", + "LanguageInfo", + "LanguagePairInfo", + "LanguagePresetInput", + "LanguagePresetOutput", + "LanguagePresetTranslation", + "LanguageResponse", + "LanguagesResponse", + "LanguagesResponse_Pair", + "LanguagesResponse_Single", + "LeaveMessageParams", + "LibraryVoiceResponse", + "LibraryVoiceResponseCategory", + "ListAgentProceduresParams", + "ListAgentReferencesParams", + "ListAgentRulesParams", + "ListAssetsParams", + "ListAuthConnectionsResponse", + "ListAuthConnectionsResponseAuthConnectionsItem", + "ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2AuthCode", + "ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2CustomApp", + "ListAuthConnectionsResponseAuthConnectionsItem_BasicAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_BearerAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_CustomHeaderAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_Mtls", + "ListAuthConnectionsResponseAuthConnectionsItem_Oauth2ClientCredentials", + "ListAuthConnectionsResponseAuthConnectionsItem_Oauth2Jwt", + "ListAuthConnectionsResponseAuthConnectionsItem_PrivateKeyJwt", + "ListAuthConnectionsResponseAuthConnectionsItem_RefreshTokenAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_SlackBotAuth", + "ListAuthConnectionsResponseAuthConnectionsItem_UrlSecret", + "ListAuthConnectionsResponseAuthConnectionsItem_WhatsappAuth", + "ListCalendarEventsParams", + "ListClientInteractionsParams", + "ListClientsParams", + "ListCrawlJobsResponseModel", + "ListCustomerFacingAgentsParams", + "ListGroupSessionsParams", + "ListHolidaysParams", + "ListLocationsParams", + "ListMcpToolsResponseModel", + "ListOrdersResponse", + "ListProceduresResponseModel", + "ListProductsParams", + "ListResponseAgentBranchSummary", + "ListResponseAgentDeploymentHistoryItem", + "ListResponseMeta", + "ListServicesParams", + "ListSpeechEnginesResponse", + "ListStaffParams", + "ListTransferRulesParams", + "ListWhatsAppAccountsResponse", + "LiteralJsonSchemaProperty", + "LiteralJsonSchemaPropertyConstantValue", + "LiteralJsonSchemaPropertyType", + "LivekitStackType", + "Llm", + "LlmCategoryUsage", + "LlmDeprecationConfigModel", + "LlmDeprecationInfoModel", + "LlmInfoModel", + "LlmInputOutputTokensUsage", + "LlmListResponseModel", + "LlmLiteralJsonSchemaProperty", + "LlmLiteralJsonSchemaPropertyType", + "LlmParameterEvaluationStrategy", + "LlmReasoningEffort", + "LlmSchemaOverride", + "LlmTokensCategoryUsage", + "LlmUsageCalculatorLlmResponseModel", + "LlmUsageCalculatorResponseModel", + "LlmUsageInput", + "LlmUsageOutput", + "LoadMemoryEntryToolErrorStatus", + "LoadableMemoryEntry", + "LockReason", + "ManualSource", + "ManualVerificationFileResponse", + "ManualVerificationResponse", + "MatchAnythingParameterEvaluationStrategy", + "McpApprovalPolicy", + "McpApprovedToolDefinition", + "McpServerConfigInput", + "McpServerConfigInputAuthConnection", + "McpServerConfigInputRequestHeadersValue", + "McpServerConfigInputRequestMetaValue", + "McpServerConfigInputSecretToken", + "McpServerConfigInputUrl", + "McpServerConfigOutput", + "McpServerConfigOutputAuthConnection", + "McpServerConfigOutputRequestHeadersValue", + "McpServerConfigOutputRequestMetaValue", + "McpServerConfigOutputSecretToken", + "McpServerConfigOutputUrl", + "McpServerMetadataResponseModel", + "McpServerResponseModel", + "McpServerResponseModelDependentAgentsItem", + "McpServerResponseModelDependentAgentsItem_Available", + "McpServerResponseModelDependentAgentsItem_Unknown", + "McpServerTransport", + "McpServersResponseModel", + "McpToolApprovalHash", + "McpToolApprovalPolicy", + "McpToolApprovalState", + "McpToolApprovalStatus", + "McpToolConfigOverrideInput", + "McpToolConfigOverrideInputInputOverridesValue", + "McpToolConfigOverrideInputInputOverridesValue_Constant", + "McpToolConfigOverrideInputInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideInputInputOverridesValue_Llm", + "McpToolConfigOverrideInputInputOverridesValue_Omit", + "McpToolConfigOverrideInputToolCallSound", + "McpToolConfigOverrideOutput", + "McpToolConfigOverrideOutputInputOverridesValue", + "McpToolConfigOverrideOutputInputOverridesValue_Constant", + "McpToolConfigOverrideOutputInputOverridesValue_DynamicVariable", + "McpToolConfigOverrideOutputInputOverridesValue_Llm", + "McpToolConfigOverrideOutputInputOverridesValue_Omit", + "McpToolConfigOverrideOutputToolCallSound", + "MediaCodec", + "MediaGenerationCompletedResponse", + "MediaGenerationCreateResponse", + "MediaGenerationFailedResponse", + "MediaGenerationFailedResponseFailureReason", + "MediaGenerationInProgressResponse", + "MediaGenerationListResponse", + "MediaGenerationResponse", + "MediaGenerationResponse_Completed", + "MediaGenerationResponse_Failed", + "MediaGenerationResponse_Generating", + "MediaGenerationResponse_Pending", + "MediaId", + "MemoryEntrySearchResult", + "MemoryEntrySearchResultSource", + "MergePreviewResponseModel", + "MergePreviewResponseModelPhoneNumbersItem", + "MergePreviewResponseModelPhoneNumbersItem_Exotel", + "MergePreviewResponseModelPhoneNumbersItem_SipTrunk", + "MergePreviewResponseModelPhoneNumbersItem_Twilio", + "MergeProposalCloseReason", + "MergeProposalComment", + "MergeProposalReview", + "MergeProposalReviewReviewerRole", + "MergeProposalReviewState", + "MergeProposalStatus", + "MergedOutcome", + "MessageSearchSortBy", + "MessagesSearchResponse", + "MessagesSearchResult", + "MetricRecord", + "MetricType", + "MockNoMatchBehavior", + "MockingStrategy", + "Model", + "ModelRatesResponseModel", + "ModerationConfig", + "ModerationGuardrailInput", + "ModerationGuardrailOutput", + "ModerationStatusResponseModel", + "ModerationStatusResponseModelSafetyStatus", + "ModerationStatusResponseModelWarningStatus", + "MtlsAuthResponse", + "MultichannelSpeechToTextResponseModel", + "MultipartMusicResponse", + "MusicAllowedOutputFormats", + "MusicExploreSongSourceContext", + "MusicFinetuneFailureReason", + "MusicFinetunePageResponseModel", + "MusicFinetuneResponseModel", + "MusicFinetuneStatus", + "MusicGenerationMode", + "MusicModelId", + "MusicOnlyOutputFormats", + "MusicOutputFormat", + "MusicPrompt", + "MusicUploadResponse", + "MusicUploadResponseCompositionPlan", + "NonStreamingOutputFormats", + "NormalizedAlignment", + "NumberSchema", + "NumericDistributionAggregate", + "OAuth2ClientCredsResponse", + "OAuth2JwtResponse", + "OAuth2JwtResponseAlgorithm", + "OAuth2JwtResponseTokenResponseField", + "OTelAttribute", + "OTelAttributeValueValue", + "OTelResource", + "OTelResourceSpans", + "OTelScope", + "OTelScopeSpans", + "OTelSpan", + "OTelStatus", + "OTelTracePayload", + "ObjectJsonSchemaPropertyInput", + "ObjectJsonSchemaPropertyInputPropertiesValue", + "ObjectJsonSchemaPropertyInputPropertyKind", + "ObjectJsonSchemaPropertyOutput", + "ObjectJsonSchemaPropertyOutputPropertiesValue", + "ObjectSchema", + "OmitSchemaOverride", + "OpenAiAudioConfigInput", + "OpenAiAudioConfigOutput", + "OpenAiAudioFormat", + "OpenAiAudioInputConfigInput", + "OpenAiAudioInputConfigOutput", + "OpenAiAudioInputFormat", + "OpenAiAudioInputTranscription", + "OpenAiAudioOutputConfigInput", + "OpenAiAudioOutputConfigOutput", + "OpenAiAudioOutputFormat", + "OpenAiFunctionTool", + "OpenAiSessionConfigInput", + "OpenAiSessionConfigInputMaxResponseOutputTokens", + "OpenAiSessionConfigInputToolChoice", + "OpenAiSessionConfigInputToolsItem", + "OpenAiSessionConfigInputToolsItem_Function", + "OpenAiSessionConfigInputToolsItem_Mcp", + "OpenAiSessionConfigInputTracing", + "OpenAiSessionConfigInputTruncation", + "OpenAiSessionConfigInputTurnDetection", + "OpenAiSessionConfigOutput", + "OpenAiSessionConfigOutputMaxResponseOutputTokens", + "OpenAiSessionConfigOutputToolChoice", + "OpenAiSessionConfigOutputToolsItem", + "OpenAiSessionConfigOutputToolsItem_Function", + "OpenAiSessionConfigOutputToolsItem_Mcp", + "OpenAiSessionConfigOutputTracing", + "OpenAiToolChoiceFunction", + "OpenAiToolChoiceFunctionInner", + "OpenAiTracingConfiguration", + "OpenAiTurnDetection", + "OpenAimcpTool", + "OpenAimcpToolRequireApproval", + "OpenOutcome", + "OpenerConfig", + "OptInSmsReminderParams", + "OptOutSmsReminderParams", + "OrbAvatar", + "OrchestratorToolMockBehaviorConfig", + "OrderDeliverablesResponse", + "OrderId", + "OrderItemInfo", + "OrderItemKind", + "OrderItemRequestInput", + "OrderItemRequestInput_Dub", + "OrderItemRequestInput_Subtitles", + "OrderItemRequestInput_Transcription", + "OrderItemRequestOutput", + "OrderItemRequestOutput_Dub", + "OrderItemRequestOutput_Subtitles", + "OrderItemRequestOutput_Transcription", + "OrderMediaResponse", + "OrderResponse", + "OrderState", + "OrderSummary", + "OutboundCallRecipient", + "OutboundCallRecipientResponseModel", + "OutboundSipTrunkConfigRequestModel", + "OutputFormat", + "PaginatedResultAgentMergeProposalResponse", + "PairedLanguagesResponse", + "PartialTranscriptPayload", + "PatchWorkspaceWebhookResponseModel", + "PdfExportOptions", + "PendingBlocksMetadataModel", + "PendingCancellationResponseModel", + "PendingClipTask", + "PendingClipTaskType", + "PendingExternalAudiosMetadataModel", + "PendingSubscriptionSwitchResponseModel", + "PendingSubscriptionSwitchResponseModelNextTier", + "PermissionType", + "PhoneNumberAgentInfo", + "PhoneNumberDynamicVariableTransferDestination", + "PhoneNumberSortBy", + "PhoneNumberTransfer", + "PhoneNumberTransferCustomSipHeadersItem", + "PhoneNumberTransferCustomSipHeadersItem_Dynamic", + "PhoneNumberTransferCustomSipHeadersItem_Static", + "PhoneNumberTransferDestination", + "PhoneNumberTransferPostDialDigits", + "PhoneNumberTransferPostDialDigits_Dynamic", + "PhoneNumberTransferPostDialDigits_Static", + "PhoneNumberTransferTransferDestination", + "PhoneNumberTransferTransferDestination_Phone", + "PhoneNumberTransferTransferDestination_PhoneDynamicVariable", + "PhoneNumberTransferTransferDestination_SipUri", + "PhoneNumberTransferTransferDestination_SipUriDynamicVariable", + "PingPayload", + "PlatformCategory", + "PlatformCategoryUsage", + "PlatformLimits", + "PlatformUsage", + "PlayDtmfResultErrorModel", + "PlayDtmfResultSuccessModel", + "PlayDtmfToolConfig", + "PodcastBulletinMode", + "PodcastBulletinModeData", + "PodcastConversationMode", + "PodcastConversationModeData", + "PodcastProjectResponseModel", + "PodcastTextSource", + "PodcastUrlSource", + "PongPayload", + "PositionInput", + "PositionOutput", + "PostAgentAvatarResponseModel", + "PostAgentHoldAudioResponseModel", + "PostDialDigitsDynamicVariable", + "PostDialDigitsStatic", + "PostWorkspaceSecretResponseModel", + "PreToolSpeechMode", + "PreviewAudioDbModel", + "Price", + "PrivacyConfigInput", + "PrivacyConfigOutput", + "PrivateKeyJwtResponse", + "PrivateKeyJwtResponseAlgorithm", + "ProcedureAtVersionResponseModel", + "ProcedureDraftRef", + "ProcedureDraftResponseModel", + "ProcedureListItemResponseModel", + "ProcedureRefResponseModel", + "ProcedureType", + "ProcedureValidationError", + "ProcedureVersionRef", + "ProjectCreationMetaResponseModel", + "ProjectCreationMetaResponseModelStatus", + "ProjectCreationMetaType", + "ProjectExtendedResponse", + "ProjectExtendedResponseAccessLevel", + "ProjectExtendedResponseApplyTextNormalization", + "ProjectExtendedResponseAspectRatio", + "ProjectExtendedResponseAssetsItem", + "ProjectExtendedResponseAssetsItem_Audio", + "ProjectExtendedResponseAssetsItem_Image", + "ProjectExtendedResponseAssetsItem_Video", + "ProjectExtendedResponseFiction", + "ProjectExtendedResponseSourceType", + "ProjectExtendedResponseTargetAudience", + "ProjectExternalAudioResponseModel", + "ProjectExternalAudioResponseModelSourceContext", + "ProjectExternalAudioResponseModelSourceContext_MusicExploreSong", + "ProjectExternalAudioResponseModelSourceContext_Sfx", + "ProjectExternalAudioResponseModelSourceContext_Song", + "ProjectImageResponseModel", + "ProjectMutedTracksResponseModel", + "ProjectResponse", + "ProjectResponseAccessLevel", + "ProjectResponseAspectRatio", + "ProjectResponseFiction", + "ProjectResponseSourceType", + "ProjectResponseTargetAudience", + "ProjectSnapshotExtendedResponseModel", + "ProjectSnapshotResponse", + "ProjectSnapshotsResponse", + "ProjectState", + "ProjectVideoResponseModel", + "ProjectVideoThumbnailSheetResponseModel", + "ProjectVoiceResponseModel", + "PromptAgent", + "PromptAgentApiModelInput", + "PromptAgentApiModelInputBackupLlmConfig", + "PromptAgentApiModelInputBackupLlmConfig_Default", + "PromptAgentApiModelInputBackupLlmConfig_Disabled", + "PromptAgentApiModelInputBackupLlmConfig_Override", + "PromptAgentApiModelInputToolsItem", + "PromptAgentApiModelInputToolsItem_ApiIntegrationWebhook", + "PromptAgentApiModelInputToolsItem_Client", + "PromptAgentApiModelInputToolsItem_Mcp", + "PromptAgentApiModelInputToolsItem_Smb", + "PromptAgentApiModelInputToolsItem_System", + "PromptAgentApiModelInputToolsItem_Webhook", + "PromptAgentApiModelOutput", + "PromptAgentApiModelOutputBackupLlmConfig", + "PromptAgentApiModelOutputBackupLlmConfig_Default", + "PromptAgentApiModelOutputBackupLlmConfig_Disabled", + "PromptAgentApiModelOutputBackupLlmConfig_Override", + "PromptAgentApiModelOutputToolsItem", + "PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook", + "PromptAgentApiModelOutputToolsItem_Client", + "PromptAgentApiModelOutputToolsItem_Mcp", + "PromptAgentApiModelOutputToolsItem_Smb", + "PromptAgentApiModelOutputToolsItem_System", + "PromptAgentApiModelOutputToolsItem_Webhook", + "PromptAgentApiModelOverrideConfig", + "PromptAgentApiModelOverrideInput", + "PromptAgentApiModelOverrideOutput", + "PromptAgentApiModelWorkflowOverrideInput", + "PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig", + "PromptAgentApiModelWorkflowOverrideInputToolsItem", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_ApiIntegrationWebhook", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Client", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Mcp", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Smb", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_System", + "PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook", + "PromptAgentApiModelWorkflowOverrideOutput", + "PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_ApiIntegrationWebhook", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Mcp", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Smb", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_System", + "PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook", + "PromptAgentDbModel", + "PromptEvaluationCriteria", + "PromptInjectionGuardrail", + "PronunciationDictionaryAliasRuleRequestModel", + "PronunciationDictionaryAliasRuleResponseModel", + "PronunciationDictionaryLocator", + "PronunciationDictionaryLocatorResponseModel", + "PronunciationDictionaryPhonemeRuleRequestModel", + "PronunciationDictionaryPhonemeRuleResponseModel", + "PronunciationDictionaryRulesResponseModel", + "PronunciationDictionaryVersionLocator", + "PronunciationDictionaryVersionResponseModel", + "PronunciationDictionaryVersionResponseModelPermissionOnResource", + "PydanticPronunciationDictionaryVersionLocator", + "QualityPresetType", + "QueryParamsJsonSchemaInput", + "QueryParamsJsonSchemaOutput", + "QuoteInfo", + "RagChunkMetadata", + "RagConfigInput", + "RagConfigOutput", + "RagConfigWorkflowOverrideInput", + "RagConfigWorkflowOverrideOutput", + "RagDocumentIndexResponseModel", + "RagDocumentIndexUsage", + "RagDocumentIndexesResponseModel", + "RagIndexBatchSuccessfulResponseModel", + "RagIndexOverviewEmbeddingModelResponseModel", + "RagIndexOverviewResponseModel", + "RagIndexStatus", + "RagRetrievalInfo", + "ReadLegalTerms", + "ReadMetadataChapterDbModel", + "ReaderResourceResponseModel", + "ReaderResourceResponseModelResourceType", + "RealtimeModel", + "RealtimeVoiceSettings", + "RecordingResponse", + "ReferenceVideo", + "ReferencedToolCommonModel", + "ReferencedToolCommonModelType", + "RefreshTokenAuthResponse", + "RegexParameterEvaluationStrategy", + "RegionConfigRequest", + "RegionalProcessingSurchargeInfo", + "RegisterForGroupSessionParams", + "RegisterMediaResponse", + "RemoveMemberFromGroupRequest", + "RemoveOrderItemResponse", + "RemoveVoiceFromUserVoiceCollectionResponseModel", + "Render", + "RenderStatus", + "RenderType", + "ReplicateVoiceToIsolatedEnvironmentResponseModel", + "ReportKnowledgeGapParams", + "RequestPvcManualVerificationResponseModel", + "RequiredConstraint", + "RequiredConstraints", + "ResourceAccessInfo", + "ResourceAccessInfoAccessSource", + "ResourceAccessInfoAnonymousAccessLevelOverride", + "ResourceAccessInfoRole", + "ResourceMetadataResponseModel", + "ResourceMetadataResponseModelAnonymousAccessLevelOverride", + "ResponseConversationErrorType", + "ResponseFilter", + "ResponseFilterMode", + "ResponseUnitTestModel", + "RestoreCalendarEventParams", + "RetryTriggerAction", + "ReviewResponseModel", + "ReviewResponseModelRejectReasonsItem", + "ReviewResponseModelReviewStatus", + "ReviewStatus", + "SafetyCommonModelInput", + "SafetyCommonModelOutput", + "SafetyEvaluation", + "SafetyResponseModel", + "SafetyRule", + "SampleConfigDbModel", + "SampleConfigDbModelParentType", + "SaveVoicePreviewRequest", + "SayNodeLiteralMessageInput", + "SayNodeLiteralMessageOutput", + "SayNodePromptMessageInput", + "SayNodePromptMessageOutput", + "ScheduleGroupSessionParams", + "ScimGroupResponseModel", + "ScopedAnalysisResult", + "ScribeAuthErrorPayload", + "ScribeChunkSizeExceededErrorPayload", + "ScribeErrorPayload", + "ScribeInputErrorPayload", + "ScribeInsufficientAudioActivityErrorPayload", + "ScribeInvalidRequestError", + "ScribeQueueOverflowErrorPayload", + "ScribeQuotaExceededErrorPayload", + "ScribeRateLimitedErrorPayload", + "ScribeResourceExhaustedErrorPayload", + "ScribeSessionTimeLimitExceededErrorPayload", + "ScribeThrottledErrorPayload", + "ScribeTranscriberErrorPayload", + "ScribeUnacceptedTermsErrorPayload", + "ScribeWarning", + "SearchClientsParams", + "SearchHighlightSegment", + "SearchStrategy", + "SeatType", + "SecretDependencyResourceType", + "SecretDependencyType", + "SectionSource", + "SegmentCreateResponse", + "SegmentDeleteResponse", + "SegmentDubResponse", + "SegmentMigrationResponse", + "SegmentSubtitleFrame", + "SegmentTranscriptionResponse", + "SegmentTranslationResponse", + "SegmentUpdateResponse", + "SegmentedJsonExportOptions", + "SendCustomEmailParams", + "SendText", + "SendTextMulti", + "SentimentAggregate", + "SentimentAnalysisSettings", + "SessionStartedPayload", + "SessionStartedPayloadConfig", + "SessionStartedPayloadConfigCommitStrategy", + "SetBookingSlugParams", + "SeverityId", + "SfxModelId", + "SfxSourceContext", + "ShareOptionResponseModel", + "ShareOptionResponseModelType", + "SimilarVoice", + "SimilarVoicesForSpeakerResponse", + "SimulationLibrarySettings", + "SimulationTestModel", + "SimulationToolMockBehaviorConfig", + "SingleLanguagesResponse", + "SingleTestRunRequestModel", + "SingleUseTokenResponseModel", + "SingleUseTokenType", + "SipLogMessage", + "SipLogMessageDirection", + "SipMediaEncryptionEnum", + "SipTrunkCredentialsRequestModel", + "SipTrunkOutboundCallResponse", + "SipTrunkTransportEnum", + "SipUriDynamicVariableTransferDestination", + "SipUriTransferDestination", + "SkipTurnToolConfig", + "SkipTurnToolResponseModel", + "SlackBotAuthResponse", + "SmbAgentType", + "SmbClientAccessConfig", + "SmsConversationInfo", + "SmsConversationInfoDirection", + "SoftTimeoutConfig", + "SoftTimeoutConfigOverride", + "SoftTimeoutConfigOverrideConfig", + "SoftTimeoutConfigWorkflowOverride", + "SongMetadata", + "SongSection", + "SongSourceContext", + "SortDirection", + "SpeakerAudioResponseModel", + "SpeakerCreatedResponse", + "SpeakerResponseModel", + "SpeakerSegment", + "SpeakerSeparationResponseModel", + "SpeakerSeparationResponseModelStatus", + "SpeakerTrack", + "SpeakerUpdatedResponse", + "SpeechEngineConfig", + "SpeechEngineConfigRequestHeadersValue", + "SpeechEngineConversationInitiationClientDataConfig", + "SpeechEngineResponse", + "SpeechEngineSummaryResponse", + "SpeechHistoryItemResponse", + "SpeechHistoryItemResponseSource", + "SpeechHistoryItemResponseVoiceCategory", + "SpeechToTextCharacterResponseModel", + "SpeechToTextChunkResponseModel", + "SpeechToTextChunkResponseModelEditedTranscript", + "SpeechToTextChunkResponseModelEditedTranscript_Error", + "SpeechToTextChunkResponseModelEditedTranscript_Transcript", + "SpeechToTextWebhookResponseModel", + "SpeechToTextWordResponseModel", + "SpeechToTextWordResponseModelType", + "SpellingPatience", + "SrtExportOptions", + "StartProcedureToolConfig", + "StartProcedureToolConfigProceduresValue", + "StartProcedureToolErrorStatus", + "StartProcedureToolResultErrorModel", + "StartProcedureToolResultSuccessModel", + "StartPvcVoiceTrainingResponseModel", + "StartSpeakerSeparationResponseModel", + "StaticAssetReference", + "StatusId", + "StoredUsagePlatformLimit", + "StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel", + "StreamingAudioChunkWithTimestampsResponse", + "StringSchema", + "StudioAgentSettingsModel", + "StudioAgentToolSettingsModel", + "StudioClipLocator", + "StudioClipLocatorClipType", + "StudioTextStyleOutlineModel", + "StudioTextStyleShadowModel", + "SubmitBusinessInfoParams", + "SubmitOrderResponse", + "Subscription", + "SubscriptionExtrasResponseModel", + "SubscriptionMaxCreditLimitExtension", + "SubscriptionPendingChange", + "SubscriptionResponse", + "SubscriptionResponseMaxCreditLimitExtension", + "SubscriptionStatusType", + "SubscriptionUsageResponseModel", + "SubtitleOrderItemRequest", + "SuggestedAudioTag", + "SupportedVoice", + "SystemDataCollectionId", + "SystemEvaluationCriteria", + "SystemEvaluationId", + "SystemToolConfigInput", + "SystemToolConfigInputParams", + "SystemToolConfigInputParams_EndCall", + "SystemToolConfigInputParams_EndProcedure", + "SystemToolConfigInputParams_KnowledgeBase", + "SystemToolConfigInputParams_KnowledgeBaseRag", + "SystemToolConfigInputParams_LanguageDetection", + "SystemToolConfigInputParams_PlayKeypadTouchTone", + "SystemToolConfigInputParams_SkipTurn", + "SystemToolConfigInputParams_StartProcedure", + "SystemToolConfigInputParams_TransferToAgent", + "SystemToolConfigInputParams_TransferToNumber", + "SystemToolConfigInputParams_VoicemailDetection", + "SystemToolConfigOutput", + "SystemToolConfigOutputParams", + "SystemToolConfigOutputParams_EndCall", + "SystemToolConfigOutputParams_EndProcedure", + "SystemToolConfigOutputParams_KnowledgeBase", + "SystemToolConfigOutputParams_KnowledgeBaseRag", + "SystemToolConfigOutputParams_LanguageDetection", + "SystemToolConfigOutputParams_PlayKeypadTouchTone", + "SystemToolConfigOutputParams_SkipTurn", + "SystemToolConfigOutputParams_StartProcedure", + "SystemToolConfigOutputParams_TransferToAgent", + "SystemToolConfigOutputParams_TransferToNumber", + "SystemToolConfigOutputParams_VoicemailDetection", + "TelephonyCallConfigInput", + "TelephonyCallConfigOutput", + "TelephonyDirection", + "TelephonyProvider", + "TemplateArrayOutput", + "TemplateArrayOutputFailureReason", + "TemplateAudioOutput", + "TemplateAudioOutputFailureReason", + "TemplateBooleanOutput", + "TemplateBooleanOutputFailureReason", + "TemplateImageOutput", + "TemplateImageOutputFailureReason", + "TemplateInputReference", + "TemplateInputReference_Asset", + "TemplateInputReference_Generation", + "TemplateInputReference_InlineBase64", + "TemplateInputReference_Voice", + "TemplateIntegerOutput", + "TemplateIntegerOutputFailureReason", + "TemplateListResponse", + "TemplateNumberOutput", + "TemplateNumberOutputFailureReason", + "TemplateObjectOutput", + "TemplateObjectOutputFailureReason", + "TemplateOutput", + "TemplateOutput_Array", + "TemplateOutput_Audio", + "TemplateOutput_Boolean", + "TemplateOutput_Image", + "TemplateOutput_Integer", + "TemplateOutput_Number", + "TemplateOutput_Object", + "TemplateOutput_String", + "TemplateOutput_Video", + "TemplatePort", + "TemplateRunInput", + "TemplateRunListResponse", + "TemplateRunResponse", + "TemplateRunStatus", + "TemplateStringOutput", + "TemplateStringOutputFailureReason", + "TemplateSummary", + "TemplateVersion", + "TemplateVideoOutput", + "TemplateVideoOutputFailureReason", + "TestConditionRationaleCommonModel", + "TestConditionResultCommonModel", + "TestFromConversationMetadataInput", + "TestFromConversationMetadataOutput", + "TestInvocationSummaryResponseModel", + "TestRunMetadata", + "TestRunMetadataTestType", + "TestRunResultBucket", + "TestRunResultSummary", + "TestRunStatus", + "TestSharingMode", + "TestToolResultModel", + "TestType", + "TestsFeatureUsageCommonModel", + "TextNormalisationType", + "TextToDialogueWebsocketApplyTextNormalizationEnum", + "TextToDialogueWebsocketAudioChunk", + "TextToDialogueWebsocketAudioChunkMulti", + "TextToDialogueWebsocketClientMessage", + "TextToDialogueWebsocketClientMessageMulti", + "TextToDialogueWebsocketError", + "TextToDialogueWebsocketFinal", + "TextToDialogueWebsocketFinalAudioForTurn", + "TextToDialogueWebsocketFinalAudioForTurnMulti", + "TextToDialogueWebsocketFinalMulti", + "TextToDialogueWebsocketOutputFormatEnum", + "TextToDialogueWebsocketVoiceInput", + "TextToDialogueWebsocketVoiceSettings", + "TextToSpeechApplyTextNormalizationEnum", + "TextToSpeechGenerationRequest", + "TextToSpeechGenerationRequest_ElevenFlashV25", + "TextToSpeechGenerationRequest_ElevenMultilingualV2", + "TextToSpeechGenerationRequest_ElevenV3", + "TextToSpeechOutputFormatEnum", + "TextToSpeechRequest", + "TextToSpeechStreamRequest", + "TextToSpeechStreamWithTimestampsRequest", + "TextToSpeechWithTimestampsRequest", + "ThresholdGuardrail", + "TicketCommentResponseModel", + "TicketMergeProposalLinkResponseModel", + "TicketPriorityChangeResponseModel", + "TicketSearchMatchField", + "TicketSearchMatchResponseModel", + "TicketStatusChangeResponseModel", + "TimeRange", + "ToDialogueSettingsResponseModel", + "TokenResponseModel", + "Tool", + "ToolAnnotations", + "ToolCallSoundBehavior", + "ToolCallSoundType", + "ToolCallUnitTestModel", + "ToolErrorHandlingMode", + "ToolExecution", + "ToolExecutionMode", + "ToolExecutionResponseModel", + "ToolExecutionResponseModelToolCallDetails", + "ToolExecutionResponseModelToolCallDetails_ApiIntegrationWebhook", + "ToolExecutionResponseModelToolCallDetails_Client", + "ToolExecutionResponseModelToolCallDetails_Mcp", + "ToolExecutionResponseModelToolCallDetails_Webhook", + "ToolExecutionTaskSupport", + "ToolInterruptionMode", + "ToolMockConfig", + "ToolRequestModel", + "ToolRequestModelToolConfig", + "ToolRequestModelToolConfig_Client", + "ToolRequestModelToolConfig_Mcp", + "ToolRequestModelToolConfig_System", + "ToolRequestModelToolConfig_Webhook", + "ToolResponseMockConfigInput", + "ToolResponseMockConfigOutput", + "ToolResponseModel", + "ToolResponseModelToolConfig", + "ToolResponseModelToolConfig_Client", + "ToolResponseModelToolConfig_Mcp", + "ToolResponseModelToolConfig_System", + "ToolResponseModelToolConfig_Webhook", + "ToolSortBy", + "ToolType", + "ToolTypeFilter", + "ToolUsageStatsResponseModel", + "ToolsResponseModel", + "TopicDiscoverySettings", + "TopicEvaluationCriteriaAggregate", + "TopicMetricsAggregate", + "TopicSentimentAggregate", + "TopicSortBy", + "TranscriptEditError", + "TranscriptMessage", + "TranscriptMessageRole", + "TranscriptPlatformEvent", + "TranscriptionOrderItemRequest", + "TranscriptionWord", + "TranscriptionWordType", + "TransferBranchInfoConfigured", + "TransferBranchInfoDefaultingToMain", + "TransferBranchInfoTrafficSplit", + "TransferToAgentToolConfigInput", + "TransferToAgentToolConfigOutput", + "TransferToAgentToolResultErrorModel", + "TransferToAgentToolResultSuccessModelInput", + "TransferToAgentToolResultSuccessModelInputBranchInfo", + "TransferToAgentToolResultSuccessModelInputBranchInfo_Configured", + "TransferToAgentToolResultSuccessModelInputBranchInfo_DefaultingToMain", + "TransferToAgentToolResultSuccessModelInputBranchInfo_TrafficSplit", + "TransferToAgentToolResultSuccessModelOutput", + "TransferToAgentToolResultSuccessModelOutputBranchInfo", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_Configured", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain", + "TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit", + "TransferToNumberResultAmazonConnectSuccessModel", + "TransferToNumberResultErrorModel", + "TransferToNumberResultExotelSuccessModel", + "TransferToNumberResultSipSuccessModel", + "TransferToNumberResultTwilioSuccessModel", + "TransferToNumberToolConfigInput", + "TransferToNumberToolConfigOutput", + "TransferTypeEnum", + "TranslateAudioOutputError", + "TranslateAudioPayload", + "TranslateAuthError", + "TranslateEndOfStreamPayload", + "TranslateErrorPayload", + "TranslateFinalTranscriptPayload", + "TranslateInputAudioChunkPayload", + "TranslateInputError", + "TranslateInputFormatEnum", + "TranslateOutputFormatEnum", + "TranslatePartialTranscriptPayload", + "TranslatePaymentIssueError", + "TranslateQueueOverflowError", + "TranslateQuotaExceededError", + "TranslateRateLimitedError", + "TranslateSessionStartedPayload", + "TranslateStatusPayload", + "TranslateTranscriberError", + "TranslateTranslationError", + "TranslateTranslationPayload", + "TranslateUnacceptedTermsError", + "TranslatedString", + "TriggerUserVerificationParams", + "TriggeredGuardrailCommonModel", + "TtsConversationalConfigInput", + "TtsConversationalConfigOutput", + "TtsConversationalConfigOverride", + "TtsConversationalConfigOverrideConfig", + "TtsConversationalConfigWorkflowOverrideInput", + "TtsConversationalConfigWorkflowOverrideOutput", + "TtsConversationalModel", + "TtsModelFamily", + "TtsOptimizeStreamingLatency", + "TtsOutputFormat", + "TtsVoiceSettings", + "TurnCommentRequestModel", + "TurnCommentResponseModel", + "TurnConfig", + "TurnConfigOverride", + "TurnConfigOverrideConfig", + "TurnConfigWorkflowOverride", + "TurnDetectionType", + "TurnEagerness", + "TurnMode", + "TurnModel", + "TwilioAnsweredBy", + "TwilioEdgeLocation", + "TwilioMachineDetectionAction", + "TwilioMachineDetectionConfig", + "TwilioMachineDetectionMode", + "TwilioMachineDetectionRule", + "TwilioOutboundCallResponse", + "TwilioRegionId", + "TxtExportOptions", + "UnitTestRunResponseModel", + "UnitTestRunResponseModelTestInfo", + "UnitTestRunResponseModelTestInfo_Llm", + "UnitTestRunResponseModelTestInfo_Simulation", + "UnitTestRunResponseModelTestInfo_Tool", + "UnitTestSummaryResponseModel", + "UnitTestToolCallEvaluationModelInput", + "UnitTestToolCallEvaluationModelOutput", + "UnitTestToolCallParameter", + "UnitTestToolCallParameterEval", + "UnitTestToolCallParameterEval_Anything", + "UnitTestToolCallParameterEval_Exact", + "UnitTestToolCallParameterEval_Llm", + "UnitTestToolCallParameterEval_Regex", + "UnitTestWorkflowNodeTransitionEvaluationNodeId", + "UpdateAgentConfigParams", + "UpdateAgentProcedureParams", + "UpdateAgentRuleParams", + "UpdateAssetParams", + "UpdateAudioNativeProjectRequest", + "UpdateBasicAuthRequest", + "UpdateBearerAuthRequest", + "UpdateBookingPageAppearanceParams", + "UpdateBookingPageSettingsParams", + "UpdateBusinessInfoParams", + "UpdateCalendarEventParams", + "UpdateChapterRequest", + "UpdateClientParams", + "UpdateGroupSessionSeatsParams", + "UpdateHolidayParams", + "UpdateLocationParams", + "UpdateOAuth2ClientCredsRequest", + "UpdateOAuth2JwtRequest", + "UpdateOAuth2JwtRequestAlgorithm", + "UpdateOAuth2JwtRequestTokenResponseField", + "UpdateOrderParams", + "UpdateOrderRequest", + "UpdateOrderResponse", + "UpdateProductParams", + "UpdateProjectRequest", + "UpdatePronunciationDictionariesRequest", + "UpdateResponseUnitTestRequest", + "UpdateServiceParams", + "UpdateSimulationTestRequest", + "UpdateStaffParams", + "UpdateToolCallUnitTestRequest", + "UpdateTransferRuleParams", + "UpdateWorkspaceMemberResponseModel", + "UpsertOrderItemRequest", + "UpsertOrderItemResponse", + "UrlAvatar", + "UrlModel", + "UrlSecretAuthResponse", + "UsageAggregationInterval", + "UsageCharactersResponseModel", + "User", + "UserAccessManagementActivityId", + "UserFeedback", + "UserFeedbackScore", + "UserModel", + "UserTranscriptPayload", + "UserTypeId", + "UserVoiceCollectionResponseModel", + "UserVoiceCollectionResponseModelPermissionOnResource", + "UsersSortBy", + "UtteranceResponseModel", + "UuiTransferConfig", + "UuiTransferConfigProtocolDiscriminatorMode", + "VadConfig", + "VadConfigWorkflowOverride", + "ValidateUserVerificationCodeParams", + "ValidationError", + "ValidationErrorLocItem", + "Veo31FastRequest", + "Veo31FastRequestAspectRatio", + "Veo31FastRequestResolution", + "Veo31Request", + "Veo31RequestAspectRatio", + "Veo31RequestResolution", + "VeoImageReference", + "VeoImageReferenceRole", + "Verbosity", + "VerificationAttemptResponse", + "VerifiedVoiceLanguageResponseModel", + "VerifyPvcVoiceCaptchaResponseModel", + "VideoAnalysis", + "VideoAnalysisResult", + "VideoAnalysisStatus", + "VideoGenerationRequest", + "VideoGenerationRequest_BytedanceSeedanceV2", + "VideoGenerationRequest_BytedanceSeedanceV25", + "VideoGenerationRequest_BytedanceSeedanceV2Fast", + "VideoGenerationRequest_BytedanceSeedanceV2Mini", + "VideoGenerationRequest_CreatifyAurora", + "VideoGenerationRequest_Veo31FastGenerate001", + "VideoGenerationRequest_Veo31Generate001", + "VideoKeyMoment", + "VideoReference", + "VideoReference_Asset", + "VideoReference_Generation", + "VideoReference_InlineBase64", + "VideoSchema", + "VideoSegment", + "VideoSubject", + "VisitedAgentRef", + "Voice", + "VoiceAccentResponseModel", + "VoiceCategory", + "VoiceDesignPreviewResponse", + "VoiceGenerationParameterOptionResponse", + "VoiceGenerationParameterResponse", + "VoiceLabellingStatus", + "VoiceMailDetectionResultSuccessModel", + "VoicePreviewResponseModel", + "VoiceRecordingQuality", + "VoiceReference", + "VoiceSafetyControl", + "VoiceSample", + "VoiceSamplePreviewResponseModel", + "VoiceSampleVisualWaveformResponseModel", + "VoiceSchema", + "VoiceSegment", + "VoiceSettings", + "VoiceSharingModerationCheckResponseModel", + "VoiceSharingResponse", + "VoiceSharingResponseCategory", + "VoiceSharingState", + "VoiceStatisticsResponseModel", + "VoiceVerificationResponse", + "VoicemailDetectionToolConfig", + "VoicesNotPermittedWarning", + "WebhookAuthMethodType", + "WebhookEventType", + "WebhookHmacSettings", + "WebhookTarget", + "WebhookTargetAll", + "WebhookTargetIds", + "WebhookTarget_All", + "WebhookTarget_Ids", + "WebhookToolApiSchemaConfigInput", + "WebhookToolApiSchemaConfigInputAuthConnection", + "WebhookToolApiSchemaConfigInputContentType", + "WebhookToolApiSchemaConfigInputMethod", + "WebhookToolApiSchemaConfigInputRequestHeadersValue", + "WebhookToolApiSchemaConfigOutput", + "WebhookToolApiSchemaConfigOutputAuthConnection", + "WebhookToolApiSchemaConfigOutputContentType", + "WebhookToolApiSchemaConfigOutputMethod", + "WebhookToolApiSchemaConfigOutputRequestHeadersValue", + "WebhookToolConfigInput", + "WebhookToolConfigOutput", + "WebhookTranscriptFormat", + "WebhookUsageType", + "WebsocketTtsClientMessageMulti", + "WebsocketTtsServerMessageMulti", + "WhatsAppAccountType", + "WhatsAppAuthResponse", + "WhatsAppCallPermissionRequest", + "WhatsAppCallPermissionRequestState", + "WhatsAppConversationInfo", + "WhatsAppConversationInfoDirection", + "WhatsAppOutboundCallResponse", + "WhatsAppOutboundMessageResponse", + "WhatsAppRecipient", + "WhatsAppTemplateBodyComponentParams", + "WhatsAppTemplateButtonComponentParams", + "WhatsAppTemplateDocumentParam", + "WhatsAppTemplateDocumentParamDetails", + "WhatsAppTemplateHeaderComponentParams", + "WhatsAppTemplateHeaderComponentParamsParametersItem", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Document", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Image", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Location", + "WhatsAppTemplateHeaderComponentParamsParametersItem_Text", + "WhatsAppTemplateImageParam", + "WhatsAppTemplateImageParamDetails", + "WhatsAppTemplateLocationParam", + "WhatsAppTemplateLocationParamDetails", + "WhatsAppTemplateTextParam", + "WidgetConfig", + "WidgetConfigAvatar", + "WidgetConfigAvatar_Image", + "WidgetConfigAvatar_Orb", + "WidgetConfigAvatar_Url", + "WidgetConfigResponse", + "WidgetConfigResponseAvatar", + "WidgetConfigResponseAvatar_Image", + "WidgetConfigResponseAvatar_Orb", + "WidgetConfigResponseAvatar_Url", + "WidgetConfigResponseSyntaxHighlightTheme", + "WidgetConfigSyntaxHighlightTheme", + "WidgetEndFeedbackConfig", + "WidgetEndFeedbackType", + "WidgetExpandable", + "WidgetFeedbackMode", + "WidgetLanguagePreset", + "WidgetLanguagePresetResponse", + "WidgetPlacement", + "WidgetStyles", + "WidgetTermsTranslation", + "WidgetTextContents", + "WidgetTextContentsTranslation", + "WordTimestamp", + "WorkflowEdgeModelInput", + "WorkflowEdgeModelInputBackwardCondition", + "WorkflowEdgeModelInputBackwardCondition_Expression", + "WorkflowEdgeModelInputBackwardCondition_Llm", + "WorkflowEdgeModelInputBackwardCondition_Result", + "WorkflowEdgeModelInputBackwardCondition_Unconditional", + "WorkflowEdgeModelInputForwardCondition", + "WorkflowEdgeModelInputForwardCondition_Expression", + "WorkflowEdgeModelInputForwardCondition_Llm", + "WorkflowEdgeModelInputForwardCondition_Result", + "WorkflowEdgeModelInputForwardCondition_Unconditional", + "WorkflowEdgeModelOutput", + "WorkflowEdgeModelOutputBackwardCondition", + "WorkflowEdgeModelOutputBackwardCondition_Expression", + "WorkflowEdgeModelOutputBackwardCondition_Llm", + "WorkflowEdgeModelOutputBackwardCondition_Result", + "WorkflowEdgeModelOutputBackwardCondition_Unconditional", + "WorkflowEdgeModelOutputForwardCondition", + "WorkflowEdgeModelOutputForwardCondition_Expression", + "WorkflowEdgeModelOutputForwardCondition_Llm", + "WorkflowEdgeModelOutputForwardCondition_Result", + "WorkflowEdgeModelOutputForwardCondition_Unconditional", + "WorkflowEndNodeModelInput", + "WorkflowEndNodeModelOutput", + "WorkflowEndNodeOutcome", + "WorkflowExpressionConditionModelInput", + "WorkflowExpressionConditionModelOutput", + "WorkflowFeaturesUsageCommonModel", + "WorkflowLlmConditionModelInput", + "WorkflowLlmConditionModelOutput", + "WorkflowOverrideAgentNodeModelInput", + "WorkflowOverrideAgentNodeModelOutput", + "WorkflowPhoneNumberNodeModelInput", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Dynamic", + "WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Static", + "WorkflowPhoneNumberNodeModelInputPostDialDigits", + "WorkflowPhoneNumberNodeModelInputPostDialDigits_Dynamic", + "WorkflowPhoneNumberNodeModelInputPostDialDigits_Static", + "WorkflowPhoneNumberNodeModelInputTransferDestination", + "WorkflowPhoneNumberNodeModelInputTransferDestination_Phone", + "WorkflowPhoneNumberNodeModelInputTransferDestination_PhoneDynamicVariable", + "WorkflowPhoneNumberNodeModelInputTransferDestination_SipUri", + "WorkflowPhoneNumberNodeModelInputTransferDestination_SipUriDynamicVariable", + "WorkflowPhoneNumberNodeModelOutput", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Dynamic", + "WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Static", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits_Dynamic", + "WorkflowPhoneNumberNodeModelOutputPostDialDigits_Static", + "WorkflowPhoneNumberNodeModelOutputTransferDestination", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_Phone", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_PhoneDynamicVariable", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUri", + "WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUriDynamicVariable", + "WorkflowResultConditionModelInput", + "WorkflowResultConditionModelOutput", + "WorkflowSayNodeModelInput", + "WorkflowSayNodeModelInputMessage", + "WorkflowSayNodeModelInputMessage_Literal", + "WorkflowSayNodeModelInputMessage_Prompt", + "WorkflowSayNodeModelOutput", + "WorkflowSayNodeModelOutputMessage", + "WorkflowSayNodeModelOutputMessage_Literal", + "WorkflowSayNodeModelOutputMessage_Prompt", + "WorkflowStandaloneAgentNodeModelInput", + "WorkflowStandaloneAgentNodeModelOutput", + "WorkflowStartNodeModelInput", + "WorkflowStartNodeModelOutput", + "WorkflowStateUpdateInput", + "WorkflowStateUpdateOutput", + "WorkflowToolEdgeStepModel", + "WorkflowToolLocator", + "WorkflowToolLocatorSchemaOverridesValue", + "WorkflowToolLocatorSchemaOverridesValue_Constant", + "WorkflowToolLocatorSchemaOverridesValue_DynamicVariable", + "WorkflowToolLocatorSchemaOverridesValue_Llm", + "WorkflowToolLocatorSchemaOverridesValue_Omit", + "WorkflowToolMaxIterationsExceededStepModel", + "WorkflowToolNestedToolsStepModelInput", + "WorkflowToolNestedToolsStepModelInputResultsItem", + "WorkflowToolNestedToolsStepModelOutput", + "WorkflowToolNestedToolsStepModelOutputResultsItem", + "WorkflowToolNodeModelInput", + "WorkflowToolNodeModelOutput", + "WorkflowToolResponseModelInput", + "WorkflowToolResponseModelInputStepsItem", + "WorkflowToolResponseModelInputStepsItem_Edge", + "WorkflowToolResponseModelInputStepsItem_MaxIterationsExceeded", + "WorkflowToolResponseModelInputStepsItem_NestedTools", + "WorkflowToolResponseModelOutput", + "WorkflowToolResponseModelOutputStepsItem", + "WorkflowToolResponseModelOutputStepsItem_Edge", + "WorkflowToolResponseModelOutputStepsItem_MaxIterationsExceeded", + "WorkflowToolResponseModelOutputStepsItem_NestedTools", + "WorkflowUnconditionalModelInput", + "WorkflowUnconditionalModelOutput", + "WorkflowUpdateStateNodeModelInput", + "WorkflowUpdateStateNodeModelOutput", + "WorkspaceAnalyticsQueryResponseModel", + "WorkspaceAnalyticsQueryResponseModelColumnTypesItem", + "WorkspaceAnalyticsQueryResponseModelRowsItemItem", + "WorkspaceApiKeyListResponseModel", + "WorkspaceApiKeyResponseModel", + "WorkspaceAuditLogEntryResponse", + "WorkspaceAuditLogEntryResponseActivityId", + "WorkspaceAuditLogsPageResponse", + "WorkspaceBatchCallsResponse", + "WorkspaceCreateApiKeyResponseModel", + "WorkspaceCreateServiceAccountResponseModel", + "WorkspaceCreateWebhookResponseModel", + "WorkspaceGroupByNameResponseModel", + "WorkspaceGroupPermission", + "WorkspaceGroupResponseModel", + "WorkspaceGroupResponseModelGroupConcurrencyLimit", + "WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit", + "WorkspaceGroupResponseModelGroupMusicConcurrencyLimit", + "WorkspaceGroupResponseModelGroupPvcLimit", + "WorkspaceGroupResponseModelGroupUsageLimit", + "WorkspaceMemberResponseModel", + "WorkspaceResourceType", + "WorkspaceServiceAccountListResponseModel", + "WorkspaceServiceAccountResponseModel", + "WorkspaceWebhookEventType", + "WorkspaceWebhookListResponseModel", + "WorkspaceWebhookResponseModel", + "WorkspaceWebhookUsageResponseModel", +] diff --git a/data/src/elevenlabs/types/account_change_activity_id.py b/data/src/elevenlabs/types/account_change_activity_id.py new file mode 100644 index 0000000000000000000000000000000000000000..5dedd649288b79a48ed88a1493f14563d38e1045 --- /dev/null +++ b/data/src/elevenlabs/types/account_change_activity_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +AccountChangeActivityId = int diff --git a/data/src/elevenlabs/types/actor_model.py b/data/src/elevenlabs/types/actor_model.py new file mode 100644 index 0000000000000000000000000000000000000000..92f60445cd2765d3787aa42e14f3d2e543490bce --- /dev/null +++ b/data/src/elevenlabs/types/actor_model.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .user_model import UserModel + + +class ActorModel(UncheckedBaseModel): + """ + OCSF Actor object - describes the entity that performed the action. + + Spec: https://schema.ocsf.io/1.6.0/objects/actor + """ + + user: UserModel = pydantic.Field() + """ + User who performed the action + """ + + app_name: typing.Optional[str] = pydantic.Field(default=None) + """ + Client application or service name + """ + + app_uid: typing.Optional[str] = pydantic.Field(default=None) + """ + Client application unique identifier + """ + + session: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Session information + """ + + 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/data/src/elevenlabs/types/add_chapter_response_model.py b/data/src/elevenlabs/types/add_chapter_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6b3208a3bb1b57e8808f184d6b0fbcca7212e590 --- /dev/null +++ b/data/src/elevenlabs/types/add_chapter_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_with_content_response_model import ChapterWithContentResponseModel + + +class AddChapterResponseModel(UncheckedBaseModel): + chapter: ChapterWithContentResponseModel + + 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/data/src/elevenlabs/types/add_knowledge_base_response_model.py b/data/src/elevenlabs/types/add_knowledge_base_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..98f36d8211e089cf574af77f838313475c554acf --- /dev/null +++ b/data/src/elevenlabs/types/add_knowledge_base_response_model.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) + + +class AddKnowledgeBaseResponseModel(UncheckedBaseModel): + id: str + name: str + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + 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/data/src/elevenlabs/types/add_project_request.py b/data/src/elevenlabs/types/add_project_request.py new file mode 100644 index 0000000000000000000000000000000000000000..31f403512df0d5b851c0ba6438bf83379fe8aded --- /dev/null +++ b/data/src/elevenlabs/types/add_project_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AddProjectRequest = typing.Any diff --git a/data/src/elevenlabs/types/add_project_response_model.py b/data/src/elevenlabs/types/add_project_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..983b1a3e3c650a21e10e7f65213231f7a85ec6e2 --- /dev/null +++ b/data/src/elevenlabs/types/add_project_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .project_response import ProjectResponse + + +class AddProjectResponseModel(UncheckedBaseModel): + project: ProjectResponse + + 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/data/src/elevenlabs/types/add_pronunciation_dictionary_response_model.py b/data/src/elevenlabs/types/add_pronunciation_dictionary_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..66703b5d704ca149fc4070746182c386816967bd --- /dev/null +++ b/data/src/elevenlabs/types/add_pronunciation_dictionary_response_model.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .add_pronunciation_dictionary_response_model_permission_on_resource import ( + AddPronunciationDictionaryResponseModelPermissionOnResource, +) + + +class AddPronunciationDictionaryResponseModel(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The ID of the created pronunciation dictionary. + """ + + name: str = pydantic.Field() + """ + The name of the created pronunciation dictionary. + """ + + created_by: str = pydantic.Field() + """ + The user ID of the creator of the pronunciation dictionary. + """ + + creation_time_unix: int = pydantic.Field() + """ + The creation time of the pronunciation dictionary in Unix timestamp. + """ + + version_id: str = pydantic.Field() + """ + The ID of the created pronunciation dictionary version. + """ + + version_rules_num: int = pydantic.Field() + """ + The number of rules in the version of the pronunciation dictionary. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the pronunciation dictionary. + """ + + permission_on_resource: typing.Optional[AddPronunciationDictionaryResponseModelPermissionOnResource] = ( + pydantic.Field(default=None) + ) + """ + The permission on the resource of the pronunciation dictionary. + """ + + 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/data/src/elevenlabs/types/add_pronunciation_dictionary_response_model_permission_on_resource.py b/data/src/elevenlabs/types/add_pronunciation_dictionary_response_model_permission_on_resource.py new file mode 100644 index 0000000000000000000000000000000000000000..d72f0ef16cda0cba460db1cc871c657b1482258e --- /dev/null +++ b/data/src/elevenlabs/types/add_pronunciation_dictionary_response_model_permission_on_resource.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AddPronunciationDictionaryResponseModelPermissionOnResource = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/add_sharing_voice_request.py b/data/src/elevenlabs/types/add_sharing_voice_request.py new file mode 100644 index 0000000000000000000000000000000000000000..1a815a2280132de9ec1bc48222e0a2530e165b97 --- /dev/null +++ b/data/src/elevenlabs/types/add_sharing_voice_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AddSharingVoiceRequest = typing.Any diff --git a/data/src/elevenlabs/types/add_voice_ivc_response_model.py b/data/src/elevenlabs/types/add_voice_ivc_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e06feddc013807cdf28b47bec1490aa9c5d1337a --- /dev/null +++ b/data/src/elevenlabs/types/add_voice_ivc_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AddVoiceIvcResponseModel(UncheckedBaseModel): + voice_id: str = pydantic.Field() + """ + The ID of the newly created voice. + """ + + requires_verification: bool = pydantic.Field() + """ + Whether the voice requires verification + """ + + 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/data/src/elevenlabs/types/add_voice_response_model.py b/data/src/elevenlabs/types/add_voice_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e50483c88f88e24c2461dbdcbb78cc2e16995e10 --- /dev/null +++ b/data/src/elevenlabs/types/add_voice_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AddVoiceResponseModel(UncheckedBaseModel): + voice_id: str = pydantic.Field() + """ + The ID of the voice. + """ + + 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/data/src/elevenlabs/types/add_voice_to_user_voice_collection_response_model.py b/data/src/elevenlabs/types/add_voice_to_user_voice_collection_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6da699007f82012354eced9049b4a5bed80b23d2 --- /dev/null +++ b/data/src/elevenlabs/types/add_voice_to_user_voice_collection_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AddVoiceToUserVoiceCollectionResponseModel(UncheckedBaseModel): + collection_id: str = pydantic.Field() + """ + The ID of the voice collection. + """ + + voice_id: str = pydantic.Field() + """ + The ID of the voice that was added. + """ + + 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/data/src/elevenlabs/types/add_workspace_group_member_response_model.py b/data/src/elevenlabs/types/add_workspace_group_member_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..bc61232dc9bc2448710211a5f912f5306b44a925 --- /dev/null +++ b/data/src/elevenlabs/types/add_workspace_group_member_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AddWorkspaceGroupMemberResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the workspace group member addition request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/add_workspace_invite_response_model.py b/data/src/elevenlabs/types/add_workspace_invite_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..0c8d3c77e1d10ae2d5493eea9538e0b9ebc85bc2 --- /dev/null +++ b/data/src/elevenlabs/types/add_workspace_invite_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AddWorkspaceInviteResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the workspace invite request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/additional_format_response_model.py b/data/src/elevenlabs/types/additional_format_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e115f0c0615f6ae24d8ef646a56e83af8ec3f026 --- /dev/null +++ b/data/src/elevenlabs/types/additional_format_response_model.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AdditionalFormatResponseModel(UncheckedBaseModel): + requested_format: str = pydantic.Field() + """ + The requested format. + """ + + file_extension: str = pydantic.Field() + """ + The file extension of the additional format. + """ + + content_type: str = pydantic.Field() + """ + The content type of the additional format. + """ + + is_base_64_encoded: typing_extensions.Annotated[ + bool, + FieldMetadata(alias="is_base64_encoded"), + pydantic.Field(alias="is_base64_encoded", description="Whether the content is base64 encoded."), + ] + content: str = pydantic.Field() + """ + The content of the additional format. + """ + + 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/data/src/elevenlabs/types/additional_formats.py b/data/src/elevenlabs/types/additional_formats.py new file mode 100644 index 0000000000000000000000000000000000000000..f2a5f5e1071a592845c589376b4d89ce60516902 --- /dev/null +++ b/data/src/elevenlabs/types/additional_formats.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .export_options import ExportOptions + +AdditionalFormats = typing.List[ExportOptions] diff --git a/data/src/elevenlabs/types/adhoc_agent_config_override_for_test_request_model.py b/data/src/elevenlabs/types/adhoc_agent_config_override_for_test_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d742c2236f149f087fd1b81ac971e1bb2701a7eb --- /dev/null +++ b/data/src/elevenlabs/types/adhoc_agent_config_override_for_test_request_model.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_platform_settings_request_model import AgentPlatformSettingsRequestModel +from .agent_workflow_request_model import AgentWorkflowRequestModel +from .conversational_config import ConversationalConfig + + +class AdhocAgentConfigOverrideForTestRequestModel(UncheckedBaseModel): + conversation_config: ConversationalConfig + platform_settings: AgentPlatformSettingsRequestModel + workflow: typing.Optional[AgentWorkflowRequestModel] = 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 + + +update_forward_refs(AdhocAgentConfigOverrideForTestRequestModel) diff --git a/data/src/elevenlabs/types/age.py b/data/src/elevenlabs/types/age.py new file mode 100644 index 0000000000000000000000000000000000000000..080c4d91ed7ea3ce03c7d017d3efffba019de8d0 --- /dev/null +++ b/data/src/elevenlabs/types/age.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Age = typing.Any diff --git a/data/src/elevenlabs/types/agent_analysis_items_input.py b/data/src/elevenlabs/types/agent_analysis_items_input.py new file mode 100644 index 0000000000000000000000000000000000000000..a340d1c8c381cbbb80871c85c9aeba51a308dea7 --- /dev/null +++ b/data/src/elevenlabs/types/agent_analysis_items_input.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_analysis_items_input_data_collection_item import AgentAnalysisItemsInputDataCollectionItem +from .agent_analysis_items_input_evaluation_criteria_item import AgentAnalysisItemsInputEvaluationCriteriaItem + + +class AgentAnalysisItemsInput(UncheckedBaseModel): + evaluation_criteria: typing.Optional[typing.List[AgentAnalysisItemsInputEvaluationCriteriaItem]] = None + data_collection: typing.Optional[typing.List[AgentAnalysisItemsInputDataCollectionItem]] = 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/data/src/elevenlabs/types/agent_analysis_items_input_data_collection_item.py b/data/src/elevenlabs/types/agent_analysis_items_input_data_collection_item.py new file mode 100644 index 0000000000000000000000000000000000000000..8f6342e42faab4988902e2c37c66056923cef37b --- /dev/null +++ b/data/src/elevenlabs/types/agent_analysis_items_input_data_collection_item.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .analysis_scope import AnalysisScope +from .system_data_collection_id import SystemDataCollectionId + + +class AgentAnalysisItemsInputDataCollectionItem_System(UncheckedBaseModel): + source: typing.Literal["system"] = "system" + analysis_item_id: SystemDataCollectionId = "__system_data_collection_topic" + scope: typing.Optional[AnalysisScope] = 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 + + +class AgentAnalysisItemsInputDataCollectionItem_User(UncheckedBaseModel): + source: typing.Literal["user"] = "user" + analysis_item_id: str + version_id: typing.Optional[str] = None + scope: typing.Optional[AnalysisScope] = 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 + + +AgentAnalysisItemsInputDataCollectionItem = typing_extensions.Annotated[ + typing.Union[AgentAnalysisItemsInputDataCollectionItem_System, AgentAnalysisItemsInputDataCollectionItem_User], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/types/agent_analysis_items_input_evaluation_criteria_item.py b/data/src/elevenlabs/types/agent_analysis_items_input_evaluation_criteria_item.py new file mode 100644 index 0000000000000000000000000000000000000000..4e2a5cf75173ff0d05b3ab3723ad5de58a132c72 --- /dev/null +++ b/data/src/elevenlabs/types/agent_analysis_items_input_evaluation_criteria_item.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .analysis_scope import AnalysisScope +from .system_evaluation_id import SystemEvaluationId + + +class AgentAnalysisItemsInputEvaluationCriteriaItem_System(UncheckedBaseModel): + source: typing.Literal["system"] = "system" + analysis_item_id: SystemEvaluationId + scope: typing.Optional[AnalysisScope] = None + weight: 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 + + +class AgentAnalysisItemsInputEvaluationCriteriaItem_User(UncheckedBaseModel): + source: typing.Literal["user"] = "user" + analysis_item_id: str + version_id: typing.Optional[str] = None + additional_version_ids: typing.Optional[typing.List[str]] = None + scope: typing.Optional[AnalysisScope] = None + weight: 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 + + +AgentAnalysisItemsInputEvaluationCriteriaItem = typing_extensions.Annotated[ + typing.Union[ + AgentAnalysisItemsInputEvaluationCriteriaItem_System, AgentAnalysisItemsInputEvaluationCriteriaItem_User + ], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/types/agent_analysis_items_output.py b/data/src/elevenlabs/types/agent_analysis_items_output.py new file mode 100644 index 0000000000000000000000000000000000000000..c3c336546d2e364a61682680bc7db6eeb9283d82 --- /dev/null +++ b/data/src/elevenlabs/types/agent_analysis_items_output.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_analysis_items_output_data_collection_item import AgentAnalysisItemsOutputDataCollectionItem +from .agent_analysis_items_output_evaluation_criteria_item import AgentAnalysisItemsOutputEvaluationCriteriaItem + + +class AgentAnalysisItemsOutput(UncheckedBaseModel): + evaluation_criteria: typing.Optional[typing.List[AgentAnalysisItemsOutputEvaluationCriteriaItem]] = None + data_collection: typing.Optional[typing.List[AgentAnalysisItemsOutputDataCollectionItem]] = 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/data/src/elevenlabs/types/agent_analysis_items_output_data_collection_item.py b/data/src/elevenlabs/types/agent_analysis_items_output_data_collection_item.py new file mode 100644 index 0000000000000000000000000000000000000000..c61fa6fcc39e163fe6bcb3ab05e26d736f1879c6 --- /dev/null +++ b/data/src/elevenlabs/types/agent_analysis_items_output_data_collection_item.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .analysis_scope import AnalysisScope +from .system_data_collection_id import SystemDataCollectionId + + +class AgentAnalysisItemsOutputDataCollectionItem_System(UncheckedBaseModel): + source: typing.Literal["system"] = "system" + analysis_item_id: SystemDataCollectionId = "__system_data_collection_topic" + scope: typing.Optional[AnalysisScope] = 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 + + +class AgentAnalysisItemsOutputDataCollectionItem_User(UncheckedBaseModel): + source: typing.Literal["user"] = "user" + analysis_item_id: str + version_id: typing.Optional[str] = None + scope: typing.Optional[AnalysisScope] = 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 + + +AgentAnalysisItemsOutputDataCollectionItem = typing_extensions.Annotated[ + typing.Union[AgentAnalysisItemsOutputDataCollectionItem_System, AgentAnalysisItemsOutputDataCollectionItem_User], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/types/agent_analysis_items_output_evaluation_criteria_item.py b/data/src/elevenlabs/types/agent_analysis_items_output_evaluation_criteria_item.py new file mode 100644 index 0000000000000000000000000000000000000000..1409317777804ab5eaf39e0a946b75ea55462f45 --- /dev/null +++ b/data/src/elevenlabs/types/agent_analysis_items_output_evaluation_criteria_item.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .analysis_scope import AnalysisScope +from .system_evaluation_id import SystemEvaluationId + + +class AgentAnalysisItemsOutputEvaluationCriteriaItem_System(UncheckedBaseModel): + source: typing.Literal["system"] = "system" + analysis_item_id: SystemEvaluationId + scope: typing.Optional[AnalysisScope] = None + weight: 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 + + +class AgentAnalysisItemsOutputEvaluationCriteriaItem_User(UncheckedBaseModel): + source: typing.Literal["user"] = "user" + analysis_item_id: str + version_id: typing.Optional[str] = None + additional_version_ids: typing.Optional[typing.List[str]] = None + scope: typing.Optional[AnalysisScope] = None + weight: 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 + + +AgentAnalysisItemsOutputEvaluationCriteriaItem = typing_extensions.Annotated[ + typing.Union[ + AgentAnalysisItemsOutputEvaluationCriteriaItem_System, AgentAnalysisItemsOutputEvaluationCriteriaItem_User + ], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/types/agent_branch_basic_info.py b/data/src/elevenlabs/types/agent_branch_basic_info.py new file mode 100644 index 0000000000000000000000000000000000000000..6bd0d32b86c901157d1464a8db540cd18a166598 --- /dev/null +++ b/data/src/elevenlabs/types/agent_branch_basic_info.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentBranchBasicInfo(UncheckedBaseModel): + id: str + 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/data/src/elevenlabs/types/agent_branch_response.py b/data/src/elevenlabs/types/agent_branch_response.py new file mode 100644 index 0000000000000000000000000000000000000000..09dc76f2c3ef1e2deb9e9fdceb1d62e874e925ee --- /dev/null +++ b/data/src/elevenlabs/types/agent_branch_response.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_branch_basic_info import AgentBranchBasicInfo +from .agent_version_metadata import AgentVersionMetadata +from .branch_protection_status import BranchProtectionStatus +from .resource_access_info import ResourceAccessInfo + + +class AgentBranchResponse(UncheckedBaseModel): + id: str + name: str + agent_id: str + description: str + created_at: int + last_committed_at: int + is_archived: bool + protection_status: typing.Optional[BranchProtectionStatus] = None + auto_rebase: typing.Optional[bool] = None + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + Access information for the branch + """ + + current_live_percentage: typing.Optional[float] = pydantic.Field(default=None) + """ + Percentage of traffic live on the branch + """ + + parent_branch: typing.Optional[AgentBranchBasicInfo] = pydantic.Field(default=None) + """ + Parent branch of the branch + """ + + most_recent_versions: typing.Optional[typing.List[AgentVersionMetadata]] = pydantic.Field(default=None) + """ + Most recent versions on the branch + """ + + 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/data/src/elevenlabs/types/agent_branch_summary.py b/data/src/elevenlabs/types/agent_branch_summary.py new file mode 100644 index 0000000000000000000000000000000000000000..19e55cac517cd6e505735967dc2d4cfe3d138a57 --- /dev/null +++ b/data/src/elevenlabs/types/agent_branch_summary.py @@ -0,0 +1,81 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .branch_protection_status import BranchProtectionStatus +from .resource_access_info import ResourceAccessInfo + + +class AgentBranchSummary(UncheckedBaseModel): + id: str + name: str + agent_id: str + description: str + created_at: int + last_committed_at: int + is_archived: bool + protection_status: typing.Optional[BranchProtectionStatus] = None + auto_rebase: typing.Optional[bool] = None + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + Access information for the branch + """ + + current_live_percentage: typing.Optional[float] = pydantic.Field(default=None) + """ + Percentage of traffic live on the branch + """ + + parent_branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the parent branch + """ + + draft_exists: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether a draft exists for the branch + """ + + draft_created_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Unix seconds when the caller's draft on this branch was first created, or null when they have no draft. A draft created before last_committed_at was written against a config the branch has since moved past, so it may not reflect the current one. + """ + + draft_is_behind_tip: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the caller's draft on this branch was created before the branch's last commit, meaning it was written against a config the branch has since moved past and may not reflect the current one. + """ + + calls_7_d: typing_extensions.Annotated[ + typing.Optional[int], + FieldMetadata(alias="calls_7d"), + pydantic.Field(alias="calls_7d", description="Number of calls in the last 7 days"), + ] = None + commits_ahead: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of commits on this branch not yet on main, relative to their common ancestor. Null if it could not be computed (e.g. no common ancestor, or the branch history exceeds the comparison budget). + """ + + commits_behind: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of commits on main not yet incorporated into this branch, relative to their common ancestor. Null if it could not be computed (e.g. no common ancestor, or the branch history exceeds the comparison budget). + """ + + merged_into_branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the branch this branch's tip version was merged into, if any + """ + + 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/data/src/elevenlabs/types/agent_call_limits.py b/data/src/elevenlabs/types/agent_call_limits.py new file mode 100644 index 0000000000000000000000000000000000000000..248b79e85991462ee64e0a15eb5103cbc1dbd8f2 --- /dev/null +++ b/data/src/elevenlabs/types/agent_call_limits.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentCallLimits(UncheckedBaseModel): + agent_concurrency_limit: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum number of concurrent conversations. -1 indicates that there is no maximum + """ + + daily_limit: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum number of conversations per day + """ + + bursting_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable bursting. If true, exceeding workspace concurrency limit will be allowed up to 3 times the limit. Calls will be charged at double rate when exceeding the limit. + """ + + 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/data/src/elevenlabs/types/agent_config.py b/data/src/elevenlabs/types/agent_config.py new file mode 100644 index 0000000000000000000000000000000000000000..27393755c358b10d71567759b1533f85e2660739 --- /dev/null +++ b/data/src/elevenlabs/types/agent_config.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .behavior_override import BehaviorOverride +from .prompt_agent_api_model_output import PromptAgentApiModelOutput + + +class AgentConfig(UncheckedBaseModel): + first_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the first message the agent will say. If empty, the agent waits for the user to start the discussion. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Language of the agent - used for ASR and TTS + """ + + hinglish_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, the agent mixes English words and phrases into responses in Hindi, Malayalam, Telugu, or Kannada. + """ + + dynamic_variables: typing.Optional[typing.Any] = None + disable_first_message_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, the user will not be able to interrupt the agent while the first message is being delivered. + """ + + max_conversation_duration_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the message the agent will send when max conversation duration is reached. + """ + + text_behavior_overrides: typing.Optional[typing.Dict[str, typing.Optional[BehaviorOverride]]] = pydantic.Field( + default=None + ) + """ + Per-channel response behavior overrides for text conversations. Built-in channel defaults apply when unset. + """ + + prompt: typing.Optional[PromptAgentApiModelOutput] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + 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 + + +update_forward_refs(AgentConfig) diff --git a/data/src/elevenlabs/types/agent_config_api_model_workflow_override_input.py b/data/src/elevenlabs/types/agent_config_api_model_workflow_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..e8eb60ab4ea4fbfd1dc68a2d7185159dbae6b130 --- /dev/null +++ b/data/src/elevenlabs/types/agent_config_api_model_workflow_override_input.py @@ -0,0 +1,68 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .behavior_override import BehaviorOverride +from .dynamic_variables_config_workflow_override import DynamicVariablesConfigWorkflowOverride +from .prompt_agent_api_model_workflow_override_input import PromptAgentApiModelWorkflowOverrideInput + + +class AgentConfigApiModelWorkflowOverrideInput(UncheckedBaseModel): + first_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the first message the agent will say. If empty, the agent waits for the user to start the discussion. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Language of the agent - used for ASR and TTS + """ + + hinglish_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, the agent mixes English words and phrases into responses in Hindi, Malayalam, Telugu, or Kannada. + """ + + dynamic_variables: typing.Optional[DynamicVariablesConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for dynamic variables + """ + + disable_first_message_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, the user will not be able to interrupt the agent while the first message is being delivered. + """ + + max_conversation_duration_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the message the agent will send when max conversation duration is reached. + """ + + text_behavior_overrides: typing.Optional[typing.Dict[str, typing.Optional[BehaviorOverride]]] = pydantic.Field( + default=None + ) + """ + Per-channel response behavior overrides for text conversations. Built-in channel defaults apply when unset. + """ + + prompt: typing.Optional[PromptAgentApiModelWorkflowOverrideInput] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + 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 + + +update_forward_refs(AgentConfigApiModelWorkflowOverrideInput) diff --git a/data/src/elevenlabs/types/agent_config_api_model_workflow_override_output.py b/data/src/elevenlabs/types/agent_config_api_model_workflow_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..fc0b66a270b4047a1bbcbc18bb3c9c27dff4066a --- /dev/null +++ b/data/src/elevenlabs/types/agent_config_api_model_workflow_override_output.py @@ -0,0 +1,68 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .behavior_override import BehaviorOverride +from .dynamic_variables_config_workflow_override import DynamicVariablesConfigWorkflowOverride +from .prompt_agent_api_model_workflow_override_output import PromptAgentApiModelWorkflowOverrideOutput + + +class AgentConfigApiModelWorkflowOverrideOutput(UncheckedBaseModel): + first_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the first message the agent will say. If empty, the agent waits for the user to start the discussion. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Language of the agent - used for ASR and TTS + """ + + hinglish_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, the agent mixes English words and phrases into responses in Hindi, Malayalam, Telugu, or Kannada. + """ + + dynamic_variables: typing.Optional[DynamicVariablesConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for dynamic variables + """ + + disable_first_message_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, the user will not be able to interrupt the agent while the first message is being delivered. + """ + + max_conversation_duration_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the message the agent will send when max conversation duration is reached. + """ + + text_behavior_overrides: typing.Optional[typing.Dict[str, typing.Optional[BehaviorOverride]]] = pydantic.Field( + default=None + ) + """ + Per-channel response behavior overrides for text conversations. Built-in channel defaults apply when unset. + """ + + prompt: typing.Optional[PromptAgentApiModelWorkflowOverrideOutput] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + 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 + + +update_forward_refs(AgentConfigApiModelWorkflowOverrideOutput) diff --git a/data/src/elevenlabs/types/agent_config_override_config.py b/data/src/elevenlabs/types/agent_config_override_config.py new file mode 100644 index 0000000000000000000000000000000000000000..643211f6622a5db22918a6bc7bd623265a22ac69 --- /dev/null +++ b/data/src/elevenlabs/types/agent_config_override_config.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .prompt_agent_api_model_override_config import PromptAgentApiModelOverrideConfig + + +class AgentConfigOverrideConfig(UncheckedBaseModel): + first_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the first_message field. + """ + + language: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the language field. + """ + + max_conversation_duration_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the max_conversation_duration_message field. + """ + + prompt: typing.Optional[PromptAgentApiModelOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + 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/data/src/elevenlabs/types/agent_config_override_input.py b/data/src/elevenlabs/types/agent_config_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..7af9716dfc4d21b4245e7a79161fbd4e730b451c --- /dev/null +++ b/data/src/elevenlabs/types/agent_config_override_input.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .prompt_agent_api_model_override_input import PromptAgentApiModelOverrideInput + + +class AgentConfigOverrideInput(UncheckedBaseModel): + first_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the first message the agent will say. If empty, the agent waits for the user to start the discussion. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Language of the agent - used for ASR and TTS + """ + + max_conversation_duration_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the message the agent will send when max conversation duration is reached. + """ + + prompt: typing.Optional[PromptAgentApiModelOverrideInput] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + 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/data/src/elevenlabs/types/agent_config_override_output.py b/data/src/elevenlabs/types/agent_config_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..b2ca2030e4347e5c912e1723e608d4563060598e --- /dev/null +++ b/data/src/elevenlabs/types/agent_config_override_output.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .prompt_agent_api_model_override_output import PromptAgentApiModelOverrideOutput + + +class AgentConfigOverrideOutput(UncheckedBaseModel): + first_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the first message the agent will say. If empty, the agent waits for the user to start the discussion. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Language of the agent - used for ASR and TTS + """ + + max_conversation_duration_message: typing.Optional[str] = pydantic.Field(default=None) + """ + If non-empty, the message the agent will send when max conversation duration is reached. + """ + + prompt: typing.Optional[PromptAgentApiModelOverrideOutput] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + 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/data/src/elevenlabs/types/agent_conversation_ticket_issue_type.py b/data/src/elevenlabs/types/agent_conversation_ticket_issue_type.py new file mode 100644 index 0000000000000000000000000000000000000000..46751665a932778df484cba750eca3d324321f79 --- /dev/null +++ b/data/src/elevenlabs/types/agent_conversation_ticket_issue_type.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentConversationTicketIssueType = typing.Union[ + typing.Literal[ + "knowledge_gap", + "incorrect_information", + "documentation_gap", + "product_feedback", + "platform_bug", + "tool_issue", + "missing_tool", + "unnecessary_escalation", + "wrong_action", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/agent_conversation_ticket_priority.py b/data/src/elevenlabs/types/agent_conversation_ticket_priority.py new file mode 100644 index 0000000000000000000000000000000000000000..ebfdba175ecc21c361aaf424790b26cb89e8dbfd --- /dev/null +++ b/data/src/elevenlabs/types/agent_conversation_ticket_priority.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentConversationTicketPriority = typing.Union[typing.Literal["low", "medium", "high", "urgent"], typing.Any] diff --git a/data/src/elevenlabs/types/agent_conversation_ticket_response_model.py b/data/src/elevenlabs/types/agent_conversation_ticket_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f7eb261af32344d9decbf17bea961cdcc9fcc76a --- /dev/null +++ b/data/src/elevenlabs/types/agent_conversation_ticket_response_model.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_conversation_ticket_issue_type import AgentConversationTicketIssueType +from .agent_conversation_ticket_priority import AgentConversationTicketPriority +from .agent_conversation_ticket_source import AgentConversationTicketSource +from .agent_conversation_ticket_status import AgentConversationTicketStatus +from .ticket_comment_response_model import TicketCommentResponseModel +from .ticket_priority_change_response_model import TicketPriorityChangeResponseModel +from .ticket_search_match_response_model import TicketSearchMatchResponseModel +from .ticket_status_change_response_model import TicketStatusChangeResponseModel +from .turn_comment_response_model import TurnCommentResponseModel + + +class AgentConversationTicketResponseModel(UncheckedBaseModel): + agentqa_ticket_id: str + workspace_id: str + owner_user_id: str + agent_id: str + needs_clustering: bool + title: typing.Optional[str] = pydantic.Field(default=None) + """ + One-line headline for the ticket. None only on tickets created before titles existed. + """ + + issue_type: typing.Optional[AgentConversationTicketIssueType] = None + labels: typing.List[str] + conversation_ids: typing.List[str] + first_seen_unix_secs: typing.Optional[int] = None + last_seen_unix_secs: typing.Optional[int] = None + qa_comment: typing.Optional[str] = None + ticket_comments: typing.List[TicketCommentResponseModel] + turn_comments: typing.List[TurnCommentResponseModel] + status: AgentConversationTicketStatus + priority: typing.Optional[AgentConversationTicketPriority] = None + priority_changes: typing.List[TicketPriorityChangeResponseModel] + status_changes: typing.List[TicketStatusChangeResponseModel] + merged_into_ticket_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ticket this one was merged into, set while its status is 'merged'. + """ + + source: AgentConversationTicketSource + assignee_user_id: typing.Optional[str] = None + created_at_unix_secs: int + updated_at_unix_secs: int + search_match: typing.Optional[TicketSearchMatchResponseModel] = pydantic.Field(default=None) + """ + Where the list's `search` query matched. Set only on searched lists. + """ + + 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/data/src/elevenlabs/types/agent_conversation_ticket_sort_by.py b/data/src/elevenlabs/types/agent_conversation_ticket_sort_by.py new file mode 100644 index 0000000000000000000000000000000000000000..197c4e7a935a4008662aec05353e4dbd0621e25c --- /dev/null +++ b/data/src/elevenlabs/types/agent_conversation_ticket_sort_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentConversationTicketSortBy = typing.Union[typing.Literal["created_at", "priority"], typing.Any] diff --git a/data/src/elevenlabs/types/agent_conversation_ticket_source.py b/data/src/elevenlabs/types/agent_conversation_ticket_source.py new file mode 100644 index 0000000000000000000000000000000000000000..f543a70e22e0909055d64239907392c63c3b878c --- /dev/null +++ b/data/src/elevenlabs/types/agent_conversation_ticket_source.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentConversationTicketSource = typing.Union[typing.Literal["qa", "agent", "manual"], typing.Any] diff --git a/data/src/elevenlabs/types/agent_conversation_ticket_status.py b/data/src/elevenlabs/types/agent_conversation_ticket_status.py new file mode 100644 index 0000000000000000000000000000000000000000..cc42f709a6d9fc276afd37cb5412a33f3740eb40 --- /dev/null +++ b/data/src/elevenlabs/types/agent_conversation_ticket_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentConversationTicketStatus = typing.Union[ + typing.Literal["open", "in_progress", "resolved", "cancelled", "merged"], typing.Any +] diff --git a/data/src/elevenlabs/types/agent_definition_source.py b/data/src/elevenlabs/types/agent_definition_source.py new file mode 100644 index 0000000000000000000000000000000000000000..d4584e08a61c82a03cba472a8bfd69599f5229b7 --- /dev/null +++ b/data/src/elevenlabs/types/agent_definition_source.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentDefinitionSource = typing.Union[typing.Literal["cli", "ui", "api", "template", "unknown"], typing.Any] diff --git a/data/src/elevenlabs/types/agent_deployment_history_item.py b/data/src/elevenlabs/types/agent_deployment_history_item.py new file mode 100644 index 0000000000000000000000000000000000000000..f624bf2683084d5e9ac60b577e9f8519325f1ab8 --- /dev/null +++ b/data/src/elevenlabs/types/agent_deployment_history_item.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_deployment_source import AgentDeploymentSource +from .resource_access_info import ResourceAccessInfo + + +class AgentDeploymentHistoryItem(UncheckedBaseModel): + id: str = pydantic.Field() + """ + ID of the deployment + """ + + traffic_percentage_branch_id_map: typing.Optional[typing.Dict[str, float]] = pydantic.Field(default=None) + """ + Map of branch IDs to traffic percentages + """ + + deployed_at_unix_secs: int = pydantic.Field() + """ + Unix timestamp of when the traffic split was applied + """ + + is_active: bool = pydantic.Field() + """ + Whether this is the live traffic split + """ + + source: typing.Optional[AgentDeploymentSource] = pydantic.Field(default=None) + """ + What caused this traffic split change. Null for deployments created before this was recorded. + """ + + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + Access information for the deployment, including who created it + """ + + 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/data/src/elevenlabs/types/agent_deployment_percentage_strategy.py b/data/src/elevenlabs/types/agent_deployment_percentage_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..f9f9f79c7fe4acc69c282099d15bf293711619ed --- /dev/null +++ b/data/src/elevenlabs/types/agent_deployment_percentage_strategy.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentDeploymentPercentageStrategy(UncheckedBaseModel): + type: typing.Optional[typing.Literal["percentage"]] = None + traffic_percentage: float = pydantic.Field() + """ + Traffic percentage to deploy + """ + + 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/data/src/elevenlabs/types/agent_deployment_request.py b/data/src/elevenlabs/types/agent_deployment_request.py new file mode 100644 index 0000000000000000000000000000000000000000..8daba621cc2661c3ede716ae1b9da52c5a3b979e --- /dev/null +++ b/data/src/elevenlabs/types/agent_deployment_request.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_deployment_request_item import AgentDeploymentRequestItem + + +class AgentDeploymentRequest(UncheckedBaseModel): + requests: typing.List[AgentDeploymentRequestItem] = pydantic.Field() + """ + List of deployment requests + """ + + 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/data/src/elevenlabs/types/agent_deployment_request_item.py b/data/src/elevenlabs/types/agent_deployment_request_item.py new file mode 100644 index 0000000000000000000000000000000000000000..a86acdf32df4548fb8056806ec41eea52b5bdaea --- /dev/null +++ b/data/src/elevenlabs/types/agent_deployment_request_item.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_deployment_percentage_strategy import AgentDeploymentPercentageStrategy + + +class AgentDeploymentRequestItem(UncheckedBaseModel): + branch_id: str = pydantic.Field() + """ + ID of the branch to deploy + """ + + deployment_strategy: AgentDeploymentPercentageStrategy + + 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/data/src/elevenlabs/types/agent_deployment_response.py b/data/src/elevenlabs/types/agent_deployment_response.py new file mode 100644 index 0000000000000000000000000000000000000000..77cde1237d001252c635bf8783733e30da03b33d --- /dev/null +++ b/data/src/elevenlabs/types/agent_deployment_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentDeploymentResponse(UncheckedBaseModel): + traffic_percentage_branch_id_map: typing.Optional[typing.Dict[str, float]] = pydantic.Field(default=None) + """ + Map of branch IDs to traffic percentages + """ + + 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/data/src/elevenlabs/types/agent_deployment_source.py b/data/src/elevenlabs/types/agent_deployment_source.py new file mode 100644 index 0000000000000000000000000000000000000000..f9edd72d7549609f128bc3350cbd78a6400623b0 --- /dev/null +++ b/data/src/elevenlabs/types/agent_deployment_source.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentDeploymentSource = typing.Union[typing.Literal["manual", "branch_merge"], typing.Any] diff --git a/data/src/elevenlabs/types/agent_failure_response_example.py b/data/src/elevenlabs/types/agent_failure_response_example.py new file mode 100644 index 0000000000000000000000000000000000000000..2229e81c29cae37b050a593313a08f172d3ca7c1 --- /dev/null +++ b/data/src/elevenlabs/types/agent_failure_response_example.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentFailureResponseExample(UncheckedBaseModel): + response: str + type: typing.Literal["failure"] = "failure" + + 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/data/src/elevenlabs/types/agent_hold_audio_config.py b/data/src/elevenlabs/types/agent_hold_audio_config.py new file mode 100644 index 0000000000000000000000000000000000000000..66f0ca7cec8e39a721bebe88610d9cb38f4d8330 --- /dev/null +++ b/data/src/elevenlabs/types/agent_hold_audio_config.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentHoldAudioConfig(UncheckedBaseModel): + """ + Custom hold audio played on loop to callers waiting in the agent's queue. + + Set by uploading a file through the agent hold-audio endpoint. Values sent in + agent create or update requests are ignored. + """ + + audio_path: str = pydantic.Field() + """ + Storage path of the uploaded clip + """ + + audio_url: str = pydantic.Field() + """ + Public CDN URL of the uploaded clip + """ + + original_filename: str = pydantic.Field() + """ + Filename of the uploaded clip as provided by the user + """ + + duration_secs: float = pydantic.Field() + """ + Duration of the uploaded clip in seconds + """ + + size_bytes: int = pydantic.Field() + """ + Size of the uploaded clip in bytes + """ + + 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/data/src/elevenlabs/types/agent_knowledge_base_rag_chunk_response_model.py b/data/src/elevenlabs/types/agent_knowledge_base_rag_chunk_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..73119f08bead27928868fe50249cede3a1469fd9 --- /dev/null +++ b/data/src/elevenlabs/types/agent_knowledge_base_rag_chunk_response_model.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_format import ContentFormat +from .knowledge_base_document_type import KnowledgeBaseDocumentType + + +class AgentKnowledgeBaseRagChunkResponseModel(UncheckedBaseModel): + document_id: str = pydantic.Field() + """ + ID of the source knowledge base document. + """ + + document_name: str = pydantic.Field() + """ + Name of the source knowledge base document. + """ + + source_url: typing.Optional[str] = pydantic.Field(default=None) + """ + Tracked source URL for URL documents, or null for other document types. + """ + + chunk_id: str = pydantic.Field() + """ + ID of the retrieved chunk. + """ + + text: str = pydantic.Field() + """ + Text content of the retrieved chunk. + """ + + vector_distance: typing.Optional[float] = pydantic.Field(default=None) + """ + Similarity distance when exposed by the retrieval strategy. + """ + + content_format: ContentFormat = pydantic.Field() + """ + Format of the chunk text. Markdown chunks contain raw markdown; HTML chunks contain HTML. + """ + + document_type: KnowledgeBaseDocumentType = pydantic.Field() + """ + Type of the source knowledge base document. + """ + + 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/data/src/elevenlabs/types/agent_knowledge_base_rag_query_request_model.py b/data/src/elevenlabs/types/agent_knowledge_base_rag_query_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..91e14644e349c56f83389b4bd47ad3d13268ec70 --- /dev/null +++ b/data/src/elevenlabs/types/agent_knowledge_base_rag_query_request_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentKnowledgeBaseRagQueryRequestModel(UncheckedBaseModel): + query: str = pydantic.Field() + """ + Query to run against the agent's knowledge base RAG index. + """ + + use_agent_defaults: typing.Optional[bool] = pydantic.Field(default=None) + """ + When true (the default), retrieval uses the agent's own RAG settings, reproducing exactly what the agent would retrieve. Set to false to retrieve with neutral default RAG settings instead (the agent's embedding model is always kept, since it determines which vector index exists). Useful for auditing the knowledge base independently of how a particular agent is tuned. + """ + + max_documents_length: typing.Optional[int] = pydantic.Field(default=None) + """ + Optional maximum total character length of document chunks returned. Overrides the selected RAG settings for this query only. + """ + + max_retrieved_rag_chunks_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Optional maximum number of document chunks retrieved. Overrides the selected RAG settings for this query only. + """ + + 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/data/src/elevenlabs/types/agent_knowledge_base_rag_query_response_model.py b/data/src/elevenlabs/types/agent_knowledge_base_rag_query_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b0d73e1a9dcd5c01d963483949c8f8962bd5ef01 --- /dev/null +++ b/data/src/elevenlabs/types/agent_knowledge_base_rag_query_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_knowledge_base_rag_chunk_response_model import AgentKnowledgeBaseRagChunkResponseModel + + +class AgentKnowledgeBaseRagQueryResponseModel(UncheckedBaseModel): + retrieval_query: str = pydantic.Field() + """ + Raw query used for retrieval (echoes the request query). + """ + + chunks: typing.List[AgentKnowledgeBaseRagChunkResponseModel] = pydantic.Field() + """ + Ranked chunks the agent would retrieve, after distance and length filtering. + """ + + 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/data/src/elevenlabs/types/agent_merge_proposal_response.py b/data/src/elevenlabs/types/agent_merge_proposal_response.py new file mode 100644 index 0000000000000000000000000000000000000000..49c5aa850c2a6ef0ae059e2b898a906e3f2c81e5 --- /dev/null +++ b/data/src/elevenlabs/types/agent_merge_proposal_response.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_merge_proposal_response_outcome import AgentMergeProposalResponseOutcome +from .merge_proposal_comment import MergeProposalComment +from .merge_proposal_review import MergeProposalReview +from .resource_access_info import ResourceAccessInfo + + +class AgentMergeProposalResponse(UncheckedBaseModel): + id: str + agent_id: str + source_branch_id: str + target_branch_id: str + source_tip_version_id_at_creation: str + title: str + description: typing.Optional[str] = None + requested_reviewer_user_ids: typing.Optional[typing.List[str]] = None + reviews: typing.Optional[typing.List[MergeProposalReview]] = None + comments: typing.Optional[typing.List[MergeProposalComment]] = None + outcome: typing.Optional[AgentMergeProposalResponseOutcome] = None + created_at: int + updated_at: int + author_user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + User ID of the merge_proposal's author. + """ + + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + Access information for the merge_proposal, including creator. + """ + + 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/data/src/elevenlabs/types/agent_merge_proposal_response_outcome.py b/data/src/elevenlabs/types/agent_merge_proposal_response_outcome.py new file mode 100644 index 0000000000000000000000000000000000000000..f8a0ac24c8dd81825b91fc380a0e53344300f87a --- /dev/null +++ b/data/src/elevenlabs/types/agent_merge_proposal_response_outcome.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .merge_proposal_close_reason import MergeProposalCloseReason + + +class AgentMergeProposalResponseOutcome_Closed(UncheckedBaseModel): + status: typing.Literal["closed"] = "closed" + reason: MergeProposalCloseReason + at: int + by_user_id: 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 + + +class AgentMergeProposalResponseOutcome_Merged(UncheckedBaseModel): + status: typing.Literal["merged"] = "merged" + version_id: str + at: int + by_user_id: 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 + + +class AgentMergeProposalResponseOutcome_Open(UncheckedBaseModel): + status: typing.Literal["open"] = "open" + + 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 + + +AgentMergeProposalResponseOutcome = typing_extensions.Annotated[ + typing.Union[ + AgentMergeProposalResponseOutcome_Closed, + AgentMergeProposalResponseOutcome_Merged, + AgentMergeProposalResponseOutcome_Open, + ], + UnionMetadata(discriminant="status"), +] diff --git a/data/src/elevenlabs/types/agent_metadata.py b/data/src/elevenlabs/types/agent_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..61853c5484d74fe41eb199e9d978240cd41ad372 --- /dev/null +++ b/data/src/elevenlabs/types/agent_metadata.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentMetadata(UncheckedBaseModel): + agent_id: str + branch_id: typing.Optional[str] = None + workflow_node_id: typing.Optional[str] = None + version_id: 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/data/src/elevenlabs/types/agent_metadata_db_model.py b/data/src/elevenlabs/types/agent_metadata_db_model.py new file mode 100644 index 0000000000000000000000000000000000000000..cb5eb9189789251e903d72f31b982dd2d825915a --- /dev/null +++ b/data/src/elevenlabs/types/agent_metadata_db_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_definition_source import AgentDefinitionSource + + +class AgentMetadataDbModel(UncheckedBaseModel): + created_at_unix_secs: int + updated_at_unix_secs: int + created_from: typing.Optional[AgentDefinitionSource] = None + last_updated_from: typing.Optional[AgentDefinitionSource] = 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/data/src/elevenlabs/types/agent_metadata_response_model.py b/data/src/elevenlabs/types/agent_metadata_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8ed3bcf9bf8cd03160d9927783263c94574dea3a --- /dev/null +++ b/data/src/elevenlabs/types/agent_metadata_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentMetadataResponseModel(UncheckedBaseModel): + created_at_unix_secs: int = pydantic.Field() + """ + The creation time of the agent in unix seconds + """ + + updated_at_unix_secs: int = pydantic.Field() + """ + The last update time of the agent in unix seconds + """ + + 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/data/src/elevenlabs/types/agent_platform_settings_request_model.py b/data/src/elevenlabs/types/agent_platform_settings_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..96c862c2aa7f0d7f39238053eac237aa72736cc2 --- /dev/null +++ b/data/src/elevenlabs/types/agent_platform_settings_request_model.py @@ -0,0 +1,141 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_analysis_items_input import AgentAnalysisItemsInput +from .agent_call_limits import AgentCallLimits +from .agent_queueing_config import AgentQueueingConfig +from .agent_testing_settings import AgentTestingSettings +from .agent_trust_context import AgentTrustContext +from .agent_workspace_overrides_input import AgentWorkspaceOverridesInput +from .alerting_settings import AlertingSettings +from .analysis_property import AnalysisProperty +from .analysis_scope import AnalysisScope +from .auth_settings import AuthSettings +from .conversation_initiation_client_data_config_input import ConversationInitiationClientDataConfigInput +from .evaluation_settings_input import EvaluationSettingsInput +from .guardrails_v_1_input import GuardrailsV1Input +from .llm import Llm +from .privacy_config_input import PrivacyConfigInput +from .sentiment_analysis_settings import SentimentAnalysisSettings +from .topic_discovery_settings import TopicDiscoverySettings +from .widget_config import WidgetConfig + + +class AgentPlatformSettingsRequestModel(UncheckedBaseModel): + evaluation: typing.Optional[EvaluationSettingsInput] = pydantic.Field(default=None) + """ + Settings for evaluation + """ + + widget: typing.Optional[WidgetConfig] = pydantic.Field(default=None) + """ + Configuration for the widget + """ + + data_collection: typing.Optional[typing.Dict[str, AnalysisProperty]] = pydantic.Field(default=None) + """ + Data collection settings + """ + + data_collection_scopes: typing.Optional[typing.Dict[str, AnalysisScope]] = pydantic.Field(default=None) + """ + Scope per data collection item ID. Missing keys default to conversation scope. + """ + + analysis_items: typing.Optional[AgentAnalysisItemsInput] = pydantic.Field(default=None) + """ + Evaluation + data-collection items attached by reference. None means the agent has not been migrated onto analysis items yet (distinct from an empty, migrated set); reads fall back to the legacy evaluation/data_collection fields in that case. + """ + + overrides: typing.Optional[ConversationInitiationClientDataConfigInput] = pydantic.Field(default=None) + """ + Additional overrides for the agent during conversation initiation + """ + + workspace_overrides: typing.Optional[AgentWorkspaceOverridesInput] = pydantic.Field(default=None) + """ + Workspace overrides for the agent + """ + + testing: typing.Optional[AgentTestingSettings] = pydantic.Field(default=None) + """ + Testing configuration for the agent + """ + + archived: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the agent is archived + """ + + guardrails: typing.Optional[GuardrailsV1Input] = pydantic.Field(default=None) + """ + Guardrails configuration for the agent + """ + + summary_language: typing.Optional[str] = pydantic.Field(default=None) + """ + Language for all conversation analysis outputs (summaries, titles, evaluation rationales, data collection rationales). If not set, the language will be inferred from the conversation. Must be one of the supported conversation languages. + """ + + auto_translate_transcript_to_app_language: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, a conversation transcript is automatically translated to the viewer's application language when they open the transcript page. If not set or false, transcripts are shown in their original language unless the viewer manually selects a translation. + """ + + auth: typing.Optional[AuthSettings] = pydantic.Field(default=None) + """ + Settings for authentication + """ + + call_limits: typing.Optional[AgentCallLimits] = pydantic.Field(default=None) + """ + Call limits for the agent + """ + + queueing_config: typing.Optional[AgentQueueingConfig] = pydantic.Field(default=None) + """ + Concurrency wait-queue config for the agent + """ + + privacy: typing.Optional[PrivacyConfigInput] = pydantic.Field(default=None) + """ + Privacy settings for the agent + """ + + trust_context: typing.Optional[AgentTrustContext] = pydantic.Field(default=None) + """ + The trust context in which the agent operates. + """ + + analysis_llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + Default LLM model for post-call analysis (evaluation and data collection) + """ + + topic_discovery: typing.Optional[TopicDiscoverySettings] = pydantic.Field(default=None) + """ + Per-agent topic discovery configuration + """ + + sentiment_analysis: typing.Optional[SentimentAnalysisSettings] = pydantic.Field(default=None) + """ + Per-agent post-call sentiment analysis configuration + """ + + alerting: typing.Optional[AlertingSettings] = pydantic.Field(default=None) + """ + Agent-level alerting configuration overriding workspace settings. + """ + + 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/data/src/elevenlabs/types/agent_platform_settings_response_model.py b/data/src/elevenlabs/types/agent_platform_settings_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..345e52d091b8b1f30bfff476834793ed9f4db8b6 --- /dev/null +++ b/data/src/elevenlabs/types/agent_platform_settings_response_model.py @@ -0,0 +1,144 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_analysis_items_output import AgentAnalysisItemsOutput +from .agent_call_limits import AgentCallLimits +from .agent_queueing_config import AgentQueueingConfig +from .agent_testing_settings import AgentTestingSettings +from .agent_trust_context import AgentTrustContext +from .agent_workspace_overrides_output import AgentWorkspaceOverridesOutput +from .alerting_settings_response import AlertingSettingsResponse +from .analysis_property import AnalysisProperty +from .analysis_scope import AnalysisScope +from .auth_settings import AuthSettings +from .conversation_initiation_client_data_config_output import ConversationInitiationClientDataConfigOutput +from .evaluation_settings_output import EvaluationSettingsOutput +from .guardrails_v_1_output import GuardrailsV1Output +from .llm import Llm +from .privacy_config_output import PrivacyConfigOutput +from .safety_response_model import SafetyResponseModel +from .sentiment_analysis_settings import SentimentAnalysisSettings +from .topic_discovery_settings import TopicDiscoverySettings +from .widget_config import WidgetConfig + + +class AgentPlatformSettingsResponseModel(UncheckedBaseModel): + evaluation: typing.Optional[EvaluationSettingsOutput] = pydantic.Field(default=None) + """ + Settings for evaluation + """ + + widget: typing.Optional[WidgetConfig] = pydantic.Field(default=None) + """ + Configuration for the widget + """ + + data_collection: typing.Optional[typing.Dict[str, AnalysisProperty]] = pydantic.Field(default=None) + """ + Data collection settings + """ + + data_collection_scopes: typing.Optional[typing.Dict[str, AnalysisScope]] = pydantic.Field(default=None) + """ + Scope per data collection item ID. Missing keys default to conversation scope. + """ + + analysis_items: typing.Optional[AgentAnalysisItemsOutput] = pydantic.Field(default=None) + """ + Evaluation + data-collection items attached by reference. None means the agent has not been migrated onto analysis items yet (distinct from an empty, migrated set); reads fall back to the legacy evaluation/data_collection fields in that case. + """ + + overrides: typing.Optional[ConversationInitiationClientDataConfigOutput] = pydantic.Field(default=None) + """ + Additional overrides for the agent during conversation initiation + """ + + workspace_overrides: typing.Optional[AgentWorkspaceOverridesOutput] = pydantic.Field(default=None) + """ + Workspace overrides for the agent + """ + + testing: typing.Optional[AgentTestingSettings] = pydantic.Field(default=None) + """ + Testing configuration for the agent + """ + + archived: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the agent is archived + """ + + guardrails: typing.Optional[GuardrailsV1Output] = pydantic.Field(default=None) + """ + Guardrails configuration for the agent + """ + + summary_language: typing.Optional[str] = pydantic.Field(default=None) + """ + Language for all conversation analysis outputs (summaries, titles, evaluation rationales, data collection rationales). If not set, the language will be inferred from the conversation. Must be one of the supported conversation languages. + """ + + auto_translate_transcript_to_app_language: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, a conversation transcript is automatically translated to the viewer's application language when they open the transcript page. If not set or false, transcripts are shown in their original language unless the viewer manually selects a translation. + """ + + auth: typing.Optional[AuthSettings] = pydantic.Field(default=None) + """ + Settings for authentication + """ + + call_limits: typing.Optional[AgentCallLimits] = pydantic.Field(default=None) + """ + Call limits for the agent + """ + + queueing_config: typing.Optional[AgentQueueingConfig] = pydantic.Field(default=None) + """ + Concurrency wait-queue config for the agent + """ + + privacy: typing.Optional[PrivacyConfigOutput] = pydantic.Field(default=None) + """ + Privacy settings for the agent + """ + + trust_context: typing.Optional[AgentTrustContext] = pydantic.Field(default=None) + """ + The trust context in which the agent operates. + """ + + analysis_llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + Default LLM model for post-call analysis (evaluation and data collection) + """ + + topic_discovery: typing.Optional[TopicDiscoverySettings] = pydantic.Field(default=None) + """ + Per-agent topic discovery configuration + """ + + sentiment_analysis: typing.Optional[SentimentAnalysisSettings] = pydantic.Field(default=None) + """ + Per-agent post-call sentiment analysis configuration + """ + + alerting: typing.Optional[AlertingSettingsResponse] = pydantic.Field(default=None) + """ + Agent-level alerting configuration overriding workspace settings. + """ + + safety: typing.Optional[SafetyResponseModel] = 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/data/src/elevenlabs/types/agent_queueing_config.py b/data/src/elevenlabs/types/agent_queueing_config.py new file mode 100644 index 0000000000000000000000000000000000000000..e5cd6a0cd5c5923c70f774a455e4170e2e0570dd --- /dev/null +++ b/data/src/elevenlabs/types/agent_queueing_config.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_hold_audio_config import AgentHoldAudioConfig + + +class AgentQueueingConfig(UncheckedBaseModel): + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Hold callers in a wait queue when the agent is at its concurrency limit, instead of rejecting them immediately. New agents are created with queueing enabled unless this field is set explicitly. + """ + + wait_timeout_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum time a caller can wait in the queue before being rejected + """ + + hold_audio: typing.Optional[AgentHoldAudioConfig] = pydantic.Field(default=None) + """ + Custom hold audio played to queued callers; when unset, callers hear the default hold tone. Read-only: set it by uploading a file through the agent hold-audio endpoint. + """ + + 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/data/src/elevenlabs/types/agent_response_payload.py b/data/src/elevenlabs/types/agent_response_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..f73109733d72fc0bbeba60ebb84a5529469cd093 --- /dev/null +++ b/data/src/elevenlabs/types/agent_response_payload.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentResponsePayload(UncheckedBaseModel): + """ + Text chunk sent from your server to ElevenLabs for speech synthesis. + Stream LLM output by sending multiple messages with `is_final: false`, then + terminate the response with a message where `is_final: true` and `content` is + an empty string. + """ + + type: typing.Literal["agent_response"] = pydantic.Field(default="agent_response") + """ + The message type identifier. + """ + + content: str = pydantic.Field() + """ + The text to synthesize. For streaming responses, send incremental chunks here. + The final message in a response must have an empty string (`""`). + """ + + event_id: typing.Optional[int] = pydantic.Field(default=None) + """ + The `event_id` from the `user_transcript` this response addresses. ElevenLabs + uses this to discard responses that belong to an interrupted turn. + """ + + is_final: bool = pydantic.Field() + """ + Set to `true` on the last message of a response (with an empty `content`). + Set to `false` on all preceding chunks. + """ + + 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/data/src/elevenlabs/types/agent_simulated_chat_test_response_model.py b/data/src/elevenlabs/types/agent_simulated_chat_test_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..651262fe45d8b3cb0ff056af1db3bd9cc6148189 --- /dev/null +++ b/data/src/elevenlabs/types/agent_simulated_chat_test_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_analysis_common_model import ConversationHistoryAnalysisCommonModel +from .conversation_history_transcript_response_model import ConversationHistoryTranscriptResponseModel + + +class AgentSimulatedChatTestResponseModel(UncheckedBaseModel): + simulated_conversation: typing.List[ConversationHistoryTranscriptResponseModel] + analysis: ConversationHistoryAnalysisCommonModel + + 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 + + +update_forward_refs(AgentSimulatedChatTestResponseModel) diff --git a/data/src/elevenlabs/types/agent_smb_metadata.py b/data/src/elevenlabs/types/agent_smb_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..294fd36f7e441ed11c1c5fc18be23e11f2d546bb --- /dev/null +++ b/data/src/elevenlabs/types/agent_smb_metadata.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .smb_agent_type import SmbAgentType + + +class AgentSmbMetadata(UncheckedBaseModel): + """ + Identifies an agent as part of the SMB product. + """ + + agent_type: SmbAgentType = pydantic.Field() + """ + Distinguishes between the customer-facing voice agent and the internal assistant agent. + """ + + is_ephemeral: typing.Optional[bool] = pydantic.Field(default=None) + """ + True for pre-signup onboarding agents that have not yet been transferred to a user workspace. + """ + + source_fingerprint: typing.Optional[str] = pydantic.Field(default=None) + """ + Hash of the SMB data+code inputs this agent was last regenerated against; the conversation-start drift gate. None (unstamped) regenerates once on the next conversation. + """ + + 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/data/src/elevenlabs/types/agent_sort_by.py b/data/src/elevenlabs/types/agent_sort_by.py new file mode 100644 index 0000000000000000000000000000000000000000..5abb23dec93d84cf6ac438c449da63087b9916cc --- /dev/null +++ b/data/src/elevenlabs/types/agent_sort_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentSortBy = typing.Union[typing.Literal["name", "created_at", "updated_at", "call_count_7d"], typing.Any] diff --git a/data/src/elevenlabs/types/agent_successful_response_example.py b/data/src/elevenlabs/types/agent_successful_response_example.py new file mode 100644 index 0000000000000000000000000000000000000000..4dd5da048d4c1e279932ad3946e210f33abc95f8 --- /dev/null +++ b/data/src/elevenlabs/types/agent_successful_response_example.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentSuccessfulResponseExample(UncheckedBaseModel): + response: str + type: typing.Literal["success"] = "success" + + 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/data/src/elevenlabs/types/agent_summary_batch_successful_response_model.py b/data/src/elevenlabs/types/agent_summary_batch_successful_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9ff3b40ade99f7d5013719c6aeb33c25c7e33a2b --- /dev/null +++ b/data/src/elevenlabs/types/agent_summary_batch_successful_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_summary_response_model import AgentSummaryResponseModel + + +class AgentSummaryBatchSuccessfulResponseModel(UncheckedBaseModel): + data: AgentSummaryResponseModel + + 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/data/src/elevenlabs/types/agent_summary_response_model.py b/data/src/elevenlabs/types/agent_summary_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ec0bb8ac997c65291ee37f8e5a1bc70dd59cf28 --- /dev/null +++ b/data/src/elevenlabs/types/agent_summary_response_model.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .resource_access_info import ResourceAccessInfo + + +class AgentSummaryResponseModel(UncheckedBaseModel): + agent_id: str = pydantic.Field() + """ + The ID of the agent + """ + + name: str = pydantic.Field() + """ + The name of the agent + """ + + voice_id: str = pydantic.Field() + """ + Voice ID assigned to this agent + """ + + tags: typing.List[str] = pydantic.Field() + """ + Agent tags used to categorize the agent + """ + + created_at_unix_secs: int = pydantic.Field() + """ + The creation time of the agent in unix seconds + """ + + updated_at_unix_secs: int = pydantic.Field() + """ + The last time the agent's main branch or agent-level settings were updated, in unix seconds + """ + + access_info: ResourceAccessInfo = pydantic.Field() + """ + The access information of the agent + """ + + last_call_time_unix_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The time of the most recent call in unix seconds, null if no calls have been made + """ + + archived: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the agent is archived + """ + + 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/data/src/elevenlabs/types/agent_test_entity_type.py b/data/src/elevenlabs/types/agent_test_entity_type.py new file mode 100644 index 0000000000000000000000000000000000000000..5807d026bd2c6950aac2a798d673e8903aed80b2 --- /dev/null +++ b/data/src/elevenlabs/types/agent_test_entity_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentTestEntityType = typing.Union[typing.Literal["test", "folder"], typing.Any] diff --git a/data/src/elevenlabs/types/agent_test_folder_path_segment_response_model.py b/data/src/elevenlabs/types/agent_test_folder_path_segment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b0c7a9d9819c4d2f6e348570fe2469cab2532617 --- /dev/null +++ b/data/src/elevenlabs/types/agent_test_folder_path_segment_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentTestFolderPathSegmentResponseModel(UncheckedBaseModel): + id: str + name: 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/data/src/elevenlabs/types/agent_testing_settings.py b/data/src/elevenlabs/types/agent_testing_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..6427a4754910ccbcc60df4528a7886f7396edc6d --- /dev/null +++ b/data/src/elevenlabs/types/agent_testing_settings.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .attached_test_model import AttachedTestModel + + +class AgentTestingSettings(UncheckedBaseModel): + """ + Settings for agent testing configuration. + """ + + attached_tests: typing.Optional[typing.List[AttachedTestModel]] = pydantic.Field(default=None) + """ + List of test IDs that should be run for this agent + """ + + 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/data/src/elevenlabs/types/agent_topic_response_model.py b/data/src/elevenlabs/types/agent_topic_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d3cf404a25bfbd534494ad04247a499166fb6cd3 --- /dev/null +++ b/data/src/elevenlabs/types/agent_topic_response_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .topic_metrics_aggregate import TopicMetricsAggregate + + +class AgentTopicResponseModel(UncheckedBaseModel): + topic_id: str + label: str + description: str + conversation_count: int + parent_topic_id: typing.Optional[str] = None + x_2_d: typing_extensions.Annotated[ + typing.Optional[float], FieldMetadata(alias="x_2d"), pydantic.Field(alias="x_2d") + ] = None + y_2_d: typing_extensions.Annotated[ + typing.Optional[float], FieldMetadata(alias="y_2d"), pydantic.Field(alias="y_2d") + ] = None + metrics: typing.Optional[TopicMetricsAggregate] = None + success_rate: typing.Optional[float] = pydantic.Field(default=None) + """ + Success rate across the topic's evaluation criteria, weighted by scored conversations. Returned regardless of include_evaluation_criteria. + """ + + 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/data/src/elevenlabs/types/agent_transfer_input.py b/data/src/elevenlabs/types/agent_transfer_input.py new file mode 100644 index 0000000000000000000000000000000000000000..6819efecbc53d2ffc553f8986770e608fb8f2f3f --- /dev/null +++ b/data/src/elevenlabs/types/agent_transfer_input.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentTransferInput(UncheckedBaseModel): + agent_id: typing.Optional[str] = None + branch_id: typing.Optional[str] = None + node_id: typing.Optional[str] = None + condition: str + delay_ms: typing.Optional[int] = None + transfer_message: typing.Optional[str] = None + enable_transferred_agent_first_message: typing.Optional[bool] = None + is_workflow_node_transfer: typing.Optional[bool] = None + preserve_client_tts_overrides: typing.Optional[bool] = pydantic.Field(default=None) + """ + Defines whether TTS client overrides should be carried over to the transferred agent. + """ + + preserve_voice_settings: typing.Optional[bool] = pydantic.Field(default=None) + """ + Defines whether the base voice, TTS model and voice settings should be carried over to the transferred agent. + """ + + 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/data/src/elevenlabs/types/agent_transfer_op.py b/data/src/elevenlabs/types/agent_transfer_op.py new file mode 100644 index 0000000000000000000000000000000000000000..458434de5319f50d1a6ec6c5450e4d4f43c80097 --- /dev/null +++ b/data/src/elevenlabs/types/agent_transfer_op.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class AgentTransferOp_Pop(UncheckedBaseModel): + type: typing.Literal["pop"] = "pop" + + 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 + + +class AgentTransferOp_Push(UncheckedBaseModel): + type: typing.Literal["push"] = "push" + return_node_id: 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 + + +class AgentTransferOp_Replace(UncheckedBaseModel): + type: typing.Literal["replace"] = "replace" + + 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 + + +AgentTransferOp = typing_extensions.Annotated[ + typing.Union[AgentTransferOp_Pop, AgentTransferOp_Push, AgentTransferOp_Replace], UnionMetadata(discriminant="type") +] diff --git a/data/src/elevenlabs/types/agent_transfer_op_pop.py b/data/src/elevenlabs/types/agent_transfer_op_pop.py new file mode 100644 index 0000000000000000000000000000000000000000..4c74b531c9ec13f476823586443c0029697d639e --- /dev/null +++ b/data/src/elevenlabs/types/agent_transfer_op_pop.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentTransferOpPop(UncheckedBaseModel): + 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/data/src/elevenlabs/types/agent_transfer_op_push.py b/data/src/elevenlabs/types/agent_transfer_op_push.py new file mode 100644 index 0000000000000000000000000000000000000000..6070e5532432f4af1b528196c43432f9f8622226 --- /dev/null +++ b/data/src/elevenlabs/types/agent_transfer_op_push.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentTransferOpPush(UncheckedBaseModel): + return_node_id: 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/data/src/elevenlabs/types/agent_transfer_op_replace.py b/data/src/elevenlabs/types/agent_transfer_op_replace.py new file mode 100644 index 0000000000000000000000000000000000000000..e5403666d42a2bc916d344943dc1d7184329ecae --- /dev/null +++ b/data/src/elevenlabs/types/agent_transfer_op_replace.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentTransferOpReplace(UncheckedBaseModel): + 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/data/src/elevenlabs/types/agent_transfer_output.py b/data/src/elevenlabs/types/agent_transfer_output.py new file mode 100644 index 0000000000000000000000000000000000000000..044f8f36c3cef1452f7cde8a3e06eda38def6b91 --- /dev/null +++ b/data/src/elevenlabs/types/agent_transfer_output.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentTransferOutput(UncheckedBaseModel): + agent_id: typing.Optional[str] = None + branch_id: typing.Optional[str] = None + node_id: typing.Optional[str] = None + condition: str + delay_ms: typing.Optional[int] = None + transfer_message: typing.Optional[str] = None + enable_transferred_agent_first_message: typing.Optional[bool] = None + is_workflow_node_transfer: typing.Optional[bool] = None + preserve_client_tts_overrides: typing.Optional[bool] = pydantic.Field(default=None) + """ + Defines whether TTS client overrides should be carried over to the transferred agent. + """ + + preserve_voice_settings: typing.Optional[bool] = pydantic.Field(default=None) + """ + Defines whether the base voice, TTS model and voice settings should be carried over to the transferred agent. + """ + + 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/data/src/elevenlabs/types/agent_trust_context.py b/data/src/elevenlabs/types/agent_trust_context.py new file mode 100644 index 0000000000000000000000000000000000000000..4e3eecbadbb22ba53784f857899c83212c0b3c7b --- /dev/null +++ b/data/src/elevenlabs/types/agent_trust_context.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AgentTrustContext = typing.Union[typing.Literal["unknown", "low", "high"], typing.Any] diff --git a/data/src/elevenlabs/types/agent_version_metadata.py b/data/src/elevenlabs/types/agent_version_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..6538b2e0a5f12f6b3dac8d1ea81a5f4e86c1f284 --- /dev/null +++ b/data/src/elevenlabs/types/agent_version_metadata.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_version_parents import AgentVersionParents +from .resource_access_info import ResourceAccessInfo + + +class AgentVersionMetadata(UncheckedBaseModel): + id: str + agent_id: str + branch_id: str + version_description: str + seq_no_in_branch: int + time_committed_secs: int + parents: AgentVersionParents + access_info: typing.Optional[ResourceAccessInfo] = None + merged_authors: typing.Optional[typing.List[ResourceAccessInfo]] = pydantic.Field(default=None) + """ + For a merge into the main branch, the people who published the merged changes on the source branch (access_info is whoever ran the merge). Null when not recorded. + """ + + 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/data/src/elevenlabs/types/agent_version_parents.py b/data/src/elevenlabs/types/agent_version_parents.py new file mode 100644 index 0000000000000000000000000000000000000000..09931fdcd09512d4116711fc199f34c4577a5ff0 --- /dev/null +++ b/data/src/elevenlabs/types/agent_version_parents.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AgentVersionParents(UncheckedBaseModel): + in_branch_parent_id: typing.Optional[str] = None + out_of_branch_parent_id: typing.Optional[str] = None + merged_into_branch_id: typing.Optional[str] = None + merged_from_branch_id: typing.Optional[str] = None + merged_from_version_id: typing.Optional[str] = None + rebased_from_version_id: 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/data/src/elevenlabs/types/agent_workflow_request_model.py b/data/src/elevenlabs/types/agent_workflow_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f088bec97775b0cea642a1d4e4b30157f59c533f --- /dev/null +++ b/data/src/elevenlabs/types/agent_workflow_request_model.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_workflow_request_model_nodes_value import AgentWorkflowRequestModelNodesValue +from .workflow_edge_model_input import WorkflowEdgeModelInput + + +class AgentWorkflowRequestModel(UncheckedBaseModel): + edges: typing.Optional[typing.Dict[str, WorkflowEdgeModelInput]] = None + nodes: typing.Optional[typing.Dict[str, AgentWorkflowRequestModelNodesValue]] = None + prevent_subagent_loops: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to prevent loops in the workflow execution. + """ + + 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 + + +update_forward_refs(AgentWorkflowRequestModel) diff --git a/data/src/elevenlabs/types/agent_workflow_request_model_nodes_value.py b/data/src/elevenlabs/types/agent_workflow_request_model_nodes_value.py new file mode 100644 index 0000000000000000000000000000000000000000..8e5b74f78c8ed36f7d161336d236f6e5b4d4dc8a --- /dev/null +++ b/data/src/elevenlabs/types/agent_workflow_request_model_nodes_value.py @@ -0,0 +1,197 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .conversational_config_api_model_workflow_override_input import ConversationalConfigApiModelWorkflowOverrideInput +from .entry_behavior import EntryBehavior +from .knowledge_base_locator import KnowledgeBaseLocator +from .position_input import PositionInput +from .transfer_type_enum import TransferTypeEnum +from .uui_transfer_config import UuiTransferConfig +from .workflow_end_node_outcome import WorkflowEndNodeOutcome +from .workflow_phone_number_node_model_input_custom_sip_headers_item import ( + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem, +) +from .workflow_phone_number_node_model_input_post_dial_digits import WorkflowPhoneNumberNodeModelInputPostDialDigits +from .workflow_phone_number_node_model_input_transfer_destination import ( + WorkflowPhoneNumberNodeModelInputTransferDestination, +) +from .workflow_say_node_model_input_message import WorkflowSayNodeModelInputMessage +from .workflow_state_update_input import WorkflowStateUpdateInput +from .workflow_tool_locator import WorkflowToolLocator + + +class AgentWorkflowRequestModelNodesValue_End(UncheckedBaseModel): + type: typing.Literal["end"] = "end" + position: typing.Optional[PositionInput] = None + edge_order: typing.Optional[typing.List[str]] = None + outcome: typing.Optional[WorkflowEndNodeOutcome] = 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 + + +class AgentWorkflowRequestModelNodesValue_OverrideAgent(UncheckedBaseModel): + type: typing.Literal["override_agent"] = "override_agent" + position: typing.Optional[PositionInput] = None + edge_order: typing.Optional[typing.List[str]] = None + conversation_config: typing.Optional[ConversationalConfigApiModelWorkflowOverrideInput] = None + additional_prompt: typing.Optional[str] = None + additional_knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = None + additional_tool_ids: typing.Optional[typing.List[str]] = None + label: str + entry_behavior: typing.Optional[EntryBehavior] = 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 + + +class AgentWorkflowRequestModelNodesValue_PhoneNumber(UncheckedBaseModel): + type: typing.Literal["phone_number"] = "phone_number" + custom_sip_headers: typing.Optional[typing.List[WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem]] = None + transfer_destination: WorkflowPhoneNumberNodeModelInputTransferDestination + transfer_type: typing.Optional[TransferTypeEnum] = None + sip_refer_play_dialtone: typing.Optional[bool] = None + uui: typing.Optional[UuiTransferConfig] = None + post_dial_digits: typing.Optional[WorkflowPhoneNumberNodeModelInputPostDialDigits] = None + position: typing.Optional[PositionInput] = None + edge_order: typing.Optional[typing.List[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 + + +class AgentWorkflowRequestModelNodesValue_StandaloneAgent(UncheckedBaseModel): + type: typing.Literal["standalone_agent"] = "standalone_agent" + position: typing.Optional[PositionInput] = None + edge_order: typing.Optional[typing.List[str]] = None + agent_id: typing.Optional[str] = None + branch_id: typing.Optional[str] = None + node_id: typing.Optional[str] = None + delay_ms: typing.Optional[int] = None + transfer_message: typing.Optional[str] = None + enable_transferred_agent_first_message: typing.Optional[bool] = None + preserve_client_tts_overrides: typing.Optional[bool] = None + preserve_voice_settings: 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 + + +class AgentWorkflowRequestModelNodesValue_Start(UncheckedBaseModel): + type: typing.Literal["start"] = "start" + position: typing.Optional[PositionInput] = None + edge_order: typing.Optional[typing.List[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 + + +class AgentWorkflowRequestModelNodesValue_Tool(UncheckedBaseModel): + type: typing.Literal["tool"] = "tool" + position: typing.Optional[PositionInput] = None + edge_order: typing.Optional[typing.List[str]] = None + tools: typing.Optional[typing.List[WorkflowToolLocator]] = 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 + + +class AgentWorkflowRequestModelNodesValue_Say(UncheckedBaseModel): + type: typing.Literal["say"] = "say" + position: typing.Optional[PositionInput] = None + edge_order: typing.Optional[typing.List[str]] = None + conversation_config: typing.Optional[ConversationalConfigApiModelWorkflowOverrideInput] = None + additional_prompt: typing.Optional[str] = None + additional_knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = None + additional_tool_ids: typing.Optional[typing.List[str]] = None + label: str + message: WorkflowSayNodeModelInputMessage + wait_for_speech_completion: typing.Optional[bool] = None + wait_for_user_response: 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 + + +class AgentWorkflowRequestModelNodesValue_UpdateState(UncheckedBaseModel): + type: typing.Literal["update_state"] = "update_state" + position: typing.Optional[PositionInput] = None + edge_order: typing.Optional[typing.List[str]] = None + label: str + updates: typing.List[WorkflowStateUpdateInput] + + 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 + + +AgentWorkflowRequestModelNodesValue = typing_extensions.Annotated[ + typing.Union[ + AgentWorkflowRequestModelNodesValue_End, + AgentWorkflowRequestModelNodesValue_OverrideAgent, + AgentWorkflowRequestModelNodesValue_PhoneNumber, + AgentWorkflowRequestModelNodesValue_StandaloneAgent, + AgentWorkflowRequestModelNodesValue_Start, + AgentWorkflowRequestModelNodesValue_Tool, + AgentWorkflowRequestModelNodesValue_Say, + AgentWorkflowRequestModelNodesValue_UpdateState, + ], + UnionMetadata(discriminant="type"), +] +update_forward_refs(AgentWorkflowRequestModelNodesValue_OverrideAgent) +update_forward_refs(AgentWorkflowRequestModelNodesValue_Say) +update_forward_refs(AgentWorkflowRequestModelNodesValue_UpdateState) diff --git a/data/src/elevenlabs/types/agent_workflow_response_model.py b/data/src/elevenlabs/types/agent_workflow_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b7531ac1a8b23ce14fd5dc3d56cfd71cc12a483e --- /dev/null +++ b/data/src/elevenlabs/types/agent_workflow_response_model.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_workflow_response_model_nodes_value import AgentWorkflowResponseModelNodesValue +from .workflow_edge_model_output import WorkflowEdgeModelOutput + + +class AgentWorkflowResponseModel(UncheckedBaseModel): + edges: typing.Dict[str, WorkflowEdgeModelOutput] + nodes: typing.Dict[str, AgentWorkflowResponseModelNodesValue] + prevent_subagent_loops: bool = pydantic.Field() + """ + Whether to prevent loops in the workflow execution. + """ + + 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 + + +update_forward_refs(AgentWorkflowResponseModel) diff --git a/data/src/elevenlabs/types/agent_workflow_response_model_nodes_value.py b/data/src/elevenlabs/types/agent_workflow_response_model_nodes_value.py new file mode 100644 index 0000000000000000000000000000000000000000..a1f8b3d0478ea1dc036a35deebe5e526a99fee15 --- /dev/null +++ b/data/src/elevenlabs/types/agent_workflow_response_model_nodes_value.py @@ -0,0 +1,197 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .conversational_config_api_model_workflow_override_output import ConversationalConfigApiModelWorkflowOverrideOutput +from .entry_behavior import EntryBehavior +from .knowledge_base_locator import KnowledgeBaseLocator +from .position_output import PositionOutput +from .transfer_type_enum import TransferTypeEnum +from .uui_transfer_config import UuiTransferConfig +from .workflow_end_node_outcome import WorkflowEndNodeOutcome +from .workflow_phone_number_node_model_output_custom_sip_headers_item import ( + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem, +) +from .workflow_phone_number_node_model_output_post_dial_digits import WorkflowPhoneNumberNodeModelOutputPostDialDigits +from .workflow_phone_number_node_model_output_transfer_destination import ( + WorkflowPhoneNumberNodeModelOutputTransferDestination, +) +from .workflow_say_node_model_output_message import WorkflowSayNodeModelOutputMessage +from .workflow_state_update_output import WorkflowStateUpdateOutput +from .workflow_tool_locator import WorkflowToolLocator + + +class AgentWorkflowResponseModelNodesValue_End(UncheckedBaseModel): + type: typing.Literal["end"] = "end" + position: PositionOutput + edge_order: typing.List[str] + outcome: WorkflowEndNodeOutcome + + 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 + + +class AgentWorkflowResponseModelNodesValue_OverrideAgent(UncheckedBaseModel): + type: typing.Literal["override_agent"] = "override_agent" + position: PositionOutput + edge_order: typing.List[str] + conversation_config: ConversationalConfigApiModelWorkflowOverrideOutput + additional_prompt: str + additional_knowledge_base: typing.List[KnowledgeBaseLocator] + additional_tool_ids: typing.List[str] + label: str + entry_behavior: EntryBehavior + + 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 + + +class AgentWorkflowResponseModelNodesValue_PhoneNumber(UncheckedBaseModel): + type: typing.Literal["phone_number"] = "phone_number" + custom_sip_headers: typing.List[WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem] + transfer_destination: WorkflowPhoneNumberNodeModelOutputTransferDestination + transfer_type: TransferTypeEnum + sip_refer_play_dialtone: bool + uui: typing.Optional[UuiTransferConfig] = None + post_dial_digits: typing.Optional[WorkflowPhoneNumberNodeModelOutputPostDialDigits] = None + position: PositionOutput + edge_order: typing.List[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 + + +class AgentWorkflowResponseModelNodesValue_StandaloneAgent(UncheckedBaseModel): + type: typing.Literal["standalone_agent"] = "standalone_agent" + position: PositionOutput + edge_order: typing.List[str] + agent_id: typing.Optional[str] = None + branch_id: typing.Optional[str] = None + node_id: typing.Optional[str] = None + delay_ms: int + transfer_message: typing.Optional[str] = None + enable_transferred_agent_first_message: bool + preserve_client_tts_overrides: bool + preserve_voice_settings: bool + + 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 + + +class AgentWorkflowResponseModelNodesValue_Start(UncheckedBaseModel): + type: typing.Literal["start"] = "start" + position: PositionOutput + edge_order: typing.List[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 + + +class AgentWorkflowResponseModelNodesValue_Tool(UncheckedBaseModel): + type: typing.Literal["tool"] = "tool" + position: PositionOutput + edge_order: typing.List[str] + tools: typing.List[WorkflowToolLocator] + + 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 + + +class AgentWorkflowResponseModelNodesValue_Say(UncheckedBaseModel): + type: typing.Literal["say"] = "say" + position: PositionOutput + edge_order: typing.List[str] + conversation_config: ConversationalConfigApiModelWorkflowOverrideOutput + additional_prompt: str + additional_knowledge_base: typing.List[KnowledgeBaseLocator] + additional_tool_ids: typing.List[str] + label: str + message: WorkflowSayNodeModelOutputMessage + wait_for_speech_completion: bool + wait_for_user_response: bool + + 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 + + +class AgentWorkflowResponseModelNodesValue_UpdateState(UncheckedBaseModel): + type: typing.Literal["update_state"] = "update_state" + position: PositionOutput + edge_order: typing.List[str] + label: str + updates: typing.List[WorkflowStateUpdateOutput] + + 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 + + +AgentWorkflowResponseModelNodesValue = typing_extensions.Annotated[ + typing.Union[ + AgentWorkflowResponseModelNodesValue_End, + AgentWorkflowResponseModelNodesValue_OverrideAgent, + AgentWorkflowResponseModelNodesValue_PhoneNumber, + AgentWorkflowResponseModelNodesValue_StandaloneAgent, + AgentWorkflowResponseModelNodesValue_Start, + AgentWorkflowResponseModelNodesValue_Tool, + AgentWorkflowResponseModelNodesValue_Say, + AgentWorkflowResponseModelNodesValue_UpdateState, + ], + UnionMetadata(discriminant="type"), +] +update_forward_refs(AgentWorkflowResponseModelNodesValue_OverrideAgent) +update_forward_refs(AgentWorkflowResponseModelNodesValue_Say) +update_forward_refs(AgentWorkflowResponseModelNodesValue_UpdateState) diff --git a/data/src/elevenlabs/types/agent_workspace_overrides_input.py b/data/src/elevenlabs/types/agent_workspace_overrides_input.py new file mode 100644 index 0000000000000000000000000000000000000000..565dc821c961ff183175ab7a94854655d27d7e35 --- /dev/null +++ b/data/src/elevenlabs/types/agent_workspace_overrides_input.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conv_ai_webhooks import ConvAiWebhooks +from .conversation_initiation_client_data_webhook import ConversationInitiationClientDataWebhook + + +class AgentWorkspaceOverridesInput(UncheckedBaseModel): + conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = ( + pydantic.Field(default=None) + ) + """ + The webhook to send conversation initiation client data to + """ + + webhooks: typing.Optional[ConvAiWebhooks] = 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/data/src/elevenlabs/types/agent_workspace_overrides_output.py b/data/src/elevenlabs/types/agent_workspace_overrides_output.py new file mode 100644 index 0000000000000000000000000000000000000000..99d64da3765c0dc386867a9e06daf1c9e80f8b1f --- /dev/null +++ b/data/src/elevenlabs/types/agent_workspace_overrides_output.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conv_ai_webhooks import ConvAiWebhooks +from .conversation_initiation_client_data_webhook import ConversationInitiationClientDataWebhook + + +class AgentWorkspaceOverridesOutput(UncheckedBaseModel): + conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = ( + pydantic.Field(default=None) + ) + """ + The webhook to send conversation initiation client data to + """ + + webhooks: typing.Optional[ConvAiWebhooks] = 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/data/src/elevenlabs/types/alerting_integration_notifier.py b/data/src/elevenlabs/types/alerting_integration_notifier.py new file mode 100644 index 0000000000000000000000000000000000000000..544bf3d053b4c2da383175bea27c7770db58634c --- /dev/null +++ b/data/src/elevenlabs/types/alerting_integration_notifier.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .alerting_integration_notifier_integration_type import AlertingIntegrationNotifierIntegrationType + + +class AlertingIntegrationNotifier(UncheckedBaseModel): + integration_type: typing.Optional[AlertingIntegrationNotifierIntegrationType] = pydantic.Field(default=None) + """ + Integration to deliver to. The server treats an omitted value as ``pagerduty``. + """ + + connection_id: str = pydantic.Field() + """ + ID of the workspace integration connection to deliver alert lifecycle notifications to. The connection's integration must have the monitoring capability and match ``integration_type``. + """ + + channel_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the Slack channel to post alert notifications to, e.g. ``C0123456789``. Required when ``integration_type`` is ``slack``. The Slack app must be a member of the channel and have the ``chat:write`` scope, or ``chat:write.public`` for public channels it has not joined. + """ + + 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/data/src/elevenlabs/types/alerting_integration_notifier_integration_type.py b/data/src/elevenlabs/types/alerting_integration_notifier_integration_type.py new file mode 100644 index 0000000000000000000000000000000000000000..def70704acf9e4d751e902e0e90fcddcd2b6fc26 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_integration_notifier_integration_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AlertingIntegrationNotifierIntegrationType = typing.Union[typing.Literal["pagerduty", "slack"], typing.Any] diff --git a/data/src/elevenlabs/types/alerting_integration_notifier_response.py b/data/src/elevenlabs/types/alerting_integration_notifier_response.py new file mode 100644 index 0000000000000000000000000000000000000000..e9d9266faca59ce0657f2f85e484f99b1374c9c5 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_integration_notifier_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .alerting_integration_notifier_response_integration_type import AlertingIntegrationNotifierResponseIntegrationType + + +class AlertingIntegrationNotifierResponse(UncheckedBaseModel): + integration_type: typing.Optional[AlertingIntegrationNotifierResponseIntegrationType] = None + connection_id: str + channel_id: 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/data/src/elevenlabs/types/alerting_integration_notifier_response_integration_type.py b/data/src/elevenlabs/types/alerting_integration_notifier_response_integration_type.py new file mode 100644 index 0000000000000000000000000000000000000000..22d733aff2785d6c64b97063bdfffefaebd514d1 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_integration_notifier_response_integration_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AlertingIntegrationNotifierResponseIntegrationType = typing.Union[typing.Literal["pagerduty", "slack"], typing.Any] diff --git a/data/src/elevenlabs/types/alerting_monitor_config.py b/data/src/elevenlabs/types/alerting_monitor_config.py new file mode 100644 index 0000000000000000000000000000000000000000..41f4d0e671e1feed524ca576182d1267c7494843 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_monitor_config.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingMonitorConfig(UncheckedBaseModel): + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether this monitor is enabled and can notify + """ + + threshold: typing.Optional[float] = pydantic.Field(default=None) + """ + Failure rate threshold at which this monitor can notify. + """ + + relative_increase_threshold: typing.Optional[float] = pydantic.Field(default=None) + """ + Relative increase over the trailing baseline at which this monitor can notify (0.2 = 20% above baseline, 0 = any failure). For conversation_volume_drop it is the share of the usual volume that must be missing, between 0.1 and 0.9 (0.5 = half). + """ + + min_failure_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum failures in the window before this monitor can fire. + """ + + min_history_bucket_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum trailing buckets with traffic before spike detection can fire. + """ + + min_sample_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum samples in the window before this monitor can fire. + """ + + suspect_trigger_threshold: typing.Optional[int] = pydantic.Field(default=None) + """ + How many suspect buckets within the lookback window are required to promote a suspect to an alert. + """ + + auto_resolve_after_inactive_minutes: typing.Optional[int] = pydantic.Field(default=None) + """ + How many minutes an alert can stay inactive before it is auto-resolved. + """ + + 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/data/src/elevenlabs/types/alerting_pager_duty_notifier.py b/data/src/elevenlabs/types/alerting_pager_duty_notifier.py new file mode 100644 index 0000000000000000000000000000000000000000..9f68b34982c77f8e33950e8a46a6cde10a09321f --- /dev/null +++ b/data/src/elevenlabs/types/alerting_pager_duty_notifier.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingPagerDutyNotifier(UncheckedBaseModel): + type: typing.Optional[typing.Literal["integration"]] = None + integration_type: typing.Optional[typing.Literal["pagerduty"]] = None + connection_id: str = pydantic.Field() + """ + ID of the workspace integration connection to deliver alert lifecycle notifications to. The connection's integration must have the monitoring capability and match ``integration_type``. + """ + + 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/data/src/elevenlabs/types/alerting_pager_duty_notifier_response.py b/data/src/elevenlabs/types/alerting_pager_duty_notifier_response.py new file mode 100644 index 0000000000000000000000000000000000000000..02194541bb45c39e89b6ae8072fabd31c4aae8eb --- /dev/null +++ b/data/src/elevenlabs/types/alerting_pager_duty_notifier_response.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingPagerDutyNotifierResponse(UncheckedBaseModel): + type: typing.Optional[typing.Literal["integration"]] = None + integration_type: typing.Optional[typing.Literal["pagerduty"]] = None + connection_id: 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/data/src/elevenlabs/types/alerting_settings.py b/data/src/elevenlabs/types/alerting_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..ad1089bd5dce5a2e30fd005e73ca2c7cfd0ad7eb --- /dev/null +++ b/data/src/elevenlabs/types/alerting_settings.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .alerting_monitor_config import AlertingMonitorConfig +from .alerting_settings_notifiers_item import AlertingSettingsNotifiersItem + + +class AlertingSettings(UncheckedBaseModel): + """ + Alerting configuration used at both per-agent and per-workspace level. + Cascade order for per-monitor threshold and auto-resolve: agent → workspace → + system default. + """ + + monitor_configs: typing.Optional[typing.Dict[str, AlertingMonitorConfig]] = pydantic.Field(default=None) + """ + Alerting configuration keyed by monitor name. + """ + + auto_resolve_after_inactive_minutes: typing.Optional[int] = pydantic.Field(default=None) + """ + How many minutes an alert can stay inactive before it is auto-resolved. Unset values fall through to the next layer. + """ + + notifiers: typing.Optional[typing.List[AlertingSettingsNotifiersItem]] = pydantic.Field(default=None) + """ + Delivery channels for alert lifecycle notifications. Stacked with other layers and deduped by ``webhook_id``, PagerDuty ``connection_id``, or Slack ``(connection_id, channel_id)``. + """ + + 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/data/src/elevenlabs/types/alerting_settings_notifiers_item.py b/data/src/elevenlabs/types/alerting_settings_notifiers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..613ad13935d381264e272a7b62e20a6ae78adc45 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_settings_notifiers_item.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .alerting_integration_notifier_integration_type import AlertingIntegrationNotifierIntegrationType + + +class AlertingSettingsNotifiersItem_Webhook(UncheckedBaseModel): + type: typing.Literal["webhook"] = "webhook" + webhook_id: 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 + + +class AlertingSettingsNotifiersItem_Integration(UncheckedBaseModel): + type: typing.Literal["integration"] = "integration" + integration_type: typing.Optional[AlertingIntegrationNotifierIntegrationType] = None + connection_id: str + channel_id: 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 + + +AlertingSettingsNotifiersItem = typing_extensions.Annotated[ + typing.Union[AlertingSettingsNotifiersItem_Webhook, AlertingSettingsNotifiersItem_Integration], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/alerting_settings_response.py b/data/src/elevenlabs/types/alerting_settings_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b4765714de77b4c942717729bbce4a1eb1573799 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_settings_response.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .alerting_monitor_config import AlertingMonitorConfig +from .alerting_settings_response_notifiers_item import AlertingSettingsResponseNotifiersItem + + +class AlertingSettingsResponse(UncheckedBaseModel): + """ + Customer-facing view of alerting settings. Unlike AdminAlertingSettingsResponse, + it has no internal_notifiers field: those are ElevenLabs-internal delivery + channels whose URLs must never be returned outside the admin API. + """ + + monitor_configs: typing.Optional[typing.Dict[str, AlertingMonitorConfig]] = None + auto_resolve_after_inactive_minutes: typing.Optional[int] = None + notifiers: typing.Optional[typing.List[AlertingSettingsResponseNotifiersItem]] = 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/data/src/elevenlabs/types/alerting_settings_response_notifiers_item.py b/data/src/elevenlabs/types/alerting_settings_response_notifiers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..5107f10f7936a26bb332f55fa00097e88233b8c4 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_settings_response_notifiers_item.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .alerting_integration_notifier_response_integration_type import AlertingIntegrationNotifierResponseIntegrationType + + +class AlertingSettingsResponseNotifiersItem_Webhook(UncheckedBaseModel): + type: typing.Literal["webhook"] = "webhook" + webhook_id: 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 + + +class AlertingSettingsResponseNotifiersItem_Integration(UncheckedBaseModel): + type: typing.Literal["integration"] = "integration" + integration_type: typing.Optional[AlertingIntegrationNotifierResponseIntegrationType] = None + connection_id: str + channel_id: 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 + + +AlertingSettingsResponseNotifiersItem = typing_extensions.Annotated[ + typing.Union[AlertingSettingsResponseNotifiersItem_Webhook, AlertingSettingsResponseNotifiersItem_Integration], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/alerting_slack_notifier.py b/data/src/elevenlabs/types/alerting_slack_notifier.py new file mode 100644 index 0000000000000000000000000000000000000000..ba94a111a72907654e2e1222ebbfb9f4a09e81ee --- /dev/null +++ b/data/src/elevenlabs/types/alerting_slack_notifier.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingSlackNotifier(UncheckedBaseModel): + type: typing.Optional[typing.Literal["integration"]] = None + integration_type: typing.Optional[typing.Literal["slack"]] = None + connection_id: str = pydantic.Field() + """ + ID of the workspace integration connection to deliver alert lifecycle notifications to. The connection's integration must have the monitoring capability and match ``integration_type``. + """ + + channel_id: str = pydantic.Field() + """ + ID of the Slack channel to post alert notifications to, e.g. ``C0123456789``. The Slack app must be a member of the channel and have the ``chat:write`` scope, or ``chat:write.public`` for public channels it has not joined. + """ + + 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/data/src/elevenlabs/types/alerting_slack_notifier_response.py b/data/src/elevenlabs/types/alerting_slack_notifier_response.py new file mode 100644 index 0000000000000000000000000000000000000000..a927c99d9b762bcd571c5eab94dab91f40201475 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_slack_notifier_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingSlackNotifierResponse(UncheckedBaseModel): + type: typing.Optional[typing.Literal["integration"]] = None + integration_type: typing.Optional[typing.Literal["slack"]] = None + connection_id: str + channel_id: 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/data/src/elevenlabs/types/alerting_webhook_header.py b/data/src/elevenlabs/types/alerting_webhook_header.py new file mode 100644 index 0000000000000000000000000000000000000000..1f8fc32c8a6b1f17ab5d3c9901fab3d7cf5eaab6 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_webhook_header.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingWebhookHeader(UncheckedBaseModel): + name: str + is_secret: typing.Optional[bool] = None + value: typing.Optional[str] = pydantic.Field(default=None) + """ + Header value. May be null only for a secret header on update. + """ + + 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/data/src/elevenlabs/types/alerting_webhook_method.py b/data/src/elevenlabs/types/alerting_webhook_method.py new file mode 100644 index 0000000000000000000000000000000000000000..55a3b3dfdd0c16bf1ffe4abe588c6579a9a174b9 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_webhook_method.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AlertingWebhookMethod = typing.Union[typing.Literal["POST", "PUT"], typing.Any] diff --git a/data/src/elevenlabs/types/alerting_webhook_notifier.py b/data/src/elevenlabs/types/alerting_webhook_notifier.py new file mode 100644 index 0000000000000000000000000000000000000000..d9b1e577359d4605c6aefaa51b3a03193e3fc1bd --- /dev/null +++ b/data/src/elevenlabs/types/alerting_webhook_notifier.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingWebhookNotifier(UncheckedBaseModel): + webhook_id: str = pydantic.Field() + """ + ID of the workspace webhook to deliver alert lifecycle notifications to. + """ + + 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/data/src/elevenlabs/types/alerting_webhook_notifier_response.py b/data/src/elevenlabs/types/alerting_webhook_notifier_response.py new file mode 100644 index 0000000000000000000000000000000000000000..66be62301fb3510378856cdb3993a20e992bba04 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_webhook_notifier_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingWebhookNotifierResponse(UncheckedBaseModel): + webhook_id: 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/data/src/elevenlabs/types/alerting_webhook_secret_header_value.py b/data/src/elevenlabs/types/alerting_webhook_secret_header_value.py new file mode 100644 index 0000000000000000000000000000000000000000..a7686929ec7cedea0e5bf0193247e9eb48c2b758 --- /dev/null +++ b/data/src/elevenlabs/types/alerting_webhook_secret_header_value.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AlertingWebhookSecretHeaderValue(UncheckedBaseModel): + """ + A custom webhook header value, encrypted at rest. + """ + + encrypted_value: str + nonce: 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/data/src/elevenlabs/types/alignment.py b/data/src/elevenlabs/types/alignment.py new file mode 100644 index 0000000000000000000000000000000000000000..fb52802ddb3b817ae63924c3a7ef38338c6601be --- /dev/null +++ b/data/src/elevenlabs/types/alignment.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class Alignment(UncheckedBaseModel): + """ + Alignment information for the generated audio given the input text sequence. + """ + + char_start_times_ms: typing_extensions.Annotated[ + typing.Optional[typing.List[int]], + FieldMetadata(alias="charStartTimesMs"), + pydantic.Field( + alias="charStartTimesMs", + description="A list of starting times (in milliseconds) for each character in the text as it\ncorresponds to the audio. For instance, the character 'H' starts at time 0 ms in the audio.\nNote these times are relative to the returned chunk from the model, and not the\nfull audio response.", + ), + ] = None + char_durations_ms: typing_extensions.Annotated[ + typing.Optional[typing.List[int]], + FieldMetadata(alias="charDurationsMs"), + pydantic.Field( + alias="charDurationsMs", + description="A list of durations (in milliseconds) for each character in the text as it\ncorresponds to the audio. For instance, the character 'H' lasts for 3 ms in the audio.\nNote these times are relative to the returned chunk from the model, and not the\nfull audio response.", + ), + ] = None + chars: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of characters in the text sequence. For instance, the first character is 'H'. + Note that this list may contain spaces, punctuation, and other special characters. + The length of this list should be the same as the lengths of `charStartTimesMs` and `charDurationsMs`. + """ + + 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/data/src/elevenlabs/types/allowed_output_formats.py b/data/src/elevenlabs/types/allowed_output_formats.py new file mode 100644 index 0000000000000000000000000000000000000000..a05b3c2a447b9e68170c6f12328453849a7fcbd3 --- /dev/null +++ b/data/src/elevenlabs/types/allowed_output_formats.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AllowedOutputFormats = typing.Union[ + typing.Literal[ + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/allowed_values.py b/data/src/elevenlabs/types/allowed_values.py new file mode 100644 index 0000000000000000000000000000000000000000..29e61969629ab06428e6f906ebb43deb83a8b62c --- /dev/null +++ b/data/src/elevenlabs/types/allowed_values.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AllowedValues(UncheckedBaseModel): + dynamic_variable: str = pydantic.Field() + """ + Name of a dynamic variable that must resolve to a JSON array of permitted values, e.g. ["ws_alpha", "ws_beta"]. System variables work only if they resolve to a list. + """ + + 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/data/src/elevenlabs/types/allowlist_item.py b/data/src/elevenlabs/types/allowlist_item.py new file mode 100644 index 0000000000000000000000000000000000000000..d56277d4a5d19fd57050452dbd115ecf5ecbb93a --- /dev/null +++ b/data/src/elevenlabs/types/allowlist_item.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AllowlistItem(UncheckedBaseModel): + hostname: str = pydantic.Field() + """ + The hostname of the allowed origin + """ + + 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/data/src/elevenlabs/types/analysis_charging.py b/data/src/elevenlabs/types/analysis_charging.py new file mode 100644 index 0000000000000000000000000000000000000000..dc697ad91a189265bf0c1ba73f12105d6990f16d --- /dev/null +++ b/data/src/elevenlabs/types/analysis_charging.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .analysis_run_snapshot import AnalysisRunSnapshot +from .analysis_running_total import AnalysisRunningTotal + + +class AnalysisCharging(UncheckedBaseModel): + """ + Cost of running post-call analysis on this conversation. + Present once an analysis pass has run, billed or not. + """ + + total: AnalysisRunningTotal + last_run: AnalysisRunSnapshot + + 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/data/src/elevenlabs/types/analysis_property.py b/data/src/elevenlabs/types/analysis_property.py new file mode 100644 index 0000000000000000000000000000000000000000..0f05d57fbcdb71b1f8e73484c7c5ca0950df788a --- /dev/null +++ b/data/src/elevenlabs/types/analysis_property.py @@ -0,0 +1,80 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .allowed_values import AllowedValues +from .analysis_property_constant_value import AnalysisPropertyConstantValue +from .analysis_property_type import AnalysisPropertyType +from .llm import Llm + + +class AnalysisProperty(UncheckedBaseModel): + """ + Data collection property with optional per-item LLM override for post-call analysis. + + TODO: migrate to composition (value_schema: LiteralJsonSchemaProperty + llm) instead of + inheritance, so this generalizes cleanly to object/array schemas in the future. + """ + + type: AnalysisPropertyType + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the property. When set, the LLM will provide the value based on this description. Mutually exclusive with dynamic_variable, is_system_provided, constant_value, and is_omitted. + """ + + enum: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of allowed string values for string type parameters + """ + + is_system_provided: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, the value will be populated by the system at runtime. Used by API Integration Webhook tools for templating. Mutually exclusive with description, dynamic_variable, constant_value, and is_omitted. + """ + + dynamic_variable: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the dynamic variable to use for this property's value. Mutually exclusive with description, is_system_provided, constant_value, and is_omitted. + """ + + allowed_values: typing.Optional[AllowedValues] = pydantic.Field(default=None) + """ + Server-side rejection guard for an LLM-provided value: the runtime rejects any value outside the permitted set this object names, and the set is not advertised to the LLM as an enum. Only supported when the value source is `description`; combining it with dynamic_variable, is_system_provided, constant_value, or is_omitted is rejected. + """ + + allowed_values_dynamic_variable: typing.Optional[str] = pydantic.Field(default=None) + """ + DEPRECATED: use `allowed_values` instead. When set, the LLM provides the value but the runtime rejects any value not present in the list held by this dynamic variable (must be a JSON array such as ["ws_alpha", "ws_beta"]). Use to let the LLM pick from a server-verified set (e.g. the IDs the current user is allowed to access). Requires description; mutually exclusive with dynamic_variable, is_system_provided, constant_value, and is_omitted. + """ + + constant_value: typing.Optional[AnalysisPropertyConstantValue] = pydantic.Field(default=None) + """ + A constant value to use for this property. Mutually exclusive with description, dynamic_variable, is_system_provided, and is_omitted. + """ + + is_omitted: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, this parameter will be completely omitted from the request. Only valid for optional parameters. Mutually exclusive with description, dynamic_variable, is_system_provided, and constant_value. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of this data collection item. + """ + + llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model to use for this analysis item. If not set, uses agent's analysis_llm default. + """ + + 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/data/src/elevenlabs/types/analysis_property_constant_value.py b/data/src/elevenlabs/types/analysis_property_constant_value.py new file mode 100644 index 0000000000000000000000000000000000000000..09091ab488649297e0970b99b6ea9fd57fc0c58a --- /dev/null +++ b/data/src/elevenlabs/types/analysis_property_constant_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AnalysisPropertyConstantValue = typing.Union[str, int, float, bool] diff --git a/data/src/elevenlabs/types/analysis_property_type.py b/data/src/elevenlabs/types/analysis_property_type.py new file mode 100644 index 0000000000000000000000000000000000000000..9568ff65eb32f590ca9a0261dc4733fc58081ce3 --- /dev/null +++ b/data/src/elevenlabs/types/analysis_property_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AnalysisPropertyType = typing.Union[typing.Literal["boolean", "string", "integer", "number"], typing.Any] diff --git a/data/src/elevenlabs/types/analysis_run_snapshot.py b/data/src/elevenlabs/types/analysis_run_snapshot.py new file mode 100644 index 0000000000000000000000000000000000000000..d35ae70ce6937442bb22baaa67158c63757fb501 --- /dev/null +++ b/data/src/elevenlabs/types/analysis_run_snapshot.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AnalysisRunSnapshot(UncheckedBaseModel): + """ + LLM cost of the most recent post-call analysis pass on this conversation. + """ + + price: typing.Optional[float] = None + charge: typing.Optional[int] = None + price_per_feature: typing.Optional[typing.Dict[str, float]] = None + charge_per_feature: typing.Optional[typing.Dict[str, int]] = 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/data/src/elevenlabs/types/analysis_running_total.py b/data/src/elevenlabs/types/analysis_running_total.py new file mode 100644 index 0000000000000000000000000000000000000000..0adbdb648b2864d718521885c684674db135cecc --- /dev/null +++ b/data/src/elevenlabs/types/analysis_running_total.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AnalysisRunningTotal(UncheckedBaseModel): + """ + Cumulative LLM cost of running post-call analysis on this conversation. + """ + + price: typing.Optional[float] = None + charge: typing.Optional[int] = None + runs: typing.Optional[int] = None + price_per_feature: typing.Optional[typing.Dict[str, float]] = None + charge_per_feature: typing.Optional[typing.Dict[str, int]] = 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/data/src/elevenlabs/types/analysis_scope.py b/data/src/elevenlabs/types/analysis_scope.py new file mode 100644 index 0000000000000000000000000000000000000000..2dd0603cc72f0a1e9b43c31b7f2cf5f102a4a571 --- /dev/null +++ b/data/src/elevenlabs/types/analysis_scope.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AnalysisScope = typing.Union[typing.Literal["conversation", "agent"], typing.Any] diff --git a/data/src/elevenlabs/types/analysis_type.py b/data/src/elevenlabs/types/analysis_type.py new file mode 100644 index 0000000000000000000000000000000000000000..47933944f268d7c54eac23c0d9574207f0a0c829 --- /dev/null +++ b/data/src/elevenlabs/types/analysis_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AnalysisType = typing.Union[typing.Literal["evaluation_criteria", "data_collection"], typing.Any] diff --git a/data/src/elevenlabs/types/api_integration_o_auth_2_auth_code_response.py b/data/src/elevenlabs/types/api_integration_o_auth_2_auth_code_response.py new file mode 100644 index 0000000000000000000000000000000000000000..6517911f27d2b4a81a382f04a0489e5e593687d4 --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_o_auth_2_auth_code_response.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .api_integration_o_auth_2_auth_code_response_scope_separator import ( + ApiIntegrationOAuth2AuthCodeResponseScopeSeparator, +) +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class ApiIntegrationOAuth2AuthCodeResponse(UncheckedBaseModel): + """ + Response model for integration-managed OAuth2 Auth Code auth connections + """ + + name: str + provider: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + scope_separator: typing.Optional[ApiIntegrationOAuth2AuthCodeResponseScopeSeparator] = pydantic.Field(default=None) + """ + Separator for scopes + """ + + expires_at: str = pydantic.Field() + """ + ISO 8601 timestamp of when the access token expires + """ + + integration_id: str + credential_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/api_integration_o_auth_2_auth_code_response_scope_separator.py b/data/src/elevenlabs/types/api_integration_o_auth_2_auth_code_response_scope_separator.py new file mode 100644 index 0000000000000000000000000000000000000000..bffa184beaac23d9d4f5f1d39a3ff893dce7ee54 --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_o_auth_2_auth_code_response_scope_separator.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ApiIntegrationOAuth2AuthCodeResponseScopeSeparator = typing.Union[typing.Literal[" ", ","], typing.Any] diff --git a/data/src/elevenlabs/types/api_integration_o_auth_2_custom_app_response.py b/data/src/elevenlabs/types/api_integration_o_auth_2_custom_app_response.py new file mode 100644 index 0000000000000000000000000000000000000000..81d96247aa69d4124cce09a23e8c1f702b04132e --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_o_auth_2_custom_app_response.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .api_integration_o_auth_2_custom_app_response_scope_separator import ( + ApiIntegrationOAuth2CustomAppResponseScopeSeparator, +) +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class ApiIntegrationOAuth2CustomAppResponse(UncheckedBaseModel): + """ + Response model for user-owned OAuth2 Custom App auth connections + """ + + name: str + provider: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + scope_separator: typing.Optional[ApiIntegrationOAuth2CustomAppResponseScopeSeparator] = pydantic.Field(default=None) + """ + Separator for scopes + """ + + expires_at: str = pydantic.Field() + """ + ISO 8601 timestamp of when the access token expires + """ + + integration_id: str + credential_id: str + client_id: str = pydantic.Field() + """ + OAuth client ID (rendered from template if credential uses templated credentials, None for legacy connections) + """ + + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/api_integration_o_auth_2_custom_app_response_scope_separator.py b/data/src/elevenlabs/types/api_integration_o_auth_2_custom_app_response_scope_separator.py new file mode 100644 index 0000000000000000000000000000000000000000..e09d4cc518b01d795e11d82ee162642e0796358f --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_o_auth_2_custom_app_response_scope_separator.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ApiIntegrationOAuth2CustomAppResponseScopeSeparator = typing.Union[typing.Literal[" ", ","], typing.Any] diff --git a/data/src/elevenlabs/types/api_integration_webhook_overrides.py b/data/src/elevenlabs/types/api_integration_webhook_overrides.py new file mode 100644 index 0000000000000000000000000000000000000000..2c96f906fd170f5a183b3aedddcbe5ee5f9d8d25 --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_webhook_overrides.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .api_integration_webhook_overrides_request_headers_value import ApiIntegrationWebhookOverridesRequestHeadersValue +from .api_integration_webhook_overrides_schema_overrides_value import ApiIntegrationWebhookOverridesSchemaOverridesValue +from .response_filter_mode import ResponseFilterMode + + +class ApiIntegrationWebhookOverrides(UncheckedBaseModel): + schema_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[ApiIntegrationWebhookOverridesSchemaOverridesValue]] + ] = None + response_filter_mode: typing.Optional[ResponseFilterMode] = None + response_filters: typing.Optional[typing.List[str]] = None + request_headers: typing.Optional[ + typing.Dict[str, typing.Optional[ApiIntegrationWebhookOverridesRequestHeadersValue]] + ] = 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/data/src/elevenlabs/types/api_integration_webhook_overrides_request_headers_value.py b/data/src/elevenlabs/types/api_integration_webhook_overrides_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..daf54db5ad52f5cabeaa968288f972bcd7c4f318 --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_webhook_overrides_request_headers_value.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable + +ApiIntegrationWebhookOverridesRequestHeadersValue = typing.Union[str, ConvAiDynamicVariable] diff --git a/data/src/elevenlabs/types/api_integration_webhook_overrides_schema_overrides_value.py b/data/src/elevenlabs/types/api_integration_webhook_overrides_schema_overrides_value.py new file mode 100644 index 0000000000000000000000000000000000000000..9a9b9cdab9d6ec4c7483a49d2d6bb2e5987c0ca7 --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_webhook_overrides_schema_overrides_value.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .constant_schema_override_constant_value import ConstantSchemaOverrideConstantValue + + +class ApiIntegrationWebhookOverridesSchemaOverridesValue_Constant(UncheckedBaseModel): + source: typing.Literal["constant"] = "constant" + constant_value: typing.Optional[ConstantSchemaOverrideConstantValue] = 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 + + +class ApiIntegrationWebhookOverridesSchemaOverridesValue_DynamicVariable(UncheckedBaseModel): + source: typing.Literal["dynamic_variable"] = "dynamic_variable" + dynamic_variable: 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 + + +class ApiIntegrationWebhookOverridesSchemaOverridesValue_Llm(UncheckedBaseModel): + source: typing.Literal["llm"] = "llm" + prompt: 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 + + +class ApiIntegrationWebhookOverridesSchemaOverridesValue_Omit(UncheckedBaseModel): + source: typing.Literal["omit"] = "omit" + + 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 + + +ApiIntegrationWebhookOverridesSchemaOverridesValue = typing_extensions.Annotated[ + typing.Union[ + ApiIntegrationWebhookOverridesSchemaOverridesValue_Constant, + ApiIntegrationWebhookOverridesSchemaOverridesValue_DynamicVariable, + ApiIntegrationWebhookOverridesSchemaOverridesValue_Llm, + ApiIntegrationWebhookOverridesSchemaOverridesValue_Omit, + ], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/types/api_integration_webhook_tool_config_input.py b/data/src/elevenlabs/types/api_integration_webhook_tool_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..2a5d443861a44e9c43d36386b81e2aefbb36e60b --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_webhook_tool_config_input.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .api_integration_webhook_overrides import ApiIntegrationWebhookOverrides +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode + + +class ApiIntegrationWebhookToolConfigInput(UncheckedBaseModel): + name: str + description: str = pydantic.Field() + """ + Description of when the tool should be used and what it does. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for the tool call to complete. Must be between 5 and 300 seconds (inclusive). + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while this tool is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, the agent will speak before the tool call. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution. If not specified, no tool call sound will be played. + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play. 'auto' only plays when there's pre-tool speech, 'always' plays for every tool call. + """ + + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = pydantic.Field(default=None) + """ + Controls how tool errors are processed before being shared with the agent. 'auto' determines handling based on tool type (summarized for native integrations, hide for others), 'summarized' sends an LLM-generated summary, 'passthrough' sends the raw error, 'hide' does not share the error with the agent. + """ + + dynamic_variables: typing.Optional[DynamicVariablesConfig] = pydantic.Field(default=None) + """ + Configuration for dynamic variables + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + Determines when and how the tool executes: 'immediate' executes the tool right away when requested by the LLM, 'post_tool_speech' waits for the agent to finish speaking before executing, 'async' runs the tool in the background without blocking - best for long-running operations. + """ + + tool_version: typing.Optional[str] = pydantic.Field(default=None) + """ + The version of the API integration tool + """ + + api_integration_id: str + api_integration_connection_id: str + api_schema_overrides: typing.Optional[ApiIntegrationWebhookOverrides] = pydantic.Field(default=None) + """ + User overrides applied on top of the base api_schema + """ + + 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/data/src/elevenlabs/types/api_integration_webhook_tool_config_output.py b/data/src/elevenlabs/types/api_integration_webhook_tool_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..aab9a509625a7fa0538466e1d02386e93e1dd7ae --- /dev/null +++ b/data/src/elevenlabs/types/api_integration_webhook_tool_config_output.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .api_integration_webhook_overrides import ApiIntegrationWebhookOverrides +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode + + +class ApiIntegrationWebhookToolConfigOutput(UncheckedBaseModel): + name: str + description: str = pydantic.Field() + """ + Description of when the tool should be used and what it does. + """ + + response_timeout_secs: int = pydantic.Field() + """ + The maximum time in seconds to wait for the tool call to complete. Must be between 5 and 300 seconds (inclusive). + """ + + disable_interruptions: bool = pydantic.Field() + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while this tool is running. + """ + + interruption_mode: ToolInterruptionMode = pydantic.Field() + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. + """ + + force_pre_tool_speech: bool = pydantic.Field() + """ + DEPRECATED: use `pre_tool_speech` instead. If true, the agent will speak before the tool call. + """ + + pre_tool_speech: PreToolSpeechMode = pydantic.Field() + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. + """ + + assignments: typing.List[DynamicVariableAssignment] = pydantic.Field() + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution. If not specified, no tool call sound will be played. + """ + + tool_call_sound_behavior: ToolCallSoundBehavior = pydantic.Field() + """ + Determines when the tool call sound should play. 'auto' only plays when there's pre-tool speech, 'always' plays for every tool call. + """ + + tool_error_handling_mode: ToolErrorHandlingMode = pydantic.Field() + """ + Controls how tool errors are processed before being shared with the agent. 'auto' determines handling based on tool type (summarized for native integrations, hide for others), 'summarized' sends an LLM-generated summary, 'passthrough' sends the raw error, 'hide' does not share the error with the agent. + """ + + dynamic_variables: DynamicVariablesConfig = pydantic.Field() + """ + Configuration for dynamic variables + """ + + execution_mode: ToolExecutionMode = pydantic.Field() + """ + Determines when and how the tool executes: 'immediate' executes the tool right away when requested by the LLM, 'post_tool_speech' waits for the agent to finish speaking before executing, 'async' runs the tool in the background without blocking - best for long-running operations. + """ + + tool_version: str = pydantic.Field() + """ + The version of the API integration tool + """ + + api_integration_id: str + api_integration_connection_id: str + api_schema_overrides: typing.Optional[ApiIntegrationWebhookOverrides] = pydantic.Field(default=None) + """ + User overrides applied on top of the base api_schema + """ + + 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/data/src/elevenlabs/types/architect_dispatch_response_model.py b/data/src/elevenlabs/types/architect_dispatch_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5b572ac288d51074fc68897f5860de78b3cb1ff5 --- /dev/null +++ b/data/src/elevenlabs/types/architect_dispatch_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ArchitectDispatchResponseModel(UncheckedBaseModel): + architect_chat_id: str + user_id: str + dispatched_at_unix_secs: int + + 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/data/src/elevenlabs/types/array_json_schema_property_input.py b/data/src/elevenlabs/types/array_json_schema_property_input.py new file mode 100644 index 0000000000000000000000000000000000000000..ff99e27ef026a0202704a04ebb7e679702da345d --- /dev/null +++ b/data/src/elevenlabs/types/array_json_schema_property_input.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .array_json_schema_property_input_property_kind import ArrayJsonSchemaPropertyInputPropertyKind + + +class ArrayJsonSchemaPropertyInput(UncheckedBaseModel): + property_kind: typing.Optional[ArrayJsonSchemaPropertyInputPropertyKind] = None + description: typing.Optional[str] = None + dynamic_variable: typing.Optional[str] = pydantic.Field(default=None) + """ + When set, the entire parameter is populated from this dynamic variable at runtime. Mutually exclusive with description (LLM-provided value), constant_value, and is_omitted. + """ + + constant_value: typing.Optional[typing.List[typing.Any]] = pydantic.Field(default=None) + """ + When set, the entire array uses this constant value at runtime. Mutually exclusive with description (LLM-provided array), dynamic_variable, and is_omitted. + """ + + is_omitted: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, this parameter will be completely omitted from the request. Only valid for optional parameters. Mutually exclusive with description, dynamic_variable, and constant_value. + """ + + type: typing.Optional[typing.Literal["array"]] = None + items: typing.Optional["ArrayJsonSchemaPropertyInputItems"] = pydantic.Field(default=None) + """ + Schema for array elements. + """ + + 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 + + +from .array_json_schema_property_input_items import ArrayJsonSchemaPropertyInputItems # noqa: E402, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, I001 +from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + ArrayJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInputItems=ArrayJsonSchemaPropertyInputItems, + ObjectJsonSchemaPropertyInput=ObjectJsonSchemaPropertyInput, + ObjectJsonSchemaPropertyInputPropertiesValue=ObjectJsonSchemaPropertyInputPropertiesValue, +) diff --git a/data/src/elevenlabs/types/array_json_schema_property_input_items.py b/data/src/elevenlabs/types/array_json_schema_property_input_items.py new file mode 100644 index 0000000000000000000000000000000000000000..88fc53ebeaa2d5bafe4cc233efb2d5091a85d324 --- /dev/null +++ b/data/src/elevenlabs/types/array_json_schema_property_input_items.py @@ -0,0 +1,14 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .literal_json_schema_property import LiteralJsonSchemaProperty + +if typing.TYPE_CHECKING: + from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput + from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput +ArrayJsonSchemaPropertyInputItems = typing.Union[ + LiteralJsonSchemaProperty, "ObjectJsonSchemaPropertyInput", "ArrayJsonSchemaPropertyInput" +] diff --git a/data/src/elevenlabs/types/array_json_schema_property_input_property_kind.py b/data/src/elevenlabs/types/array_json_schema_property_input_property_kind.py new file mode 100644 index 0000000000000000000000000000000000000000..ea863033456132c9480ff2ee953d5a0996e67547 --- /dev/null +++ b/data/src/elevenlabs/types/array_json_schema_property_input_property_kind.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ArrayJsonSchemaPropertyInputPropertyKind = typing.Union[typing.Literal["array", "object"], typing.Any] diff --git a/data/src/elevenlabs/types/array_json_schema_property_output.py b/data/src/elevenlabs/types/array_json_schema_property_output.py new file mode 100644 index 0000000000000000000000000000000000000000..ac2a085a2de0f0d1dea19d3fdcddb8081fe40fd3 --- /dev/null +++ b/data/src/elevenlabs/types/array_json_schema_property_output.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ArrayJsonSchemaPropertyOutput(UncheckedBaseModel): + description: typing.Optional[str] = None + dynamic_variable: typing.Optional[str] = pydantic.Field(default=None) + """ + When set, the entire parameter is populated from this dynamic variable at runtime. Mutually exclusive with description (LLM-provided value), constant_value, and is_omitted. + """ + + constant_value: typing.Optional[typing.List[typing.Any]] = pydantic.Field(default=None) + """ + When set, the entire array uses this constant value at runtime. Mutually exclusive with description (LLM-provided array), dynamic_variable, and is_omitted. + """ + + is_omitted: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, this parameter will be completely omitted from the request. Only valid for optional parameters. Mutually exclusive with description, dynamic_variable, and constant_value. + """ + + type: typing.Optional[typing.Literal["array"]] = None + items: typing.Optional["ArrayJsonSchemaPropertyOutputItems"] = pydantic.Field(default=None) + """ + Schema for array elements. + """ + + 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 + + +from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems # noqa: E402, I001 +from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, I001 +from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + ArrayJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems, + ObjectJsonSchemaPropertyOutput=ObjectJsonSchemaPropertyOutput, + ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue, +) diff --git a/data/src/elevenlabs/types/array_json_schema_property_output_items.py b/data/src/elevenlabs/types/array_json_schema_property_output_items.py new file mode 100644 index 0000000000000000000000000000000000000000..c9b10db820cc90632ab16d4f7a35d1f71870c519 --- /dev/null +++ b/data/src/elevenlabs/types/array_json_schema_property_output_items.py @@ -0,0 +1,14 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .literal_json_schema_property import LiteralJsonSchemaProperty + +if typing.TYPE_CHECKING: + from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput + from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput +ArrayJsonSchemaPropertyOutputItems = typing.Union[ + LiteralJsonSchemaProperty, "ObjectJsonSchemaPropertyOutput", "ArrayJsonSchemaPropertyOutput" +] diff --git a/data/src/elevenlabs/types/array_schema.py b/data/src/elevenlabs/types/array_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..6e816fbb54b1e544b73a31eb15fa9f24b7b3ed1e --- /dev/null +++ b/data/src/elevenlabs/types/array_schema.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ArraySchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: typing.Optional[str] = None + items: "ContentSchema" + + 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 + + +from .content_schema import ContentSchema # noqa: E402, I001 +from .object_schema import ObjectSchema # noqa: E402, I001 + +update_forward_refs(ArraySchema, ContentSchema=ContentSchema, ObjectSchema=ObjectSchema) diff --git a/data/src/elevenlabs/types/asr_conversational_config.py b/data/src/elevenlabs/types/asr_conversational_config.py new file mode 100644 index 0000000000000000000000000000000000000000..3afcf29b3db465904d347599be4c77f07582d0c7 --- /dev/null +++ b/data/src/elevenlabs/types/asr_conversational_config.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .asr_input_format import AsrInputFormat +from .asr_provider import AsrProvider +from .asr_quality import AsrQuality + + +class AsrConversationalConfig(UncheckedBaseModel): + quality: typing.Optional[AsrQuality] = pydantic.Field(default=None) + """ + The quality of the transcription + """ + + provider: typing.Optional[AsrProvider] = pydantic.Field(default=None) + """ + The provider of the transcription service + """ + + user_input_audio_format: typing.Optional[AsrInputFormat] = pydantic.Field(default=None) + """ + The format of the audio to be transcribed + """ + + keywords: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Keywords to boost prediction probability for + """ + + 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/data/src/elevenlabs/types/asr_conversational_config_override.py b/data/src/elevenlabs/types/asr_conversational_config_override.py new file mode 100644 index 0000000000000000000000000000000000000000..0743ccf19a445a626a38a1bff0217c4594db872e --- /dev/null +++ b/data/src/elevenlabs/types/asr_conversational_config_override.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AsrConversationalConfigOverride(UncheckedBaseModel): + keywords: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Keywords to boost prediction probability for + """ + + 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/data/src/elevenlabs/types/asr_conversational_config_override_config.py b/data/src/elevenlabs/types/asr_conversational_config_override_config.py new file mode 100644 index 0000000000000000000000000000000000000000..fbdaa23f0fbdcfdb7166d96261b1645e3e32cfd0 --- /dev/null +++ b/data/src/elevenlabs/types/asr_conversational_config_override_config.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AsrConversationalConfigOverrideConfig(UncheckedBaseModel): + keywords: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the keywords field. + """ + + 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/data/src/elevenlabs/types/asr_conversational_config_workflow_override.py b/data/src/elevenlabs/types/asr_conversational_config_workflow_override.py new file mode 100644 index 0000000000000000000000000000000000000000..f82c7721469e7e8604cf2036a762f9e9bb05ae31 --- /dev/null +++ b/data/src/elevenlabs/types/asr_conversational_config_workflow_override.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .asr_input_format import AsrInputFormat +from .asr_provider import AsrProvider +from .asr_quality import AsrQuality + + +class AsrConversationalConfigWorkflowOverride(UncheckedBaseModel): + quality: typing.Optional[AsrQuality] = pydantic.Field(default=None) + """ + The quality of the transcription + """ + + provider: typing.Optional[AsrProvider] = pydantic.Field(default=None) + """ + The provider of the transcription service + """ + + user_input_audio_format: typing.Optional[AsrInputFormat] = pydantic.Field(default=None) + """ + The format of the audio to be transcribed + """ + + keywords: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Keywords to boost prediction probability for + """ + + 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/data/src/elevenlabs/types/asr_input_format.py b/data/src/elevenlabs/types/asr_input_format.py new file mode 100644 index 0000000000000000000000000000000000000000..07fc6305741d8458b221abdd91969ed4b9f90410 --- /dev/null +++ b/data/src/elevenlabs/types/asr_input_format.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AsrInputFormat = typing.Union[ + typing.Literal["pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "pcm_48000", "ulaw_8000"], typing.Any +] diff --git a/data/src/elevenlabs/types/asr_provider.py b/data/src/elevenlabs/types/asr_provider.py new file mode 100644 index 0000000000000000000000000000000000000000..f9dc1d959546cff6fcb10d9ed014c230a30b38a6 --- /dev/null +++ b/data/src/elevenlabs/types/asr_provider.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AsrProvider = typing.Union[typing.Literal["elevenlabs", "scribe_realtime", "scribe_v2_turbo"], typing.Any] diff --git a/data/src/elevenlabs/types/asr_quality.py b/data/src/elevenlabs/types/asr_quality.py new file mode 100644 index 0000000000000000000000000000000000000000..b0f390635918f3897e2b329b0660b07dfafd4f53 --- /dev/null +++ b/data/src/elevenlabs/types/asr_quality.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AsrQuality = typing.Literal["high"] diff --git a/data/src/elevenlabs/types/asset_list_response.py b/data/src/elevenlabs/types/asset_list_response.py new file mode 100644 index 0000000000000000000000000000000000000000..fa63cd6a7812d257ea4207218ea779f67a5df53d --- /dev/null +++ b/data/src/elevenlabs/types/asset_list_response.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .asset_response import AssetResponse + + +class AssetListResponse(UncheckedBaseModel): + """ + One page of the workspace's assets, most recently created first. + """ + + assets: typing.List[AssetResponse] = pydantic.Field() + """ + List of Asset objects. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Pass as `cursor` to fetch the next page. `null` if there are no more results. + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there are more results to fetch. + """ + + 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/data/src/elevenlabs/types/asset_response.py b/data/src/elevenlabs/types/asset_response.py new file mode 100644 index 0000000000000000000000000000000000000000..18d4e2d02a9a6c09b484379fcc0827de0a5c01de --- /dev/null +++ b/data/src/elevenlabs/types/asset_response.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AssetResponse(UncheckedBaseModel): + """ + The public Asset object. + """ + + asset_id: str = pydantic.Field() + """ + Unique identifier for the asset. + """ + + name: str = pydantic.Field() + """ + Display name of the asset. + """ + + mime_type: str = pydantic.Field() + """ + MIME type of the uploaded file (e.g. `audio/mpeg`). + """ + + created_at_unix: int = pydantic.Field() + """ + Unix timestamp (seconds) the asset was created. + """ + + content_url: typing.Optional[str] = pydantic.Field(default=None) + """ + Signed URL to fetch the asset's content. May be `null` if the asset has not finished processing. Do not rely on it being valid for more than 1 hour; fetch the asset again for a fresh URL. + """ + + 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/data/src/elevenlabs/types/asset_transcription.py b/data/src/elevenlabs/types/asset_transcription.py new file mode 100644 index 0000000000000000000000000000000000000000..fe10bfceb75b275578e690fe7f3d48a8640c22c9 --- /dev/null +++ b/data/src/elevenlabs/types/asset_transcription.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .asset_transcription_data import AssetTranscriptionData +from .asset_transcription_status import AssetTranscriptionStatus + + +class AssetTranscription(UncheckedBaseModel): + status: AssetTranscriptionStatus + data: typing.Optional[AssetTranscriptionData] = None + updated_at_ms: typing.Optional[int] = 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/data/src/elevenlabs/types/asset_transcription_data.py b/data/src/elevenlabs/types/asset_transcription_data.py new file mode 100644 index 0000000000000000000000000000000000000000..f64e1cccae6b536082db1a29d03f8f19d6732dfc --- /dev/null +++ b/data/src/elevenlabs/types/asset_transcription_data.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AssetTranscriptionData(UncheckedBaseModel): + language_code: str + text: str + words: typing.List[str] + word_start_times_ms: typing.List[int] + word_end_times_ms: typing.List[int] + word_speaker_ids: typing.List[typing.Optional[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/data/src/elevenlabs/types/asset_transcription_status.py b/data/src/elevenlabs/types/asset_transcription_status.py new file mode 100644 index 0000000000000000000000000000000000000000..bec8dd9904b8c1293e494cd27cb5f011bee0303f --- /dev/null +++ b/data/src/elevenlabs/types/asset_transcription_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AssetTranscriptionStatus = typing.Union[typing.Literal["processing", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/assignable_user_response_model.py b/data/src/elevenlabs/types/assignable_user_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..95e2c0b412af53ee723debe3f2dbbdff4f05e245 --- /dev/null +++ b/data/src/elevenlabs/types/assignable_user_response_model.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AssignableUserResponseModel(UncheckedBaseModel): + user_id: str + email: str + first_name: typing.Optional[str] = None + is_service_account: bool + has_access: bool = pydantic.Field() + """ + Whether this workspace member currently has at least viewer access to the agent. Members without access are still returned so they can be surfaced (e.g. grayed out) and granted access before being assigned. + """ + + 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/data/src/elevenlabs/types/ast_addition_operator_node_input.py b/data/src/elevenlabs/types/ast_addition_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..9c1e0e69b604251eb3d3995fe086da72290f2203 --- /dev/null +++ b/data/src/elevenlabs/types/ast_addition_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstAdditionOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_addition_operator_node_output.py b/data/src/elevenlabs/types/ast_addition_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..07c49dac08116cd5e78623b5732faa02491cf32f --- /dev/null +++ b/data/src/elevenlabs/types/ast_addition_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstAdditionOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_and_operator_node_input.py b/data/src/elevenlabs/types/ast_and_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..98c602f64034cff77e1047d627e43c9cdb523ba8 --- /dev/null +++ b/data/src/elevenlabs/types/ast_and_operator_node_input.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstAndOperatorNodeInput(UncheckedBaseModel): + children: typing.List["AstNodeInput"] = pydantic.Field() + """ + Child nodes of the logical operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstAndOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_and_operator_node_output.py b/data/src/elevenlabs/types/ast_and_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..b3104d1b089ba063e7fee9947ca9e5e9bf74df2d --- /dev/null +++ b/data/src/elevenlabs/types/ast_and_operator_node_output.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstAndOperatorNodeOutput(UncheckedBaseModel): + children: typing.List["AstNodeOutput"] = pydantic.Field() + """ + Child nodes of the logical operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstAndOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_boolean_node_input.py b/data/src/elevenlabs/types/ast_boolean_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..a1f2a4cae4c96c3b9519276723470f2b9c218c4b --- /dev/null +++ b/data/src/elevenlabs/types/ast_boolean_node_input.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstBooleanNodeInput(UncheckedBaseModel): + value: bool = pydantic.Field() + """ + Value of this literal. + """ + + 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/data/src/elevenlabs/types/ast_boolean_node_output.py b/data/src/elevenlabs/types/ast_boolean_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..e2ddd3048ed081884f247bc675d94646064116ad --- /dev/null +++ b/data/src/elevenlabs/types/ast_boolean_node_output.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstBooleanNodeOutput(UncheckedBaseModel): + value: bool = pydantic.Field() + """ + Value of this literal. + """ + + 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/data/src/elevenlabs/types/ast_conditional_operator_node_input.py b/data/src/elevenlabs/types/ast_conditional_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..686bc636791e3a41c40538c6410f80828470def5 --- /dev/null +++ b/data/src/elevenlabs/types/ast_conditional_operator_node_input.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstConditionalOperatorNodeInput(UncheckedBaseModel): + condition: "AstNodeInput" = pydantic.Field() + """ + Condition deciding which expression should be selected. + """ + + true_expression: typing_extensions.Annotated[ + "AstNodeInput", + FieldMetadata(alias="trueExpression"), + pydantic.Field(alias="trueExpression", description="Expression selected if the condition is true."), + ] + false_expression: typing_extensions.Annotated[ + "AstNodeInput", + FieldMetadata(alias="falseExpression"), + pydantic.Field(alias="falseExpression", description="Expression selected if the condition is false."), + ] + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstConditionalOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_conditional_operator_node_output.py b/data/src/elevenlabs/types/ast_conditional_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..083a7ab6b596c0c66d2563eb43b971bccdb1f9d5 --- /dev/null +++ b/data/src/elevenlabs/types/ast_conditional_operator_node_output.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstConditionalOperatorNodeOutput(UncheckedBaseModel): + condition: "AstNodeOutput" = pydantic.Field() + """ + Condition deciding which expression should be selected. + """ + + true_expression: typing_extensions.Annotated[ + "AstNodeOutput", + FieldMetadata(alias="trueExpression"), + pydantic.Field(alias="trueExpression", description="Expression selected if the condition is true."), + ] + false_expression: typing_extensions.Annotated[ + "AstNodeOutput", + FieldMetadata(alias="falseExpression"), + pydantic.Field(alias="falseExpression", description="Expression selected if the condition is false."), + ] + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstConditionalOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_division_operator_node_input.py b/data/src/elevenlabs/types/ast_division_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..94363c03f1db50b9870ce938ce01f72ff21e78e6 --- /dev/null +++ b/data/src/elevenlabs/types/ast_division_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstDivisionOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstDivisionOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_division_operator_node_output.py b/data/src/elevenlabs/types/ast_division_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..14a29444a00c1a7939b6c56934ed8817793a3d67 --- /dev/null +++ b/data/src/elevenlabs/types/ast_division_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstDivisionOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstDivisionOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_dynamic_variable_node_input.py b/data/src/elevenlabs/types/ast_dynamic_variable_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..48fff5314ac64c99d9167341735ce427053651de --- /dev/null +++ b/data/src/elevenlabs/types/ast_dynamic_variable_node_input.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstDynamicVariableNodeInput(UncheckedBaseModel): + name: str = pydantic.Field() + """ + The name of the dynamic variable. + """ + + 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/data/src/elevenlabs/types/ast_dynamic_variable_node_output.py b/data/src/elevenlabs/types/ast_dynamic_variable_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..1a7eda58532988b6c4b44dc72c91f53a664f9c59 --- /dev/null +++ b/data/src/elevenlabs/types/ast_dynamic_variable_node_output.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstDynamicVariableNodeOutput(UncheckedBaseModel): + name: str = pydantic.Field() + """ + The name of the dynamic variable. + """ + + 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/data/src/elevenlabs/types/ast_equals_operator_node_input.py b/data/src/elevenlabs/types/ast_equals_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..a259eccce65e2e9fc86cadaa51b408a0fea9bf27 --- /dev/null +++ b/data/src/elevenlabs/types/ast_equals_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstEqualsOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstEqualsOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_equals_operator_node_output.py b/data/src/elevenlabs/types/ast_equals_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..7fc3d456bf7682b7feb966b2407263e6c41cdfd2 --- /dev/null +++ b/data/src/elevenlabs/types/ast_equals_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstEqualsOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstEqualsOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_greater_than_operator_node_input.py b/data/src/elevenlabs/types/ast_greater_than_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..7fda4fd61f44bf80d61937d97aa54d433a6f08d8 --- /dev/null +++ b/data/src/elevenlabs/types/ast_greater_than_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstGreaterThanOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstGreaterThanOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_greater_than_operator_node_output.py b/data/src/elevenlabs/types/ast_greater_than_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..5d501611f5a00334620f12886e4e627286169f3e --- /dev/null +++ b/data/src/elevenlabs/types/ast_greater_than_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstGreaterThanOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstGreaterThanOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_greater_than_or_equals_operator_node_input.py b/data/src/elevenlabs/types/ast_greater_than_or_equals_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..60ded4eaa2ff7361d0e829b74691c3e31445a2c0 --- /dev/null +++ b/data/src/elevenlabs/types/ast_greater_than_or_equals_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstGreaterThanOrEqualsOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstGreaterThanOrEqualsOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_greater_than_or_equals_operator_node_output.py b/data/src/elevenlabs/types/ast_greater_than_or_equals_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..3e0b650ad2c37c108adf2552c6175d0046a27944 --- /dev/null +++ b/data/src/elevenlabs/types/ast_greater_than_or_equals_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstGreaterThanOrEqualsOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstGreaterThanOrEqualsOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_less_than_operator_node_input.py b/data/src/elevenlabs/types/ast_less_than_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..cf807188a6b6f1f59fac4996b1cc799a1e5cad85 --- /dev/null +++ b/data/src/elevenlabs/types/ast_less_than_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstLessThanOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstLessThanOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_less_than_operator_node_output.py b/data/src/elevenlabs/types/ast_less_than_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..d926b43db06eb144402d5cd5f2da559b7d2a108c --- /dev/null +++ b/data/src/elevenlabs/types/ast_less_than_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstLessThanOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstLessThanOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_less_than_or_equals_operator_node_input.py b/data/src/elevenlabs/types/ast_less_than_or_equals_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..43b6ec7fa660a88ee4f6740bdc78fa3e5f1a0365 --- /dev/null +++ b/data/src/elevenlabs/types/ast_less_than_or_equals_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstLessThanOrEqualsOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstLessThanOrEqualsOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_less_than_or_equals_operator_node_output.py b/data/src/elevenlabs/types/ast_less_than_or_equals_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..be2d5cd81bca4942f4f89e2c54d5abf757946147 --- /dev/null +++ b/data/src/elevenlabs/types/ast_less_than_or_equals_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstLessThanOrEqualsOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstLessThanOrEqualsOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_multiplication_operator_node_input.py b/data/src/elevenlabs/types/ast_multiplication_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..4f4b862f3f06d97822b818105041c804d0acc90f --- /dev/null +++ b/data/src/elevenlabs/types/ast_multiplication_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstMultiplicationOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstMultiplicationOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_multiplication_operator_node_output.py b/data/src/elevenlabs/types/ast_multiplication_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..7879254d3e7c31ee032a47c38b6c48a79fd02fed --- /dev/null +++ b/data/src/elevenlabs/types/ast_multiplication_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstMultiplicationOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstMultiplicationOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_node_input.py b/data/src/elevenlabs/types/ast_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..15348024ce4889353a2561e91eae3aee4c27a4d5 --- /dev/null +++ b/data/src/elevenlabs/types/ast_node_input.py @@ -0,0 +1,543 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .ast_number_node_input_value import AstNumberNodeInputValue +from .llm_literal_json_schema_property import LlmLiteralJsonSchemaProperty + + +class AstNodeInput_AddOperator(UncheckedBaseModel): + type: typing.Literal["add_operator"] = "add_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_AndOperator(UncheckedBaseModel): + type: typing.Literal["and_operator"] = "and_operator" + children: typing.List["AstNodeInput"] + + 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 + + +class AstNodeInput_BooleanLiteral(UncheckedBaseModel): + type: typing.Literal["boolean_literal"] = "boolean_literal" + value: bool + + 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 + + +class AstNodeInput_ConditionalOperator(UncheckedBaseModel): + type: typing.Literal["conditional_operator"] = "conditional_operator" + condition: "AstNodeInput" + true_expression: typing_extensions.Annotated[ + "AstNodeInput", FieldMetadata(alias="trueExpression"), pydantic.Field(alias="trueExpression") + ] + false_expression: typing_extensions.Annotated[ + "AstNodeInput", FieldMetadata(alias="falseExpression"), pydantic.Field(alias="falseExpression") + ] + + 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 + + +class AstNodeInput_DivOperator(UncheckedBaseModel): + type: typing.Literal["div_operator"] = "div_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_DynamicVariable(UncheckedBaseModel): + type: typing.Literal["dynamic_variable"] = "dynamic_variable" + 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 + + +class AstNodeInput_EqOperator(UncheckedBaseModel): + type: typing.Literal["eq_operator"] = "eq_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_GtOperator(UncheckedBaseModel): + type: typing.Literal["gt_operator"] = "gt_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_GteOperator(UncheckedBaseModel): + type: typing.Literal["gte_operator"] = "gte_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + value_schema: typing.Optional[LlmLiteralJsonSchemaProperty] = None + prompt: 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 + + +class AstNodeInput_LtOperator(UncheckedBaseModel): + type: typing.Literal["lt_operator"] = "lt_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_LteOperator(UncheckedBaseModel): + type: typing.Literal["lte_operator"] = "lte_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_MulOperator(UncheckedBaseModel): + type: typing.Literal["mul_operator"] = "mul_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_NeqOperator(UncheckedBaseModel): + type: typing.Literal["neq_operator"] = "neq_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +class AstNodeInput_NullLiteral(UncheckedBaseModel): + type: typing.Literal["null_literal"] = "null_literal" + + 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 + + +class AstNodeInput_NumberLiteral(UncheckedBaseModel): + type: typing.Literal["number_literal"] = "number_literal" + value: AstNumberNodeInputValue + + 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 + + +class AstNodeInput_OrOperator(UncheckedBaseModel): + type: typing.Literal["or_operator"] = "or_operator" + children: typing.List["AstNodeInput"] + + 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 + + +class AstNodeInput_StringLiteral(UncheckedBaseModel): + type: typing.Literal["string_literal"] = "string_literal" + value: 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 + + +class AstNodeInput_SubOperator(UncheckedBaseModel): + type: typing.Literal["sub_operator"] = "sub_operator" + left: "AstNodeInput" + right: "AstNodeInput" + + 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 + + +AstNodeInput = typing_extensions.Annotated[ + typing.Union[ + AstNodeInput_AddOperator, + AstNodeInput_AndOperator, + AstNodeInput_BooleanLiteral, + AstNodeInput_ConditionalOperator, + AstNodeInput_DivOperator, + AstNodeInput_DynamicVariable, + AstNodeInput_EqOperator, + AstNodeInput_GtOperator, + AstNodeInput_GteOperator, + AstNodeInput_Llm, + AstNodeInput_LtOperator, + AstNodeInput_LteOperator, + AstNodeInput_MulOperator, + AstNodeInput_NeqOperator, + AstNodeInput_NullLiteral, + AstNodeInput_NumberLiteral, + AstNodeInput_OrOperator, + AstNodeInput_StringLiteral, + AstNodeInput_SubOperator, + ], + UnionMetadata(discriminant="type"), +] +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstNodeInput_AddOperator, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_AndOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_ConditionalOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_DivOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_EqOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_GtOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_GteOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_LtOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_LteOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_MulOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_NeqOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_OrOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) +update_forward_refs( + AstNodeInput_SubOperator, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_node_input_llm.py b/data/src/elevenlabs/types/ast_node_input_llm.py new file mode 100644 index 0000000000000000000000000000000000000000..bb4d43a597e6d156b03e5a04c308fdff95f7e33c --- /dev/null +++ b/data/src/elevenlabs/types/ast_node_input_llm.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_literal_json_schema_property import LlmLiteralJsonSchemaProperty + + +class AstNodeInputLlm(UncheckedBaseModel): + value_schema: typing.Optional[LlmLiteralJsonSchemaProperty] = pydantic.Field(default=None) + """ + JSON schema describing the value that the LLM should extract. + """ + + prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + The prompt to evaluate to a boolean value. Deprecated. Use a boolean schema instead. + """ + + 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/data/src/elevenlabs/types/ast_node_output.py b/data/src/elevenlabs/types/ast_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..efc16700502452729a990475eb48696684d2ab86 --- /dev/null +++ b/data/src/elevenlabs/types/ast_node_output.py @@ -0,0 +1,543 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .ast_number_node_output_value import AstNumberNodeOutputValue +from .llm_literal_json_schema_property import LlmLiteralJsonSchemaProperty + + +class AstNodeOutput_AddOperator(UncheckedBaseModel): + type: typing.Literal["add_operator"] = "add_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_AndOperator(UncheckedBaseModel): + type: typing.Literal["and_operator"] = "and_operator" + children: typing.List["AstNodeOutput"] + + 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 + + +class AstNodeOutput_BooleanLiteral(UncheckedBaseModel): + type: typing.Literal["boolean_literal"] = "boolean_literal" + value: bool + + 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 + + +class AstNodeOutput_ConditionalOperator(UncheckedBaseModel): + type: typing.Literal["conditional_operator"] = "conditional_operator" + condition: "AstNodeOutput" + true_expression: typing_extensions.Annotated[ + "AstNodeOutput", FieldMetadata(alias="trueExpression"), pydantic.Field(alias="trueExpression") + ] + false_expression: typing_extensions.Annotated[ + "AstNodeOutput", FieldMetadata(alias="falseExpression"), pydantic.Field(alias="falseExpression") + ] + + 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 + + +class AstNodeOutput_DivOperator(UncheckedBaseModel): + type: typing.Literal["div_operator"] = "div_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_DynamicVariable(UncheckedBaseModel): + type: typing.Literal["dynamic_variable"] = "dynamic_variable" + 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 + + +class AstNodeOutput_EqOperator(UncheckedBaseModel): + type: typing.Literal["eq_operator"] = "eq_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_GtOperator(UncheckedBaseModel): + type: typing.Literal["gt_operator"] = "gt_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_GteOperator(UncheckedBaseModel): + type: typing.Literal["gte_operator"] = "gte_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + value_schema: LlmLiteralJsonSchemaProperty + prompt: 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 + + +class AstNodeOutput_LtOperator(UncheckedBaseModel): + type: typing.Literal["lt_operator"] = "lt_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_LteOperator(UncheckedBaseModel): + type: typing.Literal["lte_operator"] = "lte_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_MulOperator(UncheckedBaseModel): + type: typing.Literal["mul_operator"] = "mul_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_NeqOperator(UncheckedBaseModel): + type: typing.Literal["neq_operator"] = "neq_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +class AstNodeOutput_NullLiteral(UncheckedBaseModel): + type: typing.Literal["null_literal"] = "null_literal" + + 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 + + +class AstNodeOutput_NumberLiteral(UncheckedBaseModel): + type: typing.Literal["number_literal"] = "number_literal" + value: AstNumberNodeOutputValue + + 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 + + +class AstNodeOutput_OrOperator(UncheckedBaseModel): + type: typing.Literal["or_operator"] = "or_operator" + children: typing.List["AstNodeOutput"] + + 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 + + +class AstNodeOutput_StringLiteral(UncheckedBaseModel): + type: typing.Literal["string_literal"] = "string_literal" + value: 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 + + +class AstNodeOutput_SubOperator(UncheckedBaseModel): + type: typing.Literal["sub_operator"] = "sub_operator" + left: "AstNodeOutput" + right: "AstNodeOutput" + + 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 + + +AstNodeOutput = typing_extensions.Annotated[ + typing.Union[ + AstNodeOutput_AddOperator, + AstNodeOutput_AndOperator, + AstNodeOutput_BooleanLiteral, + AstNodeOutput_ConditionalOperator, + AstNodeOutput_DivOperator, + AstNodeOutput_DynamicVariable, + AstNodeOutput_EqOperator, + AstNodeOutput_GtOperator, + AstNodeOutput_GteOperator, + AstNodeOutput_Llm, + AstNodeOutput_LtOperator, + AstNodeOutput_LteOperator, + AstNodeOutput_MulOperator, + AstNodeOutput_NeqOperator, + AstNodeOutput_NullLiteral, + AstNodeOutput_NumberLiteral, + AstNodeOutput_OrOperator, + AstNodeOutput_StringLiteral, + AstNodeOutput_SubOperator, + ], + UnionMetadata(discriminant="type"), +] +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstNodeOutput_AddOperator, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_AndOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_ConditionalOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_DivOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_EqOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_GtOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_GteOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_LtOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_LteOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_MulOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_NeqOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_OrOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) +update_forward_refs( + AstNodeOutput_SubOperator, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_not_equals_operator_node_input.py b/data/src/elevenlabs/types/ast_not_equals_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..1047a7fca4b5af70e374518229b7e37b8bf9e09d --- /dev/null +++ b/data/src/elevenlabs/types/ast_not_equals_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstNotEqualsOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstNotEqualsOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_not_equals_operator_node_output.py b/data/src/elevenlabs/types/ast_not_equals_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..859269627e5443c69a28bb9fb2151f3dbf8af1bb --- /dev/null +++ b/data/src/elevenlabs/types/ast_not_equals_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstNotEqualsOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstNotEqualsOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_null_node_input.py b/data/src/elevenlabs/types/ast_null_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..85bbf4357a7dcaa178f6887d7d7ee03312900945 --- /dev/null +++ b/data/src/elevenlabs/types/ast_null_node_input.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstNullNodeInput(UncheckedBaseModel): + 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/data/src/elevenlabs/types/ast_null_node_output.py b/data/src/elevenlabs/types/ast_null_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..2cb6a8bc2d712efc90912ad42b38af01e9432ed2 --- /dev/null +++ b/data/src/elevenlabs/types/ast_null_node_output.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstNullNodeOutput(UncheckedBaseModel): + 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/data/src/elevenlabs/types/ast_number_node_input.py b/data/src/elevenlabs/types/ast_number_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..d066a0331e779943e10a007f7b492a8cb0efc94a --- /dev/null +++ b/data/src/elevenlabs/types/ast_number_node_input.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .ast_number_node_input_value import AstNumberNodeInputValue + + +class AstNumberNodeInput(UncheckedBaseModel): + value: AstNumberNodeInputValue = pydantic.Field() + """ + Value of this literal. + """ + + 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/data/src/elevenlabs/types/ast_number_node_input_value.py b/data/src/elevenlabs/types/ast_number_node_input_value.py new file mode 100644 index 0000000000000000000000000000000000000000..b22278505400de354144e933f85cb8066ee3734e --- /dev/null +++ b/data/src/elevenlabs/types/ast_number_node_input_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AstNumberNodeInputValue = typing.Union[float, int] diff --git a/data/src/elevenlabs/types/ast_number_node_output.py b/data/src/elevenlabs/types/ast_number_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..4b51b3bcf75d1fa5bfadadfa0a62cb6054b99af1 --- /dev/null +++ b/data/src/elevenlabs/types/ast_number_node_output.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .ast_number_node_output_value import AstNumberNodeOutputValue + + +class AstNumberNodeOutput(UncheckedBaseModel): + value: AstNumberNodeOutputValue = pydantic.Field() + """ + Value of this literal. + """ + + 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/data/src/elevenlabs/types/ast_number_node_output_value.py b/data/src/elevenlabs/types/ast_number_node_output_value.py new file mode 100644 index 0000000000000000000000000000000000000000..8eb8b3997c1456e4ca11ebc0e7d8d7c517b4e7a7 --- /dev/null +++ b/data/src/elevenlabs/types/ast_number_node_output_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AstNumberNodeOutputValue = typing.Union[float, int] diff --git a/data/src/elevenlabs/types/ast_or_operator_node_input.py b/data/src/elevenlabs/types/ast_or_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..7bb7091bbf2e58b8a3c23bc0333fa1ee11c5abe6 --- /dev/null +++ b/data/src/elevenlabs/types/ast_or_operator_node_input.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstOrOperatorNodeInput(UncheckedBaseModel): + children: typing.List["AstNodeInput"] = pydantic.Field() + """ + Child nodes of the logical operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstOrOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_or_operator_node_output.py b/data/src/elevenlabs/types/ast_or_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..8eb4ba3f7dd99bb7f024511f9d4e3f31ee8bada7 --- /dev/null +++ b/data/src/elevenlabs/types/ast_or_operator_node_output.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstOrOperatorNodeOutput(UncheckedBaseModel): + children: typing.List["AstNodeOutput"] = pydantic.Field() + """ + Child nodes of the logical operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstOrOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/ast_string_node_input.py b/data/src/elevenlabs/types/ast_string_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..3b709b5ae5f7944893bf00b20072cb0226f2abbb --- /dev/null +++ b/data/src/elevenlabs/types/ast_string_node_input.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstStringNodeInput(UncheckedBaseModel): + value: str = pydantic.Field() + """ + Value of this literal. + """ + + 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/data/src/elevenlabs/types/ast_string_node_output.py b/data/src/elevenlabs/types/ast_string_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..2e0614442c1dbec2dfcdef639f25d58366b50412 --- /dev/null +++ b/data/src/elevenlabs/types/ast_string_node_output.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstStringNodeOutput(UncheckedBaseModel): + value: str = pydantic.Field() + """ + Value of this literal. + """ + + 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/data/src/elevenlabs/types/ast_subtraction_operator_node_input.py b/data/src/elevenlabs/types/ast_subtraction_operator_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..35e4e5582e1a8abaff10a926b17dc4ccb9f365ef --- /dev/null +++ b/data/src/elevenlabs/types/ast_subtraction_operator_node_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstSubtractionOperatorNodeInput(UncheckedBaseModel): + left: "AstNodeInput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeInput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + AstSubtractionOperatorNodeInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/ast_subtraction_operator_node_output.py b/data/src/elevenlabs/types/ast_subtraction_operator_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..8d1ba36a900db63553273c9753e847fdfba736e5 --- /dev/null +++ b/data/src/elevenlabs/types/ast_subtraction_operator_node_output.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstSubtractionOperatorNodeOutput(UncheckedBaseModel): + left: "AstNodeOutput" = pydantic.Field() + """ + Left operand of the binary operator. + """ + + right: "AstNodeOutput" = pydantic.Field() + """ + Right operand of the binary operator. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + AstSubtractionOperatorNodeOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/astllm_node_input.py b/data/src/elevenlabs/types/astllm_node_input.py new file mode 100644 index 0000000000000000000000000000000000000000..f04358cc446e87949a09e8df611bd3dc9c6f4997 --- /dev/null +++ b/data/src/elevenlabs/types/astllm_node_input.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .astllm_node_input_prompt import AstllmNodeInputPrompt +from .astllm_node_input_value_schema import AstllmNodeInputValueSchema + +AstllmNodeInput = typing.Union[AstllmNodeInputValueSchema, AstllmNodeInputPrompt] diff --git a/data/src/elevenlabs/types/astllm_node_input_prompt.py b/data/src/elevenlabs/types/astllm_node_input_prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..5612e539e80c99e885c62a2ef4eb29cc6bf6ef7e --- /dev/null +++ b/data/src/elevenlabs/types/astllm_node_input_prompt.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AstllmNodeInputPrompt(UncheckedBaseModel): + type: typing.Optional[typing.Literal["llm"]] = None + prompt: str = pydantic.Field() + """ + The prompt to evaluate to a boolean value. Deprecated. Use a boolean schema instead. + """ + + 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/data/src/elevenlabs/types/astllm_node_input_value_schema.py b/data/src/elevenlabs/types/astllm_node_input_value_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..3401d3057fe9aa8495ccc6e19d12a3826d44093c --- /dev/null +++ b/data/src/elevenlabs/types/astllm_node_input_value_schema.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_literal_json_schema_property import LlmLiteralJsonSchemaProperty + + +class AstllmNodeInputValueSchema(UncheckedBaseModel): + type: typing.Optional[typing.Literal["llm"]] = None + value_schema: LlmLiteralJsonSchemaProperty = pydantic.Field() + """ + JSON schema describing the value that the LLM should extract. + """ + + 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/data/src/elevenlabs/types/astllm_node_output.py b/data/src/elevenlabs/types/astllm_node_output.py new file mode 100644 index 0000000000000000000000000000000000000000..ec00f23fad074fed3f37151cfdc1a35c801e5443 --- /dev/null +++ b/data/src/elevenlabs/types/astllm_node_output.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_literal_json_schema_property import LlmLiteralJsonSchemaProperty + + +class AstllmNodeOutput(UncheckedBaseModel): + value_schema: LlmLiteralJsonSchemaProperty = pydantic.Field() + """ + JSON schema describing the value that the LLM should extract. + """ + + prompt: str = pydantic.Field() + """ + The prompt to evaluate to a boolean value. Deprecated. Use a boolean schema instead. + """ + + 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/data/src/elevenlabs/types/async_conversation_metadata.py b/data/src/elevenlabs/types/async_conversation_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..0b2125fd36a18bafd870fa79b327100dabe03745 --- /dev/null +++ b/data/src/elevenlabs/types/async_conversation_metadata.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .async_conversation_metadata_delivery_status import AsyncConversationMetadataDeliveryStatus + + +class AsyncConversationMetadata(UncheckedBaseModel): + """ + Metadata for async conversation delivery (Zendesk, Slack, etc.). + """ + + delivery_status: AsyncConversationMetadataDeliveryStatus + delivery_timestamp: int + delivery_error: typing.Optional[str] = None + external_system: str + external_id: str + external_link: typing.Optional[str] = None + retry_count: typing.Optional[int] = None + last_retry_timestamp: typing.Optional[int] = None + last_processed_external_message_id: 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/data/src/elevenlabs/types/async_conversation_metadata_delivery_status.py b/data/src/elevenlabs/types/async_conversation_metadata_delivery_status.py new file mode 100644 index 0000000000000000000000000000000000000000..da4528118dac0734929e3d7aa77a9e34ece543cd --- /dev/null +++ b/data/src/elevenlabs/types/async_conversation_metadata_delivery_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AsyncConversationMetadataDeliveryStatus = typing.Union[typing.Literal["pending", "success", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/attached_system_data_collection_ref.py b/data/src/elevenlabs/types/attached_system_data_collection_ref.py new file mode 100644 index 0000000000000000000000000000000000000000..893c3f87bf21d3749c9285196ec8d6221f84b523 --- /dev/null +++ b/data/src/elevenlabs/types/attached_system_data_collection_ref.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .analysis_scope import AnalysisScope +from .system_data_collection_id import SystemDataCollectionId + + +class AttachedSystemDataCollectionRef(UncheckedBaseModel): + analysis_item_id: SystemDataCollectionId = pydantic.Field(default="__system_data_collection_topic") + """ + Id of the referenced built-in system data-collection item. + """ + + scope: typing.Optional[AnalysisScope] = pydantic.Field(default=None) + """ + Transcript context ('conversation' or 'agent') used when running this item. + """ + + 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/data/src/elevenlabs/types/attached_system_evaluation_ref.py b/data/src/elevenlabs/types/attached_system_evaluation_ref.py new file mode 100644 index 0000000000000000000000000000000000000000..5695438167b889f9ec265769ffac16a591ab5815 --- /dev/null +++ b/data/src/elevenlabs/types/attached_system_evaluation_ref.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .analysis_scope import AnalysisScope +from .system_evaluation_id import SystemEvaluationId + + +class AttachedSystemEvaluationRef(UncheckedBaseModel): + analysis_item_id: SystemEvaluationId = pydantic.Field() + """ + Id of the referenced built-in system evaluation. + """ + + scope: typing.Optional[AnalysisScope] = pydantic.Field(default=None) + """ + Transcript context ('conversation' or 'agent') used when running this item. + """ + + weight: typing.Optional[float] = pydantic.Field(default=None) + """ + Optional relative weight for aggregate scoring. + """ + + 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/data/src/elevenlabs/types/attached_test_model.py b/data/src/elevenlabs/types/attached_test_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1b10b99d126713059b0657b969d2723751772a7b --- /dev/null +++ b/data/src/elevenlabs/types/attached_test_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AttachedTestModel(UncheckedBaseModel): + test_id: str + workflow_node_id: 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/data/src/elevenlabs/types/attached_user_data_collection_ref.py b/data/src/elevenlabs/types/attached_user_data_collection_ref.py new file mode 100644 index 0000000000000000000000000000000000000000..03520d038e833244c0f3a99d384d002595750386 --- /dev/null +++ b/data/src/elevenlabs/types/attached_user_data_collection_ref.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .analysis_scope import AnalysisScope + + +class AttachedUserDataCollectionRef(UncheckedBaseModel): + analysis_item_id: str = pydantic.Field() + """ + Id of the referenced user data-collection item. + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Pinned item version. None tracks the item's latest published version. + """ + + scope: typing.Optional[AnalysisScope] = pydantic.Field(default=None) + """ + Transcript context ('conversation' or 'agent') used when running this item. + """ + + 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/data/src/elevenlabs/types/attached_user_evaluation_ref.py b/data/src/elevenlabs/types/attached_user_evaluation_ref.py new file mode 100644 index 0000000000000000000000000000000000000000..296cc58389a5c621d9ef75f69cbbdbe04893c77a --- /dev/null +++ b/data/src/elevenlabs/types/attached_user_evaluation_ref.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .analysis_scope import AnalysisScope + + +class AttachedUserEvaluationRef(UncheckedBaseModel): + analysis_item_id: str = pydantic.Field() + """ + Id of the referenced user evaluation item. + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Primary item version whose result feeds scoring. None tracks the item's latest published version. + """ + + additional_version_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Extra item versions to also run for comparison (A/B). These are executed and stored but excluded from scoring; the primary version_id is the one that scores. + """ + + scope: typing.Optional[AnalysisScope] = pydantic.Field(default=None) + """ + Transcript context ('conversation' or 'agent') used when running this item. + """ + + weight: typing.Optional[float] = pydantic.Field(default=None) + """ + Optional relative weight for aggregate scoring. + """ + + 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/data/src/elevenlabs/types/audio_analysis.py b/data/src/elevenlabs/types/audio_analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..aaac18a75cc75228841cedf10799dff4dc66f45b --- /dev/null +++ b/data/src/elevenlabs/types/audio_analysis.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_analysis_result import AudioAnalysisResult +from .audio_analysis_status import AudioAnalysisStatus + + +class AudioAnalysis(UncheckedBaseModel): + status: AudioAnalysisStatus + data: typing.Optional[AudioAnalysisResult] = None + updated_at_ms: typing.Optional[int] = 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/data/src/elevenlabs/types/audio_analysis_result.py b/data/src/elevenlabs/types/audio_analysis_result.py new file mode 100644 index 0000000000000000000000000000000000000000..06f19332aab28d732d9cb0da29b55b508e3fac04 --- /dev/null +++ b/data/src/elevenlabs/types/audio_analysis_result.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_key_moment import AudioKeyMoment +from .audio_segment import AudioSegment + + +class AudioAnalysisResult(UncheckedBaseModel): + title: str + description: str + content_type: typing.Optional[str] = None + overall_pacing: typing.Optional[str] = None + segments: typing.Optional[typing.List[AudioSegment]] = None + key_moments: typing.Optional[typing.List[AudioKeyMoment]] = 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/data/src/elevenlabs/types/audio_analysis_status.py b/data/src/elevenlabs/types/audio_analysis_status.py new file mode 100644 index 0000000000000000000000000000000000000000..250ec750e7795323385c359c9d621400619e31d1 --- /dev/null +++ b/data/src/elevenlabs/types/audio_analysis_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AudioAnalysisStatus = typing.Union[typing.Literal["processing", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/audio_effects_background_noise_response_model.py b/data/src/elevenlabs/types/audio_effects_background_noise_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b5a3dbf8349bb76b953b21021b3c938d78c6b09b --- /dev/null +++ b/data/src/elevenlabs/types/audio_effects_background_noise_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioEffectsBackgroundNoiseResponseModel(UncheckedBaseModel): + background_noise_id: str = pydantic.Field() + """ + Value for `audio_effects.background_noise_id`. + """ + + name: str = pydantic.Field() + """ + Display name. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + What the noise bed sounds like. + """ + + 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/data/src/elevenlabs/types/audio_effects_catalog_response_model.py b/data/src/elevenlabs/types/audio_effects_catalog_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1f566d85315b93a1c2e68fdfc8cc87506cd38885 --- /dev/null +++ b/data/src/elevenlabs/types/audio_effects_catalog_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_effects_background_noise_response_model import AudioEffectsBackgroundNoiseResponseModel +from .audio_effects_environment_response_model import AudioEffectsEnvironmentResponseModel +from .audio_effects_filter_preset_response_model import AudioEffectsFilterPresetResponseModel + + +class AudioEffectsCatalogResponseModel(UncheckedBaseModel): + filter_presets: typing.List[AudioEffectsFilterPresetResponseModel] + environments: typing.List[AudioEffectsEnvironmentResponseModel] + background_noises: typing.List[AudioEffectsBackgroundNoiseResponseModel] + + 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/data/src/elevenlabs/types/audio_effects_environment_response_model.py b/data/src/elevenlabs/types/audio_effects_environment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..94be40238deb306f51427c689aae044c1c41bf34 --- /dev/null +++ b/data/src/elevenlabs/types/audio_effects_environment_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioEffectsEnvironmentResponseModel(UncheckedBaseModel): + environment_id: str = pydantic.Field() + """ + Value for `audio_effects.environment_id`. + """ + + name: str = pydantic.Field() + """ + Display name. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + What the space sounds like. + """ + + 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/data/src/elevenlabs/types/audio_effects_filter_preset_response_model.py b/data/src/elevenlabs/types/audio_effects_filter_preset_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6dae0d70195afe5674eb71dfa02c5ed7c209a59f --- /dev/null +++ b/data/src/elevenlabs/types/audio_effects_filter_preset_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioEffectsFilterPresetResponseModel(UncheckedBaseModel): + filter_preset_id: str = pydantic.Field() + """ + Value for `audio_effects.filter_preset_id`. + """ + + name: str = pydantic.Field() + """ + Display name. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + What the preset sounds like. + """ + + 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/data/src/elevenlabs/types/audio_format_enum.py b/data/src/elevenlabs/types/audio_format_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..7a3861907470e04af75e6abff7fb88d2022a5ae1 --- /dev/null +++ b/data/src/elevenlabs/types/audio_format_enum.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AudioFormatEnum = typing.Union[ + typing.Literal["pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "pcm_48000", "ulaw_8000"], typing.Any +] diff --git a/data/src/elevenlabs/types/audio_input_pacing.py b/data/src/elevenlabs/types/audio_input_pacing.py new file mode 100644 index 0000000000000000000000000000000000000000..efd0e95f9bfe1cc2fd26f3f4eefaa7ab0620570a --- /dev/null +++ b/data/src/elevenlabs/types/audio_input_pacing.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AudioInputPacing = typing.Union[typing.Literal["realtime", "bursty"], typing.Any] diff --git a/data/src/elevenlabs/types/audio_isolation_history_item_response_model.py b/data/src/elevenlabs/types/audio_isolation_history_item_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..57a7fc34a4334594dda1f7db3c5311b93ab999d4 --- /dev/null +++ b/data/src/elevenlabs/types/audio_isolation_history_item_response_model.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioIsolationHistoryItemResponseModel(UncheckedBaseModel): + id: str + title: typing.Optional[str] = None + created_at_unix: int + format: str + duration_seconds: typing.Optional[float] = None + download_url: typing.Optional[str] = None + icon_url: typing.Optional[str] = None + source_video_url: typing.Optional[str] = None + supports_video: bool + processing: bool + video_processing_failed: bool + preview_b_64: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="preview_b64"), pydantic.Field(alias="preview_b64") + ] = 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/data/src/elevenlabs/types/audio_key_moment.py b/data/src/elevenlabs/types/audio_key_moment.py new file mode 100644 index 0000000000000000000000000000000000000000..09c432ac6cc82a4317404804abed93da3198ef08 --- /dev/null +++ b/data/src/elevenlabs/types/audio_key_moment.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioKeyMoment(UncheckedBaseModel): + timestamp_ms: int + type: str + description: 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/data/src/elevenlabs/types/audio_native_create_project_response_model.py b/data/src/elevenlabs/types/audio_native_create_project_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9a5adf9f9c222ac5cdebb449f798a7a77aefb6b4 --- /dev/null +++ b/data/src/elevenlabs/types/audio_native_create_project_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioNativeCreateProjectResponseModel(UncheckedBaseModel): + project_id: str = pydantic.Field() + """ + The ID of the created Audio Native project. + """ + + converting: bool = pydantic.Field() + """ + Whether the project is currently being converted. + """ + + html_snippet: str = pydantic.Field() + """ + The HTML snippet to embed the Audio Native player. + """ + + 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/data/src/elevenlabs/types/audio_native_edit_content_response_model.py b/data/src/elevenlabs/types/audio_native_edit_content_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..109cd979e2dd041114bbc525209c97e3c8adeb10 --- /dev/null +++ b/data/src/elevenlabs/types/audio_native_edit_content_response_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioNativeEditContentResponseModel(UncheckedBaseModel): + project_id: str = pydantic.Field() + """ + The ID of the project. + """ + + converting: bool = pydantic.Field() + """ + Whether the project is currently being converted. + """ + + publishing: bool = pydantic.Field() + """ + Whether the project is currently being published. + """ + + html_snippet: str = pydantic.Field() + """ + The HTML snippet to embed the Audio Native player. + """ + + 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/data/src/elevenlabs/types/audio_native_project_settings_response_model.py b/data/src/elevenlabs/types/audio_native_project_settings_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ba10274888ff1fa6eb694a424e1f9d7558ec82a7 --- /dev/null +++ b/data/src/elevenlabs/types/audio_native_project_settings_response_model.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_native_project_settings_response_model_status import AudioNativeProjectSettingsResponseModelStatus + + +class AudioNativeProjectSettingsResponseModel(UncheckedBaseModel): + title: str = pydantic.Field() + """ + The title of the project. + """ + + image: str = pydantic.Field() + """ + The image of the project. + """ + + author: str = pydantic.Field() + """ + The author of the project. + """ + + small: bool = pydantic.Field() + """ + Whether the project is small. + """ + + text_color: str = pydantic.Field() + """ + The text color of the project. + """ + + background_color: str = pydantic.Field() + """ + The background color of the project. + """ + + sessionization: int = pydantic.Field() + """ + The sessionization of the project. Specifies for how many minutes to persist the session across page reloads. + """ + + audio_path: typing.Optional[str] = pydantic.Field(default=None) + """ + The path of the audio file. + """ + + audio_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The URL of the audio file. + """ + + status: typing.Optional[AudioNativeProjectSettingsResponseModelStatus] = pydantic.Field(default=None) + """ + Current state of the project + """ + + 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/data/src/elevenlabs/types/audio_native_project_settings_response_model_status.py b/data/src/elevenlabs/types/audio_native_project_settings_response_model_status.py new file mode 100644 index 0000000000000000000000000000000000000000..edbf92f6f61d9bdd075bc08e6dc2a64c34e47c98 --- /dev/null +++ b/data/src/elevenlabs/types/audio_native_project_settings_response_model_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AudioNativeProjectSettingsResponseModelStatus = typing.Union[typing.Literal["processing", "ready"], typing.Any] diff --git a/data/src/elevenlabs/types/audio_output.py b/data/src/elevenlabs/types/audio_output.py new file mode 100644 index 0000000000000000000000000000000000000000..937bfbbdbe2dff590bf9511195fb621fad5eec78 --- /dev/null +++ b/data/src/elevenlabs/types/audio_output.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .alignment import Alignment +from .normalized_alignment import NormalizedAlignment + + +class AudioOutput(UncheckedBaseModel): + audio: str = pydantic.Field() + """ + A generated partial audio chunk, encoded using the selected output_format, by default this + is MP3 encoded as a base64 string. + """ + + normalized_alignment: typing_extensions.Annotated[ + typing.Optional[NormalizedAlignment], + FieldMetadata(alias="normalizedAlignment"), + pydantic.Field(alias="normalizedAlignment"), + ] = None + alignment: typing.Optional[Alignment] = 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/data/src/elevenlabs/types/audio_output_multi.py b/data/src/elevenlabs/types/audio_output_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..7d2016872860004b70377e9626e6c107bb3a2764 --- /dev/null +++ b/data/src/elevenlabs/types/audio_output_multi.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .alignment import Alignment +from .normalized_alignment import NormalizedAlignment + + +class AudioOutputMulti(UncheckedBaseModel): + """ + Server payload containing an audio chunk for a specific context. + """ + + audio: str = pydantic.Field() + """ + Base64 encoded audio chunk. + """ + + normalized_alignment: typing_extensions.Annotated[ + typing.Optional[NormalizedAlignment], + FieldMetadata(alias="normalizedAlignment"), + pydantic.Field(alias="normalizedAlignment"), + ] = None + alignment: typing.Optional[Alignment] = None + context_id: typing_extensions.Annotated[ + typing.Optional[str], + FieldMetadata(alias="contextId"), + pydantic.Field(alias="contextId", description="The contextId for which this audio is."), + ] = 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/data/src/elevenlabs/types/audio_ref_chunk.py b/data/src/elevenlabs/types/audio_ref_chunk.py new file mode 100644 index 0000000000000000000000000000000000000000..0f6e86262f44819aeb78125d8a75a95a20d185d2 --- /dev/null +++ b/data/src/elevenlabs/types/audio_ref_chunk.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .time_range import TimeRange + + +class AudioRefChunk(UncheckedBaseModel): + song_id: str = pydantic.Field() + """ + The ID of the song to source the chunk from. You can find the song ID in the response headers when you generate a song. + """ + + range: TimeRange = pydantic.Field() + """ + The time range to extract from the song. + """ + + 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/data/src/elevenlabs/types/audio_reference.py b/data/src/elevenlabs/types/audio_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..64077feb65c79433e2687b0b60d5cdb193b11235 --- /dev/null +++ b/data/src/elevenlabs/types/audio_reference.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .inline_audio_reference_mime_type import InlineAudioReferenceMimeType + + +class AudioReference_Asset(UncheckedBaseModel): + type: typing.Literal["asset"] = "asset" + asset_id: 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 + + +class AudioReference_Generation(UncheckedBaseModel): + type: typing.Literal["generation"] = "generation" + generation_id: 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 + + +class AudioReference_InlineBase64(UncheckedBaseModel): + type: typing.Literal["inline_base64"] = "inline_base64" + content_base_64: typing_extensions.Annotated[ + str, FieldMetadata(alias="content_base64"), pydantic.Field(alias="content_base64") + ] + mime_type: InlineAudioReferenceMimeType + + 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 + + +AudioReference = typing_extensions.Annotated[ + typing.Union[AudioReference_Asset, AudioReference_Generation, AudioReference_InlineBase64], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/audio_schema.py b/data/src/elevenlabs/types/audio_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..b0ce36d3818eab7c34977bbb16c5807b8043d4b9 --- /dev/null +++ b/data/src/elevenlabs/types/audio_schema.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: 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/data/src/elevenlabs/types/audio_segment.py b/data/src/elevenlabs/types/audio_segment.py new file mode 100644 index 0000000000000000000000000000000000000000..e88154bc69784a55a7c09a7cadf6d770ffd1d12f --- /dev/null +++ b/data/src/elevenlabs/types/audio_segment.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AudioSegment(UncheckedBaseModel): + start_ms: int + end_ms: int + description: str + segment_type: typing.Optional[str] = None + has_speech: typing.Optional[bool] = None + has_music: typing.Optional[bool] = None + pacing: 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/data/src/elevenlabs/types/audio_with_timestamps_and_voice_segments_response_model.py b/data/src/elevenlabs/types/audio_with_timestamps_and_voice_segments_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4ef82186dc6cbc1ab2680f094f5f4ed6d0db1253 --- /dev/null +++ b/data/src/elevenlabs/types/audio_with_timestamps_and_voice_segments_response_model.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .character_alignment_response_model import CharacterAlignmentResponseModel +from .voice_segment import VoiceSegment + + +class AudioWithTimestampsAndVoiceSegmentsResponseModel(UncheckedBaseModel): + audio_base_64: typing_extensions.Annotated[ + str, + FieldMetadata(alias="audio_base64"), + pydantic.Field(alias="audio_base64", description="Base64 encoded audio data"), + ] + alignment: typing.Optional[CharacterAlignmentResponseModel] = pydantic.Field(default=None) + """ + Timestamp information for each character in the original text + """ + + normalized_alignment: typing.Optional[CharacterAlignmentResponseModel] = pydantic.Field(default=None) + """ + Timestamp information for each character in the normalized text + """ + + voice_segments: typing.List[VoiceSegment] = pydantic.Field() + """ + Voice segments for the audio + """ + + 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/data/src/elevenlabs/types/audio_with_timestamps_response.py b/data/src/elevenlabs/types/audio_with_timestamps_response.py new file mode 100644 index 0000000000000000000000000000000000000000..ace5ce4e28a2c4747bdf0ded1055d612bac51c6f --- /dev/null +++ b/data/src/elevenlabs/types/audio_with_timestamps_response.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .character_alignment_response_model import CharacterAlignmentResponseModel + + +class AudioWithTimestampsResponse(UncheckedBaseModel): + audio_base_64: typing_extensions.Annotated[ + str, + FieldMetadata(alias="audio_base64"), + pydantic.Field(alias="audio_base64", description="Base64 encoded audio data"), + ] + alignment: typing.Optional[CharacterAlignmentResponseModel] = pydantic.Field(default=None) + """ + Timestamp information for each character in the original text + """ + + normalized_alignment: typing.Optional[CharacterAlignmentResponseModel] = pydantic.Field(default=None) + """ + Timestamp information for each character in the normalized text + """ + + 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/data/src/elevenlabs/types/auth_connection_dependencies.py b/data/src/elevenlabs/types/auth_connection_dependencies.py new file mode 100644 index 0000000000000000000000000000000000000000..0be284c9624aaf65a9fbc5d8a3e78599f1e85942 --- /dev/null +++ b/data/src/elevenlabs/types/auth_connection_dependencies.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies_mcp_servers_item import AuthConnectionDependenciesMcpServersItem +from .auth_connection_dependencies_tools_item import AuthConnectionDependenciesToolsItem +from .dependent_integration_connection_identifier import DependentIntegrationConnectionIdentifier + + +class AuthConnectionDependencies(UncheckedBaseModel): + """ + Dependencies that use an auth connection + """ + + tools: typing.Optional[typing.List[AuthConnectionDependenciesToolsItem]] = None + mcp_servers: typing.Optional[typing.List[AuthConnectionDependenciesMcpServersItem]] = None + integration_connections: typing.Optional[typing.List[DependentIntegrationConnectionIdentifier]] = 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/data/src/elevenlabs/types/auth_connection_dependencies_mcp_servers_item.py b/data/src/elevenlabs/types/auth_connection_dependencies_mcp_servers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..bb64c357f828cca6997cdb8538cfd0a6969823dc --- /dev/null +++ b/data/src/elevenlabs/types/auth_connection_dependencies_mcp_servers_item.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_mcp_server_identifier_access_level import DependentAvailableMcpServerIdentifierAccessLevel + + +class AuthConnectionDependenciesMcpServersItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableMcpServerIdentifierAccessLevel + + 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 + + +class AuthConnectionDependenciesMcpServersItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + id: 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 + + +AuthConnectionDependenciesMcpServersItem = typing_extensions.Annotated[ + typing.Union[AuthConnectionDependenciesMcpServersItem_Available, AuthConnectionDependenciesMcpServersItem_Unknown], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/auth_connection_dependencies_tools_item.py b/data/src/elevenlabs/types/auth_connection_dependencies_tools_item.py new file mode 100644 index 0000000000000000000000000000000000000000..18cdaca4d832e25b63802031240af0e56808fd59 --- /dev/null +++ b/data/src/elevenlabs/types/auth_connection_dependencies_tools_item.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_tool_identifier_access_level import DependentAvailableToolIdentifierAccessLevel + + +class AuthConnectionDependenciesToolsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableToolIdentifierAccessLevel + + 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 + + +class AuthConnectionDependenciesToolsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + id: 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 + + +AuthConnectionDependenciesToolsItem = typing_extensions.Annotated[ + typing.Union[AuthConnectionDependenciesToolsItem_Available, AuthConnectionDependenciesToolsItem_Unknown], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/auth_connection_locator.py b/data/src/elevenlabs/types/auth_connection_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..386cffa8b2d642b6d1a21888d186a79f5706a5b5 --- /dev/null +++ b/data/src/elevenlabs/types/auth_connection_locator.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AuthConnectionLocator(UncheckedBaseModel): + """ + Used to reference an auth connection from the workspace's auth connection store. + """ + + auth_connection_id: 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/data/src/elevenlabs/types/auth_connection_status.py b/data/src/elevenlabs/types/auth_connection_status.py new file mode 100644 index 0000000000000000000000000000000000000000..79ee1ce717b7d52d8519a717220aeeca531acc4b --- /dev/null +++ b/data/src/elevenlabs/types/auth_connection_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AuthConnectionStatus = typing.Union[ + typing.Literal["active", "refresh_failed", "revoked", "credential_invalid"], typing.Any +] diff --git a/data/src/elevenlabs/types/auth_settings.py b/data/src/elevenlabs/types/auth_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..2f9a531eb088b9fda6317a9eb39ed4c4293b978c --- /dev/null +++ b/data/src/elevenlabs/types/auth_settings.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .allowlist_item import AllowlistItem + + +class AuthSettings(UncheckedBaseModel): + enable_auth: typing.Optional[bool] = pydantic.Field(default=None) + """ + If set to true, starting a conversation with an agent will require a signed token + """ + + allowlist: typing.Optional[typing.List[AllowlistItem]] = pydantic.Field(default=None) + """ + A list of hosts that are allowed to start conversations with the agent + """ + + require_origin_header: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, connections with no origin header will be rejected. If the allowlist is empty, this option has no effect. + """ + + shareable_token: typing.Optional[str] = pydantic.Field(default=None) + """ + A shareable token that can be used to start a conversation with the agent + """ + + 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/data/src/elevenlabs/types/authentication_activity_id.py b/data/src/elevenlabs/types/authentication_activity_id.py new file mode 100644 index 0000000000000000000000000000000000000000..f2c00a671ec5c3d00ed962e1dfc8f981317beb35 --- /dev/null +++ b/data/src/elevenlabs/types/authentication_activity_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +AuthenticationActivityId = int diff --git a/data/src/elevenlabs/types/authorization_method.py b/data/src/elevenlabs/types/authorization_method.py new file mode 100644 index 0000000000000000000000000000000000000000..19d1d4ea066956738564e9914ce4f14f5d923a05 --- /dev/null +++ b/data/src/elevenlabs/types/authorization_method.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AuthorizationMethod = typing.Union[ + typing.Literal[ + "invalid", + "public", + "authorization_header", + "signed_url", + "shareable_link", + "livekit_token", + "livekit_token_website", + "genesys_api_key", + "avaya_api_key", + "audiocodes_api_key", + "whatsapp", + "sms", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/auto_generation_metadata.py b/data/src/elevenlabs/types/auto_generation_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..3988a4e8eb16ee5e06f27a58df88f6f488cf34b6 --- /dev/null +++ b/data/src/elevenlabs/types/auto_generation_metadata.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AutoGenerationMetadata(UncheckedBaseModel): + """ + Metadata for an automatically generated simulation test. + + Tracks the origin and context of tests that were auto-generated from + conversations, including the source conversation, topic, and evaluation + criteria the test covers. + """ + + agent_id: str = pydantic.Field() + """ + Agent whose simulation library this test belongs to. + """ + + stable_topic_id: str = pydantic.Field() + """ + Stable topic id (from topic discovery) this test covers. + """ + + criteria_id: str = pydantic.Field() + """ + Evaluation criterion id this test targets. + """ + + topic_label: str = pydantic.Field() + """ + Human-readable topic label at generation time. + """ + + source_conversation_id: str = pydantic.Field() + """ + Conversation the test was generated from. + """ + + generated_at_unix: int = pydantic.Field() + """ + Unix timestamp (seconds) when the test was generated. + """ + + 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/data/src/elevenlabs/types/auto_sync_info.py b/data/src/elevenlabs/types/auto_sync_info.py new file mode 100644 index 0000000000000000000000000000000000000000..781b4f009fe0e87152d7719b240562d1920b270c --- /dev/null +++ b/data/src/elevenlabs/types/auto_sync_info.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AutoSyncInfo(UncheckedBaseModel): + minimum_frequency_days: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum frequency (in days) at which the document is refreshed. The actual interval may be shorter, never longer. + """ + + auto_remove: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to remove the document if the URL becomes unavailable + """ + + auto_discover: typing.Optional[bool] = pydantic.Field(default=None) + """ + Deprecated. This field no longer has any effect and will be removed in a future release. + """ + + consec_failures: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of consecutive sync failures + """ + + next_refresh_by: typing.Optional[int] = pydantic.Field(default=None) + """ + Unix timestamp for the next scheduled sync or None (in case of folders) + """ + + 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/data/src/elevenlabs/types/avatar_context_response_model.py b/data/src/elevenlabs/types/avatar_context_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..479ead33d5f0e13b4528fd1167dd0243b7e687d9 --- /dev/null +++ b/data/src/elevenlabs/types/avatar_context_response_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class AvatarContextResponseModel(UncheckedBaseModel): + avatar_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the avatar. + """ + + avatar_style_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the avatar style. + """ + + avatar_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the avatar. + """ + + avatar_style_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the avatar style. + """ + + 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/data/src/elevenlabs/types/background_sound_config.py b/data/src/elevenlabs/types/background_sound_config.py new file mode 100644 index 0000000000000000000000000000000000000000..bf5d185176ef4e92c99c9134310d12511a4531c0 --- /dev/null +++ b/data/src/elevenlabs/types/background_sound_config.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .background_sound_preset_id import BackgroundSoundPresetId +from .background_sound_source_type import BackgroundSoundSourceType + + +class BackgroundSoundConfig(UncheckedBaseModel): + source_type: typing.Optional[BackgroundSoundSourceType] = pydantic.Field(default=None) + """ + The type of background sound source. + """ + + source_id: typing.Optional[BackgroundSoundPresetId] = pydantic.Field(default=None) + """ + Identifier for the sound source. + """ + + volume: typing.Optional[float] = pydantic.Field(default=None) + """ + Volume level for background sound (0.01 to 1.0). + """ + + crossfade_loop: typing.Optional[bool] = pydantic.Field(default=None) + """ + Apply a crossfade at the loop boundary to avoid audible pops when the sound loops. + """ + + 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/data/src/elevenlabs/types/background_sound_config_workflow_override.py b/data/src/elevenlabs/types/background_sound_config_workflow_override.py new file mode 100644 index 0000000000000000000000000000000000000000..a943aa0d8a3532d7c515d40c0216ed7b8feb1d07 --- /dev/null +++ b/data/src/elevenlabs/types/background_sound_config_workflow_override.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .background_sound_preset_id import BackgroundSoundPresetId +from .background_sound_source_type import BackgroundSoundSourceType + + +class BackgroundSoundConfigWorkflowOverride(UncheckedBaseModel): + source_type: typing.Optional[BackgroundSoundSourceType] = pydantic.Field(default=None) + """ + The type of background sound source. + """ + + source_id: typing.Optional[BackgroundSoundPresetId] = pydantic.Field(default=None) + """ + Identifier for the sound source. + """ + + volume: typing.Optional[float] = pydantic.Field(default=None) + """ + Volume level for background sound (0.01 to 1.0). + """ + + crossfade_loop: typing.Optional[bool] = pydantic.Field(default=None) + """ + Apply a crossfade at the loop boundary to avoid audible pops when the sound loops. + """ + + 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/data/src/elevenlabs/types/background_sound_preset_id.py b/data/src/elevenlabs/types/background_sound_preset_id.py new file mode 100644 index 0000000000000000000000000000000000000000..979c10672bf7c4798f5bc4bce8ddc27068536cf2 --- /dev/null +++ b/data/src/elevenlabs/types/background_sound_preset_id.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BackgroundSoundPresetId = typing.Union[ + typing.Literal[ + "office2", "office1", "restaurant", "city", "typing", "elevator1", "elevator2", "elevator3", "elevator4" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/background_sound_source_type.py b/data/src/elevenlabs/types/background_sound_source_type.py new file mode 100644 index 0000000000000000000000000000000000000000..e19cd7524239c0ad7e1f098f17513462d2170b0a --- /dev/null +++ b/data/src/elevenlabs/types/background_sound_source_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BackgroundSoundSourceType = typing.Literal["preset"] diff --git a/data/src/elevenlabs/types/backup_llm_default.py b/data/src/elevenlabs/types/backup_llm_default.py new file mode 100644 index 0000000000000000000000000000000000000000..9dd23da7937681304143c31403703fdaf9bf554c --- /dev/null +++ b/data/src/elevenlabs/types/backup_llm_default.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class BackupLlmDefault(UncheckedBaseModel): + preference: typing.Optional[typing.Literal["default"]] = 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/data/src/elevenlabs/types/backup_llm_disabled.py b/data/src/elevenlabs/types/backup_llm_disabled.py new file mode 100644 index 0000000000000000000000000000000000000000..fe3f06208fee1e9b6461028c8c4a983d232c6e75 --- /dev/null +++ b/data/src/elevenlabs/types/backup_llm_disabled.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class BackupLlmDisabled(UncheckedBaseModel): + preference: typing.Optional[typing.Literal["disabled"]] = 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/data/src/elevenlabs/types/backup_llm_override.py b/data/src/elevenlabs/types/backup_llm_override.py new file mode 100644 index 0000000000000000000000000000000000000000..05891edc75e912951ee5a5c9bbee24dcb536ba4d --- /dev/null +++ b/data/src/elevenlabs/types/backup_llm_override.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm import Llm + + +class BackupLlmOverride(UncheckedBaseModel): + preference: typing.Optional[typing.Literal["override"]] = None + order: typing.List[Llm] + + 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/data/src/elevenlabs/types/bad_request_error_body.py b/data/src/elevenlabs/types/bad_request_error_body.py new file mode 100644 index 0000000000000000000000000000000000000000..e40253487f43b9caf8f29b29afc473f224644763 --- /dev/null +++ b/data/src/elevenlabs/types/bad_request_error_body.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class BadRequestErrorBody(UncheckedBaseModel): + error: typing.Optional[str] = None + message: 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/data/src/elevenlabs/types/ban_reason_type.py b/data/src/elevenlabs/types/ban_reason_type.py new file mode 100644 index 0000000000000000000000000000000000000000..81accd21cda93330735ff9755f35b21e0ef2a78c --- /dev/null +++ b/data/src/elevenlabs/types/ban_reason_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BanReasonType = typing.Union[typing.Literal["safety", "manual"], typing.Any] diff --git a/data/src/elevenlabs/types/base_turn_config.py b/data/src/elevenlabs/types/base_turn_config.py new file mode 100644 index 0000000000000000000000000000000000000000..ff6e6d2d14cd151c5d17413411b8baa21493d866 --- /dev/null +++ b/data/src/elevenlabs/types/base_turn_config.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .spelling_patience import SpellingPatience +from .turn_eagerness import TurnEagerness +from .turn_model import TurnModel + + +class BaseTurnConfig(UncheckedBaseModel): + turn_timeout: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum wait time for the user's reply before re-engaging the user + """ + + initial_wait_time: typing.Optional[float] = pydantic.Field(default=None) + """ + How long the agent will wait for the user to start the conversation if the first message is empty. If not set, uses the regular turn_timeout. + """ + + silence_end_call_timeout: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum wait time since the user last spoke before terminating the call + """ + + turn_eagerness: typing.Optional[TurnEagerness] = pydantic.Field(default=None) + """ + Controls how eager the agent is to respond. Low = less eager (waits longer), Standard = default eagerness, High = more eager (responds sooner) + """ + + spelling_patience: typing.Optional[SpellingPatience] = pydantic.Field(default=None) + """ + Controls if the agent should be more patient when user is spelling numbers and named entities. Auto = model based, Off = never wait extra + """ + + speculative_turn: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, starts generating LLM responses during silence before full turn confidence is reached, reducing perceived latency. May increase LLM costs. + """ + + retranscribe_on_turn_timeout: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, if VAD detects no speech, attempts to re-transcribe accumulated audio at turn timeout. Disables silence discount billing while enabled for the active agent or workflow node. + """ + + turn_model: typing.Optional[TurnModel] = None + interruption_ignore_terms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of terms that should not trigger an interruption when spoken by the user (e.g. 'gotcha', 'understood'). Uses case-insensitive exact matching. + """ + + interruption_ignore_term_languages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Language codes for which preset ignore-term categories have been activated. Stored explicitly so display is not inferred from term overlap. + """ + + merge_with_default_ignore_terms: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, the curated default terms for interruption_ignore_term_languages are used in addition to interruption_ignore_terms. + """ + + transcribe_on_disabled_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + When interruptions are disabled, still transcribe what the user says so it can carry into the next turn. When off, user speech during a non-interruptible turn is ignored and won't trigger a turn. + """ + + 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/data/src/elevenlabs/types/basic_auth_response.py b/data/src/elevenlabs/types/basic_auth_response.py new file mode 100644 index 0000000000000000000000000000000000000000..ececdf652602f6385e3d66f88503bbd2b7304494 --- /dev/null +++ b/data/src/elevenlabs/types/basic_auth_response.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class BasicAuthResponse(UncheckedBaseModel): + """ + Response model for basic auth + """ + + name: str + provider: str + username: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/batch_call_detailed_response.py b/data/src/elevenlabs/types/batch_call_detailed_response.py new file mode 100644 index 0000000000000000000000000000000000000000..0cf4a2a7d48e6f99a04aa4d3c519e5dcdb00decf --- /dev/null +++ b/data/src/elevenlabs/types/batch_call_detailed_response.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .batch_call_status import BatchCallStatus +from .batch_call_whats_app_params import BatchCallWhatsAppParams +from .outbound_call_recipient_response_model import OutboundCallRecipientResponseModel +from .telephony_call_config_output import TelephonyCallConfigOutput +from .telephony_provider import TelephonyProvider + + +class BatchCallDetailedResponse(UncheckedBaseModel): + """ + Detailed response model for a batch call including all recipients. + """ + + id: str + phone_number_id: typing.Optional[str] = None + phone_provider: typing.Optional[TelephonyProvider] = None + whatsapp_params: typing.Optional[BatchCallWhatsAppParams] = None + name: str + agent_id: str + branch_id: typing.Optional[str] = None + environment: typing.Optional[str] = None + created_at_unix: int + scheduled_time_unix: int + timezone: typing.Optional[str] = None + total_calls_dispatched: int + total_calls_scheduled: int + total_calls_finished: int + last_updated_at_unix: int + status: BatchCallStatus + retry_count: int + telephony_call_config: TelephonyCallConfigOutput + target_concurrency_limit: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of simultaneous calls for this batch. When set, dispatch is governed by this limit rather than workspace/agent capacity percentages. + """ + + agent_name: str + branch_name: typing.Optional[str] = None + recipients: typing.List[OutboundCallRecipientResponseModel] + + 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/data/src/elevenlabs/types/batch_call_recipient_status.py b/data/src/elevenlabs/types/batch_call_recipient_status.py new file mode 100644 index 0000000000000000000000000000000000000000..c3e2e9e335005d4ccb35b1a0774ce9b7501f86ca --- /dev/null +++ b/data/src/elevenlabs/types/batch_call_recipient_status.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BatchCallRecipientStatus = typing.Union[ + typing.Literal[ + "pending", "dispatched", "initiated", "in_progress", "completed", "failed", "cancelled", "voicemail" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/batch_call_response.py b/data/src/elevenlabs/types/batch_call_response.py new file mode 100644 index 0000000000000000000000000000000000000000..0bec3a77cdbaf38a47805c7726978a25f8c197c5 --- /dev/null +++ b/data/src/elevenlabs/types/batch_call_response.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .batch_call_status import BatchCallStatus +from .batch_call_whats_app_params import BatchCallWhatsAppParams +from .telephony_call_config_output import TelephonyCallConfigOutput +from .telephony_provider import TelephonyProvider + + +class BatchCallResponse(UncheckedBaseModel): + id: str + phone_number_id: typing.Optional[str] = None + phone_provider: typing.Optional[TelephonyProvider] = None + whatsapp_params: typing.Optional[BatchCallWhatsAppParams] = None + name: str + agent_id: str + branch_id: typing.Optional[str] = None + environment: typing.Optional[str] = None + created_at_unix: int + scheduled_time_unix: int + timezone: typing.Optional[str] = None + total_calls_dispatched: int + total_calls_scheduled: int + total_calls_finished: int + last_updated_at_unix: int + status: BatchCallStatus + retry_count: int + telephony_call_config: TelephonyCallConfigOutput + target_concurrency_limit: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of simultaneous calls for this batch. When set, dispatch is governed by this limit rather than workspace/agent capacity percentages. + """ + + agent_name: str + branch_name: 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/data/src/elevenlabs/types/batch_call_status.py b/data/src/elevenlabs/types/batch_call_status.py new file mode 100644 index 0000000000000000000000000000000000000000..696763c036bbc22814e985b38207bc20f30ec950 --- /dev/null +++ b/data/src/elevenlabs/types/batch_call_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BatchCallStatus = typing.Union[typing.Literal["pending", "in_progress", "completed", "failed", "cancelled"], typing.Any] diff --git a/data/src/elevenlabs/types/batch_call_whats_app_params.py b/data/src/elevenlabs/types/batch_call_whats_app_params.py new file mode 100644 index 0000000000000000000000000000000000000000..e9635fa6383ebd30d73d0c7909c39f7e9934d7fd --- /dev/null +++ b/data/src/elevenlabs/types/batch_call_whats_app_params.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class BatchCallWhatsAppParams(UncheckedBaseModel): + whatsapp_phone_number_id: typing.Optional[str] = None + whatsapp_call_permission_request_template_name: str + whatsapp_call_permission_request_template_language_code: 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/data/src/elevenlabs/types/batch_calling_campaign_information.py b/data/src/elevenlabs/types/batch_calling_campaign_information.py new file mode 100644 index 0000000000000000000000000000000000000000..846214f5373c7cff7e959c4e569c6466c0217595 --- /dev/null +++ b/data/src/elevenlabs/types/batch_calling_campaign_information.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .campaign_conversation_type import CampaignConversationType + + +class BatchCallingCampaignInformation(UncheckedBaseModel): + campaign_id: str + campaign_lead_id: str + cold_attempt: typing.Optional[int] = None + conversation_type: typing.Optional[CampaignConversationType] = 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/data/src/elevenlabs/types/batch_failure_response_model.py b/data/src/elevenlabs/types/batch_failure_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..7ca100977733d491f536823e9e1ed02aaf98388d --- /dev/null +++ b/data/src/elevenlabs/types/batch_failure_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class BatchFailureResponseModel(UncheckedBaseModel): + error_code: int + error_status: str + error_message: 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/data/src/elevenlabs/types/bearer_auth_response.py b/data/src/elevenlabs/types/bearer_auth_response.py new file mode 100644 index 0000000000000000000000000000000000000000..70e91c2d9d4e9cb509e4c099b88712fc556e5689 --- /dev/null +++ b/data/src/elevenlabs/types/bearer_auth_response.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class BearerAuthResponse(UncheckedBaseModel): + """ + Response model for bearer auth + """ + + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/behavior_override.py b/data/src/elevenlabs/types/behavior_override.py new file mode 100644 index 0000000000000000000000000000000000000000..65cd1f84e251339a353f921f8eade0bde28e8d97 --- /dev/null +++ b/data/src/elevenlabs/types/behavior_override.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .interaction_budget import InteractionBudget +from .output_format import OutputFormat +from .verbosity import Verbosity + + +class BehaviorOverride(UncheckedBaseModel): + verbosity: typing.Optional[Verbosity] = pydantic.Field(default=None) + """ + Verbosity override. Underlying default applies when unset. + """ + + output_format: typing.Optional[OutputFormat] = pydantic.Field(default=None) + """ + Output format override. Underlying default applies when unset. + """ + + interaction_budget: typing.Optional[InteractionBudget] = pydantic.Field(default=None) + """ + Interaction budget override. Underlying default applies when unset. + """ + + 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/data/src/elevenlabs/types/billing_period.py b/data/src/elevenlabs/types/billing_period.py new file mode 100644 index 0000000000000000000000000000000000000000..dee52d4b05297273b7e71a8e298dfc5680015b9e --- /dev/null +++ b/data/src/elevenlabs/types/billing_period.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BillingPeriod = typing.Union[ + typing.Literal["monthly_period", "3_month_period", "6_month_period", "annual_period"], typing.Any +] diff --git a/data/src/elevenlabs/types/boolean_schema.py b/data/src/elevenlabs/types/boolean_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..33bd357e0d3505ab319ef80ce60d28d6bec43ce4 --- /dev/null +++ b/data/src/elevenlabs/types/boolean_schema.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class BooleanSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: 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/data/src/elevenlabs/types/branch_protection_status.py b/data/src/elevenlabs/types/branch_protection_status.py new file mode 100644 index 0000000000000000000000000000000000000000..c72a7839f9b457141eb1ff6e9d6bc69c4af10192 --- /dev/null +++ b/data/src/elevenlabs/types/branch_protection_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BranchProtectionStatus = typing.Union[typing.Literal["writer_perms_required", "admin_perms_required"], typing.Any] diff --git a/data/src/elevenlabs/types/breakdown_types.py b/data/src/elevenlabs/types/breakdown_types.py new file mode 100644 index 0000000000000000000000000000000000000000..23f0e846e1cabd82a5e7284c918d5a2a7243c571 --- /dev/null +++ b/data/src/elevenlabs/types/breakdown_types.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BreakdownTypes = typing.Union[ + typing.Literal[ + "none", + "voice", + "voice_multiplier", + "user", + "groups", + "api_keys", + "all_api_keys", + "product_type", + "model", + "resource", + "request_queue", + "region", + "subresource_id", + "reporting_workspace_id", + "has_api_key", + "request_source", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/bucketing_status.py b/data/src/elevenlabs/types/bucketing_status.py new file mode 100644 index 0000000000000000000000000000000000000000..2d90a63a87b3e9b98db445dd625e37a3ea614111 --- /dev/null +++ b/data/src/elevenlabs/types/bucketing_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BucketingStatus = typing.Union[typing.Literal["pending", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/built_in_tools_input.py b/data/src/elevenlabs/types/built_in_tools_input.py new file mode 100644 index 0000000000000000000000000000000000000000..db303819a08445e03543df4cd4d3a012ad9d4601 --- /dev/null +++ b/data/src/elevenlabs/types/built_in_tools_input.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .system_tool_config_input import SystemToolConfigInput + + +class BuiltInToolsInput(UncheckedBaseModel): + """ + System tools a conversational agent can be given. + + Deliberately not named ConversationalBuiltInTools: BuiltInToolsInput and + BuiltInToolsOutput are part of the public API spec and the generated SDKs. + """ + + transfer_to_agent: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The transfer to agent tool + """ + + end_call: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The end call tool + """ + + language_detection: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The language detection tool + """ + + transfer_to_number: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The transfer to number tool + """ + + skip_turn: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The skip turn tool + """ + + play_keypad_touch_tone: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The play DTMF tool + """ + + voicemail_detection: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The voicemail detection tool + """ + + 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/data/src/elevenlabs/types/built_in_tools_output.py b/data/src/elevenlabs/types/built_in_tools_output.py new file mode 100644 index 0000000000000000000000000000000000000000..b88b43ca448af58922a58cd765ef48d96ca331d1 --- /dev/null +++ b/data/src/elevenlabs/types/built_in_tools_output.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .system_tool_config_output import SystemToolConfigOutput + + +class BuiltInToolsOutput(UncheckedBaseModel): + """ + System tools a conversational agent can be given. + + Deliberately not named ConversationalBuiltInTools: BuiltInToolsInput and + BuiltInToolsOutput are part of the public API spec and the generated SDKs. + """ + + transfer_to_agent: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The transfer to agent tool + """ + + end_call: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The end call tool + """ + + language_detection: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The language detection tool + """ + + transfer_to_number: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The transfer to number tool + """ + + skip_turn: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The skip turn tool + """ + + play_keypad_touch_tone: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The play DTMF tool + """ + + voicemail_detection: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The voicemail detection tool + """ + + 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/data/src/elevenlabs/types/built_in_tools_workflow_override_input.py b/data/src/elevenlabs/types/built_in_tools_workflow_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..5ce94a64f4a5807c50a30bc7fa0afd8879a8f325 --- /dev/null +++ b/data/src/elevenlabs/types/built_in_tools_workflow_override_input.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .system_tool_config_input import SystemToolConfigInput + + +class BuiltInToolsWorkflowOverrideInput(UncheckedBaseModel): + transfer_to_agent: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The transfer to agent tool + """ + + end_call: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The end call tool + """ + + language_detection: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The language detection tool + """ + + transfer_to_number: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The transfer to number tool + """ + + skip_turn: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The skip turn tool + """ + + play_keypad_touch_tone: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The play DTMF tool + """ + + voicemail_detection: typing.Optional[SystemToolConfigInput] = pydantic.Field(default=None) + """ + The voicemail detection tool + """ + + 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/data/src/elevenlabs/types/built_in_tools_workflow_override_output.py b/data/src/elevenlabs/types/built_in_tools_workflow_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..fefd89fc592e84dbe6bf6b0f6382cdcc3fd91853 --- /dev/null +++ b/data/src/elevenlabs/types/built_in_tools_workflow_override_output.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .system_tool_config_output import SystemToolConfigOutput + + +class BuiltInToolsWorkflowOverrideOutput(UncheckedBaseModel): + transfer_to_agent: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The transfer to agent tool + """ + + end_call: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The end call tool + """ + + language_detection: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The language detection tool + """ + + transfer_to_number: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The transfer to number tool + """ + + skip_turn: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The skip turn tool + """ + + play_keypad_touch_tone: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The play DTMF tool + """ + + voicemail_detection: typing.Optional[SystemToolConfigOutput] = pydantic.Field(default=None) + """ + The voicemail detection tool + """ + + 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/data/src/elevenlabs/types/bytedance_seedance_25_request.py b/data/src/elevenlabs/types/bytedance_seedance_25_request.py new file mode 100644 index 0000000000000000000000000000000000000000..40d1ce6a37c84bc5765cefd087340949003ea975 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_25_request.py @@ -0,0 +1,90 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_reference import AudioReference +from .bytedance_seedance_25_request_aspect_ratio import BytedanceSeedance25RequestAspectRatio +from .bytedance_seedance_25_request_resolution import BytedanceSeedance25RequestResolution +from .image_reference import ImageReference +from .video_reference import VideoReference +from .webhook_target import WebhookTarget + + +class BytedanceSeedance25Request(UncheckedBaseModel): + """ + Request body for the ByteDance Seedance 2.5 video model. + + Diverges from the Seedance 2.0 public shape: no 4K, durations up to 30s, + larger reference caps, audio-only input allowed, and no ``seed`` (Ark + tolerates it but does not honour it). + + ByteDance models are disabled by default and require explicit approval + before use. Contact support to request access. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the video to generate. + """ + + aspect_ratio: typing.Optional[BytedanceSeedance25RequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output video. With `auto`, the model picks an aspect ratio based on the inputs. First-frame / first-and-last-frame tasks always use `auto`. + """ + + resolution: typing.Optional[BytedanceSeedance25RequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output video. + """ + + duration_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The duration of the output video in seconds. + """ + + generate_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to generate audio with the video. + """ + + start_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's first frame. + """ + + end_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's last frame. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 30 reference images to draw subjects from. Cannot be combined with `start_frame`/`end_frame`. + """ + + videos: typing.Optional[typing.List[VideoReference]] = pydantic.Field(default=None) + """ + Up to 10 reference videos to draw subjects or motion from. Cannot be combined with `start_frame`/`end_frame`. + """ + + audios: typing.Optional[typing.List[AudioReference]] = pydantic.Field(default=None) + """ + Up to 10 reference audios, e.g. for lipsync. Cannot be combined with `start_frame`/`end_frame`. + """ + + 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/data/src/elevenlabs/types/bytedance_seedance_25_request_aspect_ratio.py b/data/src/elevenlabs/types/bytedance_seedance_25_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..30a9a210dd59ba6b2db11404d49125f3533b78b2 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_25_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedance25RequestAspectRatio = typing.Union[ + typing.Literal["auto", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"], typing.Any +] diff --git a/data/src/elevenlabs/types/bytedance_seedance_25_request_resolution.py b/data/src/elevenlabs/types/bytedance_seedance_25_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..d7f35becddcd69d58372fa89fb7bd43ac5b29f7b --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_25_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedance25RequestResolution = typing.Union[typing.Literal["480p", "720p", "1080p"], typing.Any] diff --git a/data/src/elevenlabs/types/bytedance_seedance_2_fast_request.py b/data/src/elevenlabs/types/bytedance_seedance_2_fast_request.py new file mode 100644 index 0000000000000000000000000000000000000000..5c89cbc8ee853c1ef72decd1cd6dc85757630d4d --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_fast_request.py @@ -0,0 +1,91 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_reference import AudioReference +from .bytedance_seedance_2_fast_request_aspect_ratio import BytedanceSeedance2FastRequestAspectRatio +from .bytedance_seedance_2_fast_request_resolution import BytedanceSeedance2FastRequestResolution +from .image_reference import ImageReference +from .video_reference import VideoReference +from .webhook_target import WebhookTarget + + +class BytedanceSeedance2FastRequest(UncheckedBaseModel): + """ + Request body for the ByteDance Seedance 2.0 Fast video model. + + ByteDance models are disabled by default and require explicit approval + before use. Contact support to request access. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the video to generate. + """ + + aspect_ratio: typing.Optional[BytedanceSeedance2FastRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output video. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + duration_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The duration of the output video in seconds. + """ + + seed: typing.Optional[int] = pydantic.Field(default=None) + """ + A seed for reproducible generation: the same seed and inputs give similar output across generations. Omit for random. + """ + + generate_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to generate audio with the video. + """ + + start_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's first frame. + """ + + end_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's last frame. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 9 reference images to draw subjects from. Cannot be combined with `start_frame`/`end_frame`. + """ + + videos: typing.Optional[typing.List[VideoReference]] = pydantic.Field(default=None) + """ + Up to 3 reference videos to draw subjects or motion from. Cannot be combined with `start_frame`/`end_frame`. + """ + + audios: typing.Optional[typing.List[AudioReference]] = pydantic.Field(default=None) + """ + Up to 3 reference audios, e.g. for lipsync. Requires at least one of `images` or `videos`, and cannot be combined with `start_frame`/`end_frame`. + """ + + resolution: typing.Optional[BytedanceSeedance2FastRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output video. + """ + + 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/data/src/elevenlabs/types/bytedance_seedance_2_fast_request_aspect_ratio.py b/data/src/elevenlabs/types/bytedance_seedance_2_fast_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..d6c319b2609b33e4db2296c00cb6833d6d312a04 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_fast_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedance2FastRequestAspectRatio = typing.Union[ + typing.Literal["auto", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"], typing.Any +] diff --git a/data/src/elevenlabs/types/bytedance_seedance_2_fast_request_resolution.py b/data/src/elevenlabs/types/bytedance_seedance_2_fast_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..a63f85c7cea4ed323ceb9125c46b8af1973cab5f --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_fast_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedance2FastRequestResolution = typing.Union[typing.Literal["480p", "720p"], typing.Any] diff --git a/data/src/elevenlabs/types/bytedance_seedance_2_mini_request.py b/data/src/elevenlabs/types/bytedance_seedance_2_mini_request.py new file mode 100644 index 0000000000000000000000000000000000000000..ee2a6d1394fbb5d558bd2cebe5444a386ba381c7 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_mini_request.py @@ -0,0 +1,91 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_reference import AudioReference +from .bytedance_seedance_2_mini_request_aspect_ratio import BytedanceSeedance2MiniRequestAspectRatio +from .bytedance_seedance_2_mini_request_resolution import BytedanceSeedance2MiniRequestResolution +from .image_reference import ImageReference +from .video_reference import VideoReference +from .webhook_target import WebhookTarget + + +class BytedanceSeedance2MiniRequest(UncheckedBaseModel): + """ + Request body for the ByteDance Seedance 2.0 Mini video model. + + ByteDance models are disabled by default and require explicit approval + before use. Contact support to request access. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the video to generate. + """ + + aspect_ratio: typing.Optional[BytedanceSeedance2MiniRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output video. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + duration_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The duration of the output video in seconds. + """ + + seed: typing.Optional[int] = pydantic.Field(default=None) + """ + A seed for reproducible generation: the same seed and inputs give similar output across generations. Omit for random. + """ + + generate_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to generate audio with the video. + """ + + start_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's first frame. + """ + + end_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's last frame. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 9 reference images to draw subjects from. Cannot be combined with `start_frame`/`end_frame`. + """ + + videos: typing.Optional[typing.List[VideoReference]] = pydantic.Field(default=None) + """ + Up to 3 reference videos to draw subjects or motion from. Cannot be combined with `start_frame`/`end_frame`. + """ + + audios: typing.Optional[typing.List[AudioReference]] = pydantic.Field(default=None) + """ + Up to 3 reference audios, e.g. for lipsync. Requires at least one of `images` or `videos`, and cannot be combined with `start_frame`/`end_frame`. + """ + + resolution: typing.Optional[BytedanceSeedance2MiniRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output video. + """ + + 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/data/src/elevenlabs/types/bytedance_seedance_2_mini_request_aspect_ratio.py b/data/src/elevenlabs/types/bytedance_seedance_2_mini_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..eb9126f565dce51feec6f8d1c6502a182fe6b4b0 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_mini_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedance2MiniRequestAspectRatio = typing.Union[ + typing.Literal["auto", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"], typing.Any +] diff --git a/data/src/elevenlabs/types/bytedance_seedance_2_mini_request_resolution.py b/data/src/elevenlabs/types/bytedance_seedance_2_mini_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..250b9c8b9bad141930762b86bc1eeee340315a9e --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_mini_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedance2MiniRequestResolution = typing.Union[typing.Literal["480p", "720p"], typing.Any] diff --git a/data/src/elevenlabs/types/bytedance_seedance_2_request.py b/data/src/elevenlabs/types/bytedance_seedance_2_request.py new file mode 100644 index 0000000000000000000000000000000000000000..0c6a53a832554b89edbd0e2efd07678421cdfff1 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_request.py @@ -0,0 +1,91 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_reference import AudioReference +from .bytedance_seedance_2_request_aspect_ratio import BytedanceSeedance2RequestAspectRatio +from .bytedance_seedance_2_request_resolution import BytedanceSeedance2RequestResolution +from .image_reference import ImageReference +from .video_reference import VideoReference +from .webhook_target import WebhookTarget + + +class BytedanceSeedance2Request(UncheckedBaseModel): + """ + Request body for the ByteDance Seedance 2.0 video model. + + ByteDance models are disabled by default and require explicit approval + before use. Contact support to request access. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the video to generate. + """ + + aspect_ratio: typing.Optional[BytedanceSeedance2RequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output video. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + duration_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The duration of the output video in seconds. + """ + + seed: typing.Optional[int] = pydantic.Field(default=None) + """ + A seed for reproducible generation: the same seed and inputs give similar output across generations. Omit for random. + """ + + generate_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to generate audio with the video. + """ + + start_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's first frame. + """ + + end_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's last frame. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 9 reference images to draw subjects from. Cannot be combined with `start_frame`/`end_frame`. + """ + + videos: typing.Optional[typing.List[VideoReference]] = pydantic.Field(default=None) + """ + Up to 3 reference videos to draw subjects or motion from. Cannot be combined with `start_frame`/`end_frame`. + """ + + audios: typing.Optional[typing.List[AudioReference]] = pydantic.Field(default=None) + """ + Up to 3 reference audios, e.g. for lipsync. Requires at least one of `images` or `videos`, and cannot be combined with `start_frame`/`end_frame`. + """ + + resolution: typing.Optional[BytedanceSeedance2RequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output video. + """ + + 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/data/src/elevenlabs/types/bytedance_seedance_2_request_aspect_ratio.py b/data/src/elevenlabs/types/bytedance_seedance_2_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..d3b6202293d7004fb6b3bc50745b8a0b1ec2c4fe --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedance2RequestAspectRatio = typing.Union[ + typing.Literal["auto", "21:9", "16:9", "4:3", "1:1", "3:4", "9:16"], typing.Any +] diff --git a/data/src/elevenlabs/types/bytedance_seedance_2_request_resolution.py b/data/src/elevenlabs/types/bytedance_seedance_2_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..e61dc6e4de702fd51075c3d6c8848bfaa52c624c --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedance_2_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedance2RequestResolution = typing.Union[typing.Literal["480p", "720p", "1080p", "4k"], typing.Any] diff --git a/data/src/elevenlabs/types/bytedance_seedream_5_lite_request.py b/data/src/elevenlabs/types/bytedance_seedream_5_lite_request.py new file mode 100644 index 0000000000000000000000000000000000000000..5251e5f4b31a4fdac5d36b63113872c1fff7fe99 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedream_5_lite_request.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .bytedance_seedream_5_lite_request_aspect_ratio import BytedanceSeedream5LiteRequestAspectRatio +from .bytedance_seedream_5_lite_request_resolution import BytedanceSeedream5LiteRequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class BytedanceSeedream5LiteRequest(UncheckedBaseModel): + """ + Request body for the ByteDance Seedream 5.0 Lite image model. + + ByteDance models are disabled by default and require explicit approval + before use. Contact support to request access. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 10 reference images to edit or draw from. + """ + + aspect_ratio: typing.Optional[BytedanceSeedream5LiteRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + seed: typing.Optional[int] = pydantic.Field(default=None) + """ + A seed for reproducible generation: the same seed and inputs give similar output across generations. Omit for random. + """ + + resolution: typing.Optional[BytedanceSeedream5LiteRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output image. + """ + + 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/data/src/elevenlabs/types/bytedance_seedream_5_lite_request_aspect_ratio.py b/data/src/elevenlabs/types/bytedance_seedream_5_lite_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..59ec98e329322a51d8fef20f1be3eadb20104cd4 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedream_5_lite_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedream5LiteRequestAspectRatio = typing.Union[ + typing.Literal["auto", "1:1", "3:4", "16:9", "4:3", "9:16"], typing.Any +] diff --git a/data/src/elevenlabs/types/bytedance_seedream_5_lite_request_resolution.py b/data/src/elevenlabs/types/bytedance_seedream_5_lite_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..ded7db57dc437d64d82f5baf4593a0aa56ff24fa --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedream_5_lite_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedream5LiteRequestResolution = typing.Union[typing.Literal["2K", "3K"], typing.Any] diff --git a/data/src/elevenlabs/types/bytedance_seedream_5_pro_request.py b/data/src/elevenlabs/types/bytedance_seedream_5_pro_request.py new file mode 100644 index 0000000000000000000000000000000000000000..7d1a602c61c4a74d12ba25741ce4d05e5cd8545b --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedream_5_pro_request.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .bytedance_seedream_5_pro_request_aspect_ratio import BytedanceSeedream5ProRequestAspectRatio +from .bytedance_seedream_5_pro_request_resolution import BytedanceSeedream5ProRequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class BytedanceSeedream5ProRequest(UncheckedBaseModel): + """ + Request body for the ByteDance Seedream 5.0 Pro image model. + + ByteDance models are disabled by default and require explicit approval + before use. Contact support to request access. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 10 reference images to edit or draw from. + """ + + aspect_ratio: typing.Optional[BytedanceSeedream5ProRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + seed: typing.Optional[int] = pydantic.Field(default=None) + """ + A seed for reproducible generation: the same seed and inputs give similar output across generations. Omit for random. + """ + + resolution: typing.Optional[BytedanceSeedream5ProRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output image. + """ + + 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/data/src/elevenlabs/types/bytedance_seedream_5_pro_request_aspect_ratio.py b/data/src/elevenlabs/types/bytedance_seedream_5_pro_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..eca127480b381f4dc01e5f63070df3c7af495bb7 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedream_5_pro_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedream5ProRequestAspectRatio = typing.Union[ + typing.Literal["auto", "1:1", "3:4", "16:9", "4:3", "9:16"], typing.Any +] diff --git a/data/src/elevenlabs/types/bytedance_seedream_5_pro_request_resolution.py b/data/src/elevenlabs/types/bytedance_seedream_5_pro_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..0c922717559dddf7ac91f7dae76f7871a79374b8 --- /dev/null +++ b/data/src/elevenlabs/types/bytedance_seedream_5_pro_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BytedanceSeedream5ProRequestResolution = typing.Union[typing.Literal["1K", "2K"], typing.Any] diff --git a/data/src/elevenlabs/types/call_result.py b/data/src/elevenlabs/types/call_result.py new file mode 100644 index 0000000000000000000000000000000000000000..f2f5f3ce16f0c92fc2e7a8c1732fcd0070e62765 --- /dev/null +++ b/data/src/elevenlabs/types/call_result.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CallResult = typing.Union[typing.Literal["answered", "voicemail", "busy", "no_answer", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/campaign_conversation_type.py b/data/src/elevenlabs/types/campaign_conversation_type.py new file mode 100644 index 0000000000000000000000000000000000000000..d86a81cd8551c4f609bef875752eab05ded0dc3d --- /dev/null +++ b/data/src/elevenlabs/types/campaign_conversation_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CampaignConversationType = typing.Union[typing.Literal["initial", "retry", "callback", "redirect"], typing.Any] diff --git a/data/src/elevenlabs/types/cancel_calendar_event_params.py b/data/src/elevenlabs/types/cancel_calendar_event_params.py new file mode 100644 index 0000000000000000000000000000000000000000..c330c724fee5a8cb4749fc20c05af4b752307db1 --- /dev/null +++ b/data/src/elevenlabs/types/cancel_calendar_event_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CancelCalendarEventParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["cancel_calendar_event"]] = 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/data/src/elevenlabs/types/cancel_group_session_for_all_params.py b/data/src/elevenlabs/types/cancel_group_session_for_all_params.py new file mode 100644 index 0000000000000000000000000000000000000000..0c0e1bf58812c185debc005303094096a311e358 --- /dev/null +++ b/data/src/elevenlabs/types/cancel_group_session_for_all_params.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CancelGroupSessionForAllParams(UncheckedBaseModel): + """ + Cancel an entire group session and notify every registered participant. + Destructive -- prefer ``cancel_group_session_registration`` for cancelling + a single attendee. + """ + + smb_tool_type: typing.Optional[typing.Literal["cancel_group_session_for_all"]] = 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/data/src/elevenlabs/types/cancel_group_session_registration_params.py b/data/src/elevenlabs/types/cancel_group_session_registration_params.py new file mode 100644 index 0000000000000000000000000000000000000000..515a6ee8fc907e09fd14cb032a54c5a8e082f4a8 --- /dev/null +++ b/data/src/elevenlabs/types/cancel_group_session_registration_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CancelGroupSessionRegistrationParams(UncheckedBaseModel): + """ + Cancel a single client's registration for a group session. + """ + + smb_tool_type: typing.Optional[typing.Literal["cancel_group_session_registration"]] = 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/data/src/elevenlabs/types/cancel_order_params.py b/data/src/elevenlabs/types/cancel_order_params.py new file mode 100644 index 0000000000000000000000000000000000000000..c28be79cb92d3a153ba6490eb00641516a75589d --- /dev/null +++ b/data/src/elevenlabs/types/cancel_order_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CancelOrderParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["cancel_order"]] = 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/data/src/elevenlabs/types/canvas_placement.py b/data/src/elevenlabs/types/canvas_placement.py new file mode 100644 index 0000000000000000000000000000000000000000..59eff309c10c265824d1ef681a1e6b1b8786006e --- /dev/null +++ b/data/src/elevenlabs/types/canvas_placement.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CanvasPlacement(UncheckedBaseModel): + """ + Defines asset positioning and transformation on canvas. + """ + + x_relative: typing.Optional[float] = None + y_relative: typing.Optional[float] = None + scale_x: typing.Optional[float] = None + scale_y: typing.Optional[float] = None + pivot_x: typing.Optional[float] = None + pivot_y: typing.Optional[float] = None + skew_x: typing.Optional[float] = None + skew_y: typing.Optional[float] = None + crop_top: typing.Optional[float] = None + crop_right: typing.Optional[float] = None + crop_bottom: typing.Optional[float] = None + crop_left: typing.Optional[float] = None + flip_x: typing.Optional[bool] = None + flip_y: 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/data/src/elevenlabs/types/caption_style_character_animation_model.py b/data/src/elevenlabs/types/caption_style_character_animation_model.py new file mode 100644 index 0000000000000000000000000000000000000000..314a661477342861080d3d5c78f6234042e60b95 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_character_animation_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .caption_style_character_animation_model_enter_type import CaptionStyleCharacterAnimationModelEnterType +from .caption_style_character_animation_model_exit_type import CaptionStyleCharacterAnimationModelExitType + + +class CaptionStyleCharacterAnimationModel(UncheckedBaseModel): + enter_type: CaptionStyleCharacterAnimationModelEnterType + exit_type: CaptionStyleCharacterAnimationModelExitType + + 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/data/src/elevenlabs/types/caption_style_character_animation_model_enter_type.py b/data/src/elevenlabs/types/caption_style_character_animation_model_enter_type.py new file mode 100644 index 0000000000000000000000000000000000000000..a19d4213be3517a1ad790568d9370b8fdcaf83bf --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_character_animation_model_enter_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleCharacterAnimationModelEnterType = typing.Union[typing.Literal["none", "fade", "typewriter"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_character_animation_model_exit_type.py b/data/src/elevenlabs/types/caption_style_character_animation_model_exit_type.py new file mode 100644 index 0000000000000000000000000000000000000000..1bcbaa7398bca53f999418c087ac1e924a46b96e --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_character_animation_model_exit_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleCharacterAnimationModelExitType = typing.Union[typing.Literal["none", "fade"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_horizontal_placement_model.py b/data/src/elevenlabs/types/caption_style_horizontal_placement_model.py new file mode 100644 index 0000000000000000000000000000000000000000..59df0e626c0fc0f05d5c6012ad93aa378bbfe92f --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_horizontal_placement_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .caption_style_horizontal_placement_model_align import CaptionStyleHorizontalPlacementModelAlign + + +class CaptionStyleHorizontalPlacementModel(UncheckedBaseModel): + align: CaptionStyleHorizontalPlacementModelAlign + translate_pct: float + + 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/data/src/elevenlabs/types/caption_style_horizontal_placement_model_align.py b/data/src/elevenlabs/types/caption_style_horizontal_placement_model_align.py new file mode 100644 index 0000000000000000000000000000000000000000..070da028e307d758d67390756a97ba9791d72fb0 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_horizontal_placement_model_align.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleHorizontalPlacementModelAlign = typing.Union[typing.Literal["left", "center", "right"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_model.py b/data/src/elevenlabs/types/caption_style_model.py new file mode 100644 index 0000000000000000000000000000000000000000..396758937aeeca129d399ff1ded99195a2aac54d --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_model.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .caption_style_character_animation_model import CaptionStyleCharacterAnimationModel +from .caption_style_horizontal_placement_model import CaptionStyleHorizontalPlacementModel +from .caption_style_model_text_align import CaptionStyleModelTextAlign +from .caption_style_model_text_blend_mode import CaptionStyleModelTextBlendMode +from .caption_style_model_text_style import CaptionStyleModelTextStyle +from .caption_style_model_text_transform import CaptionStyleModelTextTransform +from .caption_style_model_text_weight import CaptionStyleModelTextWeight +from .caption_style_section_animation_model import CaptionStyleSectionAnimationModel +from .caption_style_template_model import CaptionStyleTemplateModel +from .caption_style_vertical_placement_model import CaptionStyleVerticalPlacementModel +from .caption_style_word_animation_model import CaptionStyleWordAnimationModel +from .studio_text_style_outline_model import StudioTextStyleOutlineModel +from .studio_text_style_shadow_model import StudioTextStyleShadowModel + + +class CaptionStyleModel(UncheckedBaseModel): + template: typing.Optional[CaptionStyleTemplateModel] = None + text_font: typing.Optional[str] = None + text_scale: typing.Optional[float] = None + text_color: typing.Optional[str] = None + text_align: typing.Optional[CaptionStyleModelTextAlign] = None + text_style: typing.Optional[CaptionStyleModelTextStyle] = None + text_weight: typing.Optional[CaptionStyleModelTextWeight] = None + text_transform: typing.Optional[CaptionStyleModelTextTransform] = None + text_blend_mode: typing.Optional[CaptionStyleModelTextBlendMode] = None + text_shadow: typing.Optional[StudioTextStyleShadowModel] = None + text_outline: typing.Optional[StudioTextStyleOutlineModel] = None + background_enabled: typing.Optional[bool] = None + background_color: typing.Optional[str] = None + background_opacity: typing.Optional[float] = None + background_blur: typing.Optional[float] = None + background_border_radius: typing.Optional[float] = None + word_highlights_enabled: typing.Optional[bool] = None + word_highlights_color: typing.Optional[str] = None + word_highlights_background_color: typing.Optional[str] = None + word_highlights_opacity: typing.Optional[float] = None + word_highlights_border_radius: typing.Optional[float] = None + word_highlights_blur: typing.Optional[float] = None + section_animation: typing.Optional[CaptionStyleSectionAnimationModel] = None + word_animation: typing.Optional[CaptionStyleWordAnimationModel] = None + character_animation: typing.Optional[CaptionStyleCharacterAnimationModel] = None + cursor_enabled: typing.Optional[bool] = None + width_pct: typing.Optional[float] = None + horizontal_placement: typing.Optional[CaptionStyleHorizontalPlacementModel] = None + vertical_placement: typing.Optional[CaptionStyleVerticalPlacementModel] = None + auto_break_enabled: typing.Optional[bool] = None + max_lines_per_section: typing.Optional[int] = None + max_words_per_line: typing.Optional[int] = 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/data/src/elevenlabs/types/caption_style_model_text_align.py b/data/src/elevenlabs/types/caption_style_model_text_align.py new file mode 100644 index 0000000000000000000000000000000000000000..4dc2f76ab84b67a4c4faffa30dbd2be2fa8f1a2b --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_model_text_align.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleModelTextAlign = typing.Union[typing.Literal["start", "center", "end"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_model_text_blend_mode.py b/data/src/elevenlabs/types/caption_style_model_text_blend_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..4ebe219208aa31e2abde8e9d333b604d7dc86356 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_model_text_blend_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleModelTextBlendMode = typing.Union[typing.Literal["normal", "difference", "multiply"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_model_text_style.py b/data/src/elevenlabs/types/caption_style_model_text_style.py new file mode 100644 index 0000000000000000000000000000000000000000..e78d1b187bf22afe8ab2d8a21be12855769abfc1 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_model_text_style.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleModelTextStyle = typing.Union[typing.Literal["normal", "italic"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_model_text_transform.py b/data/src/elevenlabs/types/caption_style_model_text_transform.py new file mode 100644 index 0000000000000000000000000000000000000000..9df41f7abf9acce7e41c242b0e2df507888654a3 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_model_text_transform.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleModelTextTransform = typing.Union[typing.Literal["none", "uppercase"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_model_text_weight.py b/data/src/elevenlabs/types/caption_style_model_text_weight.py new file mode 100644 index 0000000000000000000000000000000000000000..131f22ac465d7d89547579c74e505c6ea87d43fe --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_model_text_weight.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleModelTextWeight = typing.Union[typing.Literal["normal", "bold", "900"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_section_animation_model.py b/data/src/elevenlabs/types/caption_style_section_animation_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ae5f9bd6b9e60627fc58c7fa0b091684a228d796 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_section_animation_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .caption_style_section_animation_model_enter_type import CaptionStyleSectionAnimationModelEnterType +from .caption_style_section_animation_model_exit_type import CaptionStyleSectionAnimationModelExitType + + +class CaptionStyleSectionAnimationModel(UncheckedBaseModel): + enter_type: CaptionStyleSectionAnimationModelEnterType + exit_type: CaptionStyleSectionAnimationModelExitType + + 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/data/src/elevenlabs/types/caption_style_section_animation_model_enter_type.py b/data/src/elevenlabs/types/caption_style_section_animation_model_enter_type.py new file mode 100644 index 0000000000000000000000000000000000000000..42c3dda0e21f86aa43af00bbfdfead1ec09dbca7 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_section_animation_model_enter_type.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleSectionAnimationModelEnterType = typing.Union[ + typing.Literal["none", "fade", "scale", "pop", "slide_up", "slide_down", "slam", "scale_down", "slide_in"], + typing.Any, +] diff --git a/data/src/elevenlabs/types/caption_style_section_animation_model_exit_type.py b/data/src/elevenlabs/types/caption_style_section_animation_model_exit_type.py new file mode 100644 index 0000000000000000000000000000000000000000..7140cb087f7d128afe6dc5c1bbcda3ceeacfbd1d --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_section_animation_model_exit_type.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleSectionAnimationModelExitType = typing.Union[ + typing.Literal["none", "fade", "scale", "pop", "slide_up", "slide_down", "slam", "scale_down", "slide_in"], + typing.Any, +] diff --git a/data/src/elevenlabs/types/caption_style_template_model.py b/data/src/elevenlabs/types/caption_style_template_model.py new file mode 100644 index 0000000000000000000000000000000000000000..864e4c2e4bab66358a49b3fc64f991acf20eba91 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_template_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CaptionStyleTemplateModel(UncheckedBaseModel): + key: str + label: str + requires_high_fps: 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/data/src/elevenlabs/types/caption_style_vertical_placement_model.py b/data/src/elevenlabs/types/caption_style_vertical_placement_model.py new file mode 100644 index 0000000000000000000000000000000000000000..40c946a0a313b775a113cc07fc61e4c0f3258d4c --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_vertical_placement_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .caption_style_vertical_placement_model_align import CaptionStyleVerticalPlacementModelAlign + + +class CaptionStyleVerticalPlacementModel(UncheckedBaseModel): + align: CaptionStyleVerticalPlacementModelAlign + translate_pct: float + + 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/data/src/elevenlabs/types/caption_style_vertical_placement_model_align.py b/data/src/elevenlabs/types/caption_style_vertical_placement_model_align.py new file mode 100644 index 0000000000000000000000000000000000000000..a27c9e9498cd6783ec55f5ef78dccce3edff499d --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_vertical_placement_model_align.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleVerticalPlacementModelAlign = typing.Union[typing.Literal["top", "center", "bottom"], typing.Any] diff --git a/data/src/elevenlabs/types/caption_style_word_animation_model.py b/data/src/elevenlabs/types/caption_style_word_animation_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1cab5d638dd7b4d2f7081d04e865539843da2611 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_word_animation_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .caption_style_word_animation_model_enter_type import CaptionStyleWordAnimationModelEnterType +from .caption_style_word_animation_model_exit_type import CaptionStyleWordAnimationModelExitType + + +class CaptionStyleWordAnimationModel(UncheckedBaseModel): + enter_type: CaptionStyleWordAnimationModelEnterType + exit_type: CaptionStyleWordAnimationModelExitType + + 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/data/src/elevenlabs/types/caption_style_word_animation_model_enter_type.py b/data/src/elevenlabs/types/caption_style_word_animation_model_enter_type.py new file mode 100644 index 0000000000000000000000000000000000000000..e5630329f2fab49f6842a58870c47f686434e98f --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_word_animation_model_enter_type.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleWordAnimationModelEnterType = typing.Union[ + typing.Literal["none", "fade", "scale", "pop", "slide_up", "slide_down", "slam", "scale_down", "slide_in"], + typing.Any, +] diff --git a/data/src/elevenlabs/types/caption_style_word_animation_model_exit_type.py b/data/src/elevenlabs/types/caption_style_word_animation_model_exit_type.py new file mode 100644 index 0000000000000000000000000000000000000000..e745a058baced9b8ff28e2c1cb8dc4f23a869230 --- /dev/null +++ b/data/src/elevenlabs/types/caption_style_word_animation_model_exit_type.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CaptionStyleWordAnimationModelExitType = typing.Union[ + typing.Literal["none", "fade", "scale", "pop", "slide_up", "slide_down", "slam", "scale_down", "slide_in"], + typing.Any, +] diff --git a/data/src/elevenlabs/types/chapter_content_block_extendable_node_response_model.py b/data/src/elevenlabs/types/chapter_content_block_extendable_node_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..7fa0452d4577295e76a1ddf7c3dd8d27af3d17e1 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_block_extendable_node_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ChapterContentBlockExtendableNodeResponseModel(UncheckedBaseModel): + """ + Not used. Make sure you anticipate new types in the future. + """ + + 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/data/src/elevenlabs/types/chapter_content_block_input_model.py b/data/src/elevenlabs/types/chapter_content_block_input_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b93eed921890431cac254fb352108f99fbd53ce4 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_block_input_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_content_block_input_model_sub_type import ChapterContentBlockInputModelSubType +from .chapter_content_paragraph_tts_node_input_model import ChapterContentParagraphTtsNodeInputModel + + +class ChapterContentBlockInputModel(UncheckedBaseModel): + sub_type: typing.Optional[ChapterContentBlockInputModelSubType] = None + nodes: typing.List[ChapterContentParagraphTtsNodeInputModel] + block_id: 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/data/src/elevenlabs/types/chapter_content_block_input_model_sub_type.py b/data/src/elevenlabs/types/chapter_content_block_input_model_sub_type.py new file mode 100644 index 0000000000000000000000000000000000000000..4974b86adc2bad75b6672382001968aed1747624 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_block_input_model_sub_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ChapterContentBlockInputModelSubType = typing.Union[typing.Literal["p", "h1", "h2", "h3"], typing.Any] diff --git a/data/src/elevenlabs/types/chapter_content_block_response_model.py b/data/src/elevenlabs/types/chapter_content_block_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..be3fa2847b9afefb4deb62835e362a6b3f5ea227 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_block_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_content_block_response_model_nodes_item import ChapterContentBlockResponseModelNodesItem + + +class ChapterContentBlockResponseModel(UncheckedBaseModel): + block_id: str + nodes: typing.List[ChapterContentBlockResponseModelNodesItem] + + 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/data/src/elevenlabs/types/chapter_content_block_response_model_nodes_item.py b/data/src/elevenlabs/types/chapter_content_block_response_model_nodes_item.py new file mode 100644 index 0000000000000000000000000000000000000000..03777e6a42820e1a11f6709e3947b105c0032aea --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_block_response_model_nodes_item.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class ChapterContentBlockResponseModelNodesItem_TtsNode(UncheckedBaseModel): + type: typing.Literal["tts_node"] = "tts_node" + project_voice_ref_id: str + text: str + voice_id: 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 + + +class ChapterContentBlockResponseModelNodesItem_Other(UncheckedBaseModel): + type: typing.Literal["_other"] = "_other" + + 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 + + +ChapterContentBlockResponseModelNodesItem = typing_extensions.Annotated[ + typing.Union[ChapterContentBlockResponseModelNodesItem_TtsNode, ChapterContentBlockResponseModelNodesItem_Other], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/chapter_content_block_tts_node_response_model.py b/data/src/elevenlabs/types/chapter_content_block_tts_node_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2e1c418419bc955dff26ed12ce27ab92b27d2902 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_block_tts_node_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ChapterContentBlockTtsNodeResponseModel(UncheckedBaseModel): + project_voice_ref_id: str + text: str + voice_id: 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/data/src/elevenlabs/types/chapter_content_input_model.py b/data/src/elevenlabs/types/chapter_content_input_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9c50884aa5930eeaf5036d496ab4bff7b2851cab --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_input_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_content_block_input_model import ChapterContentBlockInputModel + + +class ChapterContentInputModel(UncheckedBaseModel): + blocks: typing.List[ChapterContentBlockInputModel] + + 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/data/src/elevenlabs/types/chapter_content_paragraph_tts_node_input_model.py b/data/src/elevenlabs/types/chapter_content_paragraph_tts_node_input_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b124c9f0b651eba43bfb0fa3e6a521e4d5dd8cd4 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_paragraph_tts_node_input_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ChapterContentParagraphTtsNodeInputModel(UncheckedBaseModel): + type: typing.Literal["tts_node"] = "tts_node" + text: str + voice_id: 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/data/src/elevenlabs/types/chapter_content_response_model.py b/data/src/elevenlabs/types/chapter_content_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3471cf34a5cac3970f573bb93f1f7ccd7be9f25f --- /dev/null +++ b/data/src/elevenlabs/types/chapter_content_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_content_block_response_model import ChapterContentBlockResponseModel + + +class ChapterContentResponseModel(UncheckedBaseModel): + blocks: typing.List[ChapterContentBlockResponseModel] + + 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/data/src/elevenlabs/types/chapter_response.py b/data/src/elevenlabs/types/chapter_response.py new file mode 100644 index 0000000000000000000000000000000000000000..947bc290d389e307e34fb8e959d32aff4b203803 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_response.py @@ -0,0 +1,75 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_state import ChapterState +from .chapter_statistics_response import ChapterStatisticsResponse + + +class ChapterResponse(UncheckedBaseModel): + chapter_id: str = pydantic.Field() + """ + The ID of the chapter. + """ + + name: str = pydantic.Field() + """ + The name of the chapter. + """ + + last_conversion_date_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The last conversion date of the chapter. + """ + + conversion_progress: typing.Optional[float] = pydantic.Field(default=None) + """ + The conversion progress of the chapter. + """ + + can_be_downloaded: bool = pydantic.Field() + """ + Whether the chapter can be downloaded. + """ + + state: ChapterState = pydantic.Field() + """ + The state of the chapter. + """ + + has_video: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the chapter has a video. + """ + + has_visual_content: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the chapter has any visual content (video, image, or text clips). + """ + + voice_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of voice ids used by the chapter + """ + + statistics: typing.Optional[ChapterStatisticsResponse] = pydantic.Field(default=None) + """ + The statistics of the chapter. + """ + + last_conversion_error: typing.Optional[str] = pydantic.Field(default=None) + """ + The last conversion error of the chapter. + """ + + 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/data/src/elevenlabs/types/chapter_snapshot_extended_response_model.py b/data/src/elevenlabs/types/chapter_snapshot_extended_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b5304abf9536326f0639260dfb1a5c5598cf31f7 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_snapshot_extended_response_model.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .character_alignment_model import CharacterAlignmentModel + + +class ChapterSnapshotExtendedResponseModel(UncheckedBaseModel): + chapter_snapshot_id: str = pydantic.Field() + """ + The ID of the chapter snapshot. + """ + + project_id: str = pydantic.Field() + """ + The ID of the project. + """ + + chapter_id: str = pydantic.Field() + """ + The ID of the chapter. + """ + + created_at_unix: int = pydantic.Field() + """ + The creation date of the chapter snapshot. + """ + + name: str = pydantic.Field() + """ + The name of the chapter snapshot. + """ + + character_alignments: typing.List[CharacterAlignmentModel] + + 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/data/src/elevenlabs/types/chapter_snapshot_response.py b/data/src/elevenlabs/types/chapter_snapshot_response.py new file mode 100644 index 0000000000000000000000000000000000000000..6ef0460770fd5224f43f996fd2639b1bba5eb0b1 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_snapshot_response.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ChapterSnapshotResponse(UncheckedBaseModel): + chapter_snapshot_id: str = pydantic.Field() + """ + The ID of the chapter snapshot. + """ + + project_id: str = pydantic.Field() + """ + The ID of the project. + """ + + chapter_id: str = pydantic.Field() + """ + The ID of the chapter. + """ + + created_at_unix: int = pydantic.Field() + """ + The creation date of the chapter snapshot. + """ + + name: str = pydantic.Field() + """ + The name of the chapter snapshot. + """ + + 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/data/src/elevenlabs/types/chapter_snapshots_response.py b/data/src/elevenlabs/types/chapter_snapshots_response.py new file mode 100644 index 0000000000000000000000000000000000000000..3a4ad11fbd6f19a531c2d34898f7593afafa48b4 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_snapshots_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_snapshot_response import ChapterSnapshotResponse + + +class ChapterSnapshotsResponse(UncheckedBaseModel): + snapshots: typing.List[ChapterSnapshotResponse] = pydantic.Field() + """ + List of chapter snapshots. + """ + + 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/data/src/elevenlabs/types/chapter_state.py b/data/src/elevenlabs/types/chapter_state.py new file mode 100644 index 0000000000000000000000000000000000000000..0a0441f2d8d934c514c2273938100cce55739e69 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ChapterState = typing.Union[typing.Literal["default", "converting"], typing.Any] diff --git a/data/src/elevenlabs/types/chapter_statistics_response.py b/data/src/elevenlabs/types/chapter_statistics_response.py new file mode 100644 index 0000000000000000000000000000000000000000..e3b5629daa96e4379db34a4a0090bd9d442396f1 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_statistics_response.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .voice_statistics_response_model import VoiceStatisticsResponseModel + + +class ChapterStatisticsResponse(UncheckedBaseModel): + characters_unconverted: int = pydantic.Field() + """ + The number of unconverted characters. + """ + + characters_converted: int = pydantic.Field() + """ + The number of converted characters. + """ + + paragraphs_converted: int = pydantic.Field() + """ + The number of converted paragraphs. + """ + + paragraphs_unconverted: int = pydantic.Field() + """ + The number of unconverted paragraphs. + """ + + credits_needed_to_convert: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of credits needed to convert the remaining paragraphs. + """ + + voice_statistics: typing.Optional[typing.List[VoiceStatisticsResponseModel]] = pydantic.Field(default=None) + """ + Per-voice breakdown of character counts. + """ + + 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/data/src/elevenlabs/types/chapter_with_content_response_model.py b/data/src/elevenlabs/types/chapter_with_content_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..13b92997006453083b73ef469f18c08e29341760 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_with_content_response_model.py @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_content_response_model import ChapterContentResponseModel +from .chapter_statistics_response import ChapterStatisticsResponse +from .chapter_with_content_response_model_state import ChapterWithContentResponseModelState + + +class ChapterWithContentResponseModel(UncheckedBaseModel): + chapter_id: str = pydantic.Field() + """ + The ID of the chapter. + """ + + name: str = pydantic.Field() + """ + The name of the chapter. + """ + + last_conversion_date_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The last conversion date of the chapter. + """ + + conversion_progress: typing.Optional[float] = pydantic.Field(default=None) + """ + The conversion progress of the chapter. + """ + + can_be_downloaded: bool = pydantic.Field() + """ + Whether the chapter can be downloaded. + """ + + state: ChapterWithContentResponseModelState = pydantic.Field() + """ + The state of the chapter. + """ + + has_video: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the chapter has a video. + """ + + has_visual_content: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the chapter has any visual content (video, image, or text clips). + """ + + voice_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of voice ids used by the chapter + """ + + statistics: typing.Optional[ChapterStatisticsResponse] = pydantic.Field(default=None) + """ + The statistics of the chapter. + """ + + last_conversion_error: typing.Optional[str] = pydantic.Field(default=None) + """ + The last conversion error of the chapter. + """ + + content: ChapterContentResponseModel + + 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/data/src/elevenlabs/types/chapter_with_content_response_model_state.py b/data/src/elevenlabs/types/chapter_with_content_response_model_state.py new file mode 100644 index 0000000000000000000000000000000000000000..84a64a808f1f5682ee607cdadfef73a3e2a0dca2 --- /dev/null +++ b/data/src/elevenlabs/types/chapter_with_content_response_model_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ChapterWithContentResponseModelState = typing.Union[typing.Literal["default", "converting"], typing.Any] diff --git a/data/src/elevenlabs/types/character_age.py b/data/src/elevenlabs/types/character_age.py new file mode 100644 index 0000000000000000000000000000000000000000..6224aa2f0292c8cdef96303f7474835fe12e1eb8 --- /dev/null +++ b/data/src/elevenlabs/types/character_age.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CharacterAge = typing.Union[typing.Literal["young", "middle_aged", "old"], typing.Any] diff --git a/data/src/elevenlabs/types/character_alignment_model.py b/data/src/elevenlabs/types/character_alignment_model.py new file mode 100644 index 0000000000000000000000000000000000000000..db9553a542b36be0ff690005ce5570de7b2a5adf --- /dev/null +++ b/data/src/elevenlabs/types/character_alignment_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CharacterAlignmentModel(UncheckedBaseModel): + characters: typing.List[str] + character_start_times_seconds: typing.List[float] + character_end_times_seconds: typing.List[float] + + 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/data/src/elevenlabs/types/character_alignment_response_model.py b/data/src/elevenlabs/types/character_alignment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4374233dc0ede84a42722510e6db654c87286048 --- /dev/null +++ b/data/src/elevenlabs/types/character_alignment_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CharacterAlignmentResponseModel(UncheckedBaseModel): + characters: typing.List[str] + character_start_times_seconds: typing.List[float] + character_end_times_seconds: typing.List[float] + + 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/data/src/elevenlabs/types/character_gender.py b/data/src/elevenlabs/types/character_gender.py new file mode 100644 index 0000000000000000000000000000000000000000..1c9efd3471acc4a837623d908138ec1f6f695da9 --- /dev/null +++ b/data/src/elevenlabs/types/character_gender.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CharacterGender = typing.Union[typing.Literal["male", "female", "neutral"], typing.Any] diff --git a/data/src/elevenlabs/types/character_metadata_response_model.py b/data/src/elevenlabs/types/character_metadata_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c0ea43e00dccf426dfd8dbf1a9685cfe2bd8903d --- /dev/null +++ b/data/src/elevenlabs/types/character_metadata_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .character_age import CharacterAge +from .character_gender import CharacterGender +from .character_role import CharacterRole + + +class CharacterMetadataResponseModel(UncheckedBaseModel): + description: typing.Optional[str] = None + sample_message: typing.Optional[str] = None + voice_creation_prompt_suggestion: typing.Optional[str] = None + gender: typing.Optional[CharacterGender] = None + age: typing.Optional[CharacterAge] = None + accent: typing.Optional[str] = None + role: typing.Optional[CharacterRole] = 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/data/src/elevenlabs/types/character_refresh_period.py b/data/src/elevenlabs/types/character_refresh_period.py new file mode 100644 index 0000000000000000000000000000000000000000..798d790690b0900081dd039d7cbe2ec60753ca00 --- /dev/null +++ b/data/src/elevenlabs/types/character_refresh_period.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CharacterRefreshPeriod = typing.Union[ + typing.Literal["monthly_period", "3_month_period", "6_month_period", "annual_period"], typing.Any +] diff --git a/data/src/elevenlabs/types/character_response_model.py b/data/src/elevenlabs/types/character_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..931663de0243805acf7daf9f4c6c417331bbcf2d --- /dev/null +++ b/data/src/elevenlabs/types/character_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .character_metadata_response_model import CharacterMetadataResponseModel + + +class CharacterResponseModel(UncheckedBaseModel): + character_id: str + name: str + metadata: typing.Optional[CharacterMetadataResponseModel] = None + recommended_voice_ids: typing.Optional[typing.List[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/data/src/elevenlabs/types/character_role.py b/data/src/elevenlabs/types/character_role.py new file mode 100644 index 0000000000000000000000000000000000000000..6e76a045dc399220c00794237df3589e09ed7327 --- /dev/null +++ b/data/src/elevenlabs/types/character_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CharacterRole = typing.Union[typing.Literal["narrator", "main", "supporting", "minor"], typing.Any] diff --git a/data/src/elevenlabs/types/character_usage_response.py b/data/src/elevenlabs/types/character_usage_response.py new file mode 100644 index 0000000000000000000000000000000000000000..25d6decefafd1216df2161cf6954ad6a90f26384 --- /dev/null +++ b/data/src/elevenlabs/types/character_usage_response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CharacterUsageResponse = typing.Any diff --git a/data/src/elevenlabs/types/chat_source_medium.py b/data/src/elevenlabs/types/chat_source_medium.py new file mode 100644 index 0000000000000000000000000000000000000000..51df79263853cf0187f1d2c11b783ae66345a562 --- /dev/null +++ b/data/src/elevenlabs/types/chat_source_medium.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ChatSourceMedium = typing.Union[typing.Literal["audio", "dtmf", "text", "image", "file"], typing.Any] diff --git a/data/src/elevenlabs/types/check_service_availability_params.py b/data/src/elevenlabs/types/check_service_availability_params.py new file mode 100644 index 0000000000000000000000000000000000000000..b8264af219ae326fa75c19adb9f9b89d4b95ea80 --- /dev/null +++ b/data/src/elevenlabs/types/check_service_availability_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CheckServiceAvailabilityParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["check_service_availability"]] = 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/data/src/elevenlabs/types/client_event.py b/data/src/elevenlabs/types/client_event.py new file mode 100644 index 0000000000000000000000000000000000000000..07d01102ed11b0f9dc1431911df74830a57d0b4d --- /dev/null +++ b/data/src/elevenlabs/types/client_event.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ClientEvent = typing.Union[ + typing.Literal[ + "conversation_initiation_metadata", + "asr_initiation_metadata", + "ping", + "audio", + "interruption", + "user_transcript", + "tentative_user_transcript", + "agent_response", + "agent_response_correction", + "client_tool_call", + "mcp_tool_call", + "mcp_connection_status", + "agent_tool_request", + "agent_tool_response", + "agent_tool_response_full_payload", + "agent_response_metadata", + "vad_score", + "agent_chat_response_part", + "client_error", + "guardrail_triggered", + "dtmf_request", + "agent_response_complete", + "context_usage", + "internal_turn_probability", + "internal_tentative_agent_response", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/client_secret_response.py b/data/src/elevenlabs/types/client_secret_response.py new file mode 100644 index 0000000000000000000000000000000000000000..4afb46829807815708ba5cae379223ba91e069ae --- /dev/null +++ b/data/src/elevenlabs/types/client_secret_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_session_config_output import OpenAiSessionConfigOutput + + +class ClientSecretResponse(UncheckedBaseModel): + value: str + expires_at: int + session: typing.Optional[OpenAiSessionConfigOutput] = 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/data/src/elevenlabs/types/client_tool_config_input.py b/data/src/elevenlabs/types/client_tool_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..6fb4988ba86a74d4195b4fef469ecb1862a68328 --- /dev/null +++ b/data/src/elevenlabs/types/client_tool_config_input.py @@ -0,0 +1,117 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode + + +class ClientToolConfigInput(UncheckedBaseModel): + """ + A client tool is one that sends an event to the user's client to trigger something client side + """ + + name: str + description: str = pydantic.Field() + """ + Description of when the tool should be used and what it does. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for the tool call to complete. Must be between 1 and 120 seconds (inclusive), or -1 to wait for the client's response indefinitely (requires expects_response). + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while this tool is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, the agent will speak before the tool call. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution. If not specified, no tool call sound will be played. + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play. 'auto' only plays when there's pre-tool speech, 'always' plays for every tool call. + """ + + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = pydantic.Field(default=None) + """ + Controls how tool errors are processed before being shared with the agent. 'auto' determines handling based on tool type (summarized for native integrations, hide for others), 'summarized' sends an LLM-generated summary, 'passthrough' sends the raw error, 'hide' does not share the error with the agent. + """ + + parameters: typing.Optional["ObjectJsonSchemaPropertyInput"] = pydantic.Field(default=None) + """ + Schema for any parameters to pass to the client + """ + + expects_response: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, calling this tool should block the conversation until the client responds with some response which is passed to the llm. If false then we will continue the conversation without waiting for the client to respond, this is useful to show content to a user but not block the conversation + """ + + dynamic_variables: typing.Optional[DynamicVariablesConfig] = pydantic.Field(default=None) + """ + Configuration for dynamic variables + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + Determines when and how the tool executes: 'immediate' executes the tool right away when requested by the LLM, 'post_tool_speech' waits for the agent to finish speaking before executing, 'async' runs the tool in the background without blocking - best for long-running operations. + """ + + 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 + + +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, I001 +from .array_json_schema_property_input_items import ArrayJsonSchemaPropertyInputItems # noqa: E402, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, I001 +from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + ClientToolConfigInput, + ArrayJsonSchemaPropertyInput=ArrayJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInputItems=ArrayJsonSchemaPropertyInputItems, + ObjectJsonSchemaPropertyInput=ObjectJsonSchemaPropertyInput, + ObjectJsonSchemaPropertyInputPropertiesValue=ObjectJsonSchemaPropertyInputPropertiesValue, +) diff --git a/data/src/elevenlabs/types/client_tool_config_output.py b/data/src/elevenlabs/types/client_tool_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..655eac0d6cfd3c782847395c90c3a13ace7efcff --- /dev/null +++ b/data/src/elevenlabs/types/client_tool_config_output.py @@ -0,0 +1,117 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode + + +class ClientToolConfigOutput(UncheckedBaseModel): + """ + A client tool is one that sends an event to the user's client to trigger something client side + """ + + name: str + description: str = pydantic.Field() + """ + Description of when the tool should be used and what it does. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for the tool call to complete. Must be between 1 and 120 seconds (inclusive), or -1 to wait for the client's response indefinitely (requires expects_response). + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while this tool is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, the agent will speak before the tool call. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution. If not specified, no tool call sound will be played. + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play. 'auto' only plays when there's pre-tool speech, 'always' plays for every tool call. + """ + + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = pydantic.Field(default=None) + """ + Controls how tool errors are processed before being shared with the agent. 'auto' determines handling based on tool type (summarized for native integrations, hide for others), 'summarized' sends an LLM-generated summary, 'passthrough' sends the raw error, 'hide' does not share the error with the agent. + """ + + parameters: typing.Optional["ObjectJsonSchemaPropertyOutput"] = pydantic.Field(default=None) + """ + Schema for any parameters to pass to the client + """ + + expects_response: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, calling this tool should block the conversation until the client responds with some response which is passed to the llm. If false then we will continue the conversation without waiting for the client to respond, this is useful to show content to a user but not block the conversation + """ + + dynamic_variables: typing.Optional[DynamicVariablesConfig] = pydantic.Field(default=None) + """ + Configuration for dynamic variables + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + Determines when and how the tool executes: 'immediate' executes the tool right away when requested by the LLM, 'post_tool_speech' waits for the agent to finish speaking before executing, 'async' runs the tool in the background without blocking - best for long-running operations. + """ + + 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 + + +from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, I001 +from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems # noqa: E402, I001 +from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, I001 +from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + ClientToolConfigOutput, + ArrayJsonSchemaPropertyOutput=ArrayJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems, + ObjectJsonSchemaPropertyOutput=ObjectJsonSchemaPropertyOutput, + ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue, +) diff --git a/data/src/elevenlabs/types/clip_animation.py b/data/src/elevenlabs/types/clip_animation.py new file mode 100644 index 0000000000000000000000000000000000000000..e12b2c47816c2a4f3b8e13a2018bd6f26a39b393 --- /dev/null +++ b/data/src/elevenlabs/types/clip_animation.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .clip_animation_enter_effect import ClipAnimationEnterEffect +from .clip_animation_exit_effect import ClipAnimationExitEffect + + +class ClipAnimation(UncheckedBaseModel): + enter_effect: typing.Optional[ClipAnimationEnterEffect] = None + enter_duration_ms: typing.Optional[int] = None + exit_effect: typing.Optional[ClipAnimationExitEffect] = None + exit_duration_ms: typing.Optional[int] = 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/data/src/elevenlabs/types/clip_animation_enter_effect.py b/data/src/elevenlabs/types/clip_animation_enter_effect.py new file mode 100644 index 0000000000000000000000000000000000000000..546baa8687494634d79771cd715997fc163ff5a5 --- /dev/null +++ b/data/src/elevenlabs/types/clip_animation_enter_effect.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ClipAnimationEnterEffect = typing.Union[ + typing.Literal[ + "none", + "fade", + "float", + "gentle_float", + "zoom_in", + "drop", + "slide_left", + "slide_right", + "slide_up", + "slide_down", + "pop", + "bounce", + "spin", + "slide_bounce", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/clip_animation_exit_effect.py b/data/src/elevenlabs/types/clip_animation_exit_effect.py new file mode 100644 index 0000000000000000000000000000000000000000..ef90f990cefedad6f6e588997f39aee3ab1d8263 --- /dev/null +++ b/data/src/elevenlabs/types/clip_animation_exit_effect.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ClipAnimationExitEffect = typing.Union[ + typing.Literal[ + "none", + "fade", + "float", + "gentle_float", + "zoom_in", + "drop", + "slide_left", + "slide_right", + "slide_up", + "slide_down", + "pop", + "bounce", + "spin", + "slide_bounce", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/close_connection.py b/data/src/elevenlabs/types/close_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..6f2f25877a28f44f5c362f264a8cc0c57a3f3132 --- /dev/null +++ b/data/src/elevenlabs/types/close_connection.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CloseConnection(UncheckedBaseModel): + text: typing.Literal[""] = pydantic.Field(default="") + """ + End the stream with an empty string + """ + + 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/data/src/elevenlabs/types/close_context.py b/data/src/elevenlabs/types/close_context.py new file mode 100644 index 0000000000000000000000000000000000000000..e5a94ef689271dfc2baddd417c93df34ab4f4d09 --- /dev/null +++ b/data/src/elevenlabs/types/close_context.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CloseContext(UncheckedBaseModel): + """ + Payload to close a specific TTS context. + """ + + context_id: str = pydantic.Field() + """ + The context_id to close. + """ + + close_context: bool = pydantic.Field() + """ + Must set the close_context to true, to close the specified context. If false, the context will remain open and the text will be ignored. If set to true, the context will close. If it has already been set to flush it will continue flushing. The same context id can be used again but will not be linked to the previous context with the same name. + """ + + 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/data/src/elevenlabs/types/close_payload.py b/data/src/elevenlabs/types/close_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..5fc3639eaddd0bb8b25403df014ebe8768d03787 --- /dev/null +++ b/data/src/elevenlabs/types/close_payload.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ClosePayload(UncheckedBaseModel): + """ + Payload indicating a clean end-of-conversation signal from ElevenLabs. + """ + + type: typing.Literal["close"] = pydantic.Field(default="close") + """ + The message type identifier. + """ + + 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/data/src/elevenlabs/types/close_socket.py b/data/src/elevenlabs/types/close_socket.py new file mode 100644 index 0000000000000000000000000000000000000000..769778f9b5d32f3ef878c8a8ead835fc73a153ca --- /dev/null +++ b/data/src/elevenlabs/types/close_socket.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CloseSocket(UncheckedBaseModel): + """ + Payload to signal closing the entire WebSocket connection. + """ + + close_socket: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, closes all contexts and closes the entire WebSocket connection. Any context that was previously set to flush will wait to flush before closing. + """ + + 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/data/src/elevenlabs/types/closed_outcome.py b/data/src/elevenlabs/types/closed_outcome.py new file mode 100644 index 0000000000000000000000000000000000000000..42708610046e27ec666f4159c41ec61ba3288588 --- /dev/null +++ b/data/src/elevenlabs/types/closed_outcome.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .merge_proposal_close_reason import MergeProposalCloseReason + + +class ClosedOutcome(UncheckedBaseModel): + reason: MergeProposalCloseReason + at: int + by_user_id: 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/data/src/elevenlabs/types/column_filter.py b/data/src/elevenlabs/types/column_filter.py new file mode 100644 index 0000000000000000000000000000000000000000..20a6ef45ac2670432a74ba829721631991fe0862 --- /dev/null +++ b/data/src/elevenlabs/types/column_filter.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .column_filter_operation import ColumnFilterOperation +from .column_filter_values_item import ColumnFilterValuesItem + + +class ColumnFilter(UncheckedBaseModel): + column: str + operation: ColumnFilterOperation + values: typing.List[typing.Optional[ColumnFilterValuesItem]] + + 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/data/src/elevenlabs/types/column_filter_operation.py b/data/src/elevenlabs/types/column_filter_operation.py new file mode 100644 index 0000000000000000000000000000000000000000..1326a9733db01ea9013c8b8b3a057f8b701ae851 --- /dev/null +++ b/data/src/elevenlabs/types/column_filter_operation.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ColumnFilterOperation = typing.Union[typing.Literal["in", "not_in", "le", "ge", "lt", "gt", "eq", "neq"], typing.Any] diff --git a/data/src/elevenlabs/types/column_filter_values_item.py b/data/src/elevenlabs/types/column_filter_values_item.py new file mode 100644 index 0000000000000000000000000000000000000000..9290fcad20160d4ef7a0c93dfe403cbe6b0042f1 --- /dev/null +++ b/data/src/elevenlabs/types/column_filter_values_item.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +ColumnFilterValuesItem = typing.Union[str, int, float, dt.datetime, bool] diff --git a/data/src/elevenlabs/types/column_unit.py b/data/src/elevenlabs/types/column_unit.py new file mode 100644 index 0000000000000000000000000000000000000000..a1d3be7a3bbb83097b325f5267c0cb7637c344c4 --- /dev/null +++ b/data/src/elevenlabs/types/column_unit.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ColumnUnit = typing.Union[ + typing.Literal["ms", "s", "min", "duration", "credits", "usd", "eur", "inr", "pln", "gbp", "ratio", "rating"], + typing.Any, +] diff --git a/data/src/elevenlabs/types/committed_transcript_entities_payload.py b/data/src/elevenlabs/types/committed_transcript_entities_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..7982ed5c48a01c6a35eda5024bb17fe68e0ada0b --- /dev/null +++ b/data/src/elevenlabs/types/committed_transcript_entities_payload.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .detected_entity import DetectedEntity + + +class CommittedTranscriptEntitiesPayload(UncheckedBaseModel): + """ + Payload for detected entities on a committed transcript. + """ + + message_type: typing.Literal["committed_transcript_entities"] = pydantic.Field( + default="committed_transcript_entities" + ) + """ + The message type identifier. + """ + + text: str = pydantic.Field() + """ + The committed transcript text the entities were detected in. + """ + + entities: typing.List[DetectedEntity] = pydantic.Field() + """ + Detected entities. Empty if none were found. + """ + + 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/data/src/elevenlabs/types/committed_transcript_payload.py b/data/src/elevenlabs/types/committed_transcript_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..760cce6a2591e272e0e06474d0d8e6497613331d --- /dev/null +++ b/data/src/elevenlabs/types/committed_transcript_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CommittedTranscriptPayload(UncheckedBaseModel): + """ + Payload for committed transcription results. + """ + + message_type: typing.Literal["committed_transcript"] = pydantic.Field(default="committed_transcript") + """ + The message type identifier. + """ + + text: str = pydantic.Field() + """ + Committed transcription text. + """ + + 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/data/src/elevenlabs/types/committed_transcript_with_timestamps_payload.py b/data/src/elevenlabs/types/committed_transcript_with_timestamps_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..b3bfd26d8d87a4c0eb9dd5fa89adb9edbeb4992e --- /dev/null +++ b/data/src/elevenlabs/types/committed_transcript_with_timestamps_payload.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .transcription_word import TranscriptionWord + + +class CommittedTranscriptWithTimestampsPayload(UncheckedBaseModel): + """ + Payload for committed transcription results with word-level timestamps. + """ + + message_type: typing.Literal["committed_transcript_with_timestamps"] = pydantic.Field( + default="committed_transcript_with_timestamps" + ) + """ + The message type identifier. + """ + + text: str = pydantic.Field() + """ + Committed transcription text. + """ + + language_code: typing.Optional[str] = pydantic.Field(default=None) + """ + Detected or specified language code. + """ + + words: typing.Optional[typing.List[TranscriptionWord]] = pydantic.Field(default=None) + """ + Word-level information with timestamps. + """ + + 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/data/src/elevenlabs/types/compaction_settings_workflow_override.py b/data/src/elevenlabs/types/compaction_settings_workflow_override.py new file mode 100644 index 0000000000000000000000000000000000000000..857874d350568d03cee9973f9deb11e0fe2747be --- /dev/null +++ b/data/src/elevenlabs/types/compaction_settings_workflow_override.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CompactionSettingsWorkflowOverride(UncheckedBaseModel): + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether context compaction is enabled for this agent. + """ + + soft_trigger_fraction: typing.Optional[float] = pydantic.Field(default=None) + """ + Context window fraction at which compaction is triggered. + """ + + tail_size: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of recent messages kept verbatim after compaction. + """ + + min_reclaimable_tokens: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum number of tokens that compaction must reclaim. + """ + + 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/data/src/elevenlabs/types/compile_procedures_response_model.py b/data/src/elevenlabs/types/compile_procedures_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..41b711fbe94c37ffa7bb0d44fbda246cf99db931 --- /dev/null +++ b/data/src/elevenlabs/types/compile_procedures_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_workflow_response_model import AgentWorkflowResponseModel + + +class CompileProceduresResponseModel(UncheckedBaseModel): + workflow: AgentWorkflowResponseModel = pydantic.Field() + """ + Generated workflow from compilation + """ + + 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 + + +update_forward_refs(CompileProceduresResponseModel) diff --git a/data/src/elevenlabs/types/compile_procedures_validation_error_response_model.py b/data/src/elevenlabs/types/compile_procedures_validation_error_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1b29ed7f8f9ecf32507710d3c8035848bbb00229 --- /dev/null +++ b/data/src/elevenlabs/types/compile_procedures_validation_error_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .procedure_validation_error import ProcedureValidationError + + +class CompileProceduresValidationErrorResponseModel(UncheckedBaseModel): + errors: typing.Dict[str, typing.List[ProcedureValidationError]] = pydantic.Field() + """ + Validation errors keyed by procedure ID. + """ + + 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/data/src/elevenlabs/types/composition_plan.py b/data/src/elevenlabs/types/composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..b6218517269c974824670d0f394b5291b5c08aa5 --- /dev/null +++ b/data/src/elevenlabs/types/composition_plan.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .composition_plan_chunks_item import CompositionPlanChunksItem + + +class CompositionPlan(UncheckedBaseModel): + """ + Composition plan for the `music_v2` and `music_v2_5` models. Using this field with any other model will result in an error. + """ + + chunks: typing.List[CompositionPlanChunksItem] = pydantic.Field() + """ + The chunks that make up the generation. + """ + + 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/data/src/elevenlabs/types/composition_plan_chunks_item.py b/data/src/elevenlabs/types/composition_plan_chunks_item.py new file mode 100644 index 0000000000000000000000000000000000000000..7df50e2edcba920073abec48f46a1000b8bc1871 --- /dev/null +++ b/data/src/elevenlabs/types/composition_plan_chunks_item.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .audio_ref_chunk import AudioRefChunk +from .generation_chunk_input import GenerationChunkInput + +CompositionPlanChunksItem = typing.Union[GenerationChunkInput, AudioRefChunk] diff --git a/data/src/elevenlabs/types/computed_usage_platform_limit.py b/data/src/elevenlabs/types/computed_usage_platform_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..762fd323734368aff42b826c9a994d301ff34d17 --- /dev/null +++ b/data/src/elevenlabs/types/computed_usage_platform_limit.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ComputedUsagePlatformLimit(UncheckedBaseModel): + """ + Platform limit with usage computed externally. Example: PVCs use the count_owned_pro_voices_in_billing_group function to compute the usage. + """ + + limit: typing.Optional[int] = 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/data/src/elevenlabs/types/condition_strength.py b/data/src/elevenlabs/types/condition_strength.py new file mode 100644 index 0000000000000000000000000000000000000000..6145e231f73665b802b0f1873d7b418687a7e00b --- /dev/null +++ b/data/src/elevenlabs/types/condition_strength.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConditionStrength = typing.Union[typing.Literal["low", "medium", "high", "xhigh"], typing.Any] diff --git a/data/src/elevenlabs/types/config_entity_type.py b/data/src/elevenlabs/types/config_entity_type.py new file mode 100644 index 0000000000000000000000000000000000000000..64c232617569c96ebb8079d8447a10c28326ddeb --- /dev/null +++ b/data/src/elevenlabs/types/config_entity_type.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConfigEntityType = typing.Union[ + typing.Literal[ + "name", + "name.name_given", + "name.name_family", + "name.name_other", + "email_address", + "contact_number", + "dob", + "age", + "religious_belief", + "political_opinion", + "sexual_orientation", + "ethnicity_race", + "marital_status", + "occupation", + "physical_attribute", + "language", + "username", + "password", + "url", + "organization", + "financial_id", + "financial_id.payment_card", + "financial_id.payment_card.payment_card_number", + "financial_id.payment_card.payment_card_expiration_date", + "financial_id.payment_card.payment_card_cvv", + "financial_id.bank_account", + "financial_id.bank_account.bank_account_number", + "financial_id.bank_account.bank_routing_number", + "financial_id.bank_account.swift_bic_code", + "financial_id.financial_id_other", + "location", + "location.location_address", + "location.location_city", + "location.location_postal_code", + "location.location_coordinate", + "location.location_state", + "location.location_country", + "location.location_other", + "date", + "date_interval", + "unique_id", + "unique_id.government_issued_id", + "unique_id.account_number", + "unique_id.vehicle_id", + "unique_id.healthcare_number", + "unique_id.healthcare_number.medical_record_number", + "unique_id.healthcare_number.health_plan_beneficiary_number", + "unique_id.device_id", + "unique_id.unique_id_other", + "medical", + "medical.medical_condition", + "medical.medication", + "medical.medical_procedure", + "medical.medical_measurement", + "medical.medical_other", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/conflict_section.py b/data/src/elevenlabs/types/conflict_section.py new file mode 100644 index 0000000000000000000000000000000000000000..73abc9b17a1d9837cc244ddb4b59793cbc82e1b6 --- /dev/null +++ b/data/src/elevenlabs/types/conflict_section.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConflictSection = typing.Union[ + typing.Literal["conversation_config", "platform_settings", "procedures", "workflow"], typing.Any +] diff --git a/data/src/elevenlabs/types/constant_schema_override.py b/data/src/elevenlabs/types/constant_schema_override.py new file mode 100644 index 0000000000000000000000000000000000000000..fd48dec219deb3dc5ca19747bd88793676a5e728 --- /dev/null +++ b/data/src/elevenlabs/types/constant_schema_override.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .constant_schema_override_constant_value import ConstantSchemaOverrideConstantValue + + +class ConstantSchemaOverride(UncheckedBaseModel): + constant_value: typing.Optional[ConstantSchemaOverrideConstantValue] = pydantic.Field(default=None) + """ + The constant value to use + """ + + 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/data/src/elevenlabs/types/constant_schema_override_constant_value.py b/data/src/elevenlabs/types/constant_schema_override_constant_value.py new file mode 100644 index 0000000000000000000000000000000000000000..e076e66b1c54233c043f6ad4cebf316599189df0 --- /dev/null +++ b/data/src/elevenlabs/types/constant_schema_override_constant_value.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConstantSchemaOverrideConstantValue = typing.Union[ + str, int, float, bool, typing.List[typing.Any], typing.Dict[str, typing.Any] +] diff --git a/data/src/elevenlabs/types/content_config.py b/data/src/elevenlabs/types/content_config.py new file mode 100644 index 0000000000000000000000000000000000000000..7e79496cb39a675195d2213c1a3c46d101f868fa --- /dev/null +++ b/data/src/elevenlabs/types/content_config.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_threshold_guardrail import ContentThresholdGuardrail + + +class ContentConfig(UncheckedBaseModel): + sexual: typing.Optional[ContentThresholdGuardrail] = None + violence: typing.Optional[ContentThresholdGuardrail] = None + harassment: typing.Optional[ContentThresholdGuardrail] = None + self_harm: typing.Optional[ContentThresholdGuardrail] = None + profanity: typing.Optional[ContentThresholdGuardrail] = None + religion_or_politics: typing.Optional[ContentThresholdGuardrail] = None + medical_and_legal_information: typing.Optional[ContentThresholdGuardrail] = 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/data/src/elevenlabs/types/content_format.py b/data/src/elevenlabs/types/content_format.py new file mode 100644 index 0000000000000000000000000000000000000000..2ee71a99df1b6d2e8ce51e371e6426e8b592c4cc --- /dev/null +++ b/data/src/elevenlabs/types/content_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ContentFormat = typing.Union[typing.Literal["html", "markdown"], typing.Any] diff --git a/data/src/elevenlabs/types/content_guardrail_input.py b/data/src/elevenlabs/types/content_guardrail_input.py new file mode 100644 index 0000000000000000000000000000000000000000..c0e256ea6069eb167562b0f2535ac0d0497ae920 --- /dev/null +++ b/data/src/elevenlabs/types/content_guardrail_input.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_config import ContentConfig +from .content_guardrail_input_trigger_action import ContentGuardrailInputTriggerAction +from .guardrail_execution_mode import GuardrailExecutionMode + + +class ContentGuardrailInput(UncheckedBaseModel): + execution_mode: typing.Optional[GuardrailExecutionMode] = None + config: typing.Optional[ContentConfig] = None + trigger_action: typing.Optional[ContentGuardrailInputTriggerAction] = 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/data/src/elevenlabs/types/content_guardrail_input_trigger_action.py b/data/src/elevenlabs/types/content_guardrail_input_trigger_action.py new file mode 100644 index 0000000000000000000000000000000000000000..351ad036dc01ae8f67d908f8e10738c9f8785194 --- /dev/null +++ b/data/src/elevenlabs/types/content_guardrail_input_trigger_action.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class ContentGuardrailInputTriggerAction_EndCall(UncheckedBaseModel): + type: typing.Literal["end_call"] = "end_call" + + 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 + + +class ContentGuardrailInputTriggerAction_Retry(UncheckedBaseModel): + type: typing.Literal["retry"] = "retry" + feedback: 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 + + +ContentGuardrailInputTriggerAction = typing_extensions.Annotated[ + typing.Union[ContentGuardrailInputTriggerAction_EndCall, ContentGuardrailInputTriggerAction_Retry], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/content_guardrail_output.py b/data/src/elevenlabs/types/content_guardrail_output.py new file mode 100644 index 0000000000000000000000000000000000000000..600398634a02e6e3fa74812c2500fb47b903144b --- /dev/null +++ b/data/src/elevenlabs/types/content_guardrail_output.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_config import ContentConfig +from .content_guardrail_output_trigger_action import ContentGuardrailOutputTriggerAction +from .guardrail_execution_mode import GuardrailExecutionMode + + +class ContentGuardrailOutput(UncheckedBaseModel): + execution_mode: typing.Optional[GuardrailExecutionMode] = None + config: typing.Optional[ContentConfig] = None + trigger_action: typing.Optional[ContentGuardrailOutputTriggerAction] = 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/data/src/elevenlabs/types/content_guardrail_output_trigger_action.py b/data/src/elevenlabs/types/content_guardrail_output_trigger_action.py new file mode 100644 index 0000000000000000000000000000000000000000..5bd4e680179bec09fd0face061c7cd149c8b8c0e --- /dev/null +++ b/data/src/elevenlabs/types/content_guardrail_output_trigger_action.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class ContentGuardrailOutputTriggerAction_EndCall(UncheckedBaseModel): + type: typing.Literal["end_call"] = "end_call" + + 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 + + +class ContentGuardrailOutputTriggerAction_Retry(UncheckedBaseModel): + type: typing.Literal["retry"] = "retry" + feedback: 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 + + +ContentGuardrailOutputTriggerAction = typing_extensions.Annotated[ + typing.Union[ContentGuardrailOutputTriggerAction_EndCall, ContentGuardrailOutputTriggerAction_Retry], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/content_schema.py b/data/src/elevenlabs/types/content_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..04164ee1a3a040de27d6809ea7ed5ed2f267083a --- /dev/null +++ b/data/src/elevenlabs/types/content_schema.py @@ -0,0 +1,187 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class ContentSchema_Array(UncheckedBaseModel): + type: typing.Literal["array"] = "array" + title: typing.Optional[str] = None + description: typing.Optional[str] = None + items: "ContentSchema" + + 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 + + +class ContentSchema_Audio(UncheckedBaseModel): + type: typing.Literal["audio"] = "audio" + title: typing.Optional[str] = None + description: 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 + + +class ContentSchema_Boolean(UncheckedBaseModel): + type: typing.Literal["boolean"] = "boolean" + title: typing.Optional[str] = None + description: 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 + + +class ContentSchema_Image(UncheckedBaseModel): + type: typing.Literal["image"] = "image" + title: typing.Optional[str] = None + description: 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 + + +class ContentSchema_Integer(UncheckedBaseModel): + type: typing.Literal["integer"] = "integer" + title: typing.Optional[str] = None + description: 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 + + +class ContentSchema_Number(UncheckedBaseModel): + type: typing.Literal["number"] = "number" + title: typing.Optional[str] = None + description: typing.Optional[str] = None + enum: typing.Optional[typing.List[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 + + +class ContentSchema_Object(UncheckedBaseModel): + type: typing.Literal["object"] = "object" + title: typing.Optional[str] = None + description: typing.Optional[str] = None + properties: typing.Optional[typing.Dict[str, "ContentSchema"]] = None + required: typing.Optional[typing.List[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 + + +class ContentSchema_String(UncheckedBaseModel): + type: typing.Literal["string"] = "string" + title: typing.Optional[str] = None + description: typing.Optional[str] = None + enum: typing.Optional[typing.List[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 + + +class ContentSchema_Video(UncheckedBaseModel): + type: typing.Literal["video"] = "video" + title: typing.Optional[str] = None + description: 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 + + +class ContentSchema_Voice(UncheckedBaseModel): + type: typing.Literal["voice"] = "voice" + title: typing.Optional[str] = None + description: 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 + + +ContentSchema = typing_extensions.Annotated[ + typing.Union[ + ContentSchema_Array, + ContentSchema_Audio, + ContentSchema_Boolean, + ContentSchema_Image, + ContentSchema_Integer, + ContentSchema_Number, + ContentSchema_Object, + ContentSchema_String, + ContentSchema_Video, + ContentSchema_Voice, + ], + UnionMetadata(discriminant="type"), +] +from .object_schema import ObjectSchema # noqa: E402, I001 +from .array_schema import ArraySchema # noqa: E402, I001 + +update_forward_refs(ContentSchema_Array, ContentSchema=ContentSchema, ObjectSchema=ObjectSchema) +update_forward_refs(ContentSchema_Object, ArraySchema=ArraySchema, ContentSchema=ContentSchema) diff --git a/data/src/elevenlabs/types/content_threshold_guardrail.py b/data/src/elevenlabs/types/content_threshold_guardrail.py new file mode 100644 index 0000000000000000000000000000000000000000..03ed6915b3c8e0dc5b260d082a887cf2fade4e6a --- /dev/null +++ b/data/src/elevenlabs/types/content_threshold_guardrail.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_threshold_guardrail_threshold import ContentThresholdGuardrailThreshold + + +class ContentThresholdGuardrail(UncheckedBaseModel): + is_enabled: typing.Optional[bool] = None + threshold: typing.Optional[ContentThresholdGuardrailThreshold] = 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/data/src/elevenlabs/types/content_threshold_guardrail_threshold.py b/data/src/elevenlabs/types/content_threshold_guardrail_threshold.py new file mode 100644 index 0000000000000000000000000000000000000000..1323c215fa0d5cbe603e3f84893a032b8bb000b4 --- /dev/null +++ b/data/src/elevenlabs/types/content_threshold_guardrail_threshold.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ContentThresholdGuardrailThreshold = typing.Union[ + float, typing.Literal["low"], typing.Literal["medium"], typing.Literal["high"] +] diff --git a/data/src/elevenlabs/types/contextual_update_info.py b/data/src/elevenlabs/types/contextual_update_info.py new file mode 100644 index 0000000000000000000000000000000000000000..d811a36eb4147faca120c60f247065d7d9e41b13 --- /dev/null +++ b/data/src/elevenlabs/types/contextual_update_info.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ContextualUpdateInfo(UncheckedBaseModel): + context_id: str = pydantic.Field() + """ + Client-supplied identifier grouping related contextual updates. + """ + + is_superseded: typing.Optional[bool] = pydantic.Field(default=None) + """ + True when this contextual update has been replaced by a newer update with the same context_id. + """ + + 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/data/src/elevenlabs/types/contributor.py b/data/src/elevenlabs/types/contributor.py new file mode 100644 index 0000000000000000000000000000000000000000..7a09cf5eff63522ff094495fc14563ff66556b33 --- /dev/null +++ b/data/src/elevenlabs/types/contributor.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class Contributor(UncheckedBaseModel): + name: str + role: str + bio: typing.Optional[str] = None + profile_id: 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/data/src/elevenlabs/types/conv_ai_dynamic_variable.py b/data/src/elevenlabs/types/conv_ai_dynamic_variable.py new file mode 100644 index 0000000000000000000000000000000000000000..3944f73a0fada3e037b06e2ccf9b47762513c814 --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_dynamic_variable.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConvAiDynamicVariable(UncheckedBaseModel): + """ + Used to reference a dynamic variable. + """ + + variable_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/data/src/elevenlabs/types/conv_ai_env_var_locator.py b/data/src/elevenlabs/types/conv_ai_env_var_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..116660bc57d6bf531faef799e152fda5b1918777 --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_env_var_locator.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConvAiEnvVarLocator(UncheckedBaseModel): + """ + Used to reference an environment variable by label. + """ + + env_var_label: 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/data/src/elevenlabs/types/conv_ai_file_upload_response_model.py b/data/src/elevenlabs/types/conv_ai_file_upload_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..47a0c6a2cb5fa4a8a9f8790cf391db5b71fff9dd --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_file_upload_response_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConvAiFileUploadResponseModel(UncheckedBaseModel): + file_id: 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/data/src/elevenlabs/types/conv_ai_secret_locator.py b/data/src/elevenlabs/types/conv_ai_secret_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..d1aa9d5be961b2d34da532868bd7a5222ded2f5d --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_secret_locator.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConvAiSecretLocator(UncheckedBaseModel): + """ + Used to reference a secret from the agent's secret store. + """ + + secret_id: 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/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies.py b/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies.py new file mode 100644 index 0000000000000000000000000000000000000000..00d3a3342789d6396758fd08ea23becae463710e --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conv_ai_stored_secret_dependencies_agents_item import ConvAiStoredSecretDependenciesAgentsItem +from .conv_ai_stored_secret_dependencies_mcp_servers_item import ConvAiStoredSecretDependenciesMcpServersItem +from .conv_ai_stored_secret_dependencies_tools_item import ConvAiStoredSecretDependenciesToolsItem +from .dependent_phone_number_identifier import DependentPhoneNumberIdentifier +from .secret_dependency_type import SecretDependencyType + + +class ConvAiStoredSecretDependencies(UncheckedBaseModel): + tools: typing.List[ConvAiStoredSecretDependenciesToolsItem] + tools_has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there are more tool dependents beyond the returned preview + """ + + agents: typing.List[ConvAiStoredSecretDependenciesAgentsItem] + agents_has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there are more agent dependents beyond the returned preview + """ + + phone_numbers: typing.Optional[typing.List[DependentPhoneNumberIdentifier]] = None + phone_numbers_has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there are more phone number dependents beyond the returned preview + """ + + mcp_servers: typing.Optional[typing.List[ConvAiStoredSecretDependenciesMcpServersItem]] = None + others: typing.List[SecretDependencyType] + + 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/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_agents_item.py b/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_agents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..4dc921dc681cb1f850baa3924b87d0a37f47b98c --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_agents_item.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class ConvAiStoredSecretDependenciesAgentsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class ConvAiStoredSecretDependenciesAgentsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +ConvAiStoredSecretDependenciesAgentsItem = typing_extensions.Annotated[ + typing.Union[ConvAiStoredSecretDependenciesAgentsItem_Available, ConvAiStoredSecretDependenciesAgentsItem_Unknown], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_mcp_servers_item.py b/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_mcp_servers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..f68c52dda5bbc55c903efbe038d48c20345ad02a --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_mcp_servers_item.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_mcp_server_identifier_access_level import DependentAvailableMcpServerIdentifierAccessLevel + + +class ConvAiStoredSecretDependenciesMcpServersItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableMcpServerIdentifierAccessLevel + + 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 + + +class ConvAiStoredSecretDependenciesMcpServersItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + id: 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 + + +ConvAiStoredSecretDependenciesMcpServersItem = typing_extensions.Annotated[ + typing.Union[ + ConvAiStoredSecretDependenciesMcpServersItem_Available, ConvAiStoredSecretDependenciesMcpServersItem_Unknown + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_tools_item.py b/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_tools_item.py new file mode 100644 index 0000000000000000000000000000000000000000..6ccccd5e9f980e0b512319f31438389e8296b092 --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_stored_secret_dependencies_tools_item.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_tool_identifier_access_level import DependentAvailableToolIdentifierAccessLevel + + +class ConvAiStoredSecretDependenciesToolsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableToolIdentifierAccessLevel + + 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 + + +class ConvAiStoredSecretDependenciesToolsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + id: 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 + + +ConvAiStoredSecretDependenciesToolsItem = typing_extensions.Annotated[ + typing.Union[ConvAiStoredSecretDependenciesToolsItem_Available, ConvAiStoredSecretDependenciesToolsItem_Unknown], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/conv_ai_user_secret_db_model.py b/data/src/elevenlabs/types/conv_ai_user_secret_db_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3a64f0f1782f76325b26c0d07024266ef54d3f4a --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_user_secret_db_model.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConvAiUserSecretDbModel(UncheckedBaseModel): + """ + User-specific secret model that are not shared with other users in a workspace. + """ + + name: str + encrypted_value: str + nonce: str + id: 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/data/src/elevenlabs/types/conv_ai_webhooks.py b/data/src/elevenlabs/types/conv_ai_webhooks.py new file mode 100644 index 0000000000000000000000000000000000000000..f21c99db84b3a303e57bddbcff3d45efbe96093d --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_webhooks.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .webhook_event_type import WebhookEventType +from .webhook_transcript_format import WebhookTranscriptFormat + + +class ConvAiWebhooks(UncheckedBaseModel): + post_call_webhook_id: typing.Optional[str] = None + events: typing.Optional[typing.List[WebhookEventType]] = pydantic.Field(default=None) + """ + List of event types to send via webhook. Options: transcript, audio, call_initiation_failure, answering_machine_detection, unredacted_transcript, unredacted_audio. + """ + + transcript_format: typing.Optional[WebhookTranscriptFormat] = pydantic.Field(default=None) + """ + Format for transcript webhooks. + """ + + exclude_transcript: typing.Optional[bool] = pydantic.Field(default=None) + """ + When true, JSON post-call transcription webhooks omit the turn-by-turn transcript. Analysis, metadata, and other conversation fields are still sent. Ignored for OpenTelemetry transcript format. + """ + + send_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: Use 'events' field instead. Whether to send audio data with post-call webhooks for ConvAI conversations + """ + + 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/data/src/elevenlabs/types/conv_ai_workspace_stored_secret_config.py b/data/src/elevenlabs/types/conv_ai_workspace_stored_secret_config.py new file mode 100644 index 0000000000000000000000000000000000000000..a9563f9e10f970397659f4f89856a10a7225f155 --- /dev/null +++ b/data/src/elevenlabs/types/conv_ai_workspace_stored_secret_config.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conv_ai_stored_secret_dependencies import ConvAiStoredSecretDependencies + + +class ConvAiWorkspaceStoredSecretConfig(UncheckedBaseModel): + type: typing.Literal["stored"] = "stored" + secret_id: str + name: str + used_by: ConvAiStoredSecretDependencies + + 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/data/src/elevenlabs/types/conversation_asr_usage_model.py b/data/src/elevenlabs/types/conversation_asr_usage_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8b6c19146b06c7ca37f2dd163217c88363edebaa --- /dev/null +++ b/data/src/elevenlabs/types/conversation_asr_usage_model.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationAsrUsageModel(UncheckedBaseModel): + """ + Aggregated ASR usage for a conversation (analytics-only, not billing). + """ + + asr_model: typing.Optional[str] = None + total_transcription_calls: typing.Optional[int] = None + total_audio_input_seconds: 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/data/src/elevenlabs/types/conversation_charging_common_model.py b/data/src/elevenlabs/types/conversation_charging_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a7ad315a2c9c7360c6e8a5995ed391e6ff06c3ba --- /dev/null +++ b/data/src/elevenlabs/types/conversation_charging_common_model.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .analysis_charging import AnalysisCharging +from .conversation_asr_usage_model import ConversationAsrUsageModel +from .conversation_tts_usage_model import ConversationTtsUsageModel +from .llm_category_usage import LlmCategoryUsage +from .platform_usage import PlatformUsage + + +class ConversationChargingCommonModel(UncheckedBaseModel): + dev_discount: typing.Optional[bool] = None + is_burst: typing.Optional[bool] = None + tier: typing.Optional[str] = None + llm_usage: typing.Optional[LlmCategoryUsage] = None + llm_price: typing.Optional[float] = None + llm_charge: typing.Optional[int] = None + call_charge: typing.Optional[int] = None + platform_charge: typing.Optional[int] = None + platform_usage: typing.Optional[PlatformUsage] = None + platform_price: typing.Optional[float] = None + free_minutes_consumed: typing.Optional[float] = None + free_llm_dollars_consumed: typing.Optional[float] = None + tts_usage: typing.Optional[ConversationTtsUsageModel] = None + asr_usage: typing.Optional[ConversationAsrUsageModel] = None + analysis: typing.Optional[AnalysisCharging] = 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/data/src/elevenlabs/types/conversation_config_client_override_config_input.py b/data/src/elevenlabs/types/conversation_config_client_override_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..b14cba6434dec429edd249af898ebc940914f4a3 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_client_override_config_input.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_config_override_config import AgentConfigOverrideConfig +from .asr_conversational_config_override_config import AsrConversationalConfigOverrideConfig +from .conversation_config_override_config import ConversationConfigOverrideConfig +from .tts_conversational_config_override_config import TtsConversationalConfigOverrideConfig +from .turn_config_override_config import TurnConfigOverrideConfig + + +class ConversationConfigClientOverrideConfigInput(UncheckedBaseModel): + asr: typing.Optional[AsrConversationalConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + turn: typing.Optional[TurnConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + tts: typing.Optional[TtsConversationalConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + conversation: typing.Optional[ConversationConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + agent: typing.Optional[AgentConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + 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/data/src/elevenlabs/types/conversation_config_client_override_config_output.py b/data/src/elevenlabs/types/conversation_config_client_override_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..0d2dcc2fab25058be025f02c3da2c5fa3f1df754 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_client_override_config_output.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_config_override_config import AgentConfigOverrideConfig +from .asr_conversational_config_override_config import AsrConversationalConfigOverrideConfig +from .conversation_config_override_config import ConversationConfigOverrideConfig +from .tts_conversational_config_override_config import TtsConversationalConfigOverrideConfig +from .turn_config_override_config import TurnConfigOverrideConfig + + +class ConversationConfigClientOverrideConfigOutput(UncheckedBaseModel): + asr: typing.Optional[AsrConversationalConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + turn: typing.Optional[TurnConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + tts: typing.Optional[TtsConversationalConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + conversation: typing.Optional[ConversationConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + agent: typing.Optional[AgentConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + 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/data/src/elevenlabs/types/conversation_config_client_override_input.py b/data/src/elevenlabs/types/conversation_config_client_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..a70e728c10e55d25fcabf60caef6d45862156930 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_client_override_input.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_config_override_input import AgentConfigOverrideInput +from .asr_conversational_config_override import AsrConversationalConfigOverride +from .conversation_config_override import ConversationConfigOverride +from .tts_conversational_config_override import TtsConversationalConfigOverride +from .turn_config_override import TurnConfigOverride + + +class ConversationConfigClientOverrideInput(UncheckedBaseModel): + asr: typing.Optional[AsrConversationalConfigOverride] = pydantic.Field(default=None) + """ + Configuration for conversational transcription + """ + + turn: typing.Optional[TurnConfigOverride] = pydantic.Field(default=None) + """ + Configuration for turn detection + """ + + tts: typing.Optional[TtsConversationalConfigOverride] = pydantic.Field(default=None) + """ + Configuration for conversational text to speech + """ + + conversation: typing.Optional[ConversationConfigOverride] = pydantic.Field(default=None) + """ + Configuration for conversational events + """ + + agent: typing.Optional[AgentConfigOverrideInput] = pydantic.Field(default=None) + """ + Agent specific configuration + """ + + 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/data/src/elevenlabs/types/conversation_config_client_override_output.py b/data/src/elevenlabs/types/conversation_config_client_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..ad717d6eb125aa4e71dfd66386f7dd4ef9e69f9b --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_client_override_output.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_config_override_output import AgentConfigOverrideOutput +from .asr_conversational_config_override import AsrConversationalConfigOverride +from .conversation_config_override import ConversationConfigOverride +from .tts_conversational_config_override import TtsConversationalConfigOverride +from .turn_config_override import TurnConfigOverride + + +class ConversationConfigClientOverrideOutput(UncheckedBaseModel): + asr: typing.Optional[AsrConversationalConfigOverride] = pydantic.Field(default=None) + """ + Configuration for conversational transcription + """ + + turn: typing.Optional[TurnConfigOverride] = pydantic.Field(default=None) + """ + Configuration for turn detection + """ + + tts: typing.Optional[TtsConversationalConfigOverride] = pydantic.Field(default=None) + """ + Configuration for conversational text to speech + """ + + conversation: typing.Optional[ConversationConfigOverride] = pydantic.Field(default=None) + """ + Configuration for conversational events + """ + + agent: typing.Optional[AgentConfigOverrideOutput] = pydantic.Field(default=None) + """ + Agent specific configuration + """ + + 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/data/src/elevenlabs/types/conversation_config_input.py b/data/src/elevenlabs/types/conversation_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..6fb1b1330260af0992db0495c3bf8d9b2871373d --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_input.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .background_sound_config import BackgroundSoundConfig +from .client_event import ClientEvent +from .dtmf_input_config import DtmfInputConfig +from .file_input_config import FileInputConfig + + +class ConversationConfigInput(UncheckedBaseModel): + text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled audio will not be processed and only text will be used, use to avoid audio pricing. + """ + + max_duration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum duration of a conversation in seconds + """ + + client_events: typing.Optional[typing.List[ClientEvent]] = pydantic.Field(default=None) + """ + The events that will be sent to the client + """ + + file_input: typing.Optional[FileInputConfig] = pydantic.Field(default=None) + """ + Configuration for file input (image/PDF uploads) during conversations. + """ + + monitoring_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable real-time monitoring of conversations via WebSocket + """ + + monitoring_events: typing.Optional[typing.List[ClientEvent]] = pydantic.Field(default=None) + """ + The events that will be sent to monitoring connections. + """ + + dtmf_input_settings: typing.Optional[DtmfInputConfig] = pydantic.Field(default=None) + """ + Configure DTMF (keypad) input collection during phone calls + """ + + background_sound: typing.Optional[BackgroundSoundConfig] = pydantic.Field(default=None) + """ + Configuration for background sound during conversations. + """ + + source_attribution: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled and knowledge base content is present, the LLM is instructed to report which sources it used. + """ + + 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/data/src/elevenlabs/types/conversation_config_output.py b/data/src/elevenlabs/types/conversation_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..2441c014c6784be3885f2f51a38ec65b509f4bcb --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_output.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .background_sound_config import BackgroundSoundConfig +from .client_event import ClientEvent +from .dtmf_input_config import DtmfInputConfig +from .file_input_config import FileInputConfig + + +class ConversationConfigOutput(UncheckedBaseModel): + text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled audio will not be processed and only text will be used, use to avoid audio pricing. + """ + + max_duration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum duration of a conversation in seconds + """ + + client_events: typing.Optional[typing.List[ClientEvent]] = pydantic.Field(default=None) + """ + The events that will be sent to the client + """ + + file_input: typing.Optional[FileInputConfig] = pydantic.Field(default=None) + """ + Configuration for file input (image/PDF uploads) during conversations. + """ + + monitoring_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable real-time monitoring of conversations via WebSocket + """ + + monitoring_events: typing.Optional[typing.List[ClientEvent]] = pydantic.Field(default=None) + """ + The events that will be sent to monitoring connections. + """ + + dtmf_input_settings: typing.Optional[DtmfInputConfig] = pydantic.Field(default=None) + """ + Configure DTMF (keypad) input collection during phone calls + """ + + background_sound: typing.Optional[BackgroundSoundConfig] = pydantic.Field(default=None) + """ + Configuration for background sound during conversations. + """ + + source_attribution: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled and knowledge base content is present, the LLM is instructed to report which sources it used. + """ + + 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/data/src/elevenlabs/types/conversation_config_override.py b/data/src/elevenlabs/types/conversation_config_override.py new file mode 100644 index 0000000000000000000000000000000000000000..b2be1036e4ad1c0debfc080152ba21a08b69f857 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_override.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationConfigOverride(UncheckedBaseModel): + text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled audio will not be processed and only text will be used, use to avoid audio pricing. + """ + + max_duration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum duration of a conversation in seconds + """ + + 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/data/src/elevenlabs/types/conversation_config_override_config.py b/data/src/elevenlabs/types/conversation_config_override_config.py new file mode 100644 index 0000000000000000000000000000000000000000..0308805baaac898c4699d67f95b3384cdd4a8f12 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_override_config.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationConfigOverrideConfig(UncheckedBaseModel): + text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the text_only field. + """ + + max_duration_seconds: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the max_duration_seconds field. + """ + + 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/data/src/elevenlabs/types/conversation_config_workflow_override_input.py b/data/src/elevenlabs/types/conversation_config_workflow_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..2f865eb4aa0b9a428a1510c7fc60f54c6c56e600 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_workflow_override_input.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .background_sound_config_workflow_override import BackgroundSoundConfigWorkflowOverride +from .client_event import ClientEvent +from .dtmf_input_config import DtmfInputConfig +from .file_input_config_workflow_override import FileInputConfigWorkflowOverride + + +class ConversationConfigWorkflowOverrideInput(UncheckedBaseModel): + text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled audio will not be processed and only text will be used, use to avoid audio pricing. + """ + + max_duration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum duration of a conversation in seconds + """ + + client_events: typing.Optional[typing.List[ClientEvent]] = pydantic.Field(default=None) + """ + The events that will be sent to the client + """ + + file_input: typing.Optional[FileInputConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for file input (image/PDF uploads) during conversations. + """ + + monitoring_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable real-time monitoring of conversations via WebSocket + """ + + monitoring_events: typing.Optional[typing.List[ClientEvent]] = pydantic.Field(default=None) + """ + The events that will be sent to monitoring connections. + """ + + dtmf_input_settings: typing.Optional[DtmfInputConfig] = pydantic.Field(default=None) + """ + Configure DTMF (keypad) input collection during phone calls + """ + + background_sound: typing.Optional[BackgroundSoundConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for background sound during conversations. + """ + + source_attribution: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled and knowledge base content is present, the LLM is instructed to report which sources it used. + """ + + 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/data/src/elevenlabs/types/conversation_config_workflow_override_output.py b/data/src/elevenlabs/types/conversation_config_workflow_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..a70664809c8d58c13b4ccfc9abc47be75076c2fb --- /dev/null +++ b/data/src/elevenlabs/types/conversation_config_workflow_override_output.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .background_sound_config_workflow_override import BackgroundSoundConfigWorkflowOverride +from .client_event import ClientEvent +from .dtmf_input_config import DtmfInputConfig +from .file_input_config_workflow_override import FileInputConfigWorkflowOverride + + +class ConversationConfigWorkflowOverrideOutput(UncheckedBaseModel): + text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled audio will not be processed and only text will be used, use to avoid audio pricing. + """ + + max_duration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum duration of a conversation in seconds + """ + + client_events: typing.Optional[typing.List[ClientEvent]] = pydantic.Field(default=None) + """ + The events that will be sent to the client + """ + + file_input: typing.Optional[FileInputConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for file input (image/PDF uploads) during conversations. + """ + + monitoring_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable real-time monitoring of conversations via WebSocket + """ + + monitoring_events: typing.Optional[typing.List[ClientEvent]] = pydantic.Field(default=None) + """ + The events that will be sent to monitoring connections. + """ + + dtmf_input_settings: typing.Optional[DtmfInputConfig] = pydantic.Field(default=None) + """ + Configure DTMF (keypad) input collection during phone calls + """ + + background_sound: typing.Optional[BackgroundSoundConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for background sound during conversations. + """ + + source_attribution: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled and knowledge base content is present, the LLM is instructed to report which sources it used. + """ + + 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/data/src/elevenlabs/types/conversation_deletion_settings.py b/data/src/elevenlabs/types/conversation_deletion_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..4c4f3ef559c397cabf3e26270414a814b3b6f743 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_deletion_settings.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationDeletionSettings(UncheckedBaseModel): + deletion_time_unix_secs: typing.Optional[int] = None + deleted_logs_at_time_unix_secs: typing.Optional[int] = None + deleted_audio_at_time_unix_secs: typing.Optional[int] = None + deleted_transcript_at_time_unix_secs: typing.Optional[int] = None + delete_transcript_and_pii: typing.Optional[bool] = None + delete_audio: 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/data/src/elevenlabs/types/conversation_error_type.py b/data/src/elevenlabs/types/conversation_error_type.py new file mode 100644 index 0000000000000000000000000000000000000000..0811e109af1c581f88afd46697560f167a3f5634 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_error_type.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationErrorType = typing.Union[ + typing.Literal[ + "unknown", + "call_initialization_error", + "line_busy", + "no_answer", + "call_rejected", + "blocked_by_user", + "agent_configuration_error", + "invalid_client_request", + "permission_error", + "entitlement_exceeded", + "client_disconnected", + "llm_error", + "speech_error", + "tool_error", + "integration_error", + "dependency_error", + "guardrail_triggered", + "safety_violation", + "max_duration_exceeded", + "workflow_end_failure", + "internal_error", + "post_processing_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/conversation_feedback_type.py b/data/src/elevenlabs/types/conversation_feedback_type.py new file mode 100644 index 0000000000000000000000000000000000000000..dad58f574d8a6cd938b4bad9db7a77285141bc67 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_feedback_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationFeedbackType = typing.Union[typing.Literal["thumbs", "rating"], typing.Any] diff --git a/data/src/elevenlabs/types/conversation_history_analysis_common_model.py b/data/src/elevenlabs/types/conversation_history_analysis_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..251aa1735a62c96fab56adbae829b688241cb2c6 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_analysis_common_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_evaluation_criteria_result_common_model import ( + ConversationHistoryEvaluationCriteriaResultCommonModel, +) +from .data_collection_result_common_model import DataCollectionResultCommonModel +from .evaluation_success_result import EvaluationSuccessResult +from .scoped_analysis_result import ScopedAnalysisResult + + +class ConversationHistoryAnalysisCommonModel(UncheckedBaseModel): + evaluation_criteria_results: typing.Optional[ + typing.Dict[str, ConversationHistoryEvaluationCriteriaResultCommonModel] + ] = None + data_collection_results: typing.Optional[typing.Dict[str, DataCollectionResultCommonModel]] = None + evaluation_criteria_results_list: typing.Optional[ + typing.List[ConversationHistoryEvaluationCriteriaResultCommonModel] + ] = None + data_collection_results_list: typing.Optional[typing.List[DataCollectionResultCommonModel]] = None + call_successful: EvaluationSuccessResult + call_success_score: typing.Optional[float] = None + transcript_summary: str + call_summary_title: typing.Optional[str] = None + scoped: typing.Optional[typing.List[ScopedAnalysisResult]] = 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/data/src/elevenlabs/types/conversation_history_batch_call_model.py b/data/src/elevenlabs/types/conversation_history_batch_call_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9c3fd4686143d905b57c0470ea87c737a1cfc0e2 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_batch_call_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .batch_calling_campaign_information import BatchCallingCampaignInformation + + +class ConversationHistoryBatchCallModel(UncheckedBaseModel): + batch_call_id: str + batch_call_recipient_id: str + campaign: typing.Optional[BatchCallingCampaignInformation] = 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/data/src/elevenlabs/types/conversation_history_eleven_assistant_common_model.py b/data/src/elevenlabs/types/conversation_history_eleven_assistant_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9f76bbccc1a5df6155085115c563ec43a031cdab --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_eleven_assistant_common_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationHistoryElevenAssistantCommonModel(UncheckedBaseModel): + is_eleven_assistant: 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/data/src/elevenlabs/types/conversation_history_error_common_model.py b/data/src/elevenlabs/types/conversation_history_error_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..bff4915d008d921382d6f84ea42fa0c4b534e901 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_error_common_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationHistoryErrorCommonModel(UncheckedBaseModel): + code: int + reason: 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/data/src/elevenlabs/types/conversation_history_evaluation_criteria_result_common_model.py b/data/src/elevenlabs/types/conversation_history_evaluation_criteria_result_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..78f5daff6e0fb724e81aa0e82a50da8cedf46f38 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_evaluation_criteria_result_common_model.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .criteria_scoring_mode import CriteriaScoringMode +from .evaluation_success_result import EvaluationSuccessResult + + +class ConversationHistoryEvaluationCriteriaResultCommonModel(UncheckedBaseModel): + criteria_id: str + result: EvaluationSuccessResult + rationale: str + scoring_mode: typing.Optional[CriteriaScoringMode] = None + score: typing.Optional[int] = None + max_score: typing.Optional[int] = 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/data/src/elevenlabs/types/conversation_history_exotel_phone_call_model.py b/data/src/elevenlabs/types/conversation_history_exotel_phone_call_model.py new file mode 100644 index 0000000000000000000000000000000000000000..03436266099d183a56548a54501bffbf114eb259 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_exotel_phone_call_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .call_result import CallResult +from .telephony_direction import TelephonyDirection + + +class ConversationHistoryExotelPhoneCallModel(UncheckedBaseModel): + direction: TelephonyDirection + phone_number_id: str + agent_number: str + external_number: str + call_result: typing.Optional[CallResult] = None + stream_sid: str + call_sid: 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/data/src/elevenlabs/types/conversation_history_feedback_common_model.py b/data/src/elevenlabs/types/conversation_history_feedback_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4b67808251dda3a4a605646af2c0302cc09fd3da --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_feedback_common_model.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_feedback_type import ConversationFeedbackType +from .user_feedback_score import UserFeedbackScore + + +class ConversationHistoryFeedbackCommonModel(UncheckedBaseModel): + type: typing.Optional[ConversationFeedbackType] = None + overall_score: typing.Optional[UserFeedbackScore] = None + likes: typing.Optional[int] = None + dislikes: typing.Optional[int] = None + rating: typing.Optional[int] = None + comment: 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/data/src/elevenlabs/types/conversation_history_metadata_common_model.py b/data/src/elevenlabs/types/conversation_history_metadata_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a64fc62761da9601e087974bc4fb1e885308cfaa --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_metadata_common_model.py @@ -0,0 +1,72 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_definition_source import AgentDefinitionSource +from .async_conversation_metadata import AsyncConversationMetadata +from .authorization_method import AuthorizationMethod +from .conversation_charging_common_model import ConversationChargingCommonModel +from .conversation_deletion_settings import ConversationDeletionSettings +from .conversation_history_batch_call_model import ConversationHistoryBatchCallModel +from .conversation_history_eleven_assistant_common_model import ConversationHistoryElevenAssistantCommonModel +from .conversation_history_error_common_model import ConversationHistoryErrorCommonModel +from .conversation_history_feedback_common_model import ConversationHistoryFeedbackCommonModel +from .conversation_history_metadata_common_model_phone_call import ConversationHistoryMetadataCommonModelPhoneCall +from .conversation_history_rag_usage_common_model import ConversationHistoryRagUsageCommonModel +from .conversation_initiation_source import ConversationInitiationSource +from .conversation_voice_reward_model import ConversationVoiceRewardModel +from .features_usage_common_model import FeaturesUsageCommonModel +from .sms_conversation_info import SmsConversationInfo +from .whats_app_conversation_info import WhatsAppConversationInfo + + +class ConversationHistoryMetadataCommonModel(UncheckedBaseModel): + start_time_unix_secs: int + accepted_time_unix_secs: typing.Optional[int] = None + call_duration_secs: int + queue_wait_secs: typing.Optional[float] = pydantic.Field(default=None) + """ + Seconds the caller was held in the concurrency wait queue. Excluded from call_duration_secs and from billed time. None when the conversation was never queued. + """ + + cost: typing.Optional[int] = None + deletion_settings: typing.Optional[ConversationDeletionSettings] = None + feedback: typing.Optional[ConversationHistoryFeedbackCommonModel] = None + authorization_method: typing.Optional[AuthorizationMethod] = None + charging: typing.Optional[ConversationChargingCommonModel] = None + phone_call: typing.Optional[ConversationHistoryMetadataCommonModelPhoneCall] = None + batch_call: typing.Optional[ConversationHistoryBatchCallModel] = None + termination_reason: typing.Optional[str] = None + error: typing.Optional[ConversationHistoryErrorCommonModel] = None + warnings: typing.Optional[typing.List[str]] = None + main_language: typing.Optional[str] = None + rag_usage: typing.Optional[ConversationHistoryRagUsageCommonModel] = None + text_only: typing.Optional[bool] = None + features_usage: typing.Optional[FeaturesUsageCommonModel] = None + eleven_assistant: typing.Optional[ConversationHistoryElevenAssistantCommonModel] = None + initiator_id: typing.Optional[str] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + conversation_initiation_source_version: typing.Optional[str] = None + timezone: typing.Optional[str] = None + async_metadata: typing.Optional[AsyncConversationMetadata] = None + whatsapp: typing.Optional[WhatsAppConversationInfo] = None + sms: typing.Optional[SmsConversationInfo] = None + agent_created_from: typing.Optional[AgentDefinitionSource] = None + agent_last_updated_from: typing.Optional[AgentDefinitionSource] = None + voice_rewards: typing.Optional[typing.List[ConversationVoiceRewardModel]] = None + cost_fiat: typing.Optional[float] = pydantic.Field(default=None) + """ + Total fiat cost of the conversation in USD, i.e. the sum of the LLM price and the non-LLM platform price (the fiat analogue of ``cost``). ``None`` when neither is set (e.g. conversations that predate fiat cost tracking). + """ + + 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/data/src/elevenlabs/types/conversation_history_metadata_common_model_phone_call.py b/data/src/elevenlabs/types/conversation_history_metadata_common_model_phone_call.py new file mode 100644 index 0000000000000000000000000000000000000000..a7a3f9b1474531a66bf23c21e3553a0c4df5e510 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_metadata_common_model_phone_call.py @@ -0,0 +1,83 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .call_result import CallResult +from .telephony_direction import TelephonyDirection + + +class ConversationHistoryMetadataCommonModelPhoneCall_Exotel(UncheckedBaseModel): + type: typing.Literal["exotel"] = "exotel" + direction: TelephonyDirection + phone_number_id: str + agent_number: str + external_number: str + call_result: typing.Optional[CallResult] = None + stream_sid: str + call_sid: 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 + + +class ConversationHistoryMetadataCommonModelPhoneCall_SipTrunking(UncheckedBaseModel): + type: typing.Literal["sip_trunking"] = "sip_trunking" + direction: TelephonyDirection + phone_number_id: str + agent_number: str + external_number: str + call_result: typing.Optional[CallResult] = None + call_id: typing.Optional[str] = None + call_sid: str + sip_header_dynamic_variables: typing.Optional[typing.Dict[str, 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 + + +class ConversationHistoryMetadataCommonModelPhoneCall_Twilio(UncheckedBaseModel): + type: typing.Literal["twilio"] = "twilio" + direction: TelephonyDirection + phone_number_id: str + agent_number: str + external_number: str + call_result: typing.Optional[CallResult] = None + stream_sid: str + call_sid: 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 + + +ConversationHistoryMetadataCommonModelPhoneCall = typing_extensions.Annotated[ + typing.Union[ + ConversationHistoryMetadataCommonModelPhoneCall_Exotel, + ConversationHistoryMetadataCommonModelPhoneCall_SipTrunking, + ConversationHistoryMetadataCommonModelPhoneCall_Twilio, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/conversation_history_multivoice_message_model.py b/data/src/elevenlabs/types/conversation_history_multivoice_message_model.py new file mode 100644 index 0000000000000000000000000000000000000000..011ac3bc2f92ee5536f95ae83a55b013b715343b --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_multivoice_message_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_multivoice_message_part_model import ConversationHistoryMultivoiceMessagePartModel + + +class ConversationHistoryMultivoiceMessageModel(UncheckedBaseModel): + """ + Represents a message from a multi-voice agent. + """ + + parts: typing.List[ConversationHistoryMultivoiceMessagePartModel] + + 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/data/src/elevenlabs/types/conversation_history_multivoice_message_part_model.py b/data/src/elevenlabs/types/conversation_history_multivoice_message_part_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5c84b46f3220488a337fea27537a201633edafa6 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_multivoice_message_part_model.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationHistoryMultivoiceMessagePartModel(UncheckedBaseModel): + """ + Represents a single voice part of a multi-voice message. + """ + + text: str + voice_label: typing.Optional[str] = None + time_in_call_secs: typing.Optional[int] = 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/data/src/elevenlabs/types/conversation_history_rag_usage_common_model.py b/data/src/elevenlabs/types/conversation_history_rag_usage_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..34f86ffa698995132064c484c362562409765e3c --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_rag_usage_common_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationHistoryRagUsageCommonModel(UncheckedBaseModel): + usage_count: int + embedding_model: 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/data/src/elevenlabs/types/conversation_history_redaction_config.py b/data/src/elevenlabs/types/conversation_history_redaction_config.py new file mode 100644 index 0000000000000000000000000000000000000000..a944e1b910bbf45a291b0e043a7b43bb620e9113 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_redaction_config.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .config_entity_type import ConfigEntityType + + +class ConversationHistoryRedactionConfig(UncheckedBaseModel): + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether conversation history redaction is enabled + """ + + entities: typing.Optional[typing.List[ConfigEntityType]] = pydantic.Field(default=None) + """ + The entities to redact from the conversation transcript, audio and analysis. Use top-level types like 'name', 'email_address', or dot notation for specific subtypes like 'name.full_name'. + """ + + excluded_data_collection_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Data collection item IDs whose extracted values are not redacted. Their rationales are still redacted. + """ + + 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/data/src/elevenlabs/types/conversation_history_sip_trunking_phone_call_model.py b/data/src/elevenlabs/types/conversation_history_sip_trunking_phone_call_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e0efa77f428983fc94ff23a4a9aaab9e523badb7 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_sip_trunking_phone_call_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .call_result import CallResult +from .telephony_direction import TelephonyDirection + + +class ConversationHistorySipTrunkingPhoneCallModel(UncheckedBaseModel): + direction: TelephonyDirection + phone_number_id: str + agent_number: str + external_number: str + call_result: typing.Optional[CallResult] = None + call_id: typing.Optional[str] = None + call_sid: str + sip_header_dynamic_variables: typing.Optional[typing.Dict[str, 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/data/src/elevenlabs/types/conversation_history_transcript_api_integration_webhook_tools_result_common_model_input.py b/data/src/elevenlabs/types/conversation_history_transcript_api_integration_webhook_tools_result_common_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..f3e4fcb13ab1dedcd5d91928edf80839c9968274 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_api_integration_webhook_tools_result_common_model_input.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_update_common_model import DynamicVariableUpdateCommonModel + + +class ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput(UncheckedBaseModel): + request_id: str + tool_name: str + result_value: str + is_error: bool + is_blocked: typing.Optional[bool] = None + tool_has_been_called: bool + tool_latency_secs: typing.Optional[float] = None + error_type: typing.Optional[str] = None + raw_error_message: typing.Optional[str] = None + dynamic_variable_updates: typing.Optional[typing.List[DynamicVariableUpdateCommonModel]] = None + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + integration_id: typing.Optional[str] = None + credential_id: typing.Optional[str] = None + integration_connection_id: 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/data/src/elevenlabs/types/conversation_history_transcript_api_integration_webhook_tools_result_common_model_output.py b/data/src/elevenlabs/types/conversation_history_transcript_api_integration_webhook_tools_result_common_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..9300d9163a4e8f16fd5ef7ad61e11188a81876a8 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_api_integration_webhook_tools_result_common_model_output.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_update_common_model import DynamicVariableUpdateCommonModel + + +class ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput(UncheckedBaseModel): + request_id: str + tool_name: str + result_value: str + is_error: bool + is_blocked: bool + tool_has_been_called: bool + tool_latency_secs: float + error_type: str + raw_error_message: str + dynamic_variable_updates: typing.List[DynamicVariableUpdateCommonModel] + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + integration_id: str + credential_id: str + integration_connection_id: 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/data/src/elevenlabs/types/conversation_history_transcript_common_model_input.py b/data/src/elevenlabs/types/conversation_history_transcript_common_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..81343350ac3261fc44dde94dbcf170ddf9ceeb22 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_common_model_input.py @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_metadata import AgentMetadata +from .chat_source_medium import ChatSourceMedium +from .conversation_history_multivoice_message_model import ConversationHistoryMultivoiceMessageModel +from .conversation_history_transcript_common_model_input_role import ConversationHistoryTranscriptCommonModelInputRole +from .conversation_history_transcript_common_model_input_tool_results_item import ( + ConversationHistoryTranscriptCommonModelInputToolResultsItem, +) +from .conversation_history_transcript_tool_call_common_model_input import ( + ConversationHistoryTranscriptToolCallCommonModelInput, +) +from .conversation_reasoning_model import ConversationReasoningModel +from .conversation_turn_metrics import ConversationTurnMetrics +from .llm_usage_input import LlmUsageInput +from .rag_retrieval_info import RagRetrievalInfo +from .transcript_platform_event import TranscriptPlatformEvent +from .triggered_guardrail_common_model import TriggeredGuardrailCommonModel +from .user_feedback import UserFeedback + + +class ConversationHistoryTranscriptCommonModelInput(UncheckedBaseModel): + role: ConversationHistoryTranscriptCommonModelInputRole + agent_metadata: typing.Optional[AgentMetadata] = None + message: typing.Optional[str] = None + multivoice_message: typing.Optional[ConversationHistoryMultivoiceMessageModel] = None + tool_calls: typing.Optional[typing.List[ConversationHistoryTranscriptToolCallCommonModelInput]] = None + tool_results: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInputToolResultsItem]] = None + feedback: typing.Optional[UserFeedback] = None + llm_override: typing.Optional[str] = None + producing_llm: typing.Optional[str] = None + time_in_call_secs: int + conversation_turn_metrics: typing.Optional[ConversationTurnMetrics] = None + rag_retrieval_info: typing.Optional[RagRetrievalInfo] = None + llm_usage: typing.Optional[LlmUsageInput] = None + interrupted: typing.Optional[bool] = None + ignored_as_backchannel: typing.Optional[bool] = None + platform_event: typing.Optional[TranscriptPlatformEvent] = None + original_message: typing.Optional[str] = None + reasoning: typing.Optional[typing.List[ConversationReasoningModel]] = None + source_medium: typing.Optional[ChatSourceMedium] = None + source_event_id: typing.Optional[int] = None + used_static_kb_document_ids: typing.Optional[typing.List[str]] = None + user_identifier: typing.Optional[str] = None + id: typing.Optional[str] = None + triggered_guardrails: typing.Optional[typing.List[TriggeredGuardrailCommonModel]] = 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 + + +update_forward_refs(ConversationHistoryTranscriptCommonModelInput) diff --git a/data/src/elevenlabs/types/conversation_history_transcript_common_model_input_role.py b/data/src/elevenlabs/types/conversation_history_transcript_common_model_input_role.py new file mode 100644 index 0000000000000000000000000000000000000000..0ced1587eb4953609a9958a845dcd1b432df8470 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_common_model_input_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationHistoryTranscriptCommonModelInputRole = typing.Union[typing.Literal["user", "agent"], typing.Any] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_common_model_input_tool_results_item.py b/data/src/elevenlabs/types/conversation_history_transcript_common_model_input_tool_results_item.py new file mode 100644 index 0000000000000000000000000000000000000000..048cd2673a9fb11720e94ba471925341db247cad --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_common_model_input_tool_results_item.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conversation_history_transcript_api_integration_webhook_tools_result_common_model_input import ( + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput, +) +from .conversation_history_transcript_other_tools_result_common_model import ( + ConversationHistoryTranscriptOtherToolsResultCommonModel, +) +from .conversation_history_transcript_system_tool_result_common_model_input import ( + ConversationHistoryTranscriptSystemToolResultCommonModelInput, +) +from .conversation_history_transcript_workflow_tools_result_common_model_input import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, +) + +ConversationHistoryTranscriptCommonModelInputToolResultsItem = typing.Union[ + ConversationHistoryTranscriptOtherToolsResultCommonModel, + ConversationHistoryTranscriptSystemToolResultCommonModelInput, + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, +] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_common_model_output.py b/data/src/elevenlabs/types/conversation_history_transcript_common_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..df6334d2d8ef8eb824927fcfb3c5ffbb43a94e23 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_common_model_output.py @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_metadata import AgentMetadata +from .chat_source_medium import ChatSourceMedium +from .conversation_history_multivoice_message_model import ConversationHistoryMultivoiceMessageModel +from .conversation_history_transcript_common_model_output_role import ConversationHistoryTranscriptCommonModelOutputRole +from .conversation_history_transcript_common_model_output_tool_results_item import ( + ConversationHistoryTranscriptCommonModelOutputToolResultsItem, +) +from .conversation_history_transcript_tool_call_common_model_output import ( + ConversationHistoryTranscriptToolCallCommonModelOutput, +) +from .conversation_reasoning_model import ConversationReasoningModel +from .conversation_turn_metrics import ConversationTurnMetrics +from .llm_usage_output import LlmUsageOutput +from .rag_retrieval_info import RagRetrievalInfo +from .transcript_platform_event import TranscriptPlatformEvent +from .triggered_guardrail_common_model import TriggeredGuardrailCommonModel +from .user_feedback import UserFeedback + + +class ConversationHistoryTranscriptCommonModelOutput(UncheckedBaseModel): + role: ConversationHistoryTranscriptCommonModelOutputRole + agent_metadata: typing.Optional[AgentMetadata] = None + message: typing.Optional[str] = None + multivoice_message: typing.Optional[ConversationHistoryMultivoiceMessageModel] = None + tool_calls: typing.Optional[typing.List[ConversationHistoryTranscriptToolCallCommonModelOutput]] = None + tool_results: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutputToolResultsItem]] = None + feedback: typing.Optional[UserFeedback] = None + llm_override: typing.Optional[str] = None + producing_llm: typing.Optional[str] = None + time_in_call_secs: int + conversation_turn_metrics: typing.Optional[ConversationTurnMetrics] = None + rag_retrieval_info: typing.Optional[RagRetrievalInfo] = None + llm_usage: typing.Optional[LlmUsageOutput] = None + interrupted: typing.Optional[bool] = None + ignored_as_backchannel: typing.Optional[bool] = None + platform_event: typing.Optional[TranscriptPlatformEvent] = None + original_message: typing.Optional[str] = None + reasoning: typing.Optional[typing.List[ConversationReasoningModel]] = None + source_medium: typing.Optional[ChatSourceMedium] = None + source_event_id: typing.Optional[int] = None + used_static_kb_document_ids: typing.Optional[typing.List[str]] = None + user_identifier: typing.Optional[str] = None + id: typing.Optional[str] = None + triggered_guardrails: typing.Optional[typing.List[TriggeredGuardrailCommonModel]] = 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 + + +update_forward_refs(ConversationHistoryTranscriptCommonModelOutput) diff --git a/data/src/elevenlabs/types/conversation_history_transcript_common_model_output_role.py b/data/src/elevenlabs/types/conversation_history_transcript_common_model_output_role.py new file mode 100644 index 0000000000000000000000000000000000000000..2ee8fce30df8a83a143143d5d2eb4ada2d9521a5 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_common_model_output_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationHistoryTranscriptCommonModelOutputRole = typing.Union[typing.Literal["user", "agent"], typing.Any] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_common_model_output_tool_results_item.py b/data/src/elevenlabs/types/conversation_history_transcript_common_model_output_tool_results_item.py new file mode 100644 index 0000000000000000000000000000000000000000..7dd1a6c4d47595b4a5dbfde8e40a77067234dbf8 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_common_model_output_tool_results_item.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conversation_history_transcript_api_integration_webhook_tools_result_common_model_output import ( + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput, +) +from .conversation_history_transcript_other_tools_result_common_model import ( + ConversationHistoryTranscriptOtherToolsResultCommonModel, +) +from .conversation_history_transcript_system_tool_result_common_model_output import ( + ConversationHistoryTranscriptSystemToolResultCommonModelOutput, +) +from .conversation_history_transcript_workflow_tools_result_common_model_output import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, +) + +ConversationHistoryTranscriptCommonModelOutputToolResultsItem = typing.Union[ + ConversationHistoryTranscriptOtherToolsResultCommonModel, + ConversationHistoryTranscriptSystemToolResultCommonModelOutput, + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, +] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_file_input_response_model.py b/data/src/elevenlabs/types/conversation_history_transcript_file_input_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a396b363a5ce30200b149b8d9553ad312f33e4e4 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_file_input_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationHistoryTranscriptFileInputResponseModel(UncheckedBaseModel): + file_id: str + original_filename: str + mime_type: str + file_url: 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/data/src/elevenlabs/types/conversation_history_transcript_other_tools_result_common_model.py b/data/src/elevenlabs/types/conversation_history_transcript_other_tools_result_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..399a13479663d8bbf2517465f7c3756ebd1f9b24 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_other_tools_result_common_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_other_tools_result_common_model_type import ( + ConversationHistoryTranscriptOtherToolsResultCommonModelType, +) +from .dynamic_variable_update_common_model import DynamicVariableUpdateCommonModel + + +class ConversationHistoryTranscriptOtherToolsResultCommonModel(UncheckedBaseModel): + request_id: str + tool_name: str + result_value: str + is_error: bool + is_blocked: typing.Optional[bool] = None + tool_has_been_called: bool + tool_latency_secs: typing.Optional[float] = None + error_type: typing.Optional[str] = None + raw_error_message: typing.Optional[str] = None + dynamic_variable_updates: typing.Optional[typing.List[DynamicVariableUpdateCommonModel]] = None + type: typing.Optional[ConversationHistoryTranscriptOtherToolsResultCommonModelType] = 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/data/src/elevenlabs/types/conversation_history_transcript_other_tools_result_common_model_type.py b/data/src/elevenlabs/types/conversation_history_transcript_other_tools_result_common_model_type.py new file mode 100644 index 0000000000000000000000000000000000000000..8b8a00d61eb1b12778e190a83ad8b7308d3093ca --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_other_tools_result_common_model_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationHistoryTranscriptOtherToolsResultCommonModelType = typing.Union[ + typing.Literal["client", "webhook", "mcp", "code"], typing.Any +] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_response_model.py b/data/src/elevenlabs/types/conversation_history_transcript_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..fb3519c3ee831259e7212f539ac85097ad88447a --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_response_model.py @@ -0,0 +1,83 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_metadata import AgentMetadata +from .chat_source_medium import ChatSourceMedium +from .contextual_update_info import ContextualUpdateInfo +from .conversation_history_multivoice_message_model import ConversationHistoryMultivoiceMessageModel +from .conversation_history_transcript_file_input_response_model import ( + ConversationHistoryTranscriptFileInputResponseModel, +) +from .conversation_history_transcript_response_model_role import ConversationHistoryTranscriptResponseModelRole +from .conversation_history_transcript_response_model_tool_results_item import ( + ConversationHistoryTranscriptResponseModelToolResultsItem, +) +from .conversation_history_transcript_tool_call_common_model_output import ( + ConversationHistoryTranscriptToolCallCommonModelOutput, +) +from .conversation_reasoning_model import ConversationReasoningModel +from .conversation_turn_metrics import ConversationTurnMetrics +from .llm_usage_output import LlmUsageOutput +from .rag_retrieval_info import RagRetrievalInfo +from .transcript_platform_event import TranscriptPlatformEvent +from .triggered_guardrail_common_model import TriggeredGuardrailCommonModel +from .user_feedback import UserFeedback + + +class ConversationHistoryTranscriptResponseModel(UncheckedBaseModel): + role: ConversationHistoryTranscriptResponseModelRole + agent_metadata: typing.Optional[AgentMetadata] = None + message: typing.Optional[str] = None + multivoice_message: typing.Optional[ConversationHistoryMultivoiceMessageModel] = None + tool_calls: typing.Optional[typing.List[ConversationHistoryTranscriptToolCallCommonModelOutput]] = None + tool_results: typing.Optional[typing.List[ConversationHistoryTranscriptResponseModelToolResultsItem]] = None + feedback: typing.Optional[UserFeedback] = None + llm_override: typing.Optional[str] = None + producing_llm: typing.Optional[str] = None + time_in_call_secs: int + conversation_turn_metrics: typing.Optional[ConversationTurnMetrics] = None + rag_retrieval_info: typing.Optional[RagRetrievalInfo] = None + llm_usage: typing.Optional[LlmUsageOutput] = None + interrupted: typing.Optional[bool] = None + ignored_as_backchannel: typing.Optional[bool] = None + platform_event: typing.Optional[TranscriptPlatformEvent] = None + original_message: typing.Optional[str] = None + reasoning: typing.Optional[typing.List[ConversationReasoningModel]] = None + source_medium: typing.Optional[ChatSourceMedium] = None + source_event_id: typing.Optional[int] = None + used_static_kb_document_ids: typing.Optional[typing.List[str]] = None + user_identifier: typing.Optional[str] = None + id: typing.Optional[str] = None + triggered_guardrails: typing.Optional[typing.List[TriggeredGuardrailCommonModel]] = None + file_input: typing.Optional[ConversationHistoryTranscriptFileInputResponseModel] = pydantic.Field(default=None) + """ + Deprecated: the first attachment on this turn. Use `file_inputs` to see every attachment. + """ + + file_inputs: typing.Optional[typing.List[ConversationHistoryTranscriptFileInputResponseModel]] = pydantic.Field( + default=None + ) + """ + All files attached to this turn, in the order the user attached them. + """ + + contextual_update_info: typing.Optional[ContextualUpdateInfo] = None + reasoned: 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 + + +update_forward_refs(ConversationHistoryTranscriptResponseModel) diff --git a/data/src/elevenlabs/types/conversation_history_transcript_response_model_role.py b/data/src/elevenlabs/types/conversation_history_transcript_response_model_role.py new file mode 100644 index 0000000000000000000000000000000000000000..8787d329b6afb820b3412f7bcedbad1eff3f3a13 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_response_model_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationHistoryTranscriptResponseModelRole = typing.Union[typing.Literal["user", "agent"], typing.Any] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_response_model_tool_results_item.py b/data/src/elevenlabs/types/conversation_history_transcript_response_model_tool_results_item.py new file mode 100644 index 0000000000000000000000000000000000000000..50403be319d4e31b51bba44eae79c6b460cf71ec --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_response_model_tool_results_item.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conversation_history_transcript_api_integration_webhook_tools_result_common_model_output import ( + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput, +) +from .conversation_history_transcript_other_tools_result_common_model import ( + ConversationHistoryTranscriptOtherToolsResultCommonModel, +) +from .conversation_history_transcript_system_tool_result_common_model_output import ( + ConversationHistoryTranscriptSystemToolResultCommonModelOutput, +) +from .conversation_history_transcript_workflow_tools_result_common_model_output import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, +) + +ConversationHistoryTranscriptResponseModelToolResultsItem = typing.Union[ + ConversationHistoryTranscriptOtherToolsResultCommonModel, + ConversationHistoryTranscriptSystemToolResultCommonModelOutput, + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, +] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_input.py b/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..1cf2d461b98e8ee89f9d75874e2250e874dda840 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_input.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_system_tool_result_common_model_input_result import ( + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult, +) +from .dynamic_variable_update_common_model import DynamicVariableUpdateCommonModel + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInput(UncheckedBaseModel): + request_id: str + tool_name: str + result_value: str + is_error: bool + is_blocked: typing.Optional[bool] = None + tool_has_been_called: bool + tool_latency_secs: typing.Optional[float] = None + error_type: typing.Optional[str] = None + raw_error_message: typing.Optional[str] = None + dynamic_variable_updates: typing.Optional[typing.List[DynamicVariableUpdateCommonModel]] = None + type: typing.Literal["system"] = "system" + result: typing.Optional[ConversationHistoryTranscriptSystemToolResultCommonModelInputResult] = 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/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_input_result.py b/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_input_result.py new file mode 100644 index 0000000000000000000000000000000000000000..42fb94a399d4be7104c5ab0512a6013dd2437fc6 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_input_result.py @@ -0,0 +1,411 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .end_procedure_tool_error_status import EndProcedureToolErrorStatus +from .knowledge_base_rag_chunk_model import KnowledgeBaseRagChunkModel +from .knowledge_base_rag_tool_status import KnowledgeBaseRagToolStatus +from .knowledge_base_tool_status import KnowledgeBaseToolStatus +from .start_procedure_tool_error_status import StartProcedureToolErrorStatus +from .transfer_to_agent_tool_result_success_model_input_branch_info import ( + TransferToAgentToolResultSuccessModelInputBranchInfo, +) + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_Dummy(UncheckedBaseModel): + result_type: typing.Literal["dummy"] = "dummy" + + 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndCallSuccess(UncheckedBaseModel): + result_type: typing.Literal["end_call_success"] = "end_call_success" + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureError(UncheckedBaseModel): + result_type: typing.Literal["end_procedure_error"] = "end_procedure_error" + status: EndProcedureToolErrorStatus + procedure_id: typing.Optional[str] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureSuccess(UncheckedBaseModel): + result_type: typing.Literal["end_procedure_success"] = "end_procedure_success" + status: typing.Optional[typing.Literal["success"]] = None + procedure_id: str + procedure_name: str + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseRagSuccess(UncheckedBaseModel): + result_type: typing.Literal["knowledge_base_rag_success"] = "knowledge_base_rag_success" + status: typing.Optional[KnowledgeBaseRagToolStatus] = None + chunk_count: typing.Optional[int] = None + message: typing.Optional[str] = None + chunks: typing.Optional[typing.List[KnowledgeBaseRagChunkModel]] = 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseSuccess(UncheckedBaseModel): + result_type: typing.Literal["knowledge_base_success"] = "knowledge_base_success" + status: typing.Optional[KnowledgeBaseToolStatus] = None + chunk_count: typing.Optional[int] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_LanguageDetectionSuccess(UncheckedBaseModel): + result_type: typing.Literal["language_detection_success"] = "language_detection_success" + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + language: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfError(UncheckedBaseModel): + result_type: typing.Literal["play_dtmf_error"] = "play_dtmf_error" + status: typing.Optional[typing.Literal["error"]] = None + error: str + details: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfSuccess(UncheckedBaseModel): + result_type: typing.Literal["play_dtmf_success"] = "play_dtmf_success" + status: typing.Optional[typing.Literal["success"]] = None + dtmf_tones: str + reason: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_SkipTurnSuccess(UncheckedBaseModel): + result_type: typing.Literal["skip_turn_success"] = "skip_turn_success" + status: typing.Optional[typing.Literal["success"]] = None + reason: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureError(UncheckedBaseModel): + result_type: typing.Literal["start_procedure_error"] = "start_procedure_error" + status: StartProcedureToolErrorStatus + procedure_id: typing.Optional[str] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureSuccess(UncheckedBaseModel): + result_type: typing.Literal["start_procedure_success"] = "start_procedure_success" + status: typing.Optional[typing.Literal["success"]] = None + procedure_id: str + procedure_name: str + procedure_entry_workflow_node: typing.Optional[str] = None + procedure_return_workflow_node: typing.Optional[str] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TestingToolResult(UncheckedBaseModel): + result_type: typing.Literal["testing_tool_result"] = "testing_tool_result" + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + to_agent: typing.Optional[str] = None + to_node: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentError(UncheckedBaseModel): + result_type: typing.Literal["transfer_to_agent_error"] = "transfer_to_agent_error" + status: typing.Optional[typing.Literal["error"]] = None + from_agent: str + error: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentSuccess(UncheckedBaseModel): + result_type: typing.Literal["transfer_to_agent_success"] = "transfer_to_agent_success" + status: typing.Optional[typing.Literal["success"]] = None + from_agent: str + to_agent: str + to_node: typing.Optional[str] = None + condition: str + delay_ms: typing.Optional[int] = None + transfer_message: typing.Optional[str] = None + enable_transferred_agent_first_message: typing.Optional[bool] = None + branch_info: typing.Optional[TransferToAgentToolResultSuccessModelInputBranchInfo] = None + preserve_client_tts_overrides: typing.Optional[bool] = None + preserve_voice_settings: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberAmazonConnectSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["transfer_to_number_amazon_connect_success"] = ( + "transfer_to_number_amazon_connect_success" + ) + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + client_message: typing.Optional[str] = None + note: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberError(UncheckedBaseModel): + result_type: typing.Literal["transfer_to_number_error"] = "transfer_to_number_error" + status: typing.Optional[typing.Literal["error"]] = None + error: str + details: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberExotelSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["transfer_to_number_exotel_success"] = "transfer_to_number_exotel_success" + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + agent_message: typing.Optional[str] = None + note: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberSipSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["transfer_to_number_sip_success"] = "transfer_to_number_sip_success" + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + note: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberTwilioSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["transfer_to_number_twilio_success"] = "transfer_to_number_twilio_success" + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + client_message: typing.Optional[str] = None + agent_message: str + conference_name: str + post_dial_digits: typing.Optional[str] = None + note: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_VoicemailDetectionSuccess(UncheckedBaseModel): + result_type: typing.Literal["voicemail_detection_success"] = "voicemail_detection_success" + status: typing.Optional[typing.Literal["success"]] = None + voicemail_message: typing.Optional[str] = None + reason: 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 + + +ConversationHistoryTranscriptSystemToolResultCommonModelInputResult = typing_extensions.Annotated[ + typing.Union[ + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_Dummy, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndCallSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_EndProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseRagSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_KnowledgeBaseSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_LanguageDetectionSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_PlayDtmfSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_SkipTurnSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_StartProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TestingToolResult, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToAgentSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberAmazonConnectSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberError, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberExotelSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberSipSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_TransferToNumberTwilioSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelInputResult_VoicemailDetectionSuccess, + ], + UnionMetadata(discriminant="result_type"), +] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_output.py b/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..fb2bcc64e700975414b6d8f55572e22946604624 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_output.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_system_tool_result_common_model_output_result import ( + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult, +) +from .dynamic_variable_update_common_model import DynamicVariableUpdateCommonModel + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutput(UncheckedBaseModel): + request_id: str + tool_name: str + result_value: str + is_error: bool + is_blocked: typing.Optional[bool] = None + tool_has_been_called: bool + tool_latency_secs: typing.Optional[float] = None + error_type: typing.Optional[str] = None + raw_error_message: typing.Optional[str] = None + dynamic_variable_updates: typing.Optional[typing.List[DynamicVariableUpdateCommonModel]] = None + type: typing.Literal["system"] = "system" + result: typing.Optional[ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult] = 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/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_output_result.py b/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_output_result.py new file mode 100644 index 0000000000000000000000000000000000000000..0d4770064bb62c9cf73693d7e737e2eb917d437c --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_system_tool_result_common_model_output_result.py @@ -0,0 +1,413 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .end_procedure_tool_error_status import EndProcedureToolErrorStatus +from .knowledge_base_rag_chunk_model import KnowledgeBaseRagChunkModel +from .knowledge_base_rag_tool_status import KnowledgeBaseRagToolStatus +from .knowledge_base_tool_status import KnowledgeBaseToolStatus +from .start_procedure_tool_error_status import StartProcedureToolErrorStatus +from .transfer_to_agent_tool_result_success_model_output_branch_info import ( + TransferToAgentToolResultSuccessModelOutputBranchInfo, +) + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_Dummy(UncheckedBaseModel): + result_type: typing.Literal["dummy"] = "dummy" + + 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndCallSuccess(UncheckedBaseModel): + result_type: typing.Literal["end_call_success"] = "end_call_success" + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureError(UncheckedBaseModel): + result_type: typing.Literal["end_procedure_error"] = "end_procedure_error" + status: EndProcedureToolErrorStatus + procedure_id: typing.Optional[str] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureSuccess(UncheckedBaseModel): + result_type: typing.Literal["end_procedure_success"] = "end_procedure_success" + status: typing.Optional[typing.Literal["success"]] = None + procedure_id: str + procedure_name: str + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseRagSuccess(UncheckedBaseModel): + result_type: typing.Literal["knowledge_base_rag_success"] = "knowledge_base_rag_success" + status: typing.Optional[KnowledgeBaseRagToolStatus] = None + chunk_count: typing.Optional[int] = None + message: typing.Optional[str] = None + chunks: typing.Optional[typing.List[KnowledgeBaseRagChunkModel]] = 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseSuccess(UncheckedBaseModel): + result_type: typing.Literal["knowledge_base_success"] = "knowledge_base_success" + status: typing.Optional[KnowledgeBaseToolStatus] = None + chunk_count: typing.Optional[int] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_LanguageDetectionSuccess(UncheckedBaseModel): + result_type: typing.Literal["language_detection_success"] = "language_detection_success" + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + language: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfError(UncheckedBaseModel): + result_type: typing.Literal["play_dtmf_error"] = "play_dtmf_error" + status: typing.Optional[typing.Literal["error"]] = None + error: str + details: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfSuccess(UncheckedBaseModel): + result_type: typing.Literal["play_dtmf_success"] = "play_dtmf_success" + status: typing.Optional[typing.Literal["success"]] = None + dtmf_tones: str + reason: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_SkipTurnSuccess(UncheckedBaseModel): + result_type: typing.Literal["skip_turn_success"] = "skip_turn_success" + status: typing.Optional[typing.Literal["success"]] = None + reason: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureError(UncheckedBaseModel): + result_type: typing.Literal["start_procedure_error"] = "start_procedure_error" + status: StartProcedureToolErrorStatus + procedure_id: typing.Optional[str] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureSuccess(UncheckedBaseModel): + result_type: typing.Literal["start_procedure_success"] = "start_procedure_success" + status: typing.Optional[typing.Literal["success"]] = None + procedure_id: str + procedure_name: str + procedure_entry_workflow_node: typing.Optional[str] = None + procedure_return_workflow_node: typing.Optional[str] = None + message: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TestingToolResult(UncheckedBaseModel): + result_type: typing.Literal["testing_tool_result"] = "testing_tool_result" + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + to_agent: typing.Optional[str] = None + to_node: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentError(UncheckedBaseModel): + result_type: typing.Literal["transfer_to_agent_error"] = "transfer_to_agent_error" + status: typing.Optional[typing.Literal["error"]] = None + from_agent: str + error: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentSuccess(UncheckedBaseModel): + result_type: typing.Literal["transfer_to_agent_success"] = "transfer_to_agent_success" + status: typing.Optional[typing.Literal["success"]] = None + from_agent: str + to_agent: str + to_node: typing.Optional[str] = None + condition: str + delay_ms: typing.Optional[int] = None + transfer_message: typing.Optional[str] = None + enable_transferred_agent_first_message: typing.Optional[bool] = None + branch_info: typing.Optional[TransferToAgentToolResultSuccessModelOutputBranchInfo] = None + preserve_client_tts_overrides: typing.Optional[bool] = None + preserve_voice_settings: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberAmazonConnectSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["transfer_to_number_amazon_connect_success"] = ( + "transfer_to_number_amazon_connect_success" + ) + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + client_message: typing.Optional[str] = None + note: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberError(UncheckedBaseModel): + result_type: typing.Literal["transfer_to_number_error"] = "transfer_to_number_error" + status: typing.Optional[typing.Literal["error"]] = None + error: str + details: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberExotelSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["transfer_to_number_exotel_success"] = "transfer_to_number_exotel_success" + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + agent_message: typing.Optional[str] = None + note: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberSipSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["transfer_to_number_sip_success"] = "transfer_to_number_sip_success" + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + note: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberTwilioSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["transfer_to_number_twilio_success"] = "transfer_to_number_twilio_success" + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + client_message: typing.Optional[str] = None + agent_message: str + conference_name: str + post_dial_digits: typing.Optional[str] = None + note: 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 + + +class ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_VoicemailDetectionSuccess( + UncheckedBaseModel +): + result_type: typing.Literal["voicemail_detection_success"] = "voicemail_detection_success" + status: typing.Optional[typing.Literal["success"]] = None + voicemail_message: typing.Optional[str] = None + reason: 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 + + +ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult = typing_extensions.Annotated[ + typing.Union[ + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_Dummy, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndCallSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_EndProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseRagSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_KnowledgeBaseSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_LanguageDetectionSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_PlayDtmfSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_SkipTurnSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_StartProcedureSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TestingToolResult, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToAgentSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberAmazonConnectSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberError, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberExotelSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberSipSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_TransferToNumberTwilioSuccess, + ConversationHistoryTranscriptSystemToolResultCommonModelOutputResult_VoicemailDetectionSuccess, + ], + UnionMetadata(discriminant="result_type"), +] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_tool_call_api_integration_webhook_details_input.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_api_integration_webhook_details_input.py new file mode 100644 index 0000000000000000000000000000000000000000..b4028c7ef83815ab4c38f43024c352980857b480 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_api_integration_webhook_details_input.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_tool_call_webhook_details import ( + ConversationHistoryTranscriptToolCallWebhookDetails, +) + + +class ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsInput(UncheckedBaseModel): + integration_id: typing.Optional[str] = None + credential_id: typing.Optional[str] = None + integration_connection_id: typing.Optional[str] = None + webhook_details: ConversationHistoryTranscriptToolCallWebhookDetails + + 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/data/src/elevenlabs/types/conversation_history_transcript_tool_call_api_integration_webhook_details_output.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_api_integration_webhook_details_output.py new file mode 100644 index 0000000000000000000000000000000000000000..e6441872b91a291a1ffa3f4b6dedc28fbf45960c --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_api_integration_webhook_details_output.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_tool_call_webhook_details import ( + ConversationHistoryTranscriptToolCallWebhookDetails, +) + + +class ConversationHistoryTranscriptToolCallApiIntegrationWebhookDetailsOutput(UncheckedBaseModel): + integration_id: str + credential_id: str + integration_connection_id: str + webhook_details: ConversationHistoryTranscriptToolCallWebhookDetails + + 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/data/src/elevenlabs/types/conversation_history_transcript_tool_call_client_details.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_client_details.py new file mode 100644 index 0000000000000000000000000000000000000000..ee73d1058fbfa1162f8ec23b6e2f57de3f42344d --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_client_details.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationHistoryTranscriptToolCallClientDetails(UncheckedBaseModel): + parameters: 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/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_input.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..34f87ac0de4c9263508b013a128f40267daf1a03 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_input.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_tool_call_common_model_input_tool_details import ( + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails, +) +from .tool_type import ToolType + + +class ConversationHistoryTranscriptToolCallCommonModelInput(UncheckedBaseModel): + type: typing.Optional[ToolType] = None + request_id: str + tool_name: str + tool_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the called tool. Not set for tools without an ID, such as system tools. + """ + + params_as_json: str + tool_has_been_called: bool + tool_details: typing.Optional[ConversationHistoryTranscriptToolCallCommonModelInputToolDetails] = 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/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_input_tool_details.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_input_tool_details.py new file mode 100644 index 0000000000000000000000000000000000000000..3f72b696a5a2ef6d991ea3afaaaa6a475444609b --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_input_tool_details.py @@ -0,0 +1,95 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .conversation_history_transcript_tool_call_webhook_details import ( + ConversationHistoryTranscriptToolCallWebhookDetails, +) + + +class ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_ApiIntegrationWebhook(UncheckedBaseModel): + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + integration_id: typing.Optional[str] = None + credential_id: typing.Optional[str] = None + integration_connection_id: typing.Optional[str] = None + webhook_details: ConversationHistoryTranscriptToolCallWebhookDetails + + 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 + + +class ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Client(UncheckedBaseModel): + type: typing.Literal["client"] = "client" + parameters: 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 + + +class ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Mcp(UncheckedBaseModel): + type: typing.Literal["mcp"] = "mcp" + mcp_server_id: str + mcp_server_name: str + integration_type: str + parameters: typing.Optional[typing.Dict[str, str]] = None + approval_policy: str + requires_approval: typing.Optional[bool] = None + mcp_tool_name: typing.Optional[str] = None + mcp_tool_description: 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 + + +class ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Webhook(UncheckedBaseModel): + type: typing.Literal["webhook"] = "webhook" + method: str + url: str + headers: typing.Optional[typing.Dict[str, str]] = None + path_params: typing.Optional[typing.Dict[str, str]] = None + query_params: typing.Optional[typing.Dict[str, str]] = None + body: 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 + + +ConversationHistoryTranscriptToolCallCommonModelInputToolDetails = typing_extensions.Annotated[ + typing.Union[ + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_ApiIntegrationWebhook, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Client, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Mcp, + ConversationHistoryTranscriptToolCallCommonModelInputToolDetails_Webhook, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_output.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..e1aac026b98c70dd0f35b9e53c5f2d56dd1123f3 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_output.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_tool_call_common_model_output_tool_details import ( + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails, +) +from .tool_type import ToolType + + +class ConversationHistoryTranscriptToolCallCommonModelOutput(UncheckedBaseModel): + type: typing.Optional[ToolType] = None + request_id: str + tool_name: str + tool_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the called tool. Not set for tools without an ID, such as system tools. + """ + + params_as_json: str + tool_has_been_called: bool + tool_details: typing.Optional[ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails] = 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/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_output_tool_details.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_output_tool_details.py new file mode 100644 index 0000000000000000000000000000000000000000..4778abb8dcbe869ba2ea261450fe57c1b7b3dba1 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_common_model_output_tool_details.py @@ -0,0 +1,95 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .conversation_history_transcript_tool_call_webhook_details import ( + ConversationHistoryTranscriptToolCallWebhookDetails, +) + + +class ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_ApiIntegrationWebhook(UncheckedBaseModel): + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + integration_id: str + credential_id: str + integration_connection_id: str + webhook_details: ConversationHistoryTranscriptToolCallWebhookDetails + + 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 + + +class ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Client(UncheckedBaseModel): + type: typing.Literal["client"] = "client" + parameters: 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 + + +class ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Mcp(UncheckedBaseModel): + type: typing.Literal["mcp"] = "mcp" + mcp_server_id: str + mcp_server_name: str + integration_type: str + parameters: typing.Optional[typing.Dict[str, str]] = None + approval_policy: str + requires_approval: typing.Optional[bool] = None + mcp_tool_name: typing.Optional[str] = None + mcp_tool_description: 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 + + +class ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Webhook(UncheckedBaseModel): + type: typing.Literal["webhook"] = "webhook" + method: str + url: str + headers: typing.Optional[typing.Dict[str, str]] = None + path_params: typing.Optional[typing.Dict[str, str]] = None + query_params: typing.Optional[typing.Dict[str, str]] = None + body: 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 + + +ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails = typing_extensions.Annotated[ + typing.Union[ + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_ApiIntegrationWebhook, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Client, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Mcp, + ConversationHistoryTranscriptToolCallCommonModelOutputToolDetails_Webhook, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/conversation_history_transcript_tool_call_mcp_details.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_mcp_details.py new file mode 100644 index 0000000000000000000000000000000000000000..ed898ae10eb7251c4891728c64a56cf8a07cc41f --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_mcp_details.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationHistoryTranscriptToolCallMcpDetails(UncheckedBaseModel): + mcp_server_id: str + mcp_server_name: str + integration_type: str + parameters: typing.Optional[typing.Dict[str, str]] = None + approval_policy: str + requires_approval: typing.Optional[bool] = None + mcp_tool_name: typing.Optional[str] = None + mcp_tool_description: 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/data/src/elevenlabs/types/conversation_history_transcript_tool_call_webhook_details.py b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_webhook_details.py new file mode 100644 index 0000000000000000000000000000000000000000..a363b775da24346ee2a885138d147860139fc959 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_tool_call_webhook_details.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationHistoryTranscriptToolCallWebhookDetails(UncheckedBaseModel): + type: typing.Optional[typing.Literal["webhook"]] = None + method: str + url: str + headers: typing.Optional[typing.Dict[str, str]] = None + path_params: typing.Optional[typing.Dict[str, str]] = None + query_params: typing.Optional[typing.Dict[str, str]] = None + body: 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/data/src/elevenlabs/types/conversation_history_transcript_workflow_tools_result_common_model_input.py b/data/src/elevenlabs/types/conversation_history_transcript_workflow_tools_result_common_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..b4b09194321e80507d7ad7f1087bdd05747a1a6b --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_workflow_tools_result_common_model_input.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_update_common_model import DynamicVariableUpdateCommonModel + + +class ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput(UncheckedBaseModel): + request_id: str + tool_name: str + result_value: str + is_error: bool + is_blocked: typing.Optional[bool] = None + tool_has_been_called: bool + tool_latency_secs: typing.Optional[float] = None + error_type: typing.Optional[str] = None + raw_error_message: typing.Optional[str] = None + dynamic_variable_updates: typing.Optional[typing.List[DynamicVariableUpdateCommonModel]] = None + type: typing.Literal["workflow"] = "workflow" + result: typing.Optional["WorkflowToolResponseModelInput"] = 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 + + +from .workflow_tool_nested_tools_step_model_input import WorkflowToolNestedToolsStepModelInput # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_input_results_item import WorkflowToolNestedToolsStepModelInputResultsItem # noqa: E402, I001 +from .workflow_tool_response_model_input import WorkflowToolResponseModelInput # noqa: E402, I001 +from .workflow_tool_response_model_input_steps_item import WorkflowToolResponseModelInputStepsItem # noqa: E402, I001 + +update_forward_refs( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, + WorkflowToolNestedToolsStepModelInput=WorkflowToolNestedToolsStepModelInput, + WorkflowToolNestedToolsStepModelInputResultsItem=WorkflowToolNestedToolsStepModelInputResultsItem, + WorkflowToolResponseModelInput=WorkflowToolResponseModelInput, + WorkflowToolResponseModelInputStepsItem=WorkflowToolResponseModelInputStepsItem, +) diff --git a/data/src/elevenlabs/types/conversation_history_transcript_workflow_tools_result_common_model_output.py b/data/src/elevenlabs/types/conversation_history_transcript_workflow_tools_result_common_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..3503257a3437888e276b8a6e65b649817eec6de2 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_transcript_workflow_tools_result_common_model_output.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_update_common_model import DynamicVariableUpdateCommonModel + + +class ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput(UncheckedBaseModel): + request_id: str + tool_name: str + result_value: str + is_error: bool + is_blocked: typing.Optional[bool] = None + tool_has_been_called: bool + tool_latency_secs: typing.Optional[float] = None + error_type: typing.Optional[str] = None + raw_error_message: typing.Optional[str] = None + dynamic_variable_updates: typing.Optional[typing.List[DynamicVariableUpdateCommonModel]] = None + type: typing.Literal["workflow"] = "workflow" + result: typing.Optional["WorkflowToolResponseModelOutput"] = 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 + + +from .workflow_tool_nested_tools_step_model_output import WorkflowToolNestedToolsStepModelOutput # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_output_results_item import WorkflowToolNestedToolsStepModelOutputResultsItem # noqa: E402, I001 +from .workflow_tool_response_model_output import WorkflowToolResponseModelOutput # noqa: E402, I001 +from .workflow_tool_response_model_output_steps_item import WorkflowToolResponseModelOutputStepsItem # noqa: E402, I001 + +update_forward_refs( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, + WorkflowToolNestedToolsStepModelOutput=WorkflowToolNestedToolsStepModelOutput, + WorkflowToolNestedToolsStepModelOutputResultsItem=WorkflowToolNestedToolsStepModelOutputResultsItem, + WorkflowToolResponseModelOutput=WorkflowToolResponseModelOutput, + WorkflowToolResponseModelOutputStepsItem=WorkflowToolResponseModelOutputStepsItem, +) diff --git a/data/src/elevenlabs/types/conversation_history_twilio_phone_call_model.py b/data/src/elevenlabs/types/conversation_history_twilio_phone_call_model.py new file mode 100644 index 0000000000000000000000000000000000000000..34569dbca668a2cf890e5f7704037dce59b9b5ed --- /dev/null +++ b/data/src/elevenlabs/types/conversation_history_twilio_phone_call_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .call_result import CallResult +from .telephony_direction import TelephonyDirection + + +class ConversationHistoryTwilioPhoneCallModel(UncheckedBaseModel): + direction: TelephonyDirection + phone_number_id: str + agent_number: str + external_number: str + call_result: typing.Optional[CallResult] = None + stream_sid: str + call_sid: 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/data/src/elevenlabs/types/conversation_initiation_client_data_config_input.py b/data/src/elevenlabs/types/conversation_initiation_client_data_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..4c402a0425b4d1efc9b1cd4c2994fa735c9d7c36 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_client_data_config_input.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_config_client_override_config_input import ConversationConfigClientOverrideConfigInput + + +class ConversationInitiationClientDataConfigInput(UncheckedBaseModel): + conversation_config_override: typing.Optional[ConversationConfigClientOverrideConfigInput] = pydantic.Field( + default=None + ) + """ + Overrides for the conversation configuration + """ + + custom_llm_extra_body: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to include custom LLM extra body + """ + + enable_conversation_initiation_client_data_from_webhook: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable conversation initiation client data from webhooks + """ + + enable_starting_workflow_node_id_from_client: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether clients may pass starting_workflow_node_id in initiation client data; if false, sending it fails conversation start. + """ + + enable_procedure_ids_from_client: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether clients may pass procedure_ids in initiation client data to select which of the agent's procedures are available for the conversation; if false, sending it fails conversation start. + """ + + 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/data/src/elevenlabs/types/conversation_initiation_client_data_config_output.py b/data/src/elevenlabs/types/conversation_initiation_client_data_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..745335b254ade332e01755ff7a4f168dcb7b7aec --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_client_data_config_output.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_config_client_override_config_output import ConversationConfigClientOverrideConfigOutput + + +class ConversationInitiationClientDataConfigOutput(UncheckedBaseModel): + conversation_config_override: typing.Optional[ConversationConfigClientOverrideConfigOutput] = pydantic.Field( + default=None + ) + """ + Overrides for the conversation configuration + """ + + custom_llm_extra_body: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to include custom LLM extra body + """ + + enable_conversation_initiation_client_data_from_webhook: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable conversation initiation client data from webhooks + """ + + enable_starting_workflow_node_id_from_client: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether clients may pass starting_workflow_node_id in initiation client data; if false, sending it fails conversation start. + """ + + enable_procedure_ids_from_client: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether clients may pass procedure_ids in initiation client data to select which of the agent's procedures are available for the conversation; if false, sending it fails conversation start. + """ + + 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/data/src/elevenlabs/types/conversation_initiation_client_data_internal.py b/data/src/elevenlabs/types/conversation_initiation_client_data_internal.py new file mode 100644 index 0000000000000000000000000000000000000000..d05a38ad28779b3a4f00e89489fdfa2de64549a1 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_client_data_internal.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_config_client_override_output import ConversationConfigClientOverrideOutput +from .conversation_initiation_source_info import ConversationInitiationSourceInfo +from .dynamic_variable_internal_value_type import DynamicVariableInternalValueType +from .orchestrator_tool_mock_behavior_config import OrchestratorToolMockBehaviorConfig +from .tool_response_mock_config_output import ToolResponseMockConfigOutput + + +class ConversationInitiationClientDataInternal(UncheckedBaseModel): + conversation_config_override: typing.Optional[ConversationConfigClientOverrideOutput] = None + custom_llm_extra_body: typing.Optional[typing.Dict[str, typing.Any]] = None + user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the end user participating in this conversation (for agent owner's user identification) + """ + + source_info: typing.Optional[ConversationInitiationSourceInfo] = None + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the agent branch to use for this conversation + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + Environment to use for resolving environment variables + """ + + starting_workflow_node_id: typing.Optional[str] = pydantic.Field(default=None) + """ + If set, start the workflow at this node id instead of the default entry + """ + + procedure_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + If set, only these procedures are available to the starting agent. Each ID must be attached to that agent; unknown IDs fail conversation start. An empty list disables all of that agent's procedures. Not applied after an agent transfer. Requires enable_procedure_ids_from_client. + """ + + dynamic_variables: typing.Optional[typing.Dict[str, DynamicVariableInternalValueType]] = None + tool_mock_config: typing.Optional[OrchestratorToolMockBehaviorConfig] = pydantic.Field(default=None) + """ + Configuration for which tools to mock and fallback behavior + """ + + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigOutput]]] = pydantic.Field( + default=None + ) + """ + Per-tool response mock overrides keyed by resolved tool name, applied ahead of the tool's shared mocks. Used for test-specific mocks. + """ + + 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/data/src/elevenlabs/types/conversation_initiation_client_data_request_input.py b/data/src/elevenlabs/types/conversation_initiation_client_data_request_input.py new file mode 100644 index 0000000000000000000000000000000000000000..bf8285a311731fcf23cc5c48c3ce03770aff445a --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_client_data_request_input.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_config_client_override_input import ConversationConfigClientOverrideInput +from .conversation_initiation_source_info import ConversationInitiationSourceInfo + + +class ConversationInitiationClientDataRequestInput(UncheckedBaseModel): + conversation_config_override: typing.Optional[ConversationConfigClientOverrideInput] = None + custom_llm_extra_body: typing.Optional[typing.Dict[str, typing.Any]] = None + user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the end user participating in this conversation (for agent owner's user identification) + """ + + source_info: typing.Optional[ConversationInitiationSourceInfo] = None + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the agent branch to use for this conversation + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + Environment to use for resolving environment variables + """ + + starting_workflow_node_id: typing.Optional[str] = pydantic.Field(default=None) + """ + If set, start the workflow at this node id instead of the default entry + """ + + procedure_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + If set, only these procedures are available to the starting agent. Each ID must be attached to that agent; unknown IDs fail conversation start. An empty list disables all of that agent's procedures. Not applied after an agent transfer. Requires enable_procedure_ids_from_client. + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = 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/data/src/elevenlabs/types/conversation_initiation_client_data_request_output.py b/data/src/elevenlabs/types/conversation_initiation_client_data_request_output.py new file mode 100644 index 0000000000000000000000000000000000000000..012ba22f327302f2099e85528d8aba84db931cf4 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_client_data_request_output.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_config_client_override_output import ConversationConfigClientOverrideOutput +from .conversation_initiation_source_info import ConversationInitiationSourceInfo + + +class ConversationInitiationClientDataRequestOutput(UncheckedBaseModel): + conversation_config_override: typing.Optional[ConversationConfigClientOverrideOutput] = None + custom_llm_extra_body: typing.Optional[typing.Dict[str, typing.Any]] = None + user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the end user participating in this conversation (for agent owner's user identification) + """ + + source_info: typing.Optional[ConversationInitiationSourceInfo] = None + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the agent branch to use for this conversation + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + Environment to use for resolving environment variables + """ + + starting_workflow_node_id: typing.Optional[str] = pydantic.Field(default=None) + """ + If set, start the workflow at this node id instead of the default entry + """ + + procedure_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + If set, only these procedures are available to the starting agent. Each ID must be attached to that agent; unknown IDs fail conversation start. An empty list disables all of that agent's procedures. Not applied after an agent transfer. Requires enable_procedure_ids_from_client. + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = 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/data/src/elevenlabs/types/conversation_initiation_client_data_webhook.py b/data/src/elevenlabs/types/conversation_initiation_client_data_webhook.py new file mode 100644 index 0000000000000000000000000000000000000000..e55d0a9e3ce3bf0f344e92772c4ffe0636523b09 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_client_data_webhook.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_initiation_client_data_webhook_request_headers_value import ( + ConversationInitiationClientDataWebhookRequestHeadersValue, +) + + +class ConversationInitiationClientDataWebhook(UncheckedBaseModel): + url: str = pydantic.Field() + """ + The URL to send the webhook to + """ + + request_headers: typing.Dict[str, ConversationInitiationClientDataWebhookRequestHeadersValue] = pydantic.Field() + """ + The headers to send with the webhook request + """ + + 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/data/src/elevenlabs/types/conversation_initiation_client_data_webhook_request_headers_value.py b/data/src/elevenlabs/types/conversation_initiation_client_data_webhook_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..1e0797278b225af5c719e3a52a3231596ca1d359 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_client_data_webhook_request_headers_value.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_secret_locator import ConvAiSecretLocator + +ConversationInitiationClientDataWebhookRequestHeadersValue = typing.Union[str, ConvAiSecretLocator] diff --git a/data/src/elevenlabs/types/conversation_initiation_source.py b/data/src/elevenlabs/types/conversation_initiation_source.py new file mode 100644 index 0000000000000000000000000000000000000000..744ba5fa54c43bd791ddeb21452429e3b03b2bd2 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_source.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationInitiationSource = typing.Union[ + typing.Literal[ + "unknown", + "android_sdk", + "node_js_sdk", + "react_native_sdk", + "react_sdk", + "js_sdk", + "python_sdk", + "widget", + "sip_trunk", + "twilio", + "exotel", + "genesys", + "avaya", + "audiocodes", + "swift_sdk", + "whatsapp", + "twilio_sms", + "flutter_sdk", + "zendesk_integration", + "slack_integration", + "telegram_integration", + "intercom_integration", + "freshdesk_integration", + "salesforce_integration", + "template_preview", + "genesys_bot_connector", + "subagent_tool", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/conversation_initiation_source_info.py b/data/src/elevenlabs/types/conversation_initiation_source_info.py new file mode 100644 index 0000000000000000000000000000000000000000..97beb3fe18c6a4e89d94a85f8ff6494df0e1025a --- /dev/null +++ b/data/src/elevenlabs/types/conversation_initiation_source_info.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_initiation_source import ConversationInitiationSource + + +class ConversationInitiationSourceInfo(UncheckedBaseModel): + """ + Information about the source of conversation initiation + """ + + source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Source of the conversation initiation + """ + + version: typing.Optional[str] = pydantic.Field(default=None) + """ + The SDK version number + """ + + 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/data/src/elevenlabs/types/conversation_product.py b/data/src/elevenlabs/types/conversation_product.py new file mode 100644 index 0000000000000000000000000000000000000000..8dd33bd21819aec17e66b16f8b7fb32f2e0f037c --- /dev/null +++ b/data/src/elevenlabs/types/conversation_product.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationProduct = typing.Union[typing.Literal["agents", "speech_engine"], typing.Any] diff --git a/data/src/elevenlabs/types/conversation_reasoning_model.py b/data/src/elevenlabs/types/conversation_reasoning_model.py new file mode 100644 index 0000000000000000000000000000000000000000..cd8c3e1a0f09d47962c4e2f8ba9732eb611e5e15 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_reasoning_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationReasoningModel(UncheckedBaseModel): + summary: typing.Optional[str] = None + provider_redact: 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/data/src/elevenlabs/types/conversation_sentiment_analysis.py b/data/src/elevenlabs/types/conversation_sentiment_analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..19194d56ed19a3bdb06dbd06ad17ccb71b04e8f1 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_sentiment_analysis.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_sentiment_analysis_overall_label import ConversationSentimentAnalysisOverallLabel + + +class ConversationSentimentAnalysis(UncheckedBaseModel): + overall_label: ConversationSentimentAnalysisOverallLabel + overall_sentiment_score: float + overall_frustration_score: float + min_user_sentiment_score: float + max_user_frustration_score: float + num_scored_user_turns: int + + 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/data/src/elevenlabs/types/conversation_sentiment_analysis_overall_label.py b/data/src/elevenlabs/types/conversation_sentiment_analysis_overall_label.py new file mode 100644 index 0000000000000000000000000000000000000000..1b2d9685478e613c95d9f87f2b0c4032f5d6df05 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_sentiment_analysis_overall_label.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationSentimentAnalysisOverallLabel = typing.Union[typing.Literal["positive", "neutral", "negative"], typing.Any] diff --git a/data/src/elevenlabs/types/conversation_signed_url_response_model.py b/data/src/elevenlabs/types/conversation_signed_url_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c282f46e1cdd899f068e895da6eb5ec411c7dca5 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_signed_url_response_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationSignedUrlResponseModel(UncheckedBaseModel): + signed_url: 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/data/src/elevenlabs/types/conversation_simulation_specification.py b/data/src/elevenlabs/types/conversation_simulation_specification.py new file mode 100644 index 0000000000000000000000000000000000000000..25769f721830b335499d6befa0aa88879f093338 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_simulation_specification.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_config import AgentConfig +from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from .tool_mock_config import ToolMockConfig + + +class ConversationSimulationSpecification(UncheckedBaseModel): + """ + A specification that will be used to simulate a conversation between an agent and an AI user. + """ + + simulated_user_config: AgentConfig + tool_mock_config: typing.Optional[typing.Dict[str, ToolMockConfig]] = None + partial_conversation_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = ( + pydantic.Field(default=None) + ) + """ + A partial conversation history to start the simulation from. If empty, simulation starts fresh. + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = 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 + + +update_forward_refs(ConversationSimulationSpecification) diff --git a/data/src/elevenlabs/types/conversation_source.py b/data/src/elevenlabs/types/conversation_source.py new file mode 100644 index 0000000000000000000000000000000000000000..51d642a3807520c83865fe58afedc9f838e18dd1 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_source.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationSource(UncheckedBaseModel): + type: typing.Optional[typing.Literal["conversation"]] = None + conversation_id: 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/data/src/elevenlabs/types/conversation_summary_message_model.py b/data/src/elevenlabs/types/conversation_summary_message_model.py new file mode 100644 index 0000000000000000000000000000000000000000..459a051675dd0afa8a5bfd2e64ac33d63029ad07 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_summary_message_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_summary_message_model_role import ConversationSummaryMessageModelRole + + +class ConversationSummaryMessageModel(UncheckedBaseModel): + role: ConversationSummaryMessageModelRole + message: 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/data/src/elevenlabs/types/conversation_summary_message_model_role.py b/data/src/elevenlabs/types/conversation_summary_message_model_role.py new file mode 100644 index 0000000000000000000000000000000000000000..9be1965a52efa7b981352ba38b96d739da9b0c4d --- /dev/null +++ b/data/src/elevenlabs/types/conversation_summary_message_model_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationSummaryMessageModelRole = typing.Union[typing.Literal["user", "agent"], typing.Any] diff --git a/data/src/elevenlabs/types/conversation_summary_response_model.py b/data/src/elevenlabs/types/conversation_summary_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e53d5e8b1187ba5deea21901529493ebed8aa1d2 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_summary_response_model.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_initiation_source import ConversationInitiationSource +from .conversation_sentiment_analysis import ConversationSentimentAnalysis +from .conversation_summary_response_model_status import ConversationSummaryResponseModelStatus +from .evaluation_criteria_summary_result import EvaluationCriteriaSummaryResult +from .evaluation_success_result import EvaluationSuccessResult +from .telephony_direction import TelephonyDirection + + +class ConversationSummaryResponseModel(UncheckedBaseModel): + agent_id: str + branch_id: typing.Optional[str] = None + version_id: typing.Optional[str] = None + agent_name: typing.Optional[str] = None + conversation_id: str + start_time_unix_secs: int + call_duration_secs: int + message_count: int + status: ConversationSummaryResponseModelStatus + termination_reason: typing.Optional[str] = None + call_successful: EvaluationSuccessResult + call_success_score: typing.Optional[float] = None + transcript_summary: typing.Optional[str] = None + call_summary_title: typing.Optional[str] = None + main_language: typing.Optional[str] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + tool_names: typing.Optional[typing.List[str]] = None + direction: typing.Optional[TelephonyDirection] = None + rating: typing.Optional[float] = None + sentiment_analysis: typing.Optional[ConversationSentimentAnalysis] = None + data_collection_results: typing.Optional[typing.Dict[str, typing.Any]] = None + evaluation_criteria_results: typing.Optional[typing.Dict[str, typing.Optional[EvaluationCriteriaSummaryResult]]] = ( + None + ) + tag_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Conversation tag ids assigned to this conversation. + """ + + 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/data/src/elevenlabs/types/conversation_summary_response_model_status.py b/data/src/elevenlabs/types/conversation_summary_response_model_status.py new file mode 100644 index 0000000000000000000000000000000000000000..9fc10287873b31dfe49f5e59b5e4bf18bc65fb97 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_summary_response_model_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationSummaryResponseModelStatus = typing.Union[ + typing.Literal["initiated", "in-progress", "processing", "done", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/types/conversation_tag_response_model.py b/data/src/elevenlabs/types/conversation_tag_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f5c8282239b1aaa41c5f85347e3231945789c228 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_tag_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationTagResponseModel(UncheckedBaseModel): + tag_id: str + workspace_id: str + owner_user_id: str + title: str + description: typing.Optional[str] = None + created_at_unix_secs: int + + 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/data/src/elevenlabs/types/conversation_token_purpose.py b/data/src/elevenlabs/types/conversation_token_purpose.py new file mode 100644 index 0000000000000000000000000000000000000000..bfaccef4764ce6ebb5ab56eebe4fb5b261437eae --- /dev/null +++ b/data/src/elevenlabs/types/conversation_token_purpose.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ConversationTokenPurpose = typing.Union[typing.Literal["signed_url", "shareable_link"], typing.Any] diff --git a/data/src/elevenlabs/types/conversation_token_response_model.py b/data/src/elevenlabs/types/conversation_token_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..fccea02f121cb16df930042aa649ab3e1f8e4708 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_token_response_model.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_token_purpose import ConversationTokenPurpose + + +class ConversationTokenResponseModel(UncheckedBaseModel): + agent_id: str = pydantic.Field() + """ + The ID of the agent + """ + + conversation_token: str = pydantic.Field() + """ + The token for the agent + """ + + expiration_time_unix_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The expiration time of the token in unix seconds + """ + + conversation_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the conversation + """ + + purpose: ConversationTokenPurpose = pydantic.Field() + """ + The purpose of the token + """ + + token_requester_user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The user ID of the entity who requested the token + """ + + 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/data/src/elevenlabs/types/conversation_tts_usage_model.py b/data/src/elevenlabs/types/conversation_tts_usage_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4256dbf8124ac67b2741dc68fc124eca3cb8886e --- /dev/null +++ b/data/src/elevenlabs/types/conversation_tts_usage_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_voice_usage_model import ConversationVoiceUsageModel + + +class ConversationTtsUsageModel(UncheckedBaseModel): + """ + Aggregated TTS usage for a conversation (analytics-only, not billing). + """ + + primary_tts_model: typing.Optional[str] = None + total_audio_output_seconds: typing.Optional[float] = None + total_characters: typing.Optional[int] = None + per_voice_usage: typing.Optional[typing.List[ConversationVoiceUsageModel]] = 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/data/src/elevenlabs/types/conversation_turn_metrics.py b/data/src/elevenlabs/types/conversation_turn_metrics.py new file mode 100644 index 0000000000000000000000000000000000000000..fb3ffe9efe15dcbd010f82200c0ceab0da6db212 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_turn_metrics.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .metric_record import MetricRecord + + +class ConversationTurnMetrics(UncheckedBaseModel): + metrics: typing.Optional[typing.Dict[str, MetricRecord]] = None + convai_asr_provider: typing.Optional[str] = None + convai_tts_model: typing.Optional[str] = None + convai_tts_cascade: typing.Optional[str] = None + voice_id: 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/data/src/elevenlabs/types/conversation_user_response_model.py b/data/src/elevenlabs/types/conversation_user_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d20cb2d90f1c15ff112a505add5de10115b01bb3 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_user_response_model.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .frustrated_conversation_ref import FrustratedConversationRef +from .sentiment_aggregate import SentimentAggregate + + +class ConversationUserResponseModel(UncheckedBaseModel): + user_id: str + last_contact_unix_secs: int + first_contact_unix_secs: int + conversation_count: int + last_contact_agent_id: typing.Optional[str] = None + last_contact_conversation_id: str + last_contact_agent_name: typing.Optional[str] = None + sentiment: SentimentAggregate + most_frustrated_conversations: typing.Optional[typing.List[FrustratedConversationRef]] = 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/data/src/elevenlabs/types/conversation_voice_reward_model.py b/data/src/elevenlabs/types/conversation_voice_reward_model.py new file mode 100644 index 0000000000000000000000000000000000000000..256f0612d77688fa21ffb6ebf36a90628e80619a --- /dev/null +++ b/data/src/elevenlabs/types/conversation_voice_reward_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationVoiceRewardModel(UncheckedBaseModel): + voice_id: str + reward_usd_cents: float + + 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/data/src/elevenlabs/types/conversation_voice_usage_model.py b/data/src/elevenlabs/types/conversation_voice_usage_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3ba20b78a71112b65379af6133fe624f53c44f41 --- /dev/null +++ b/data/src/elevenlabs/types/conversation_voice_usage_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConversationVoiceUsageModel(UncheckedBaseModel): + voice_id: str + audio_output_seconds: 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/data/src/elevenlabs/types/conversational_config.py b/data/src/elevenlabs/types/conversational_config.py new file mode 100644 index 0000000000000000000000000000000000000000..c4c6ebd957e5fb9ccc8e120ee243e796de9f0f83 --- /dev/null +++ b/data/src/elevenlabs/types/conversational_config.py @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_config import AgentConfig +from .asr_conversational_config import AsrConversationalConfig +from .conversation_config_output import ConversationConfigOutput +from .language_preset_output import LanguagePresetOutput +from .tts_conversational_config_output import TtsConversationalConfigOutput +from .turn_config import TurnConfig +from .vad_config import VadConfig + + +class ConversationalConfig(UncheckedBaseModel): + asr: typing.Optional[AsrConversationalConfig] = pydantic.Field(default=None) + """ + Configuration for conversational transcription + """ + + turn: typing.Optional[TurnConfig] = pydantic.Field(default=None) + """ + Configuration for turn detection + """ + + tts: typing.Optional[TtsConversationalConfigOutput] = pydantic.Field(default=None) + """ + Configuration for conversational text to speech + """ + + conversation: typing.Optional[ConversationConfigOutput] = pydantic.Field(default=None) + """ + Configuration for conversational events + """ + + language_presets: typing.Optional[typing.Dict[str, LanguagePresetOutput]] = pydantic.Field(default=None) + """ + Language presets for conversations + """ + + vad: typing.Optional[VadConfig] = pydantic.Field(default=None) + """ + Configuration for voice activity detection + """ + + agent: typing.Optional[AgentConfig] = pydantic.Field(default=None) + """ + Agent specific configuration + """ + + 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 + + +update_forward_refs(ConversationalConfig) diff --git a/data/src/elevenlabs/types/conversational_config_api_model_workflow_override_input.py b/data/src/elevenlabs/types/conversational_config_api_model_workflow_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..5efa8577a013cc8f37a3494fa4b2d4f4668b091a --- /dev/null +++ b/data/src/elevenlabs/types/conversational_config_api_model_workflow_override_input.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_config_api_model_workflow_override_input import AgentConfigApiModelWorkflowOverrideInput +from .asr_conversational_config_workflow_override import AsrConversationalConfigWorkflowOverride +from .conversation_config_workflow_override_input import ConversationConfigWorkflowOverrideInput +from .language_preset_input import LanguagePresetInput +from .tts_conversational_config_workflow_override_input import TtsConversationalConfigWorkflowOverrideInput +from .turn_config_workflow_override import TurnConfigWorkflowOverride +from .vad_config_workflow_override import VadConfigWorkflowOverride + + +class ConversationalConfigApiModelWorkflowOverrideInput(UncheckedBaseModel): + asr: typing.Optional[AsrConversationalConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for conversational transcription + """ + + turn: typing.Optional[TurnConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for turn detection + """ + + tts: typing.Optional[TtsConversationalConfigWorkflowOverrideInput] = pydantic.Field(default=None) + """ + Configuration for conversational text to speech + """ + + conversation: typing.Optional[ConversationConfigWorkflowOverrideInput] = pydantic.Field(default=None) + """ + Configuration for conversational events + """ + + language_presets: typing.Optional[typing.Dict[str, typing.Optional[LanguagePresetInput]]] = pydantic.Field( + default=None + ) + """ + Language presets for conversations + """ + + vad: typing.Optional[VadConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for voice activity detection + """ + + agent: typing.Optional[AgentConfigApiModelWorkflowOverrideInput] = pydantic.Field(default=None) + """ + Agent specific configuration + """ + + 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 + + +update_forward_refs(ConversationalConfigApiModelWorkflowOverrideInput) diff --git a/data/src/elevenlabs/types/conversational_config_api_model_workflow_override_output.py b/data/src/elevenlabs/types/conversational_config_api_model_workflow_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..4051452b9e0257a3cf94941f971feda9e2e29d8c --- /dev/null +++ b/data/src/elevenlabs/types/conversational_config_api_model_workflow_override_output.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_config_api_model_workflow_override_output import AgentConfigApiModelWorkflowOverrideOutput +from .asr_conversational_config_workflow_override import AsrConversationalConfigWorkflowOverride +from .conversation_config_workflow_override_output import ConversationConfigWorkflowOverrideOutput +from .language_preset_output import LanguagePresetOutput +from .tts_conversational_config_workflow_override_output import TtsConversationalConfigWorkflowOverrideOutput +from .turn_config_workflow_override import TurnConfigWorkflowOverride +from .vad_config_workflow_override import VadConfigWorkflowOverride + + +class ConversationalConfigApiModelWorkflowOverrideOutput(UncheckedBaseModel): + asr: typing.Optional[AsrConversationalConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for conversational transcription + """ + + turn: typing.Optional[TurnConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for turn detection + """ + + tts: typing.Optional[TtsConversationalConfigWorkflowOverrideOutput] = pydantic.Field(default=None) + """ + Configuration for conversational text to speech + """ + + conversation: typing.Optional[ConversationConfigWorkflowOverrideOutput] = pydantic.Field(default=None) + """ + Configuration for conversational events + """ + + language_presets: typing.Optional[typing.Dict[str, typing.Optional[LanguagePresetOutput]]] = pydantic.Field( + default=None + ) + """ + Language presets for conversations + """ + + vad: typing.Optional[VadConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for voice activity detection + """ + + agent: typing.Optional[AgentConfigApiModelWorkflowOverrideOutput] = pydantic.Field(default=None) + """ + Agent specific configuration + """ + + 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 + + +update_forward_refs(ConversationalConfigApiModelWorkflowOverrideOutput) diff --git a/data/src/elevenlabs/types/convert_chapter_response_model.py b/data/src/elevenlabs/types/convert_chapter_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4a1a21d157cf13c164da60bf43c10d0bbfc9601e --- /dev/null +++ b/data/src/elevenlabs/types/convert_chapter_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConvertChapterResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the studio chapter conversion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/convert_project_response_model.py b/data/src/elevenlabs/types/convert_project_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1c229d866714b61603ced746de5820869d8b1e67 --- /dev/null +++ b/data/src/elevenlabs/types/convert_project_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ConvertProjectResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the studio project conversion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/crawl_status.py b/data/src/elevenlabs/types/crawl_status.py new file mode 100644 index 0000000000000000000000000000000000000000..4b51d07c8ee6006bb36bd8ddceea0ad06010fda7 --- /dev/null +++ b/data/src/elevenlabs/types/crawl_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CrawlStatus = typing.Union[ + typing.Literal["queued", "processing", "succeeded", "failed", "skipped", "cancelled"], typing.Any +] diff --git a/data/src/elevenlabs/types/crawl_type.py b/data/src/elevenlabs/types/crawl_type.py new file mode 100644 index 0000000000000000000000000000000000000000..5c59eb5cab3ef8b47b2f783b2f030955d9e5e9ef --- /dev/null +++ b/data/src/elevenlabs/types/crawl_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CrawlType = typing.Union[typing.Literal["discovery", "sitemap"], typing.Any] diff --git a/data/src/elevenlabs/types/create_agent_branch_response_model.py b/data/src/elevenlabs/types/create_agent_branch_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ff0fe07402e15a65b887f71fdebe50d9d34f937f --- /dev/null +++ b/data/src/elevenlabs/types/create_agent_branch_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateAgentBranchResponseModel(UncheckedBaseModel): + created_branch_id: str = pydantic.Field() + """ + ID of the created branch + """ + + created_version_id: str = pydantic.Field() + """ + ID of the first version on the created branch + """ + + 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/data/src/elevenlabs/types/create_agent_merge_proposal_response_model.py b/data/src/elevenlabs/types/create_agent_merge_proposal_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5d4b1db70416cfca88dacd379143df651f3e4435 --- /dev/null +++ b/data/src/elevenlabs/types/create_agent_merge_proposal_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateAgentMergeProposalResponseModel(UncheckedBaseModel): + created_merge_proposal_id: str = pydantic.Field() + """ + ID of the created merge_proposal + """ + + 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/data/src/elevenlabs/types/create_agent_procedure_params.py b/data/src/elevenlabs/types/create_agent_procedure_params.py new file mode 100644 index 0000000000000000000000000000000000000000..08e32fd3acfab221107a7b6ecd42b54b04887651 --- /dev/null +++ b/data/src/elevenlabs/types/create_agent_procedure_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateAgentProcedureParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_agent_procedure"]] = 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/data/src/elevenlabs/types/create_agent_response_model.py b/data/src/elevenlabs/types/create_agent_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3c66211dfbd60cfb7f6f72ad993841a6acd01ce7 --- /dev/null +++ b/data/src/elevenlabs/types/create_agent_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateAgentResponseModel(UncheckedBaseModel): + agent_id: str = pydantic.Field() + """ + ID of the created agent + """ + + 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/data/src/elevenlabs/types/create_agent_rule_params.py b/data/src/elevenlabs/types/create_agent_rule_params.py new file mode 100644 index 0000000000000000000000000000000000000000..a6b0f549e6d4e088500d4aad6a27947207d88a4b --- /dev/null +++ b/data/src/elevenlabs/types/create_agent_rule_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateAgentRuleParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_agent_rule"]] = 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/data/src/elevenlabs/types/create_agent_test_folder_response_model.py b/data/src/elevenlabs/types/create_agent_test_folder_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d815b7674d023fc8c2534d52fff477a57761fb1e --- /dev/null +++ b/data/src/elevenlabs/types/create_agent_test_folder_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateAgentTestFolderResponseModel(UncheckedBaseModel): + id: str + 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/data/src/elevenlabs/types/create_agent_test_response_model.py b/data/src/elevenlabs/types/create_agent_test_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..02be1f5190d101eaea60bd27f5cf286836c2c707 --- /dev/null +++ b/data/src/elevenlabs/types/create_agent_test_response_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateAgentTestResponseModel(UncheckedBaseModel): + id: 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/data/src/elevenlabs/types/create_asset_params.py b/data/src/elevenlabs/types/create_asset_params.py new file mode 100644 index 0000000000000000000000000000000000000000..676f18cd41971021ea5d4fb47d7d8999d6e35047 --- /dev/null +++ b/data/src/elevenlabs/types/create_asset_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateAssetParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_asset"]] = 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/data/src/elevenlabs/types/create_audio_native_project_request.py b/data/src/elevenlabs/types/create_audio_native_project_request.py new file mode 100644 index 0000000000000000000000000000000000000000..2f1f9f9edca25ef9631ec846b18aa4ebc29db38f --- /dev/null +++ b/data/src/elevenlabs/types/create_audio_native_project_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateAudioNativeProjectRequest = typing.Any diff --git a/data/src/elevenlabs/types/create_auth_connection_environment_variable_request.py b/data/src/elevenlabs/types/create_auth_connection_environment_variable_request.py new file mode 100644 index 0000000000000000000000000000000000000000..549526b5173a0200649a3b8918e1fa52707fe0a2 --- /dev/null +++ b/data/src/elevenlabs/types/create_auth_connection_environment_variable_request.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .environment_variable_auth_connection_value_request import EnvironmentVariableAuthConnectionValueRequest + + +class CreateAuthConnectionEnvironmentVariableRequest(UncheckedBaseModel): + label: str = pydantic.Field() + """ + Unique label for the environment variable. + """ + + values: typing.Dict[str, EnvironmentVariableAuthConnectionValueRequest] = pydantic.Field() + """ + Environment-specific auth connection references. Must include 'production' key. + """ + + 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/data/src/elevenlabs/types/create_basic_auth_request.py b/data/src/elevenlabs/types/create_basic_auth_request.py new file mode 100644 index 0000000000000000000000000000000000000000..65b8b91c630eba3a19857f951c383c68e37d4ee4 --- /dev/null +++ b/data/src/elevenlabs/types/create_basic_auth_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateBasicAuthRequest(UncheckedBaseModel): + """ + Request model for creating Basic Auth connections - inherits common settings and includes sensitive fields + """ + + name: str + provider: str + username: str + password: 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/data/src/elevenlabs/types/create_bearer_auth_request.py b/data/src/elevenlabs/types/create_bearer_auth_request.py new file mode 100644 index 0000000000000000000000000000000000000000..9a5117454b230115b14301f61d3bd7e2cd347462 --- /dev/null +++ b/data/src/elevenlabs/types/create_bearer_auth_request.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateBearerAuthRequest(UncheckedBaseModel): + """ + Request model for creating Bearer Auth connections - inherits common settings and includes sensitive fields + """ + + name: str + provider: str + token: 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/data/src/elevenlabs/types/create_client_appointment_params.py b/data/src/elevenlabs/types/create_client_appointment_params.py new file mode 100644 index 0000000000000000000000000000000000000000..3855b3db09057e916711d588e72927e8315abe04 --- /dev/null +++ b/data/src/elevenlabs/types/create_client_appointment_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateClientAppointmentParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_client_appointment"]] = 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/data/src/elevenlabs/types/create_client_interaction_params.py b/data/src/elevenlabs/types/create_client_interaction_params.py new file mode 100644 index 0000000000000000000000000000000000000000..f66da89d58b1983b9f4189222d94cf09fe8f00a0 --- /dev/null +++ b/data/src/elevenlabs/types/create_client_interaction_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateClientInteractionParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_client_interaction"]] = 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/data/src/elevenlabs/types/create_client_params.py b/data/src/elevenlabs/types/create_client_params.py new file mode 100644 index 0000000000000000000000000000000000000000..20bebfc7874ec31a3bf2f8f609efbf6eb34e43a7 --- /dev/null +++ b/data/src/elevenlabs/types/create_client_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateClientParams(UncheckedBaseModel): + """ + Create a new client in the system. + """ + + smb_tool_type: typing.Optional[typing.Literal["create_client"]] = 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/data/src/elevenlabs/types/create_client_secret_request.py b/data/src/elevenlabs/types/create_client_secret_request.py new file mode 100644 index 0000000000000000000000000000000000000000..fd66a26b6991cf605e9c711ec9ddab800e331784 --- /dev/null +++ b/data/src/elevenlabs/types/create_client_secret_request.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .expires_after import ExpiresAfter +from .open_ai_session_config_input import OpenAiSessionConfigInput + + +class CreateClientSecretRequest(UncheckedBaseModel): + session: typing.Optional[OpenAiSessionConfigInput] = None + expires_after: typing.Optional[ExpiresAfter] = 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/data/src/elevenlabs/types/create_crawl_job_response_model.py b/data/src/elevenlabs/types/create_crawl_job_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6eb25ffb019fd33755759ae11e96df00547334fd --- /dev/null +++ b/data/src/elevenlabs/types/create_crawl_job_response_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .crawl_type import CrawlType +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) + + +class CreateCrawlJobResponseModel(UncheckedBaseModel): + id: str + type: CrawlType + root_folder_id: str + status: str + created_at: int + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to the root folder, from root to parent folder. + """ + + 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/data/src/elevenlabs/types/create_custom_header_auth_request.py b/data/src/elevenlabs/types/create_custom_header_auth_request.py new file mode 100644 index 0000000000000000000000000000000000000000..bbf316848da2d3ee8b1443855d5fc10f3d0a5d0c --- /dev/null +++ b/data/src/elevenlabs/types/create_custom_header_auth_request.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateCustomHeaderAuthRequest(UncheckedBaseModel): + name: str + provider: str + header_name: str = pydantic.Field() + """ + The name of the header to use for authentication (e.g., 'x-api-key') + """ + + token: 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/data/src/elevenlabs/types/create_exotel_phone_number_request.py b/data/src/elevenlabs/types/create_exotel_phone_number_request.py new file mode 100644 index 0000000000000000000000000000000000000000..552644739f40f66ce8b33ce991547c3d808f2129 --- /dev/null +++ b/data/src/elevenlabs/types/create_exotel_phone_number_request.py @@ -0,0 +1,74 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .exotel_api_subdomain import ExotelApiSubdomain + + +class CreateExotelPhoneNumberRequest(UncheckedBaseModel): + phone_number: str = pydantic.Field() + """ + Phone number + """ + + label: str = pydantic.Field() + """ + Label for the phone number + """ + + supports_inbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports inbound calls + """ + + supports_outbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls + """ + + agent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Agent ID to assign the phone number to + """ + + account_sid: str = pydantic.Field() + """ + Exotel Account SID + """ + + api_key: str = pydantic.Field() + """ + Exotel API Key + """ + + api_token: str = pydantic.Field() + """ + Exotel API Token + """ + + api_subdomain: ExotelApiSubdomain = pydantic.Field() + """ + Exotel region-specific API host + """ + + app_id: str = pydantic.Field() + """ + Exotel applet identifier used in Calls/connect + """ + + applet_url: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional full applet URL override. Defaults to Exotel start_voice URL derived from account SID and app ID. + """ + + 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/data/src/elevenlabs/types/create_holiday_params.py b/data/src/elevenlabs/types/create_holiday_params.py new file mode 100644 index 0000000000000000000000000000000000000000..639d8cad2ae4b0a27a927019ddc36b96c672e454 --- /dev/null +++ b/data/src/elevenlabs/types/create_holiday_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateHolidayParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_holiday"]] = 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/data/src/elevenlabs/types/create_location_params.py b/data/src/elevenlabs/types/create_location_params.py new file mode 100644 index 0000000000000000000000000000000000000000..5bc404a88bf05977c8ef3872f5fbd56375d5735b --- /dev/null +++ b/data/src/elevenlabs/types/create_location_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateLocationParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_location"]] = 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/data/src/elevenlabs/types/create_mtls_auth_request.py b/data/src/elevenlabs/types/create_mtls_auth_request.py new file mode 100644 index 0000000000000000000000000000000000000000..72cc82b3984b58bf15cd771259841d5bf56d0b1b --- /dev/null +++ b/data/src/elevenlabs/types/create_mtls_auth_request.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateMtlsAuthRequest(UncheckedBaseModel): + """ + Request model for creating mTLS auth connections. + """ + + name: str + provider: str + client_certificate: str + client_key: str + ca_certificate: typing.Optional[str] = None + key_passphrase: 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/data/src/elevenlabs/types/create_o_auth_2_client_creds_request.py b/data/src/elevenlabs/types/create_o_auth_2_client_creds_request.py new file mode 100644 index 0000000000000000000000000000000000000000..4f0caccfcf441f5dda0adddc09d314c4becf9870 --- /dev/null +++ b/data/src/elevenlabs/types/create_o_auth_2_client_creds_request.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateOAuth2ClientCredsRequest(UncheckedBaseModel): + """ + Request model for creating auth connections - inherits common settings and includes sensitive fields + """ + + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + basic_auth_in_header: typing.Optional[bool] = pydantic.Field(default=None) + """ + If True, send client credentials in Authorization header as Basic Auth instead of request body + """ + + client_secret: str + custom_headers: typing.Optional[typing.Dict[str, 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/data/src/elevenlabs/types/create_o_auth_2_jwt_request.py b/data/src/elevenlabs/types/create_o_auth_2_jwt_request.py new file mode 100644 index 0000000000000000000000000000000000000000..d229e3b291cac26efe974f336caf065d986675e4 --- /dev/null +++ b/data/src/elevenlabs/types/create_o_auth_2_jwt_request.py @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .create_o_auth_2_jwt_request_algorithm import CreateOAuth2JwtRequestAlgorithm +from .create_o_auth_2_jwt_request_token_response_field import CreateOAuth2JwtRequestTokenResponseField + + +class CreateOAuth2JwtRequest(UncheckedBaseModel): + """ + Request model for creating OAuth2 JWT auth connections - inherits common settings and includes sensitive fields + """ + + name: str + provider: str + algorithm: typing.Optional[CreateOAuth2JwtRequestAlgorithm] = pydantic.Field(default=None) + """ + JWT signing algorithm + """ + + key_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Key ID (kid) for JWT header - useful for key rotation + """ + + issuer: str = pydantic.Field() + """ + JWT issuer (iss claim) + """ + + audience: str = pydantic.Field() + """ + JWT audience (aud claim) + """ + + subject: str = pydantic.Field() + """ + JWT subject (sub claim) + """ + + expiration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + Token expiration time in seconds + """ + + extra_params: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Additional custom claims to include in the JWT + """ + + token_url: str = pydantic.Field() + """ + Token endpoint URL for exchanging JWT for access token + """ + + scopes: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + OAuth2 scopes to request when exchanging JWT for access token + """ + + token_response_field: typing.Optional[CreateOAuth2JwtRequestTokenResponseField] = pydantic.Field(default=None) + """ + Token field to extract from the token endpoint response. + """ + + secret_key: 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/data/src/elevenlabs/types/create_o_auth_2_jwt_request_algorithm.py b/data/src/elevenlabs/types/create_o_auth_2_jwt_request_algorithm.py new file mode 100644 index 0000000000000000000000000000000000000000..33bd36abcffc746aeb235255918a206ebe428c48 --- /dev/null +++ b/data/src/elevenlabs/types/create_o_auth_2_jwt_request_algorithm.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateOAuth2JwtRequestAlgorithm = typing.Union[ + typing.Literal["HS256", "HS384", "HS512", "RS256", "RS384", "RS512"], typing.Any +] diff --git a/data/src/elevenlabs/types/create_o_auth_2_jwt_request_token_response_field.py b/data/src/elevenlabs/types/create_o_auth_2_jwt_request_token_response_field.py new file mode 100644 index 0000000000000000000000000000000000000000..ca2aab4763598fdc5d84a53fefb777e9f7a2cce6 --- /dev/null +++ b/data/src/elevenlabs/types/create_o_auth_2_jwt_request_token_response_field.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateOAuth2JwtRequestTokenResponseField = typing.Union[typing.Literal["access_token", "id_token"], typing.Any] diff --git a/data/src/elevenlabs/types/create_order_params.py b/data/src/elevenlabs/types/create_order_params.py new file mode 100644 index 0000000000000000000000000000000000000000..4f581ab6f2cc8499710ff29ae37062988aacf68c --- /dev/null +++ b/data/src/elevenlabs/types/create_order_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateOrderParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_order"]] = 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/data/src/elevenlabs/types/create_order_request.py b/data/src/elevenlabs/types/create_order_request.py new file mode 100644 index 0000000000000000000000000000000000000000..0dede187d8ad3e7a0ad6fdec4023f63734b0d848 --- /dev/null +++ b/data/src/elevenlabs/types/create_order_request.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateOrderRequest(UncheckedBaseModel): + sandbox: typing.Optional[bool] = pydantic.Field(default=None) + """ + When true, creates a sandbox order that auto-progresses without producer intervention. + """ + + 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/data/src/elevenlabs/types/create_order_response.py b/data/src/elevenlabs/types/create_order_response.py new file mode 100644 index 0000000000000000000000000000000000000000..e2fd9312e071a17c931973d85be3a5bfb61bdd28 --- /dev/null +++ b/data/src/elevenlabs/types/create_order_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .order_id import OrderId + + +class CreateOrderResponse(UncheckedBaseModel): + order_id: OrderId = pydantic.Field() + """ + The ID of the newly created order. + """ + + sandbox: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether this is a sandbox order. + """ + + 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/data/src/elevenlabs/types/create_phone_number_response_model.py b/data/src/elevenlabs/types/create_phone_number_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..7246bc75da9e8393d8697c19d9f5ff299d9deb61 --- /dev/null +++ b/data/src/elevenlabs/types/create_phone_number_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreatePhoneNumberResponseModel(UncheckedBaseModel): + phone_number_id: str = pydantic.Field() + """ + Phone entity ID + """ + + 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/data/src/elevenlabs/types/create_previously_generated_voice_request.py b/data/src/elevenlabs/types/create_previously_generated_voice_request.py new file mode 100644 index 0000000000000000000000000000000000000000..3c43cb8c4253b307752a8d5debd8d0665fe7ea37 --- /dev/null +++ b/data/src/elevenlabs/types/create_previously_generated_voice_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreatePreviouslyGeneratedVoiceRequest = typing.Any diff --git a/data/src/elevenlabs/types/create_private_key_jwt_request.py b/data/src/elevenlabs/types/create_private_key_jwt_request.py new file mode 100644 index 0000000000000000000000000000000000000000..d2463b9b284af89d6d0386df11c1639841023b98 --- /dev/null +++ b/data/src/elevenlabs/types/create_private_key_jwt_request.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .create_private_key_jwt_request_algorithm import CreatePrivateKeyJwtRequestAlgorithm + + +class CreatePrivateKeyJwtRequest(UncheckedBaseModel): + """ + Request model for creating Private Key JWT auth connections - inherits common settings and includes sensitive fields + """ + + name: str + provider: str + algorithm: typing.Optional[CreatePrivateKeyJwtRequestAlgorithm] = pydantic.Field(default=None) + """ + JWT signing algorithm + """ + + key_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Key ID (kid) for JWT header - useful for key rotation + """ + + issuer: str = pydantic.Field() + """ + JWT issuer (iss claim) + """ + + audience: str = pydantic.Field() + """ + JWT audience (aud claim) + """ + + subject: str = pydantic.Field() + """ + JWT subject (sub claim) + """ + + expiration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + Token expiration time in seconds + """ + + extra_params: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Additional custom claims to include in the JWT + """ + + secret_key: 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/data/src/elevenlabs/types/create_private_key_jwt_request_algorithm.py b/data/src/elevenlabs/types/create_private_key_jwt_request_algorithm.py new file mode 100644 index 0000000000000000000000000000000000000000..c61452ae7d06443a1528f199c521b47a3b37a9c8 --- /dev/null +++ b/data/src/elevenlabs/types/create_private_key_jwt_request_algorithm.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreatePrivateKeyJwtRequestAlgorithm = typing.Union[ + typing.Literal["HS256", "HS384", "HS512", "RS256", "RS384", "RS512"], typing.Any +] diff --git a/data/src/elevenlabs/types/create_procedure_request_model.py b/data/src/elevenlabs/types/create_procedure_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9d288e4fc6eaf4d8352932a0148b6cf406e64264 --- /dev/null +++ b/data/src/elevenlabs/types/create_procedure_request_model.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .procedure_type import ProcedureType + + +class CreateProcedureRequestModel(UncheckedBaseModel): + name: typing.Optional[str] = pydantic.Field(default=None) + """ + Procedure name + """ + + content: typing.Optional[str] = pydantic.Field(default=None) + """ + Initial procedure content + """ + + type: typing.Optional[ProcedureType] = pydantic.Field(default=None) + """ + Procedure type + """ + + trigger: typing.Optional[str] = pydantic.Field(default=None) + """ + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. Omit this field (or send null) to keep the stored trigger, which is empty on create. Send `""` to clear it. `description` is accepted as an alias. + """ + + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Procedure ID of the folder to create this procedure in, or null for root. + """ + + 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/data/src/elevenlabs/types/create_procedure_response_model.py b/data/src/elevenlabs/types/create_procedure_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f7579749eb34bb208eab2fa346c0a7f989481391 --- /dev/null +++ b/data/src/elevenlabs/types/create_procedure_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateProcedureResponseModel(UncheckedBaseModel): + procedure_id: str = pydantic.Field() + """ + ID of the created procedure + """ + + 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/data/src/elevenlabs/types/create_product_params.py b/data/src/elevenlabs/types/create_product_params.py new file mode 100644 index 0000000000000000000000000000000000000000..3ea6c18b9d9e8ed43b2c2cb5e099c5dd829b2c34 --- /dev/null +++ b/data/src/elevenlabs/types/create_product_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateProductParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_product"]] = 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/data/src/elevenlabs/types/create_product_quote_request_params.py b/data/src/elevenlabs/types/create_product_quote_request_params.py new file mode 100644 index 0000000000000000000000000000000000000000..d872900378bac3b32609c83e736e28ffaea726f1 --- /dev/null +++ b/data/src/elevenlabs/types/create_product_quote_request_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateProductQuoteRequestParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_product_quote_request"]] = 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/data/src/elevenlabs/types/create_pronunciation_dictionary_response_model.py b/data/src/elevenlabs/types/create_pronunciation_dictionary_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..161c448e5cbbda1c5c6801b995c437998d50176e --- /dev/null +++ b/data/src/elevenlabs/types/create_pronunciation_dictionary_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreatePronunciationDictionaryResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the create pronunciation dictionary request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/create_response_unit_test_request.py b/data/src/elevenlabs/types/create_response_unit_test_request.py new file mode 100644 index 0000000000000000000000000000000000000000..ccce57b2b82cc2455843048fb398ac0500e06e7f --- /dev/null +++ b/data/src/elevenlabs/types/create_response_unit_test_request.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_failure_response_example import AgentFailureResponseExample +from .agent_successful_response_example import AgentSuccessfulResponseExample +from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from .conversation_initiation_source import ConversationInitiationSource +from .test_from_conversation_metadata_input import TestFromConversationMetadataInput + + +class CreateResponseUnitTestRequest(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + success_condition: typing.Optional[str] = pydantic.Field(default=None) + """ + A prompt that evaluates whether the agent's response is successful. Should return True or False. + """ + + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = pydantic.Field(default=None) + """ + Non-empty list of example responses that should be considered successful + """ + + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = pydantic.Field(default=None) + """ + Non-empty list of example responses that should be considered failures + """ + + name: str + parent_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder. If not provided, the test will be created at the root level. + """ + + 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 + + +update_forward_refs(CreateResponseUnitTestRequest) diff --git a/data/src/elevenlabs/types/create_secret_environment_variable_request.py b/data/src/elevenlabs/types/create_secret_environment_variable_request.py new file mode 100644 index 0000000000000000000000000000000000000000..fe32ebe28bdff01e181df3d228ac9441ba26c18c --- /dev/null +++ b/data/src/elevenlabs/types/create_secret_environment_variable_request.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .environment_variable_secret_value_request import EnvironmentVariableSecretValueRequest + + +class CreateSecretEnvironmentVariableRequest(UncheckedBaseModel): + label: str = pydantic.Field() + """ + Unique label for the environment variable. + """ + + values: typing.Dict[str, EnvironmentVariableSecretValueRequest] = pydantic.Field() + """ + Environment-specific secret references. Must include 'production' key. + """ + + 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/data/src/elevenlabs/types/create_service_params.py b/data/src/elevenlabs/types/create_service_params.py new file mode 100644 index 0000000000000000000000000000000000000000..1d0f18d5e83d830f02bfbf84c484c76724dd8f11 --- /dev/null +++ b/data/src/elevenlabs/types/create_service_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateServiceParams(UncheckedBaseModel): + """ + Create a new service (classic, rental, or group) in the system. + """ + + smb_tool_type: typing.Optional[typing.Literal["create_service"]] = 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/data/src/elevenlabs/types/create_service_quote_request_params.py b/data/src/elevenlabs/types/create_service_quote_request_params.py new file mode 100644 index 0000000000000000000000000000000000000000..5a39ff934fc0d053f09f59996e2c6c45ee567ed6 --- /dev/null +++ b/data/src/elevenlabs/types/create_service_quote_request_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateServiceQuoteRequestParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_service_quote_request"]] = 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/data/src/elevenlabs/types/create_simulation_test_request.py b/data/src/elevenlabs/types/create_simulation_test_request.py new file mode 100644 index 0000000000000000000000000000000000000000..d4171b150280f3e37f24ba939589b42d1d7b242c --- /dev/null +++ b/data/src/elevenlabs/types/create_simulation_test_request.py @@ -0,0 +1,103 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from .conversation_initiation_source import ConversationInitiationSource +from .llm import Llm +from .simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from .test_from_conversation_metadata_input import TestFromConversationMetadataInput +from .tool_response_mock_config_input import ToolResponseMockConfigInput + + +class CreateSimulationTestRequest(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + success_condition: typing.Optional[str] = pydantic.Field(default=None) + """ + Deprecated legacy single success criterion. Use success_conditions instead. At least one of success_condition or success_conditions is required. + """ + + success_conditions: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of prompts that evaluate whether the simulation was successful. If provided, all criteria are evaluated and merged into a final result. Capped at the maximum number of evaluation criteria. + """ + + simulation_scenario: typing.Optional[str] = pydantic.Field(default=None) + """ + Description of the simulation scenario and user persona for simulation tests. + """ + + simulation_max_turns: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of conversation turns for simulation tests. + """ + + simulation_environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to use when running this simulation test. If not provided, defaults to 'production'. + """ + + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = pydantic.Field(default=None) + """ + Configuration for which tools to mock and fallback behavior. + """ + + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigInput]]] = pydantic.Field( + default=None + ) + """ + Test-specific response mocks, keyed by tool ID. Applied ahead of the tool's shared mocks and only within this test. Only take effect for tools that are mocked (see tool_mock_config). + """ + + evaluation_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model to use for evaluating simulation results. + """ + + simulated_user_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model for the simulated user. + """ + + name: str + parent_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder. If not provided, the test will be created at the root level. + """ + + 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 + + +update_forward_refs(CreateSimulationTestRequest) diff --git a/data/src/elevenlabs/types/create_sip_trunk_phone_number_request.py b/data/src/elevenlabs/types/create_sip_trunk_phone_number_request.py new file mode 100644 index 0000000000000000000000000000000000000000..d98491f353ce999f633abb1c3a4a4fa5591cf2d9 --- /dev/null +++ b/data/src/elevenlabs/types/create_sip_trunk_phone_number_request.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .inbound_sip_trunk_config_request_model import InboundSipTrunkConfigRequestModel +from .outbound_sip_trunk_config_request_model import OutboundSipTrunkConfigRequestModel + + +class CreateSipTrunkPhoneNumberRequest(UncheckedBaseModel): + phone_number: str = pydantic.Field() + """ + Phone number + """ + + label: str = pydantic.Field() + """ + Label for the phone number + """ + + supports_inbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports inbound calls + """ + + supports_outbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls + """ + + agent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Agent ID to assign the phone number to + """ + + inbound_trunk_config: typing.Optional[InboundSipTrunkConfigRequestModel] = None + outbound_trunk_config: typing.Optional[OutboundSipTrunkConfigRequestModel] = 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/data/src/elevenlabs/types/create_staff_params.py b/data/src/elevenlabs/types/create_staff_params.py new file mode 100644 index 0000000000000000000000000000000000000000..32cfada4268fe104597e5f9d1654e0def0acc470 --- /dev/null +++ b/data/src/elevenlabs/types/create_staff_params.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateStaffParams(UncheckedBaseModel): + """ + Create a new staff member in the system. + """ + + smb_tool_type: typing.Optional[typing.Literal["create_staff"]] = None + per_resource_timezones: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to offer a working_hours timezone, set from the workspace's enable_per_resource_timezones. While that is off every staff member uses the workspace timezone, so the key is not offered. + """ + + 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/data/src/elevenlabs/types/create_string_environment_variable_request.py b/data/src/elevenlabs/types/create_string_environment_variable_request.py new file mode 100644 index 0000000000000000000000000000000000000000..b54dcf7f96813585caaba73faca093c5048925ba --- /dev/null +++ b/data/src/elevenlabs/types/create_string_environment_variable_request.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateStringEnvironmentVariableRequest(UncheckedBaseModel): + label: str = pydantic.Field() + """ + Unique label for the environment variable. + """ + + values: typing.Dict[str, str] = pydantic.Field() + """ + Environment-specific values. Must include 'production' key. + """ + + 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/data/src/elevenlabs/types/create_tool_call_unit_test_request.py b/data/src/elevenlabs/types/create_tool_call_unit_test_request.py new file mode 100644 index 0000000000000000000000000000000000000000..211ddc092d43fee649061c537f5ddc922a20ce4c --- /dev/null +++ b/data/src/elevenlabs/types/create_tool_call_unit_test_request.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from .conversation_initiation_source import ConversationInitiationSource +from .test_from_conversation_metadata_input import TestFromConversationMetadataInput +from .unit_test_tool_call_evaluation_model_input import UnitTestToolCallEvaluationModelInput + + +class CreateToolCallUnitTestRequest(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelInput] = pydantic.Field(default=None) + """ + How to evaluate the agent's tool call (if any). If empty, the tool call is not evaluated. + """ + + check_any_tool_matches: typing.Optional[bool] = pydantic.Field(default=None) + """ + If set to True this test will pass if any tool call returned by the LLM matches the criteria. Otherwise it will fail if more than one tool is returned by the agent. + """ + + name: str + parent_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder. If not provided, the test will be created at the root level. + """ + + 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 + + +update_forward_refs(CreateToolCallUnitTestRequest) diff --git a/data/src/elevenlabs/types/create_transcript_request.py b/data/src/elevenlabs/types/create_transcript_request.py new file mode 100644 index 0000000000000000000000000000000000000000..9b7c4ae188e41aebb1e28538d1db0e38b21eb474 --- /dev/null +++ b/data/src/elevenlabs/types/create_transcript_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreateTranscriptRequest = typing.Any diff --git a/data/src/elevenlabs/types/create_transfer_rule_params.py b/data/src/elevenlabs/types/create_transfer_rule_params.py new file mode 100644 index 0000000000000000000000000000000000000000..12224ec83d24ea1812b89a3c188fefc039d6c9fe --- /dev/null +++ b/data/src/elevenlabs/types/create_transfer_rule_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CreateTransferRuleParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["create_transfer_rule"]] = None + post_dial_digits_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to offer the post_dial_digits parameter, set from the receptionists' enable_play_keypad_touch_tone_tool config. Digits saved while that is off are dropped when the receptionist is built, so the parameter is hidden rather than accepted and ignored. + """ + + 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/data/src/elevenlabs/types/create_twilio_phone_number_request.py b/data/src/elevenlabs/types/create_twilio_phone_number_request.py new file mode 100644 index 0000000000000000000000000000000000000000..735f952d3107472d7fb2791787902fbe43013950 --- /dev/null +++ b/data/src/elevenlabs/types/create_twilio_phone_number_request.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .region_config_request import RegionConfigRequest + + +class CreateTwilioPhoneNumberRequest(UncheckedBaseModel): + phone_number: str = pydantic.Field() + """ + Phone number + """ + + label: str = pydantic.Field() + """ + Label for the phone number + """ + + supports_inbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports inbound calls + """ + + supports_outbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls + """ + + agent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Agent ID to assign the phone number to + """ + + sid: str = pydantic.Field() + """ + Twilio Account SID (starts with `AC`) or API Key SID (starts with `SK`) + """ + + token: str = pydantic.Field() + """ + Secret paired with `sid`: the Account Auth Token for an Account SID, or the API Key Secret for an API Key SID + """ + + account_auth_token: typing.Optional[str] = pydantic.Field(default=None) + """ + Twilio Account Auth Token, required for API Key imports to validate inbound webhook signatures + """ + + region_config: typing.Optional[RegionConfigRequest] = pydantic.Field(default=None) + """ + Twilio Additional Region Configuration + """ + + enable_sms: typing.Optional[bool] = pydantic.Field(default=None) + """ + Route inbound SMS to ElevenLabs. On by default; set to false to skip SMS configuration for numbers that don't support it. + """ + + 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/data/src/elevenlabs/types/creatify_aurora_request.py b/data/src/elevenlabs/types/creatify_aurora_request.py new file mode 100644 index 0000000000000000000000000000000000000000..ec687a136d433251123ad2522e457ed57021b550 --- /dev/null +++ b/data/src/elevenlabs/types/creatify_aurora_request.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_reference import AudioReference +from .creatify_aurora_request_resolution import CreatifyAuroraRequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class CreatifyAuroraRequest(UncheckedBaseModel): + """ + Request body for the Creatify Aurora lipsync video model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + image: ImageReference = pydantic.Field() + """ + The image of the character to animate. + """ + + audio: AudioReference = pydantic.Field() + """ + The speech audio to drive the character's lip movements. + """ + + resolution: typing.Optional[CreatifyAuroraRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output video. + """ + + guidance_scale: typing.Optional[float] = pydantic.Field(default=None) + """ + How strongly the generation adheres to the input image. Omit to use the model's default. + """ + + audio_guidance_scale: typing.Optional[float] = pydantic.Field(default=None) + """ + How strongly the lip movements adhere to the audio. Omit to use the model's default. + """ + + 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/data/src/elevenlabs/types/creatify_aurora_request_resolution.py b/data/src/elevenlabs/types/creatify_aurora_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..5786ede447ec934dec165792a5fe191e51cf66bb --- /dev/null +++ b/data/src/elevenlabs/types/creatify_aurora_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CreatifyAuroraRequestResolution = typing.Union[typing.Literal["480p", "720p"], typing.Any] diff --git a/data/src/elevenlabs/types/criteria_scoring_mode.py b/data/src/elevenlabs/types/criteria_scoring_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..d036773ab66215f0a768d7fd7db5cd7c27a827b3 --- /dev/null +++ b/data/src/elevenlabs/types/criteria_scoring_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CriteriaScoringMode = typing.Union[typing.Literal["binary", "numeric_uniform"], typing.Any] diff --git a/data/src/elevenlabs/types/cue_options_request.py b/data/src/elevenlabs/types/cue_options_request.py new file mode 100644 index 0000000000000000000000000000000000000000..a5989350be1bbbaf4e73a2ec8bec0b9f58a5bbcf --- /dev/null +++ b/data/src/elevenlabs/types/cue_options_request.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CueOptionsRequest(UncheckedBaseModel): + min_duration_ms: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum duration of each cue in milliseconds. + """ + + max_duration_ms: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum duration of each cue in milliseconds. + """ + + max_lines_per_cue: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of lines per cue. + """ + + max_chars_per_line: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of characters per line in a cue. + """ + + max_chars_per_s: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum characters per second reading speed. If not set, no reading speed limit is applied. + """ + + min_gap_between_cues_frames: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum gap between consecutive cues in frames. If not set, no minimum gap is enforced. + """ + + 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/data/src/elevenlabs/types/currency.py b/data/src/elevenlabs/types/currency.py new file mode 100644 index 0000000000000000000000000000000000000000..6f2cdd4ef64a0cf559aaefd64cb3cdc31065ee53 --- /dev/null +++ b/data/src/elevenlabs/types/currency.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Currency = typing.Union[typing.Literal["usd", "eur", "inr", "pln", "gbp"], typing.Any] diff --git a/data/src/elevenlabs/types/custom_guardrail_config.py b/data/src/elevenlabs/types/custom_guardrail_config.py new file mode 100644 index 0000000000000000000000000000000000000000..7833707d8bd16f80d3dca6b56aa0ee4bb29856d6 --- /dev/null +++ b/data/src/elevenlabs/types/custom_guardrail_config.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .custom_guardrail_config_model import CustomGuardrailConfigModel +from .custom_guardrail_config_trigger_action import CustomGuardrailConfigTriggerAction +from .guardrail_execution_mode import GuardrailExecutionMode + + +class CustomGuardrailConfig(UncheckedBaseModel): + """ + Single custom guardrail configuration + """ + + is_enabled: typing.Optional[bool] = None + name: str = pydantic.Field() + """ + User-facing name for this guardrail + """ + + prompt: str = pydantic.Field() + """ + Instruction describing what to block, e.g. 'don't talk about politics' + """ + + execution_mode: typing.Optional[GuardrailExecutionMode] = None + model: typing.Optional[CustomGuardrailConfigModel] = pydantic.Field(default=None) + """ + LLM model to use for custom guardrail evaluation + """ + + history_message_count: typing.Optional[int] = pydantic.Field(default=None) + """ + How much recent history the guardrail sees before the reply it evaluates, counted in user messages (the agent replies between them are included too). The guardrail always gets a single transcript ending in the evaluated reply, marked 'AGENT [current reply]:'. 0 (default) adds no prior history (just that line); 1 adds the latest user message onward. + """ + + trigger_action: typing.Optional[CustomGuardrailConfigTriggerAction] = None + evaluate_full_response_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + Evaluate once against the complete non-TTS response instead of cumulative partials. Requires blocking mode. + """ + + 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/data/src/elevenlabs/types/custom_guardrail_config_model.py b/data/src/elevenlabs/types/custom_guardrail_config_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c4d5cddc145503153c1327d54b99cdab2392c03d --- /dev/null +++ b/data/src/elevenlabs/types/custom_guardrail_config_model.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CustomGuardrailConfigModel = typing.Union[ + typing.Literal[ + "gemini-2.5-flash-lite", + "gemini-2.5-flash", + "gemini-3.1-flash-lite", + "gemini-3.5-flash", + "claude-haiku-4-5", + "claude-sonnet-4-6", + "gpt-5.4-nano", + "gpt-5.4-mini", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/custom_guardrail_config_trigger_action.py b/data/src/elevenlabs/types/custom_guardrail_config_trigger_action.py new file mode 100644 index 0000000000000000000000000000000000000000..7cbca60db309570a61ff98f422c1b00f8c7121e7 --- /dev/null +++ b/data/src/elevenlabs/types/custom_guardrail_config_trigger_action.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class CustomGuardrailConfigTriggerAction_EndCall(UncheckedBaseModel): + type: typing.Literal["end_call"] = "end_call" + + 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 + + +class CustomGuardrailConfigTriggerAction_Retry(UncheckedBaseModel): + type: typing.Literal["retry"] = "retry" + feedback: 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 + + +CustomGuardrailConfigTriggerAction = typing_extensions.Annotated[ + typing.Union[CustomGuardrailConfigTriggerAction_EndCall, CustomGuardrailConfigTriggerAction_Retry], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/custom_guardrail_input.py b/data/src/elevenlabs/types/custom_guardrail_input.py new file mode 100644 index 0000000000000000000000000000000000000000..d11053a14b65ddb1808a476d797b7a1b2019ffbc --- /dev/null +++ b/data/src/elevenlabs/types/custom_guardrail_input.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .custom_guardrails_config_input import CustomGuardrailsConfigInput + + +class CustomGuardrailInput(UncheckedBaseModel): + """ + Container for custom guardrails, matching ModerationGuardrail pattern + """ + + config: typing.Optional[CustomGuardrailsConfigInput] = 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/data/src/elevenlabs/types/custom_guardrail_output.py b/data/src/elevenlabs/types/custom_guardrail_output.py new file mode 100644 index 0000000000000000000000000000000000000000..679d3976a19d3636bd5a3e42925a25c46471b065 --- /dev/null +++ b/data/src/elevenlabs/types/custom_guardrail_output.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .custom_guardrails_config_output import CustomGuardrailsConfigOutput + + +class CustomGuardrailOutput(UncheckedBaseModel): + """ + Container for custom guardrails, matching ModerationGuardrail pattern + """ + + config: typing.Optional[CustomGuardrailsConfigOutput] = 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/data/src/elevenlabs/types/custom_guardrails_config_input.py b/data/src/elevenlabs/types/custom_guardrails_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..6b20e370b703fb111bd6c131688a351870777f96 --- /dev/null +++ b/data/src/elevenlabs/types/custom_guardrails_config_input.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .custom_guardrail_config import CustomGuardrailConfig + + +class CustomGuardrailsConfigInput(UncheckedBaseModel): + """ + Config container for custom guardrails list + """ + + configs: typing.Optional[typing.List[CustomGuardrailConfig]] = 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/data/src/elevenlabs/types/custom_guardrails_config_output.py b/data/src/elevenlabs/types/custom_guardrails_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..beb7a6dcf1c4d60d06f3a399870e876caf9634f7 --- /dev/null +++ b/data/src/elevenlabs/types/custom_guardrails_config_output.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .custom_guardrail_config import CustomGuardrailConfig + + +class CustomGuardrailsConfigOutput(UncheckedBaseModel): + """ + Config container for custom guardrails list + """ + + configs: typing.Optional[typing.List[CustomGuardrailConfig]] = 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/data/src/elevenlabs/types/custom_header_auth_response.py b/data/src/elevenlabs/types/custom_header_auth_response.py new file mode 100644 index 0000000000000000000000000000000000000000..bc3a6a14f1199905935dad80e9b6b6ee0c041e16 --- /dev/null +++ b/data/src/elevenlabs/types/custom_header_auth_response.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class CustomHeaderAuthResponse(UncheckedBaseModel): + """ + Response model for Custom Header Auth auth connections + """ + + name: str + provider: str + header_name: str = pydantic.Field() + """ + The name of the header to use for authentication (e.g., 'x-api-key') + """ + + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/custom_llm.py b/data/src/elevenlabs/types/custom_llm.py new file mode 100644 index 0000000000000000000000000000000000000000..be888cb5949736ea98218872a0015cba8b7231b7 --- /dev/null +++ b/data/src/elevenlabs/types/custom_llm.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .custom_llm_api_key import CustomLlmApiKey +from .custom_llm_auth_connection import CustomLlmAuthConnection +from .custom_llm_request_headers_value import CustomLlmRequestHeadersValue +from .custom_llmapi_type import CustomLlmapiType + + +class CustomLlm(UncheckedBaseModel): + url: str = pydantic.Field() + """ + The URL of the Chat Completions compatible endpoint + """ + + model_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The model ID to be used if URL serves multiple models + """ + + api_key: typing.Optional[CustomLlmApiKey] = pydantic.Field(default=None) + """ + The API key for authentication. Either a workspace secret reference {'secret_id': '...'} or an environment variable reference {'env_var_label': '...'}. + """ + + auth_connection: typing.Optional[CustomLlmAuthConnection] = pydantic.Field(default=None) + """ + Optional workspace auth connection for authentication. Only auth connections that produce an Authorization Bearer token are supported; Basic auth, mTLS, custom header, and URL secret auth connections are not supported. + """ + + request_headers: typing.Optional[typing.Dict[str, CustomLlmRequestHeadersValue]] = pydantic.Field(default=None) + """ + Headers that should be included in the request + """ + + api_version: typing.Optional[str] = pydantic.Field(default=None) + """ + The API version to use for the request + """ + + api_type: typing.Optional[CustomLlmapiType] = pydantic.Field(default=None) + """ + The API type to use (chat_completions, responses or websocket) + """ + + 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/data/src/elevenlabs/types/custom_llm_api_key.py b/data/src/elevenlabs/types/custom_llm_api_key.py new file mode 100644 index 0000000000000000000000000000000000000000..dbaea2704d22b905d09a9e2b34dc818eec5b02f6 --- /dev/null +++ b/data/src/elevenlabs/types/custom_llm_api_key.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_env_var_locator import ConvAiEnvVarLocator +from .conv_ai_secret_locator import ConvAiSecretLocator + +CustomLlmApiKey = typing.Union[ConvAiSecretLocator, ConvAiEnvVarLocator] diff --git a/data/src/elevenlabs/types/custom_llm_auth_connection.py b/data/src/elevenlabs/types/custom_llm_auth_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..57264ae51d2ce34a9f0d8aa6b251fae93a15fe03 --- /dev/null +++ b/data/src/elevenlabs/types/custom_llm_auth_connection.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .auth_connection_locator import AuthConnectionLocator +from .environment_auth_connection_locator import EnvironmentAuthConnectionLocator + +CustomLlmAuthConnection = typing.Union[AuthConnectionLocator, EnvironmentAuthConnectionLocator] diff --git a/data/src/elevenlabs/types/custom_llm_request_headers_value.py b/data/src/elevenlabs/types/custom_llm_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..a06166c534ad818e7621cc1b1900587ec77357b3 --- /dev/null +++ b/data/src/elevenlabs/types/custom_llm_request_headers_value.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable +from .conv_ai_env_var_locator import ConvAiEnvVarLocator +from .conv_ai_secret_locator import ConvAiSecretLocator + +CustomLlmRequestHeadersValue = typing.Union[str, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator] diff --git a/data/src/elevenlabs/types/custom_llmapi_type.py b/data/src/elevenlabs/types/custom_llmapi_type.py new file mode 100644 index 0000000000000000000000000000000000000000..cb950b668f3d8ca2c53eb4744f61e7dc3e85ba7e --- /dev/null +++ b/data/src/elevenlabs/types/custom_llmapi_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CustomLlmapiType = typing.Union[typing.Literal["chat_completions", "responses", "websocket"], typing.Any] diff --git a/data/src/elevenlabs/types/custom_sip_header.py b/data/src/elevenlabs/types/custom_sip_header.py new file mode 100644 index 0000000000000000000000000000000000000000..8ee6fc1632671024a897ada65c374e545981513a --- /dev/null +++ b/data/src/elevenlabs/types/custom_sip_header.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CustomSipHeader(UncheckedBaseModel): + """ + Custom SIP header for phone transfers with a static (validated) value. + """ + + key: str = pydantic.Field() + """ + The SIP header name (e.g., 'X-Customer-ID') + """ + + value: str = pydantic.Field() + """ + The header value + """ + + 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/data/src/elevenlabs/types/custom_sip_header_with_dynamic_variable.py b/data/src/elevenlabs/types/custom_sip_header_with_dynamic_variable.py new file mode 100644 index 0000000000000000000000000000000000000000..47d6859f05e579ea004d3d2b6bee403fd1d20a9c --- /dev/null +++ b/data/src/elevenlabs/types/custom_sip_header_with_dynamic_variable.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class CustomSipHeaderWithDynamicVariable(UncheckedBaseModel): + """ + Custom SIP header for phone transfers with a dynamic variable reference. + The value is a variable name that will be resolved at runtime. + Value is not validated here since it will be substituted with actual value later. + """ + + value: str = pydantic.Field() + """ + The dynamic variable name to resolve + """ + + key: str = pydantic.Field() + """ + The SIP header name (e.g., 'X-Customer-ID') + """ + + 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/data/src/elevenlabs/types/dashboard_call_success_chart_model.py b/data/src/elevenlabs/types/dashboard_call_success_chart_model.py new file mode 100644 index 0000000000000000000000000000000000000000..37dba93b972258bea405ee6c86450c2326a1df15 --- /dev/null +++ b/data/src/elevenlabs/types/dashboard_call_success_chart_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DashboardCallSuccessChartModel(UncheckedBaseModel): + 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/data/src/elevenlabs/types/dashboard_criteria_chart_model.py b/data/src/elevenlabs/types/dashboard_criteria_chart_model.py new file mode 100644 index 0000000000000000000000000000000000000000..fc4a0d33ead0ad0a490397cac5558dbf0dffe773 --- /dev/null +++ b/data/src/elevenlabs/types/dashboard_criteria_chart_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DashboardCriteriaChartModel(UncheckedBaseModel): + name: str + criteria_id: 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/data/src/elevenlabs/types/dashboard_data_collection_chart_model.py b/data/src/elevenlabs/types/dashboard_data_collection_chart_model.py new file mode 100644 index 0000000000000000000000000000000000000000..80cc5305ccd866448208df12bfc766ce6e9f3c9b --- /dev/null +++ b/data/src/elevenlabs/types/dashboard_data_collection_chart_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DashboardDataCollectionChartModel(UncheckedBaseModel): + name: str + data_collection_id: 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/data/src/elevenlabs/types/data_collection_result_common_model.py b/data/src/elevenlabs/types/data_collection_result_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1bb4ed2417fb85055ae12d596c2ac11acb3f513c --- /dev/null +++ b/data/src/elevenlabs/types/data_collection_result_common_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .literal_json_schema_property import LiteralJsonSchemaProperty + + +class DataCollectionResultCommonModel(UncheckedBaseModel): + data_collection_id: str + name: typing.Optional[str] = None + value: typing.Optional[typing.Any] = None + json_schema: typing.Optional[LiteralJsonSchemaProperty] = None + rationale: 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/data/src/elevenlabs/types/default_sharing_group_config.py b/data/src/elevenlabs/types/default_sharing_group_config.py new file mode 100644 index 0000000000000000000000000000000000000000..bf5f402aff2b6f177bfd56c6a9c23b8f3da7dab9 --- /dev/null +++ b/data/src/elevenlabs/types/default_sharing_group_config.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .default_sharing_group_config_permission_level import DefaultSharingGroupConfigPermissionLevel + + +class DefaultSharingGroupConfig(UncheckedBaseModel): + group_id: str = pydantic.Field() + """ + The ID of the group to share with + """ + + permission_level: DefaultSharingGroupConfigPermissionLevel = pydantic.Field() + """ + The permission level to grant to the group + """ + + 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/data/src/elevenlabs/types/default_sharing_group_config_permission_level.py b/data/src/elevenlabs/types/default_sharing_group_config_permission_level.py new file mode 100644 index 0000000000000000000000000000000000000000..8b0950e890646f0e7b19c47948ad6624deb43b2d --- /dev/null +++ b/data/src/elevenlabs/types/default_sharing_group_config_permission_level.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DefaultSharingGroupConfigPermissionLevel = typing.Union[typing.Literal["admin", "editor", "viewer"], typing.Any] diff --git a/data/src/elevenlabs/types/default_sharing_group_response_model.py b/data/src/elevenlabs/types/default_sharing_group_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d44a15994862a738f98eb00aec6f03ed80230a77 --- /dev/null +++ b/data/src/elevenlabs/types/default_sharing_group_response_model.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .default_sharing_group_response_model_permission_level import DefaultSharingGroupResponseModelPermissionLevel +from .workspace_group_response_model import WorkspaceGroupResponseModel + + +class DefaultSharingGroupResponseModel(UncheckedBaseModel): + group: WorkspaceGroupResponseModel = pydantic.Field() + """ + The group to share with by default + """ + + permission_level: DefaultSharingGroupResponseModelPermissionLevel = pydantic.Field() + """ + The permission level to grant to the group + """ + + 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/data/src/elevenlabs/types/default_sharing_group_response_model_permission_level.py b/data/src/elevenlabs/types/default_sharing_group_response_model_permission_level.py new file mode 100644 index 0000000000000000000000000000000000000000..9d6c4ac218e05ee209faad52abb3f3c4a592156f --- /dev/null +++ b/data/src/elevenlabs/types/default_sharing_group_response_model_permission_level.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DefaultSharingGroupResponseModelPermissionLevel = typing.Union[typing.Literal["admin", "editor", "viewer"], typing.Any] diff --git a/data/src/elevenlabs/types/delete_agent_hold_audio_response_model.py b/data/src/elevenlabs/types/delete_agent_hold_audio_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8c6fdbb9c129d930006a7db81e58a3dd4d3073ab --- /dev/null +++ b/data/src/elevenlabs/types/delete_agent_hold_audio_response_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteAgentHoldAudioResponseModel(UncheckedBaseModel): + agent_id: 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/data/src/elevenlabs/types/delete_agent_procedure_params.py b/data/src/elevenlabs/types/delete_agent_procedure_params.py new file mode 100644 index 0000000000000000000000000000000000000000..c1539461cb9ef4207f78d3066baa62386515cfad --- /dev/null +++ b/data/src/elevenlabs/types/delete_agent_procedure_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteAgentProcedureParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["delete_agent_procedure"]] = 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/data/src/elevenlabs/types/delete_agent_rule_params.py b/data/src/elevenlabs/types/delete_agent_rule_params.py new file mode 100644 index 0000000000000000000000000000000000000000..a9ab145e5ccd95a4b2cf86e66fd1942d0b7aa0cd --- /dev/null +++ b/data/src/elevenlabs/types/delete_agent_rule_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteAgentRuleParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["delete_agent_rule"]] = 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/data/src/elevenlabs/types/delete_asset_params.py b/data/src/elevenlabs/types/delete_asset_params.py new file mode 100644 index 0000000000000000000000000000000000000000..c99f872d0fa601695ea86592c62bcc0553c69af3 --- /dev/null +++ b/data/src/elevenlabs/types/delete_asset_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteAssetParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["delete_asset"]] = 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/data/src/elevenlabs/types/delete_calendar_event_params.py b/data/src/elevenlabs/types/delete_calendar_event_params.py new file mode 100644 index 0000000000000000000000000000000000000000..809f79eb91d12797e6c57e20c3e6f27a875425ff --- /dev/null +++ b/data/src/elevenlabs/types/delete_calendar_event_params.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteCalendarEventParams(UncheckedBaseModel): + """ + Permanently remove a previously-cancelled calendar event. + + This delete tool is the irreversible follow-up to cancel_calendar_event. + The backend rejects the call (422) if the event hasn't been + cancelled yet, so the only safe path is cancel-then-delete. + """ + + smb_tool_type: typing.Optional[typing.Literal["delete_calendar_event"]] = 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/data/src/elevenlabs/types/delete_chapter_request.py b/data/src/elevenlabs/types/delete_chapter_request.py new file mode 100644 index 0000000000000000000000000000000000000000..732fdfabcfc29ba609d0416d0065247ec82ecf56 --- /dev/null +++ b/data/src/elevenlabs/types/delete_chapter_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeleteChapterRequest = typing.Any diff --git a/data/src/elevenlabs/types/delete_chapter_response_model.py b/data/src/elevenlabs/types/delete_chapter_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c04b5c43bbdd8b2590e8979eef4696e37b43f42f --- /dev/null +++ b/data/src/elevenlabs/types/delete_chapter_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteChapterResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the studio chapter deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_client_interaction_params.py b/data/src/elevenlabs/types/delete_client_interaction_params.py new file mode 100644 index 0000000000000000000000000000000000000000..2ec22b221ba66e11ae6d098dd69aedae017697b8 --- /dev/null +++ b/data/src/elevenlabs/types/delete_client_interaction_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteClientInteractionParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["delete_client_interaction"]] = 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/data/src/elevenlabs/types/delete_client_params.py b/data/src/elevenlabs/types/delete_client_params.py new file mode 100644 index 0000000000000000000000000000000000000000..63f786081b78645837f2d2ce5c68d4c798c2e522 --- /dev/null +++ b/data/src/elevenlabs/types/delete_client_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteClientParams(UncheckedBaseModel): + """ + Delete a client, cascading deletion of all their appointments first. + """ + + smb_tool_type: typing.Optional[typing.Literal["delete_client"]] = 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/data/src/elevenlabs/types/delete_dubbing_response_model.py b/data/src/elevenlabs/types/delete_dubbing_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..66b9d8aeb4e94e4a775c117c4c4b8b60ae284d3b --- /dev/null +++ b/data/src/elevenlabs/types/delete_dubbing_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteDubbingResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the dubbing project. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_group_session_params.py b/data/src/elevenlabs/types/delete_group_session_params.py new file mode 100644 index 0000000000000000000000000000000000000000..bc35cc4d9d90973ac6c9b6cf6771cb461736fc86 --- /dev/null +++ b/data/src/elevenlabs/types/delete_group_session_params.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteGroupSessionParams(UncheckedBaseModel): + """ + Permanently remove a previously-cancelled group session. + + Group analogue of ``delete_calendar_event``: cancel + (``cancel_group_session_for_all``) is the soft, history-preserving step; + this tool is the irreversible follow-up that drops the row from Mongo + and the staff Google Calendar entirely. The backend rejects the call + (422) if the session hasn't been cancelled yet, so the only safe path + is cancel-then-delete. + """ + + smb_tool_type: typing.Optional[typing.Literal["delete_group_session"]] = 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/data/src/elevenlabs/types/delete_history_item_response.py b/data/src/elevenlabs/types/delete_history_item_response.py new file mode 100644 index 0000000000000000000000000000000000000000..e3bae9199a19ec7e8bfbd24aec90d271c32d764d --- /dev/null +++ b/data/src/elevenlabs/types/delete_history_item_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteHistoryItemResponse(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with http code 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_holiday_params.py b/data/src/elevenlabs/types/delete_holiday_params.py new file mode 100644 index 0000000000000000000000000000000000000000..bb5f505dfd71215bf4ca391600723eb6d5314ae7 --- /dev/null +++ b/data/src/elevenlabs/types/delete_holiday_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteHolidayParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["delete_holiday"]] = 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/data/src/elevenlabs/types/delete_location_params.py b/data/src/elevenlabs/types/delete_location_params.py new file mode 100644 index 0000000000000000000000000000000000000000..a936f32e1931e39edaa0610c18b2dce4275b037b --- /dev/null +++ b/data/src/elevenlabs/types/delete_location_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteLocationParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["delete_location"]] = 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/data/src/elevenlabs/types/delete_product_params.py b/data/src/elevenlabs/types/delete_product_params.py new file mode 100644 index 0000000000000000000000000000000000000000..b73ff970d9c460f272b1705cf98dbcc019fa87ed --- /dev/null +++ b/data/src/elevenlabs/types/delete_product_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteProductParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["delete_product"]] = 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/data/src/elevenlabs/types/delete_project_request.py b/data/src/elevenlabs/types/delete_project_request.py new file mode 100644 index 0000000000000000000000000000000000000000..2fa7a30ed1d5f56c32e341c96f10e9421ed6a9fb --- /dev/null +++ b/data/src/elevenlabs/types/delete_project_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DeleteProjectRequest = typing.Any diff --git a/data/src/elevenlabs/types/delete_project_response_model.py b/data/src/elevenlabs/types/delete_project_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2f78d121d443201673b2fe0e10c377075d45b462 --- /dev/null +++ b/data/src/elevenlabs/types/delete_project_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteProjectResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the studio project deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_sample_response.py b/data/src/elevenlabs/types/delete_sample_response.py new file mode 100644 index 0000000000000000000000000000000000000000..28ea4d97182132ba506924a02121a81eb8bcf125 --- /dev/null +++ b/data/src/elevenlabs/types/delete_sample_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteSampleResponse(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the sample deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_service_params.py b/data/src/elevenlabs/types/delete_service_params.py new file mode 100644 index 0000000000000000000000000000000000000000..f5089124892b5534fcc76d9e7a9b223d835a94d4 --- /dev/null +++ b/data/src/elevenlabs/types/delete_service_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteServiceParams(UncheckedBaseModel): + """ + Delete an existing service from the system. + """ + + smb_tool_type: typing.Optional[typing.Literal["delete_service"]] = 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/data/src/elevenlabs/types/delete_staff_params.py b/data/src/elevenlabs/types/delete_staff_params.py new file mode 100644 index 0000000000000000000000000000000000000000..6d4283ecc2af967c1e7e71a73daece44a7f80e85 --- /dev/null +++ b/data/src/elevenlabs/types/delete_staff_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteStaffParams(UncheckedBaseModel): + """ + Delete an existing staff member from the system. + """ + + smb_tool_type: typing.Optional[typing.Literal["delete_staff"]] = 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/data/src/elevenlabs/types/delete_transfer_rule_params.py b/data/src/elevenlabs/types/delete_transfer_rule_params.py new file mode 100644 index 0000000000000000000000000000000000000000..18407db7f195a3be52ec69fa6dd45aaa2342a85a --- /dev/null +++ b/data/src/elevenlabs/types/delete_transfer_rule_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteTransferRuleParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["delete_transfer_rule"]] = 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/data/src/elevenlabs/types/delete_user_voice_collection_response_model.py b/data/src/elevenlabs/types/delete_user_voice_collection_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b8147d3b9a9287d608ae3b36b20ca4969c4cd279 --- /dev/null +++ b/data/src/elevenlabs/types/delete_user_voice_collection_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteUserVoiceCollectionResponseModel(UncheckedBaseModel): + collection_id: str = pydantic.Field() + """ + The ID of the deleted voice collection. + """ + + 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/data/src/elevenlabs/types/delete_voice_response_model.py b/data/src/elevenlabs/types/delete_voice_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4638fcd0e9ecaad3c0a625c17c0f5059c328e082 --- /dev/null +++ b/data/src/elevenlabs/types/delete_voice_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteVoiceResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the voice deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_voice_sample_response_model.py b/data/src/elevenlabs/types/delete_voice_sample_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6ffb2e42380618fb460a023a9af22b828f30bae5 --- /dev/null +++ b/data/src/elevenlabs/types/delete_voice_sample_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteVoiceSampleResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the voice sample deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_workspace_group_member_response_model.py b/data/src/elevenlabs/types/delete_workspace_group_member_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..aa51ea0fe66d3dc2d96036d4119a601a69867a1e --- /dev/null +++ b/data/src/elevenlabs/types/delete_workspace_group_member_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteWorkspaceGroupMemberResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the workspace group member deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_workspace_invite_response_model.py b/data/src/elevenlabs/types/delete_workspace_invite_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6976368c721b4ac9143eab007fe3b8cec3ea5696 --- /dev/null +++ b/data/src/elevenlabs/types/delete_workspace_invite_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteWorkspaceInviteResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the workspace invite deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/delete_workspace_webhook_response_model.py b/data/src/elevenlabs/types/delete_workspace_webhook_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..239c17a261040dcabd109f2a30596bac6d248d3c --- /dev/null +++ b/data/src/elevenlabs/types/delete_workspace_webhook_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeleteWorkspaceWebhookResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the workspace webhook deletion request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/deliverable_info.py b/data/src/elevenlabs/types/deliverable_info.py new file mode 100644 index 0000000000000000000000000000000000000000..6b6bb3c9d2c9bb5bf873ad3fb87dbd12153cc89d --- /dev/null +++ b/data/src/elevenlabs/types/deliverable_info.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeliverableInfo(UncheckedBaseModel): + signed_url: str = pydantic.Field() + """ + A time-limited URL to download the delivered file. + """ + + content_type: str = pydantic.Field() + """ + The MIME type of the delivered file (e.g. 'video/mp4'). + """ + + name: str = pydantic.Field() + """ + The name of the delivered file. + """ + + version: typing.Optional[int] = pydantic.Field(default=None) + """ + The version number of the deliverable. + """ + + 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/data/src/elevenlabs/types/dependent_available_agent_identifier.py b/data/src/elevenlabs/types/dependent_available_agent_identifier.py new file mode 100644 index 0000000000000000000000000000000000000000..645d87f10b96c2725df36fd50e054b1af4a6b41e --- /dev/null +++ b/data/src/elevenlabs/types/dependent_available_agent_identifier.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class DependentAvailableAgentIdentifier(UncheckedBaseModel): + referenced_resource_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + If the agent is a transitive dependent, contains IDs of the resources that the agent depends on directly. + """ + + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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/data/src/elevenlabs/types/dependent_available_agent_identifier_access_level.py b/data/src/elevenlabs/types/dependent_available_agent_identifier_access_level.py new file mode 100644 index 0000000000000000000000000000000000000000..24700ba33165ac8a223dd96ce5433d50ccbdafe8 --- /dev/null +++ b/data/src/elevenlabs/types/dependent_available_agent_identifier_access_level.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DependentAvailableAgentIdentifierAccessLevel = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/dependent_available_mcp_server_identifier.py b/data/src/elevenlabs/types/dependent_available_mcp_server_identifier.py new file mode 100644 index 0000000000000000000000000000000000000000..540bc56b574af9d29c4d8219c4068d50f777f02b --- /dev/null +++ b/data/src/elevenlabs/types/dependent_available_mcp_server_identifier.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dependent_available_mcp_server_identifier_access_level import DependentAvailableMcpServerIdentifierAccessLevel + + +class DependentAvailableMcpServerIdentifier(UncheckedBaseModel): + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableMcpServerIdentifierAccessLevel + + 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/data/src/elevenlabs/types/dependent_available_mcp_server_identifier_access_level.py b/data/src/elevenlabs/types/dependent_available_mcp_server_identifier_access_level.py new file mode 100644 index 0000000000000000000000000000000000000000..543a8cf922a66441cfe35a71e7f76ea9115f86ff --- /dev/null +++ b/data/src/elevenlabs/types/dependent_available_mcp_server_identifier_access_level.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DependentAvailableMcpServerIdentifierAccessLevel = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/dependent_available_tool_identifier.py b/data/src/elevenlabs/types/dependent_available_tool_identifier.py new file mode 100644 index 0000000000000000000000000000000000000000..9afa8207ea7cc04ad5cebbc88b214527190a9fea --- /dev/null +++ b/data/src/elevenlabs/types/dependent_available_tool_identifier.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dependent_available_tool_identifier_access_level import DependentAvailableToolIdentifierAccessLevel + + +class DependentAvailableToolIdentifier(UncheckedBaseModel): + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableToolIdentifierAccessLevel + + 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/data/src/elevenlabs/types/dependent_available_tool_identifier_access_level.py b/data/src/elevenlabs/types/dependent_available_tool_identifier_access_level.py new file mode 100644 index 0000000000000000000000000000000000000000..7a86c83203046b98bfe58f869d40955a1a37da94 --- /dev/null +++ b/data/src/elevenlabs/types/dependent_available_tool_identifier_access_level.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DependentAvailableToolIdentifierAccessLevel = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/dependent_branch_info.py b/data/src/elevenlabs/types/dependent_branch_info.py new file mode 100644 index 0000000000000000000000000000000000000000..62077f760bb009513fa2813d27fee402da98fea2 --- /dev/null +++ b/data/src/elevenlabs/types/dependent_branch_info.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DependentBranchInfo(UncheckedBaseModel): + agent_id: str + agent_name: str + branch_id: str + branch_name: str + is_main: bool + + 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/data/src/elevenlabs/types/dependent_integration_connection_identifier.py b/data/src/elevenlabs/types/dependent_integration_connection_identifier.py new file mode 100644 index 0000000000000000000000000000000000000000..81696cb30ca2aff77b8c34ce83ce1d65b48f5397 --- /dev/null +++ b/data/src/elevenlabs/types/dependent_integration_connection_identifier.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DependentIntegrationConnectionIdentifier(UncheckedBaseModel): + """ + Identifier for an integration connection that depends on an auth connection + """ + + id: str + 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/data/src/elevenlabs/types/dependent_phone_number_identifier.py b/data/src/elevenlabs/types/dependent_phone_number_identifier.py new file mode 100644 index 0000000000000000000000000000000000000000..5a9f4aeb5fc984dd6b1a8b820e481d51057e50b5 --- /dev/null +++ b/data/src/elevenlabs/types/dependent_phone_number_identifier.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .telephony_provider import TelephonyProvider + + +class DependentPhoneNumberIdentifier(UncheckedBaseModel): + phone_number_id: str + phone_number: str + label: str + provider: TelephonyProvider + + 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/data/src/elevenlabs/types/dependent_unknown_agent_identifier.py b/data/src/elevenlabs/types/dependent_unknown_agent_identifier.py new file mode 100644 index 0000000000000000000000000000000000000000..be92c0f23c9057332ace43f85da2ee9b243a4bfa --- /dev/null +++ b/data/src/elevenlabs/types/dependent_unknown_agent_identifier.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DependentUnknownAgentIdentifier(UncheckedBaseModel): + """ + A model that represents an agent dependent on a knowledge base/tools + to which the user has no direct access. + """ + + referenced_resource_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + If the agent is a transitive dependent, contains IDs of the resources that the agent depends on directly. + """ + + id: 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/data/src/elevenlabs/types/dependent_unknown_mcp_server_identifier.py b/data/src/elevenlabs/types/dependent_unknown_mcp_server_identifier.py new file mode 100644 index 0000000000000000000000000000000000000000..c883346c3ec8103555a19ec9ea3c46bb8aa0d5b7 --- /dev/null +++ b/data/src/elevenlabs/types/dependent_unknown_mcp_server_identifier.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DependentUnknownMcpServerIdentifier(UncheckedBaseModel): + id: 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/data/src/elevenlabs/types/dependent_unknown_tool_identifier.py b/data/src/elevenlabs/types/dependent_unknown_tool_identifier.py new file mode 100644 index 0000000000000000000000000000000000000000..1398e1f3dff879789578a08faefcaadc292ee39f --- /dev/null +++ b/data/src/elevenlabs/types/dependent_unknown_tool_identifier.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DependentUnknownToolIdentifier(UncheckedBaseModel): + """ + A model that represents an tool dependent on a knowledge base/tools + to which the user has no direct access. + """ + + id: 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/data/src/elevenlabs/types/detailed_music_response.py b/data/src/elevenlabs/types/detailed_music_response.py new file mode 100644 index 0000000000000000000000000000000000000000..f228278de295d00b6ae66a6d24fcbcf5c3338b66 --- /dev/null +++ b/data/src/elevenlabs/types/detailed_music_response.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .detailed_music_response_composition_plan import DetailedMusicResponseCompositionPlan +from .song_metadata import SongMetadata +from .word_timestamp import WordTimestamp + + +class DetailedMusicResponse(UncheckedBaseModel): + """ + Response model for structured music generation endpoint + """ + + composition_plan: DetailedMusicResponseCompositionPlan = pydantic.Field() + """ + The composition plan used to generate the song + """ + + song_metadata: SongMetadata = pydantic.Field() + """ + The metadata of the generated song + """ + + words_timestamps: typing.Optional[typing.List[WordTimestamp]] = pydantic.Field(default=None) + """ + The timestamps of the words in the generated song + """ + + waveform_visual: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + A low-resolution waveform of the generated song, for showing a preview of it. Holds 4 values per second of audio, from -1000 to 1000. Stereo is mixed down to a single channel. Only present if `with_waveform_visual` was True in the request body. + """ + + 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/data/src/elevenlabs/types/detailed_music_response_composition_plan.py b/data/src/elevenlabs/types/detailed_music_response_composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..bde83be0154d44e7df17c3e2e55717834df27487 --- /dev/null +++ b/data/src/elevenlabs/types/detailed_music_response_composition_plan.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .composition_plan import CompositionPlan +from .music_prompt import MusicPrompt + +DetailedMusicResponseCompositionPlan = typing.Union[MusicPrompt, CompositionPlan] diff --git a/data/src/elevenlabs/types/detected_entity.py b/data/src/elevenlabs/types/detected_entity.py new file mode 100644 index 0000000000000000000000000000000000000000..cee866bb41e97db8458fef8466960fbe1f9a03b3 --- /dev/null +++ b/data/src/elevenlabs/types/detected_entity.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DetectedEntity(UncheckedBaseModel): + """ + An entity detected within transcribed text. + """ + + text: str = pydantic.Field() + """ + The text that was identified as an entity. + """ + + entity_type: str = pydantic.Field() + """ + The type of entity detected (e.g., 'credit_card', 'email_address', 'person_name'). + """ + + start_char: int = pydantic.Field() + """ + Start character position in the transcript text. + """ + + end_char: int = pydantic.Field() + """ + End character position in the transcript text. + """ + + 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/data/src/elevenlabs/types/device_model.py b/data/src/elevenlabs/types/device_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2b98d50b24f89dfc21c8d22cfc4eecb72f01d215 --- /dev/null +++ b/data/src/elevenlabs/types/device_model.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DeviceModel(UncheckedBaseModel): + """ + Device information. + + Spec: https://schema.ocsf.io/1.6.0/objects/device + """ + + ip: typing.Optional[str] = pydantic.Field(default=None) + """ + IP address + """ + + hostname: typing.Optional[str] = pydantic.Field(default=None) + """ + Device hostname + """ + + type_id: typing.Optional[int] = pydantic.Field(default=None) + """ + Device type ID (99 = Unknown) + """ + + 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/data/src/elevenlabs/types/dialogue_input.py b/data/src/elevenlabs/types/dialogue_input.py new file mode 100644 index 0000000000000000000000000000000000000000..901f394a89d6d8f64de61e7ec1b9309a475b0d6a --- /dev/null +++ b/data/src/elevenlabs/types/dialogue_input.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DialogueInput(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text to be converted into speech. + """ + + voice_id: str = pydantic.Field() + """ + The ID of the voice to be used for the generation. + """ + + 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/data/src/elevenlabs/types/dialogue_input_response_model.py b/data/src/elevenlabs/types/dialogue_input_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f219bdcb0dfc611e7087af9c7b392e5e8d32d872 --- /dev/null +++ b/data/src/elevenlabs/types/dialogue_input_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DialogueInputResponseModel(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text of the dialogue input line. + """ + + voice_id: str = pydantic.Field() + """ + The ID of the voice used for this dialogue input line. + """ + + voice_name: str = pydantic.Field() + """ + The name of the voice used for this dialogue input line. + """ + + 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/data/src/elevenlabs/types/dialogue_text_alignment.py b/data/src/elevenlabs/types/dialogue_text_alignment.py new file mode 100644 index 0000000000000000000000000000000000000000..b60329712aa951c1efbee8f79ee5dcfa3c1d2af7 --- /dev/null +++ b/data/src/elevenlabs/types/dialogue_text_alignment.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DialogueTextAlignment(UncheckedBaseModel): + """ + Character-level alignment data (field names use snake_case in JSON). + """ + + chars: typing.Optional[typing.List[str]] = None + char_start_times_ms: typing.Optional[typing.List[int]] = None + char_durations_ms: typing.Optional[typing.List[int]] = 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/data/src/elevenlabs/types/direct_publishing_read_response_model.py b/data/src/elevenlabs/types/direct_publishing_read_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e30cfeca602e451cb97d5db6f58e6c682830617e --- /dev/null +++ b/data/src/elevenlabs/types/direct_publishing_read_response_model.py @@ -0,0 +1,82 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .contributor import Contributor +from .direct_publishing_read_response_model_display_mode import DirectPublishingReadResponseModelDisplayMode +from .direct_publishing_read_response_model_genre_item import DirectPublishingReadResponseModelGenreItem +from .direct_publishing_read_response_model_payout_type import DirectPublishingReadResponseModelPayoutType +from .direct_publishing_read_response_model_target_audience import DirectPublishingReadResponseModelTargetAudience +from .preview_audio_db_model import PreviewAudioDbModel +from .read_legal_terms import ReadLegalTerms +from .read_metadata_chapter_db_model import ReadMetadataChapterDbModel +from .review_response_model import ReviewResponseModel +from .sample_config_db_model import SampleConfigDbModel + + +class DirectPublishingReadResponseModel(UncheckedBaseModel): + read_id: str + created_at_unix: int + updated_at_unix: int + word_count: int + char_count: int + chapters: typing.List[ReadMetadataChapterDbModel] + title: typing.Optional[str] = None + author: typing.Optional[str] = None + description: typing.Optional[str] = None + article_image_url: typing.Optional[str] = None + language: typing.Optional[str] = None + locale: typing.Optional[str] = None + display_mode: typing.Optional[DirectPublishingReadResponseModelDisplayMode] = None + genre: typing.Optional[typing.List[DirectPublishingReadResponseModelGenreItem]] = None + fiction: typing.Optional[str] = None + content_type: typing.Optional[str] = None + original_file_type: typing.Optional[str] = None + target_audience: typing.Optional[DirectPublishingReadResponseModelTargetAudience] = None + mature_content: typing.Optional[bool] = None + safesearch_adult: typing.Optional[bool] = None + origin: typing.Optional[str] = None + publication_date: typing.Optional[str] = None + isbn: typing.Optional[str] = None + ean: typing.Optional[str] = None + legal_terms: typing.Optional[ReadLegalTerms] = None + content_guidelines_terms: typing.Optional[ReadLegalTerms] = None + last_updated_from_project_unix: typing.Optional[int] = None + publishing_project_id: typing.Optional[str] = None + publishing_state: typing.Optional[str] = None + publisher_profile_id: typing.Optional[str] = None + quality_score: typing.Optional[int] = None + publisher: typing.Optional[str] = None + copyright: typing.Optional[str] = None + subtitle: typing.Optional[str] = None + distribution_territories: typing.Optional[typing.List[str]] = None + edition: typing.Optional[str] = None + contributors: typing.Optional[typing.List[Contributor]] = None + payout_type: typing.Optional[DirectPublishingReadResponseModelPayoutType] = None + list_price: typing.Optional[float] = None + currency: typing.Optional[typing.Literal["usd"]] = None + original_audio_project_export_id: typing.Optional[str] = None + original_audio_document_id: typing.Optional[str] = None + series_id: typing.Optional[str] = None + volume: typing.Optional[int] = None + published_at_unix: typing.Optional[int] = None + read_slug: typing.Optional[str] = None + preview_audio_object: typing.Optional[PreviewAudioDbModel] = None + sample_config: typing.Optional[SampleConfigDbModel] = None + review: typing.Optional[ReviewResponseModel] = None + voice_id: typing.Optional[str] = None + can_use_assistant: typing.Optional[bool] = None + is_voice_changer_on: typing.Optional[bool] = None + restricted_to_user_email_domains: typing.Optional[typing.List[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/data/src/elevenlabs/types/direct_publishing_read_response_model_display_mode.py b/data/src/elevenlabs/types/direct_publishing_read_response_model_display_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..76751a038fda4c88ff9468a69e810ca1bc97245a --- /dev/null +++ b/data/src/elevenlabs/types/direct_publishing_read_response_model_display_mode.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DirectPublishingReadResponseModelDisplayMode = typing.Union[ + typing.Literal["text", "audio-only", "text-with-audio"], typing.Any +] diff --git a/data/src/elevenlabs/types/direct_publishing_read_response_model_genre_item.py b/data/src/elevenlabs/types/direct_publishing_read_response_model_genre_item.py new file mode 100644 index 0000000000000000000000000000000000000000..7fcecdbf43df4c405140fa07dd6219cf4f17eaed --- /dev/null +++ b/data/src/elevenlabs/types/direct_publishing_read_response_model_genre_item.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DirectPublishingReadResponseModelGenreItem = typing.Union[ + typing.Literal[ + "Fantasy", + "Romance", + "Science Fiction", + "Mystery and Thriller", + "Action and Adventure", + "Dystopia", + "Business and Economics", + "Technology", + "Christian & Inspirational", + "Horror", + "Biography and Memoir", + "Education and Learning", + "History", + "Children's Literature", + "Young Adult", + "Fairy Tales and Folklore", + "Fan Fiction", + "General Fiction", + "Health and Wellness", + "Historical Fiction", + "Humor", + "Literary Classics", + "Philosophy", + "Poetry", + "Politics and Government", + "Psychology", + "Science and Nature", + "Self-Help", + "Spirituality and Religion", + "Travel", + "True Crime", + "Other", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/direct_publishing_read_response_model_payout_type.py b/data/src/elevenlabs/types/direct_publishing_read_response_model_payout_type.py new file mode 100644 index 0000000000000000000000000000000000000000..668621f51d979d0d3a500f6f710c50cf7e54d310 --- /dev/null +++ b/data/src/elevenlabs/types/direct_publishing_read_response_model_payout_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DirectPublishingReadResponseModelPayoutType = typing.Union[ + typing.Literal["none", "engagement_based", "fixed_payout"], typing.Any +] diff --git a/data/src/elevenlabs/types/direct_publishing_read_response_model_target_audience.py b/data/src/elevenlabs/types/direct_publishing_read_response_model_target_audience.py new file mode 100644 index 0000000000000000000000000000000000000000..cc85a7976951f16722a5b2f92207dd0dd40ed5c0 --- /dev/null +++ b/data/src/elevenlabs/types/direct_publishing_read_response_model_target_audience.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DirectPublishingReadResponseModelTargetAudience = typing.Union[ + typing.Literal["children", "young adult", "adult", "all ages"], typing.Any +] diff --git a/data/src/elevenlabs/types/discount_response_model.py b/data/src/elevenlabs/types/discount_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..018ca0ffb4e1903e5320f38662908b312894f6fa --- /dev/null +++ b/data/src/elevenlabs/types/discount_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DiscountResponseModel(UncheckedBaseModel): + discount_percent_off: typing.Optional[float] = pydantic.Field(default=None) + """ + The discount applied to the invoice. E.g. [20.0f] for 20% off. + """ + + discount_amount_off: typing.Optional[float] = pydantic.Field(default=None) + """ + The discount applied to the invoice. E.g. [20.0f] for 20 cents off. + """ + + 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/data/src/elevenlabs/types/do_dubbing_response.py b/data/src/elevenlabs/types/do_dubbing_response.py new file mode 100644 index 0000000000000000000000000000000000000000..749e52183fdfec8ac31e3083b66059ebca8eb93c --- /dev/null +++ b/data/src/elevenlabs/types/do_dubbing_response.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DoDubbingResponse(UncheckedBaseModel): + dubbing_id: str = pydantic.Field() + """ + The ID of the dubbing project. + """ + + expected_duration_sec: float = pydantic.Field() + """ + The expected duration of the dubbing project in seconds. + """ + + 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/data/src/elevenlabs/types/document_usage_mode_enum.py b/data/src/elevenlabs/types/document_usage_mode_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..bf5bc1c89c7fa1562363b352f8dddb72048f6482 --- /dev/null +++ b/data/src/elevenlabs/types/document_usage_mode_enum.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DocumentUsageModeEnum = typing.Union[typing.Literal["prompt", "auto"], typing.Any] diff --git a/data/src/elevenlabs/types/docx_export_options.py b/data/src/elevenlabs/types/docx_export_options.py new file mode 100644 index 0000000000000000000000000000000000000000..ad3b982ebe1fa35c7b46a771f25eb32556951ae7 --- /dev/null +++ b/data/src/elevenlabs/types/docx_export_options.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DocxExportOptions(UncheckedBaseModel): + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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/data/src/elevenlabs/types/dtmf_input_config.py b/data/src/elevenlabs/types/dtmf_input_config.py new file mode 100644 index 0000000000000000000000000000000000000000..1233ff641323cae8a5c8142c63552d2fb7b232fc --- /dev/null +++ b/data/src/elevenlabs/types/dtmf_input_config.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DtmfInputConfig(UncheckedBaseModel): + """ + Configuration for DTMF (keypad) input collection during phone calls. + """ + + dtmf_input_timeout: typing.Optional[float] = pydantic.Field(default=None) + """ + Timeout in seconds to wait for additional DTMF digits + """ + + hash_terminator: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, pressing # immediately completes DTMF input + """ + + redact_input: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, replace the caller's DTMF (keypad) entries with a redaction marker in the transcript, conversation log and analysis. Digits the agent repeats back or passes to a tool are not affected. + """ + + 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/data/src/elevenlabs/types/dub_order_item_request.py b/data/src/elevenlabs/types/dub_order_item_request.py new file mode 100644 index 0000000000000000000000000000000000000000..1ff54ff3e215944c453f2619fe62107d3971b660 --- /dev/null +++ b/data/src/elevenlabs/types/dub_order_item_request.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .media_id import MediaId + + +class DubOrderItemRequest(UncheckedBaseModel): + media_id: MediaId = pydantic.Field() + """ + The ID of the uploaded media file to dub. + """ + + source_language: str = pydantic.Field() + """ + The language code of the source media (e.g. 'en', 'es'). + """ + + destination_languages: typing.List[str] = pydantic.Field() + """ + List of target language codes to dub the media into. + """ + + include_captions: bool = pydantic.Field() + """ + Whether to generate captions for the dubbed outputs. + """ + + include_source_captions: bool = pydantic.Field() + """ + Whether to generate captions for the source language. + """ + + instructions: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional free-text instructions for the dubbing team. + """ + + captions_sdh: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether captions should use SDH format, which includes descriptions for deaf and hard-of-hearing viewers. + """ + + 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/data/src/elevenlabs/types/dubbed_segment.py b/data/src/elevenlabs/types/dubbed_segment.py new file mode 100644 index 0000000000000000000000000000000000000000..1ac05e1387f6cccce088f28bb97d552250c40093 --- /dev/null +++ b/data/src/elevenlabs/types/dubbed_segment.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_media_reference import DubbingMediaReference +from .segment_subtitle_frame import SegmentSubtitleFrame + + +class DubbedSegment(UncheckedBaseModel): + start_time: float + end_time: float + text: typing.Optional[str] = None + subtitles: typing.List[SegmentSubtitleFrame] + audio_stale: bool + media_ref: typing.Optional[DubbingMediaReference] = 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/data/src/elevenlabs/types/dubbing_audio.py b/data/src/elevenlabs/types/dubbing_audio.py new file mode 100644 index 0000000000000000000000000000000000000000..210bef3524067039f11829db4c56369c9b948530 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_audio.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingAudio(UncheckedBaseModel): + message_type: typing.Literal["audio"] = "audio" + data: str + sample_rate: int + + 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/data/src/elevenlabs/types/dubbing_audio_output_error.py b/data/src/elevenlabs/types/dubbing_audio_output_error.py new file mode 100644 index 0000000000000000000000000000000000000000..61994386693d881d912e154959e8f3dbf5ba651d --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_audio_output_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingAudioOutputError(UncheckedBaseModel): + message_type: typing.Literal["audio_output_error"] = "audio_output_error" + error: 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/data/src/elevenlabs/types/dubbing_auth_error.py b/data/src/elevenlabs/types/dubbing_auth_error.py new file mode 100644 index 0000000000000000000000000000000000000000..f0c96ebce32f935c095f808fe56a468f76f64ba2 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_auth_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingAuthError(UncheckedBaseModel): + message_type: typing.Literal["auth_error"] = "auth_error" + error: 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/data/src/elevenlabs/types/dubbing_bulk_source_segment_update_response.py b/data/src/elevenlabs/types/dubbing_bulk_source_segment_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b14fa7d8654606806af052202a6dd2a5fc44fdfc --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_bulk_source_segment_update_response.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_transcript_segment import DubbingTranscriptSegment + + +class DubbingBulkSourceSegmentUpdateResponse(UncheckedBaseModel): + """ + The result of a bulk source edit: the updated segments and the new revision. + """ + + segments: typing.List[DubbingTranscriptSegment] = pydantic.Field() + """ + The edited segments in their updated state. + """ + + revision: int = pydantic.Field() + """ + The project's source-transcript revision after the edits. + """ + + 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/data/src/elevenlabs/types/dubbing_bulk_target_segment_update_response.py b/data/src/elevenlabs/types/dubbing_bulk_target_segment_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..af8766b6c1eb6d5e8ec65a2a578a1cc7d35d781a --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_bulk_target_segment_update_response.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_target_transcript_segment import DubbingTargetTranscriptSegment + + +class DubbingBulkTargetSegmentUpdateResponse(UncheckedBaseModel): + """ + The result of a bulk target edit: the updated segments and the new revision. + """ + + segments: typing.List[DubbingTargetTranscriptSegment] = pydantic.Field() + """ + The edited target segments in their updated state. + """ + + revision: int = pydantic.Field() + """ + The target's revision after the edits. + """ + + 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/data/src/elevenlabs/types/dubbing_committed_transcript.py b/data/src/elevenlabs/types/dubbing_committed_transcript.py new file mode 100644 index 0000000000000000000000000000000000000000..d80d013474f98c713d521ce003ccb48a0754794f --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_committed_transcript.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingCommittedTranscript(UncheckedBaseModel): + message_type: typing.Literal["committed_transcript"] = "committed_transcript" + text: str + segment_id: str + start_s: float + end_s: float + speaker_id: 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/data/src/elevenlabs/types/dubbing_end_of_stream.py b/data/src/elevenlabs/types/dubbing_end_of_stream.py new file mode 100644 index 0000000000000000000000000000000000000000..32a23c68c3397d9cefeac8c915c1aad69227d742 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_end_of_stream.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingEndOfStream(UncheckedBaseModel): + message_type: typing.Literal["end_of_stream"] = "end_of_stream" + + 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/data/src/elevenlabs/types/dubbing_error.py b/data/src/elevenlabs/types/dubbing_error.py new file mode 100644 index 0000000000000000000000000000000000000000..afb1c5dc1e3fe817614dc48f9094f2ac9536bdaa --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingError(UncheckedBaseModel): + message_type: typing.Literal["error"] = "error" + error: 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/data/src/elevenlabs/types/dubbing_input_audio_chunk.py b/data/src/elevenlabs/types/dubbing_input_audio_chunk.py new file mode 100644 index 0000000000000000000000000000000000000000..dc2e0492e4d44436bdf72c25593822a5359f724b --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_input_audio_chunk.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingInputAudioChunk(UncheckedBaseModel): + message_type: typing.Literal["input_audio_chunk"] = "input_audio_chunk" + audio_base_64: 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/data/src/elevenlabs/types/dubbing_input_error.py b/data/src/elevenlabs/types/dubbing_input_error.py new file mode 100644 index 0000000000000000000000000000000000000000..00031ac6821cff0819c86616ccef1695c5bf5a23 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_input_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingInputError(UncheckedBaseModel): + message_type: typing.Literal["input_error"] = "input_error" + error: 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/data/src/elevenlabs/types/dubbing_invalid_request_error.py b/data/src/elevenlabs/types/dubbing_invalid_request_error.py new file mode 100644 index 0000000000000000000000000000000000000000..55ba12c0320f8f0d5702ef46bd6150b9e70c6de4 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_invalid_request_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingInvalidRequestError(UncheckedBaseModel): + message_type: typing.Literal["invalid_request"] = "invalid_request" + error: 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/data/src/elevenlabs/types/dubbing_language_list_response.py b/data/src/elevenlabs/types/dubbing_language_list_response.py new file mode 100644 index 0000000000000000000000000000000000000000..57d135f3e453aa74d22b4816fd63ec456e265b34 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_language_list_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_language_response import DubbingLanguageResponse + + +class DubbingLanguageListResponse(UncheckedBaseModel): + languages: typing.List[DubbingLanguageResponse] = pydantic.Field() + """ + The page of language targets for the project. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Opaque cursor to pass back as `cursor` for the next page, or null when there are no more results. + """ + + 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/data/src/elevenlabs/types/dubbing_language_outputs.py b/data/src/elevenlabs/types/dubbing_language_outputs.py new file mode 100644 index 0000000000000000000000000000000000000000..b7cf143ad1a8b979d5f6af4941ed7a170b3128c5 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_language_outputs.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingLanguageOutputs(UncheckedBaseModel): + """ + Signed, time-limited download URLs for a language target's outputs. + """ + + lossless_audio: typing.Optional[str] = pydantic.Field(default=None) + """ + Signed URL for the dubbed lossless audio track, in FLAC. The link expires one hour after it is issued; re-read the language target for a fresh one. + """ + + subtitles: typing.Optional[str] = pydantic.Field(default=None) + """ + Signed URL for the translated lines as WebVTT subtitles, timed to the source speech. Null when none are available, such as for languages dubbed before subtitles were produced. The link expires one hour after it is issued. + """ + + 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/data/src/elevenlabs/types/dubbing_language_response.py b/data/src/elevenlabs/types/dubbing_language_response.py new file mode 100644 index 0000000000000000000000000000000000000000..1521e93d322fd84d0e80ea49827541ec69fb6cb5 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_language_response.py @@ -0,0 +1,89 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_error import DubbingError +from .dubbing_language_outputs import DubbingLanguageOutputs +from .dubbing_language_response_status import DubbingLanguageResponseStatus +from .voice_settings import VoiceSettings +from .voices_not_permitted_warning import VoicesNotPermittedWarning + + +class DubbingLanguageResponse(UncheckedBaseModel): + language_id: str = pydantic.Field() + """ + Unique identifier of the language target. + """ + + project_id: str = pydantic.Field() + """ + Identifier of the parent dubbing project. + """ + + target_language: str = pydantic.Field() + """ + BCP-47 language tag this target is dubbed into. + """ + + status: DubbingLanguageResponseStatus = pydantic.Field() + """ + Lifecycle status: `queued` (waiting on the project to be ready, or on a worker), `processing` while it is being dubbed, `completed` once its output is available, `stale` when the transcript changed after the output was produced, or `failed`. + """ + + model_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Dubbing model this target is dubbed with, inherited from the project and not selectable per language. + """ + + voice_settings: typing.Optional[VoiceSettings] = pydantic.Field(default=None) + """ + Voice settings applied to every speaker in this language, or null if the defaults apply. + """ + + outputs: typing.Optional[DubbingLanguageOutputs] = pydantic.Field(default=None) + """ + Signed output URLs; null until the target has produced an output (present once `completed`, and kept while `stale` — compare `output_revision` against `revision` to tell whether the output is up to date). + """ + + revision: int = pydantic.Field() + """ + Monotonic counter incremented whenever this target's transcript changes (a source edit affecting it, or an edit to its translation). + """ + + output_revision: typing.Optional[int] = pydantic.Field(default=None) + """ + The `revision` the current dubbed output was generated from; equal to `revision` when up to date, and lower when `stale`. This is null until a generation has completed. + """ + + error: typing.Optional[DubbingError] = pydantic.Field(default=None) + """ + Why this language failed; null unless `status` is `failed`, and also null for the few languages that failed before failure reporting was introduced. A code of `project_failed` means the parent project failed, so read the project for the underlying cause. + """ + + warnings: typing.Optional[typing.List[VoicesNotPermittedWarning]] = pydantic.Field(default=None) + """ + Non-fatal conditions raised while dubbing this language, empty when there are none. Reflects the latest generation. Conditions raised while preparing the source are reported on the project instead. + """ + + created_at: dt.datetime = pydantic.Field() + """ + When the language target was created. + """ + + updated_at: dt.datetime = pydantic.Field() + """ + When the language target was last updated. + """ + + 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/data/src/elevenlabs/types/dubbing_language_response_status.py b/data/src/elevenlabs/types/dubbing_language_response_status.py new file mode 100644 index 0000000000000000000000000000000000000000..4ec24e6dd1d772d2c2639dda2c1e0407ad46dc29 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_language_response_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingLanguageResponseStatus = typing.Union[ + typing.Literal["queued", "processing", "completed", "stale", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/types/dubbing_media_metadata.py b/data/src/elevenlabs/types/dubbing_media_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..c4fdd9ddca6b8d4d0d475da133c514c6f25c1e7f --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_media_metadata.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingMediaMetadata(UncheckedBaseModel): + content_type: str = pydantic.Field() + """ + The content type of the media. + """ + + duration: float = pydantic.Field() + """ + The duration of the media in seconds. + """ + + 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/data/src/elevenlabs/types/dubbing_media_reference.py b/data/src/elevenlabs/types/dubbing_media_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..b4f5ef341c8960989bebb22f6bc729772401fb88 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_media_reference.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingMediaReference(UncheckedBaseModel): + src: str + content_type: str + bucket_name: str + random_path_slug: str + duration_secs: float + is_audio: bool + url: 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/data/src/elevenlabs/types/dubbing_metadata_page_response_model.py b/data/src/elevenlabs/types/dubbing_metadata_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6f3336b376a0685a18a6b2b18d39ae0f8fde6fce --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_metadata_page_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_metadata_response import DubbingMetadataResponse + + +class DubbingMetadataPageResponseModel(UncheckedBaseModel): + dubs: typing.List[DubbingMetadataResponse] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/dubbing_metadata_response.py b/data/src/elevenlabs/types/dubbing_metadata_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b1054e578cea038f6311e4824baa0e41e47ff6a4 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_metadata_response.py @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_media_metadata import DubbingMediaMetadata + + +class DubbingMetadataResponse(UncheckedBaseModel): + dubbing_id: str = pydantic.Field() + """ + The ID of the dubbing project. + """ + + name: str = pydantic.Field() + """ + The name of the dubbing project. + """ + + status: str = pydantic.Field() + """ + The state this dub is in. + """ + + source_language: typing.Optional[str] = pydantic.Field(default=None) + """ + Once dubbing has completed, the ISO-639-1 code of the original media's source language. + """ + + target_languages: typing.List[str] = pydantic.Field() + """ + The ISO-639-1 code of the languages this media has been dubbed into. + """ + + editable: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether this dubbing project is editable in Dubbing Studio. + """ + + created_at: dt.datetime = pydantic.Field() + """ + Timestamp this dub was created. + """ + + media_metadata: typing.Optional[DubbingMediaMetadata] = pydantic.Field(default=None) + """ + Metadata, such as the length in seconds and content type, of the dubbed content. + """ + + error: typing.Optional[str] = pydantic.Field(default=None) + """ + Error message indicate, if this dub has failed, what happened. + """ + + 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/data/src/elevenlabs/types/dubbing_partial_transcript.py b/data/src/elevenlabs/types/dubbing_partial_transcript.py new file mode 100644 index 0000000000000000000000000000000000000000..4619df245b67b5a0e1297c8436efc3705f9b5673 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_partial_transcript.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingPartialTranscript(UncheckedBaseModel): + message_type: typing.Literal["partial_transcript"] = "partial_transcript" + text: 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/data/src/elevenlabs/types/dubbing_project_list_response.py b/data/src/elevenlabs/types/dubbing_project_list_response.py new file mode 100644 index 0000000000000000000000000000000000000000..4b4d540be8f6398dafc3a23965a5db4aff6a2c75 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_project_list_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_project_response import DubbingProjectResponse + + +class DubbingProjectListResponse(UncheckedBaseModel): + projects: typing.List[DubbingProjectResponse] = pydantic.Field() + """ + The page of dubbing projects the caller can access. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Opaque cursor to pass back as `cursor` for the next page, or null when there are no more results. + """ + + 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/data/src/elevenlabs/types/dubbing_project_response.py b/data/src/elevenlabs/types/dubbing_project_response.py new file mode 100644 index 0000000000000000000000000000000000000000..a7fad1a62f21a16f0ab709db59df48ac1a6d13d5 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_project_response.py @@ -0,0 +1,88 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_error import DubbingError +from .dubbing_project_response_status import DubbingProjectResponseStatus +from .dubbing_source_media_info import DubbingSourceMediaInfo +from .voices_not_permitted_warning import VoicesNotPermittedWarning + + +class DubbingProjectResponse(UncheckedBaseModel): + project_id: str = pydantic.Field() + """ + Unique identifier of the dubbing project. + """ + + status: DubbingProjectResponseStatus = pydantic.Field() + """ + Lifecycle status of the project: `queued` before the source is picked up, `preparing` while it is transcribed, `ready` once transcription is done and language targets can start, or `failed`. A project is never reported as `processing` — that value belongs to language targets. + """ + + reference: typing.Optional[str] = pydantic.Field(default=None) + """ + The free-form string you supplied as `reference` when creating the project, or null if you supplied none. + """ + + source_language: typing.Optional[str] = pydantic.Field(default=None) + """ + BCP-47 language tag of the source media (null if auto-detected). + """ + + model_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Dubbing model every language target of this project is dubbed with. Fixed at create time and not selectable per language. + """ + + media: typing.Optional[DubbingSourceMediaInfo] = pydantic.Field(default=None) + """ + Source media metadata, populated once the source has been fetched and decoded (shortly after create, before the project is `ready`); null until then. + """ + + language_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Identifiers of the language targets under this project. Populated when a single project is fetched, and on create when `target_language` creates one. Always empty in list responses — list the project's language targets instead. + """ + + webhook_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + IDs of the workspace webhooks notified as this project and its languages reach `ready`, `completed`, or `failed`. + """ + + revision: int = pydantic.Field() + """ + Monotonic counter incremented whenever the source transcript is edited (segment add/edit/delete). + """ + + error: typing.Optional[DubbingError] = pydantic.Field(default=None) + """ + Why the project failed; null unless `status` is `failed`. Also null for the few projects that failed before failure reporting was introduced. + """ + + warnings: typing.Optional[typing.List[VoicesNotPermittedWarning]] = pydantic.Field(default=None) + """ + Non-fatal conditions raised while preparing the source, empty when there are none. Reflects the latest preparation. Conditions raised while dubbing a particular language are reported on that language instead. + """ + + created_at: dt.datetime = pydantic.Field() + """ + When the project was created. + """ + + updated_at: dt.datetime = pydantic.Field() + """ + When the project was last updated. + """ + + 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/data/src/elevenlabs/types/dubbing_project_response_status.py b/data/src/elevenlabs/types/dubbing_project_response_status.py new file mode 100644 index 0000000000000000000000000000000000000000..104859edb8c808820c5c623d6148bdb0c0ff1f0a --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_project_response_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingProjectResponseStatus = typing.Union[ + typing.Literal["queued", "preparing", "processing", "ready", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/types/dubbing_queue_overflow_error.py b/data/src/elevenlabs/types/dubbing_queue_overflow_error.py new file mode 100644 index 0000000000000000000000000000000000000000..14c40968cb18f26dbe7185e96904fc87ebed79ae --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_queue_overflow_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingQueueOverflowError(UncheckedBaseModel): + message_type: typing.Literal["queue_overflow"] = "queue_overflow" + error: 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/data/src/elevenlabs/types/dubbing_rate_limited_error.py b/data/src/elevenlabs/types/dubbing_rate_limited_error.py new file mode 100644 index 0000000000000000000000000000000000000000..4939a9392ef25392bd0baba672c72090de3a6ef8 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_rate_limited_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingRateLimitedError(UncheckedBaseModel): + message_type: typing.Literal["rate_limited"] = "rate_limited" + error: 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/data/src/elevenlabs/types/dubbing_regenerate_response.py b/data/src/elevenlabs/types/dubbing_regenerate_response.py new file mode 100644 index 0000000000000000000000000000000000000000..72d84fe3f41e8e21314b797f1ab8287fda2ba186 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_regenerate_response.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingRegenerateResponse(UncheckedBaseModel): + """ + The accepted re-dub: what it covers and what it cost. + """ + + regenerated_segment_ids: typing.List[str] = pydantic.Field() + """ + The segments this re-dub re-synthesizes: those with edits to apply. + """ + + regenerated_seconds: float = pydantic.Field() + """ + Seconds of audio this re-dub covers — the edited regions only, never the whole target. `charged_seconds` is the part of it that was billed. + """ + + charged_seconds: float = pydantic.Field() + """ + Seconds actually billed, after the free-regeneration allowance. Zero when the re-dub cost nothing — either the allowance covered all of it, or the project's included generation did. + """ + + free_regeneration_seconds_remaining: float = pydantic.Field() + """ + Free-regeneration seconds left for this language target after this re-dub. The allowance is the source's own duration. + """ + + 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/data/src/elevenlabs/types/dubbing_release_channel.py b/data/src/elevenlabs/types/dubbing_release_channel.py new file mode 100644 index 0000000000000000000000000000000000000000..4fbeee49b54c18350c0377feb536d3dfdde8a4d5 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_release_channel.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingReleaseChannel = typing.Union[typing.Literal["stable", "release", "experimental"], typing.Any] diff --git a/data/src/elevenlabs/types/dubbing_render_response_model.py b/data/src/elevenlabs/types/dubbing_render_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..cc4886f9eeb10bfd2823a71ccc28a0ed959fc821 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_render_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingRenderResponseModel(UncheckedBaseModel): + version: int + render_id: 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/data/src/elevenlabs/types/dubbing_resource.py b/data/src/elevenlabs/types/dubbing_resource.py new file mode 100644 index 0000000000000000000000000000000000000000..73ba77bedaf25e9f51b47ca508431e7646ded947 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_resource.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_media_reference import DubbingMediaReference +from .render import Render +from .speaker_segment import SpeakerSegment +from .speaker_track import SpeakerTrack + + +class DubbingResource(UncheckedBaseModel): + id: str + version: int + source_language: str + target_languages: typing.List[str] + input: DubbingMediaReference + background: typing.Optional[DubbingMediaReference] = None + foreground: typing.Optional[DubbingMediaReference] = None + speaker_tracks: typing.Dict[str, SpeakerTrack] + speaker_segments: typing.Dict[str, SpeakerSegment] + renders: typing.Dict[str, Render] + + 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/data/src/elevenlabs/types/dubbing_segment_update_request.py b/data/src/elevenlabs/types/dubbing_segment_update_request.py new file mode 100644 index 0000000000000000000000000000000000000000..2ae1f377b1ad90ed781df82b07d81a3a07ad5255 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_segment_update_request.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingSegmentUpdateRequest(UncheckedBaseModel): + """ + A partial update to a source segment; omitted fields are left unchanged. + """ + + text: typing.Optional[str] = pydantic.Field(default=None) + """ + New text for the segment. + """ + + speaker_id: typing.Optional[str] = pydantic.Field(default=None) + """ + New speaker ID for the segment. + """ + + start_s: typing.Optional[float] = pydantic.Field(default=None) + """ + New start time, in seconds. + """ + + end_s: typing.Optional[float] = pydantic.Field(default=None) + """ + New end time, in seconds. + """ + + 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/data/src/elevenlabs/types/dubbing_session_started.py b/data/src/elevenlabs/types/dubbing_session_started.py new file mode 100644 index 0000000000000000000000000000000000000000..ec0f9d27d6ae58df3c7580e769f2149154c7f8d2 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_session_started.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingSessionStarted(UncheckedBaseModel): + message_type: typing.Literal["session_started"] = "session_started" + session_id: str + client_session_id: 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/data/src/elevenlabs/types/dubbing_source_media_info.py b/data/src/elevenlabs/types/dubbing_source_media_info.py new file mode 100644 index 0000000000000000000000000000000000000000..3bef27578e8e06fbdabee95753e4c47de68eace0 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_source_media_info.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingSourceMediaInfo(UncheckedBaseModel): + """ + Metadata about the project's source media. + """ + + filename: typing.Optional[str] = pydantic.Field(default=None) + """ + Original filename of the uploaded source media (null for URL sources). + """ + + duration_s: typing.Optional[float] = pydantic.Field(default=None) + """ + Duration of the source media, in seconds. + """ + + has_video: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the source media contains a video stream. + """ + + mime_type: typing.Optional[str] = pydantic.Field(default=None) + """ + MIME type of the uploaded source media (null for URL sources). + """ + + 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/data/src/elevenlabs/types/dubbing_source_segment_update_response.py b/data/src/elevenlabs/types/dubbing_source_segment_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..9086a9f985f454fac98cc37935b23568a3bec1dd --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_source_segment_update_response.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_transcript_segment import DubbingTranscriptSegment + + +class DubbingSourceSegmentUpdateResponse(UncheckedBaseModel): + """ + The result of a source-segment add or edit: the segment and the new revision. + """ + + segment: DubbingTranscriptSegment = pydantic.Field() + """ + The segment in its updated state. + """ + + revision: int = pydantic.Field() + """ + The project's source-transcript revision after this edit. + """ + + 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/data/src/elevenlabs/types/dubbing_source_transcript_response.py b/data/src/elevenlabs/types/dubbing_source_transcript_response.py new file mode 100644 index 0000000000000000000000000000000000000000..44c4dcdf0f62df0480c144811f33a3c425de70ec --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_source_transcript_response.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_transcript_segment import DubbingTranscriptSegment + + +class DubbingSourceTranscriptResponse(UncheckedBaseModel): + language: typing.Optional[str] = pydantic.Field(default=None) + """ + BCP-47 language tag of the source transcript (null if unknown). + """ + + segments: typing.List[DubbingTranscriptSegment] = pydantic.Field() + """ + The source segments, in playback order. + """ + + revision: int = pydantic.Field() + """ + The project's source-transcript revision at read time. + """ + + 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/data/src/elevenlabs/types/dubbing_status.py b/data/src/elevenlabs/types/dubbing_status.py new file mode 100644 index 0000000000000000000000000000000000000000..a4ecc9520583630ab2604b9a19695653f87eca5b --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_status.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_status_status import DubbingStatusStatus + + +class DubbingStatus(UncheckedBaseModel): + message_type: typing.Literal["status"] = "status" + status: DubbingStatusStatus + + 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/data/src/elevenlabs/types/dubbing_status_status.py b/data/src/elevenlabs/types/dubbing_status_status.py new file mode 100644 index 0000000000000000000000000000000000000000..0a7b20a8ada4025fd30da2661074a01aa6a6e585 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_status_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingStatusStatus = typing.Union[typing.Literal["started", "stopped"], typing.Any] diff --git a/data/src/elevenlabs/types/dubbing_target_segment_update_request.py b/data/src/elevenlabs/types/dubbing_target_segment_update_request.py new file mode 100644 index 0000000000000000000000000000000000000000..ee43635daefe74a152260e164f157f72807c2a08 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_target_segment_update_request.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingTargetSegmentUpdateRequest(UncheckedBaseModel): + """ + A partial edit to a target segment. An omitted field is left unchanged; a provided `null` + clears it (see each field for what clearing means). + """ + + translation: typing.Optional[str] = pydantic.Field(default=None) + """ + New translated text, or null to mark the segment for re-translation. + """ + + 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/data/src/elevenlabs/types/dubbing_target_segment_update_response.py b/data/src/elevenlabs/types/dubbing_target_segment_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..75911e0697d6f5561156504cca82dd043426f8f1 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_target_segment_update_response.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_target_transcript_segment import DubbingTargetTranscriptSegment + + +class DubbingTargetSegmentUpdateResponse(UncheckedBaseModel): + """ + The result of a target-translation edit: the updated segment and the new revision. + """ + + segment: DubbingTargetTranscriptSegment = pydantic.Field() + """ + The target segment in its updated state. + """ + + revision: int = pydantic.Field() + """ + The target's revision after this edit. + """ + + 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/data/src/elevenlabs/types/dubbing_target_transcript_response.py b/data/src/elevenlabs/types/dubbing_target_transcript_response.py new file mode 100644 index 0000000000000000000000000000000000000000..dd62a5672758c8ed8ac7b9488b58d4b317d777be --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_target_transcript_response.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_target_transcript_segment import DubbingTargetTranscriptSegment + + +class DubbingTargetTranscriptResponse(UncheckedBaseModel): + source_language: typing.Optional[str] = pydantic.Field(default=None) + """ + BCP-47 language tag of the source transcript. + """ + + target_language: str = pydantic.Field() + """ + BCP-47 language tag this target is translated into. + """ + + segments: typing.List[DubbingTargetTranscriptSegment] = pydantic.Field() + """ + The target segments, in playback order. + """ + + revision: int = pydantic.Field() + """ + The target's revision at read time. + """ + + 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/data/src/elevenlabs/types/dubbing_target_transcript_segment.py b/data/src/elevenlabs/types/dubbing_target_transcript_segment.py new file mode 100644 index 0000000000000000000000000000000000000000..62c6437e83b02a9583a8397d78cc9ccaac806f3f --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_target_transcript_segment.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingTargetTranscriptSegment(UncheckedBaseModel): + """ + One segment of a target transcript: a source segment plus its translation. + """ + + id: str = pydantic.Field() + """ + Stable identifier of the segment (from the source). + """ + + speaker_id: str = pydantic.Field() + """ + Identifier of the segment's speaker. + """ + + start_s: float = pydantic.Field() + """ + Start time of the segment, in seconds. + """ + + end_s: float = pydantic.Field() + """ + End time of the segment, in seconds. + """ + + source_text: str = pydantic.Field() + """ + The source-language text of the segment. + """ + + translation: typing.Optional[str] = pydantic.Field(default=None) + """ + The translated text, or null if not translated yet (needs translation). + """ + + 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/data/src/elevenlabs/types/dubbing_transcriber_error.py b/data/src/elevenlabs/types/dubbing_transcriber_error.py new file mode 100644 index 0000000000000000000000000000000000000000..206c633ca0fe03fe349939c5c212a2e84d25edfc --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcriber_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingTranscriberError(UncheckedBaseModel): + message_type: typing.Literal["transcriber_error"] = "transcriber_error" + error: 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/data/src/elevenlabs/types/dubbing_transcript.py b/data/src/elevenlabs/types/dubbing_transcript.py new file mode 100644 index 0000000000000000000000000000000000000000..67b58dcd186452dc6e816a2df2a6fb0502e2cc0a --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcript.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_transcript_utterance import DubbingTranscriptUtterance + + +class DubbingTranscript(UncheckedBaseModel): + language: str + utterances: typing.List[DubbingTranscriptUtterance] + + 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/data/src/elevenlabs/types/dubbing_transcript_character.py b/data/src/elevenlabs/types/dubbing_transcript_character.py new file mode 100644 index 0000000000000000000000000000000000000000..aa2d1e59f86f0abe0927a0db97e31bdbd7b6b975 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcript_character.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingTranscriptCharacter(UncheckedBaseModel): + text: typing.Optional[str] = None + start_s: typing.Optional[float] = None + end_s: 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/data/src/elevenlabs/types/dubbing_transcript_response_model.py b/data/src/elevenlabs/types/dubbing_transcript_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..0aa2f00dc837b23b080861e5559f5555ba5b196b --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcript_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_transcript_utterance import DubbingTranscriptUtterance + + +class DubbingTranscriptResponseModel(UncheckedBaseModel): + language: str + utterances: typing.List[DubbingTranscriptUtterance] + + 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/data/src/elevenlabs/types/dubbing_transcript_revision_response.py b/data/src/elevenlabs/types/dubbing_transcript_revision_response.py new file mode 100644 index 0000000000000000000000000000000000000000..9e040655cfe525e318f8f3a79125dcde453c7ef3 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcript_revision_response.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingTranscriptRevisionResponse(UncheckedBaseModel): + """ + The new revision after a source edit that returns no segment, such as a delete. + """ + + revision: int = pydantic.Field() + """ + The project's source-transcript revision after this edit. + """ + + 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/data/src/elevenlabs/types/dubbing_transcript_segment.py b/data/src/elevenlabs/types/dubbing_transcript_segment.py new file mode 100644 index 0000000000000000000000000000000000000000..8a3b4c32d2e9f3fda447ff3156a73ca148986895 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcript_segment.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingTranscriptSegment(UncheckedBaseModel): + """ + One segment of a source transcript. + """ + + id: str = pydantic.Field() + """ + Stable identifier of the segment, used to address it in edit requests. + """ + + text: str = pydantic.Field() + """ + The transcribed text of the segment. + """ + + speaker_id: str = pydantic.Field() + """ + Identifier of the segment's speaker. + """ + + start_s: float = pydantic.Field() + """ + Start time of the segment, in seconds. + """ + + end_s: float = pydantic.Field() + """ + End time of the segment, in seconds. + """ + + external_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The caller-supplied external ID for this segment, if one was provided. + """ + + 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/data/src/elevenlabs/types/dubbing_transcript_utterance.py b/data/src/elevenlabs/types/dubbing_transcript_utterance.py new file mode 100644 index 0000000000000000000000000000000000000000..b7b78c524c4c48063f573f6c359eb5e40a507662 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcript_utterance.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_transcript_word import DubbingTranscriptWord + + +class DubbingTranscriptUtterance(UncheckedBaseModel): + text: typing.Optional[str] = None + speaker_id: typing.Optional[str] = None + start_s: typing.Optional[float] = None + end_s: typing.Optional[float] = None + words: typing.Optional[typing.List[DubbingTranscriptWord]] = 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/data/src/elevenlabs/types/dubbing_transcript_word.py b/data/src/elevenlabs/types/dubbing_transcript_word.py new file mode 100644 index 0000000000000000000000000000000000000000..6e7287f7dff3d5304abd0ebbfedbd5da030feefe --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcript_word.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_transcript_character import DubbingTranscriptCharacter + + +class DubbingTranscriptWord(UncheckedBaseModel): + text: typing.Optional[str] = None + word_type: typing.Optional[str] = None + start_s: typing.Optional[float] = None + end_s: typing.Optional[float] = None + characters: typing.Optional[typing.List[DubbingTranscriptCharacter]] = 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/data/src/elevenlabs/types/dubbing_transcripts_response_model.py b/data/src/elevenlabs/types/dubbing_transcripts_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4248577f6461b5b527bc97690481cf2d8f2acbda --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcripts_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_transcript import DubbingTranscript +from .dubbing_transcripts_response_model_transcript_format import DubbingTranscriptsResponseModelTranscriptFormat + + +class DubbingTranscriptsResponseModel(UncheckedBaseModel): + transcript_format: DubbingTranscriptsResponseModelTranscriptFormat + srt: typing.Optional[str] = None + webvtt: typing.Optional[str] = None + json_: typing_extensions.Annotated[ + typing.Optional[DubbingTranscript], FieldMetadata(alias="json"), pydantic.Field(alias="json") + ] = 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/data/src/elevenlabs/types/dubbing_transcripts_response_model_transcript_format.py b/data/src/elevenlabs/types/dubbing_transcripts_response_model_transcript_format.py new file mode 100644 index 0000000000000000000000000000000000000000..6961478626fec9949c2b2883092eb96fcdebcc44 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_transcripts_response_model_transcript_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DubbingTranscriptsResponseModelTranscriptFormat = typing.Union[typing.Literal["srt", "webvtt", "json"], typing.Any] diff --git a/data/src/elevenlabs/types/dubbing_translation.py b/data/src/elevenlabs/types/dubbing_translation.py new file mode 100644 index 0000000000000000000000000000000000000000..2767ec382d9297d4df9444e6960b52785bfd1900 --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_translation.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingTranslation(UncheckedBaseModel): + message_type: typing.Literal["translation"] = "translation" + text: str + segment_id: str + start_s: float + end_s: float + speaker_id: 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/data/src/elevenlabs/types/dubbing_translation_error.py b/data/src/elevenlabs/types/dubbing_translation_error.py new file mode 100644 index 0000000000000000000000000000000000000000..78aa7d2a9548c55c330bdad2726b69fcf080b81c --- /dev/null +++ b/data/src/elevenlabs/types/dubbing_translation_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DubbingTranslationError(UncheckedBaseModel): + message_type: typing.Literal["translation_error"] = "translation_error" + error: 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/data/src/elevenlabs/types/dummy_tool_result_model.py b/data/src/elevenlabs/types/dummy_tool_result_model.py new file mode 100644 index 0000000000000000000000000000000000000000..38ce6ad8875773c20a38cf633d4aacb6db31cc09 --- /dev/null +++ b/data/src/elevenlabs/types/dummy_tool_result_model.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DummyToolResultModel(UncheckedBaseModel): + 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/data/src/elevenlabs/types/duplicate_speech_engine_request.py b/data/src/elevenlabs/types/duplicate_speech_engine_request.py new file mode 100644 index 0000000000000000000000000000000000000000..39b6909e23afd83ff85de8d466b7f505843ddaab --- /dev/null +++ b/data/src/elevenlabs/types/duplicate_speech_engine_request.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DuplicateSpeechEngineRequest(UncheckedBaseModel): + name: typing.Optional[str] = pydantic.Field(default=None) + """ + Name for the duplicated speech engine. Defaults to the source name. + """ + + 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/data/src/elevenlabs/types/dynamic_variable_assignment.py b/data/src/elevenlabs/types/dynamic_variable_assignment.py new file mode 100644 index 0000000000000000000000000000000000000000..6417a5f6268f429942ad134e72f3e4c210d41548 --- /dev/null +++ b/data/src/elevenlabs/types/dynamic_variable_assignment.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DynamicVariableAssignment(UncheckedBaseModel): + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables. + """ + + source: typing.Optional[typing.Literal["response"]] = pydantic.Field(default=None) + """ + The source to extract the value from. Currently only 'response' is supported. + """ + + dynamic_variable: str = pydantic.Field() + """ + The name of the dynamic variable to assign the extracted value to + """ + + value_path: str = pydantic.Field() + """ + Dot notation path to extract the value from the source (e.g., 'user.name' or 'data.0.id') + """ + + sanitize: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, this assignment's value will be removed from the tool response before sending to the LLM and transcript, but still processed for variable assignment. + """ + + preserve_native_type: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, non-scalar values (lists, objects) extracted from the tool response are stored as their native type instead of being stringified to JSON. Enable this to use extracted arrays directly as list dynamic variables. + """ + + 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/data/src/elevenlabs/types/dynamic_variable_internal_value_type.py b/data/src/elevenlabs/types/dynamic_variable_internal_value_type.py new file mode 100644 index 0000000000000000000000000000000000000000..f93fd27c5259434b28a54d28030fc4ebcb06b51e --- /dev/null +++ b/data/src/elevenlabs/types/dynamic_variable_internal_value_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DynamicVariableInternalValueType = typing.Any diff --git a/data/src/elevenlabs/types/dynamic_variable_nested_value_type_input.py b/data/src/elevenlabs/types/dynamic_variable_nested_value_type_input.py new file mode 100644 index 0000000000000000000000000000000000000000..583035d9c6f28770545845372fab7cd9787fc47d --- /dev/null +++ b/data/src/elevenlabs/types/dynamic_variable_nested_value_type_input.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DynamicVariableNestedValueTypeInput = typing.Any diff --git a/data/src/elevenlabs/types/dynamic_variable_nested_value_type_output.py b/data/src/elevenlabs/types/dynamic_variable_nested_value_type_output.py new file mode 100644 index 0000000000000000000000000000000000000000..04435f1051f82388423bc33aae6658d74303683d --- /dev/null +++ b/data/src/elevenlabs/types/dynamic_variable_nested_value_type_output.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +DynamicVariableNestedValueTypeOutput = typing.Any diff --git a/data/src/elevenlabs/types/dynamic_variable_schema_override.py b/data/src/elevenlabs/types/dynamic_variable_schema_override.py new file mode 100644 index 0000000000000000000000000000000000000000..f5fb1347b74abddc42241a8fb624dcafb1cdb1be --- /dev/null +++ b/data/src/elevenlabs/types/dynamic_variable_schema_override.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DynamicVariableSchemaOverride(UncheckedBaseModel): + dynamic_variable: str = pydantic.Field() + """ + The name of the dynamic variable to use + """ + + 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/data/src/elevenlabs/types/dynamic_variable_update_common_model.py b/data/src/elevenlabs/types/dynamic_variable_update_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..de213b480a40dd76c0a125c33033f418dc4f2676 --- /dev/null +++ b/data/src/elevenlabs/types/dynamic_variable_update_common_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DynamicVariableUpdateCommonModel(UncheckedBaseModel): + """ + Tracks a dynamic variable update that occurred during tool execution. + """ + + variable_name: str + old_value: typing.Optional[str] = None + new_value: str + updated_at: float + tool_name: str + tool_request_id: 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/data/src/elevenlabs/types/dynamic_variables_config.py b/data/src/elevenlabs/types/dynamic_variables_config.py new file mode 100644 index 0000000000000000000000000000000000000000..7364582972b6cc7b5ff37c2989434f74b98dbd7e --- /dev/null +++ b/data/src/elevenlabs/types/dynamic_variables_config.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DynamicVariablesConfig(UncheckedBaseModel): + dynamic_variable_placeholders: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + A dictionary of dynamic variable placeholders and their values + """ + + 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/data/src/elevenlabs/types/dynamic_variables_config_workflow_override.py b/data/src/elevenlabs/types/dynamic_variables_config_workflow_override.py new file mode 100644 index 0000000000000000000000000000000000000000..1e78c93e1c29ed763ceb5f730883387c401c7160 --- /dev/null +++ b/data/src/elevenlabs/types/dynamic_variables_config_workflow_override.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class DynamicVariablesConfigWorkflowOverride(UncheckedBaseModel): + dynamic_variable_placeholders: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + A dictionary of dynamic variable placeholders and their values + """ + + 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/data/src/elevenlabs/types/eagerness.py b/data/src/elevenlabs/types/eagerness.py new file mode 100644 index 0000000000000000000000000000000000000000..98921082aba5ec48875c449f89aa3507b8019f4c --- /dev/null +++ b/data/src/elevenlabs/types/eagerness.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Eagerness = typing.Union[typing.Literal["low", "medium", "high"], typing.Any] diff --git a/data/src/elevenlabs/types/edit_chapter_response_model.py b/data/src/elevenlabs/types/edit_chapter_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2f4de578898fb80b6f6471335788c20830ef996d --- /dev/null +++ b/data/src/elevenlabs/types/edit_chapter_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_with_content_response_model import ChapterWithContentResponseModel + + +class EditChapterResponseModel(UncheckedBaseModel): + chapter: ChapterWithContentResponseModel + + 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/data/src/elevenlabs/types/edit_project_response_model.py b/data/src/elevenlabs/types/edit_project_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e4d54fe1e477a094aab99404d5b0064aa0a68266 --- /dev/null +++ b/data/src/elevenlabs/types/edit_project_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .project_response import ProjectResponse + + +class EditProjectResponseModel(UncheckedBaseModel): + project: ProjectResponse + + 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/data/src/elevenlabs/types/edit_voice_response_model.py b/data/src/elevenlabs/types/edit_voice_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ba1c140cc989762ecf2ee8d44778fb19f5bbf872 --- /dev/null +++ b/data/src/elevenlabs/types/edit_voice_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EditVoiceResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the voice edit request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/edit_voice_settings_request.py b/data/src/elevenlabs/types/edit_voice_settings_request.py new file mode 100644 index 0000000000000000000000000000000000000000..a293b2dff377a89b5039d6d5db2228ea95241291 --- /dev/null +++ b/data/src/elevenlabs/types/edit_voice_settings_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EditVoiceSettingsRequest = typing.Any diff --git a/data/src/elevenlabs/types/edit_voice_settings_response_model.py b/data/src/elevenlabs/types/edit_voice_settings_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6a5bc4cf135d1d601b74567bc85472e7c1b75978 --- /dev/null +++ b/data/src/elevenlabs/types/edit_voice_settings_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EditVoiceSettingsResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the voice settings edit request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/edited_transcript.py b/data/src/elevenlabs/types/edited_transcript.py new file mode 100644 index 0000000000000000000000000000000000000000..987fe57ac162c38c46421c51bd826e10ec89332b --- /dev/null +++ b/data/src/elevenlabs/types/edited_transcript.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EditedTranscript(UncheckedBaseModel): + message_type: typing.Optional[str] = None + text: str = pydantic.Field() + """ + The committed transcript text the edit instruction was applied to. + """ + + edited_text: str = pydantic.Field() + """ + The edited transcript text. If no edits were made it will be identical to the `text` field. + """ + + 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/data/src/elevenlabs/types/effects_spec_input.py b/data/src/elevenlabs/types/effects_spec_input.py new file mode 100644 index 0000000000000000000000000000000000000000..2e7b6c1b5ff0e6c2c5a5aec6dee0b45bd0d011c3 --- /dev/null +++ b/data/src/elevenlabs/types/effects_spec_input.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EffectsSpecInput(UncheckedBaseModel): + """ + Audio effects applied to generated speech: a filter preset, perceived distance, a reverb + environment, a background noise bed, and stereo panning. Leave every field at its default + to get unprocessed audio. + """ + + filter_preset_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of a filter preset that colors the voice, such as `phone` or `old_radio`. List valid IDs with `GET /v1/audio-effects/catalog`. + """ + + distance: typing.Optional[float] = pydantic.Field(default=None) + """ + How far the speaker sounds from the microphone, from 0 (close, unchanged) to 1 (far). Higher values roll off low and high frequencies and, when an environment is set, shift the balance from the dry voice toward the reverb. + """ + + environment_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of a reverb environment that places the voice in a space, such as `small_room` or `hall`. List valid IDs with `GET /v1/audio-effects/catalog`. Reverb is rendered in stereo and adds a tail of up to several seconds after the speech ends. + """ + + background_noise_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of a background noise bed looped under the voice, such as `cafe` or `keyboard`. List valid IDs with `GET /v1/audio-effects/catalog`. + """ + + send_level: typing.Optional[float] = pydantic.Field(default=None) + """ + How much of the voice feeds the reverb, from 0 (none) to 1 (full). Only applies when `environment_id` is set; 0 turns the reverb off. + """ + + pan: typing.Optional[float] = pydantic.Field(default=None) + """ + Stereo position of the voice, from -1 (hard left) through 0 (center) to 1 (hard right). Only the voice is panned; reverb and background noise stay centered. + """ + + 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/data/src/elevenlabs/types/effects_spec_output.py b/data/src/elevenlabs/types/effects_spec_output.py new file mode 100644 index 0000000000000000000000000000000000000000..fe00ade90b38430dec9a8bb480b572d68d9fd4c1 --- /dev/null +++ b/data/src/elevenlabs/types/effects_spec_output.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EffectsSpecOutput(UncheckedBaseModel): + """ + Audio effects applied to generated speech: a filter preset, perceived distance, a reverb + environment, a background noise bed, and stereo panning. Leave every field at its default + to get unprocessed audio. + """ + + filter_preset_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of a filter preset that colors the voice, such as `phone` or `old_radio`. List valid IDs with `GET /v1/audio-effects/catalog`. + """ + + distance: float = pydantic.Field() + """ + How far the speaker sounds from the microphone, from 0 (close, unchanged) to 1 (far). Higher values roll off low and high frequencies and, when an environment is set, shift the balance from the dry voice toward the reverb. + """ + + environment_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of a reverb environment that places the voice in a space, such as `small_room` or `hall`. List valid IDs with `GET /v1/audio-effects/catalog`. Reverb is rendered in stereo and adds a tail of up to several seconds after the speech ends. + """ + + background_noise_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of a background noise bed looped under the voice, such as `cafe` or `keyboard`. List valid IDs with `GET /v1/audio-effects/catalog`. + """ + + send_level: float = pydantic.Field() + """ + How much of the voice feeds the reverb, from 0 (none) to 1 (full). Only applies when `environment_id` is set; 0 turns the reverb off. + """ + + pan: float = pydantic.Field() + """ + Stereo position of the voice, from -1 (hard left) through 0 (center) to 1 (hard right). Only the voice is panned; reverb and background noise stay centered. + """ + + 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/data/src/elevenlabs/types/eleven_flash_v_25_request.py b/data/src/elevenlabs/types/eleven_flash_v_25_request.py new file mode 100644 index 0000000000000000000000000000000000000000..25a75904838ed983593e43725a0f3853e0ed5a24 --- /dev/null +++ b/data/src/elevenlabs/types/eleven_flash_v_25_request.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .eleven_flash_v_25_request_output_format import ElevenFlashV25RequestOutputFormat +from .eleven_flash_v_25_voice_settings import ElevenFlashV25VoiceSettings +from .pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from .webhook_target import WebhookTarget + + +class ElevenFlashV25Request(UncheckedBaseModel): + """ + Request body for the ElevenLabs Flash v2.5 TTS model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + text: str = pydantic.Field() + """ + The text to synthesize into speech. + """ + + voice: str = pydantic.Field() + """ + The ID of the voice to speak with. + """ + + output_format: typing.Optional[ElevenFlashV25RequestOutputFormat] = pydantic.Field(default=None) + """ + The audio encoding of the output, as `codec_sampleRateHz_bitrateKbps`. `mp3_44100_192` requires the Creator tier or above. + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryVersionLocator]] = ( + pydantic.Field(default=None) + ) + """ + Pronunciation dictionaries to apply to the text, in order of precedence. Up to 3. + """ + + language_code: typing.Optional[str] = pydantic.Field(default=None) + """ + ISO 639-1 language code to enforce on the output. Omit to detect the language from the text. + """ + + voice_settings: typing.Optional[ElevenFlashV25VoiceSettings] = pydantic.Field(default=None) + """ + Overrides for the voice's saved settings, applied to this generation only. + """ + + 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/data/src/elevenlabs/types/eleven_flash_v_25_request_output_format.py b/data/src/elevenlabs/types/eleven_flash_v_25_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..00c2410259ee5f5cf90fcfdd32365fc099a4a474 --- /dev/null +++ b/data/src/elevenlabs/types/eleven_flash_v_25_request_output_format.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ElevenFlashV25RequestOutputFormat = typing.Union[ + typing.Literal[ + "mp3_22050_32", "mp3_24000_48", "mp3_44100_32", "mp3_44100_64", "mp3_44100_96", "mp3_44100_128", "mp3_44100_192" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/eleven_flash_v_25_voice_settings.py b/data/src/elevenlabs/types/eleven_flash_v_25_voice_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..bfb30ea38a9db77e2db6f66c0b9dbc003d880388 --- /dev/null +++ b/data/src/elevenlabs/types/eleven_flash_v_25_voice_settings.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ElevenFlashV25VoiceSettings(UncheckedBaseModel): + """ + Overrides for the voice's saved settings, applied to one generation. + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + How consistent the voice stays across generations. Lower values give more expressive, varied speech. + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + How closely the output adheres to the original voice. + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + The speed of the generated speech, where 1.0 is the voice's natural pace. + """ + + 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/data/src/elevenlabs/types/eleven_multilingual_v_2_request.py b/data/src/elevenlabs/types/eleven_multilingual_v_2_request.py new file mode 100644 index 0000000000000000000000000000000000000000..4e83f03ba7c15fbcb327d3ac960f30196bd2bce0 --- /dev/null +++ b/data/src/elevenlabs/types/eleven_multilingual_v_2_request.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .eleven_multilingual_v_2_request_output_format import ElevenMultilingualV2RequestOutputFormat +from .pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from .tts_voice_settings import TtsVoiceSettings +from .webhook_target import WebhookTarget + + +class ElevenMultilingualV2Request(UncheckedBaseModel): + """ + Request body for the ElevenLabs Multilingual v2 TTS model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + text: str = pydantic.Field() + """ + The text to synthesize into speech. + """ + + voice: str = pydantic.Field() + """ + The ID of the voice to speak with. + """ + + output_format: typing.Optional[ElevenMultilingualV2RequestOutputFormat] = pydantic.Field(default=None) + """ + The audio encoding of the output, as `codec_sampleRateHz_bitrateKbps`. `mp3_44100_192` requires the Creator tier or above. + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryVersionLocator]] = ( + pydantic.Field(default=None) + ) + """ + Pronunciation dictionaries to apply to the text, in order of precedence. Up to 3. + """ + + voice_settings: typing.Optional[TtsVoiceSettings] = pydantic.Field(default=None) + """ + Overrides for the voice's saved settings, applied to this generation only. + """ + + 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/data/src/elevenlabs/types/eleven_multilingual_v_2_request_output_format.py b/data/src/elevenlabs/types/eleven_multilingual_v_2_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..5177d1866c81334aae90575feb0bc5f0480fd52c --- /dev/null +++ b/data/src/elevenlabs/types/eleven_multilingual_v_2_request_output_format.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ElevenMultilingualV2RequestOutputFormat = typing.Union[ + typing.Literal[ + "mp3_22050_32", "mp3_24000_48", "mp3_44100_32", "mp3_44100_64", "mp3_44100_96", "mp3_44100_128", "mp3_44100_192" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/eleven_v_3_request.py b/data/src/elevenlabs/types/eleven_v_3_request.py new file mode 100644 index 0000000000000000000000000000000000000000..985f446dadeba192edd0ba0af6cd06b6a4e15a65 --- /dev/null +++ b/data/src/elevenlabs/types/eleven_v_3_request.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .eleven_v_3_request_output_format import ElevenV3RequestOutputFormat +from .eleven_v_3_voice_settings import ElevenV3VoiceSettings +from .pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from .webhook_target import WebhookTarget + + +class ElevenV3Request(UncheckedBaseModel): + """ + Request body for the Eleven v3 TTS model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + text: str = pydantic.Field() + """ + The text to synthesize into speech. + """ + + voice: str = pydantic.Field() + """ + The ID of the voice to speak with. + """ + + output_format: typing.Optional[ElevenV3RequestOutputFormat] = pydantic.Field(default=None) + """ + The audio encoding of the output, as `codec_sampleRateHz_bitrateKbps`. `mp3_44100_192` requires the Creator tier or above. + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryVersionLocator]] = ( + pydantic.Field(default=None) + ) + """ + Pronunciation dictionaries to apply to the text, in order of precedence. Up to 3. + """ + + language_code: typing.Optional[str] = pydantic.Field(default=None) + """ + ISO 639-1 language code to enforce on the output. Omit to detect the language from the text. + """ + + voice_settings: typing.Optional[ElevenV3VoiceSettings] = pydantic.Field(default=None) + """ + Overrides for the voice's saved settings, applied to this generation only. + """ + + 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/data/src/elevenlabs/types/eleven_v_3_request_output_format.py b/data/src/elevenlabs/types/eleven_v_3_request_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..04fb1b7d5541036f7e0c5794878a11c5d3e7e455 --- /dev/null +++ b/data/src/elevenlabs/types/eleven_v_3_request_output_format.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ElevenV3RequestOutputFormat = typing.Union[ + typing.Literal[ + "mp3_22050_32", "mp3_24000_48", "mp3_44100_32", "mp3_44100_64", "mp3_44100_96", "mp3_44100_128", "mp3_44100_192" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/eleven_v_3_voice_settings.py b/data/src/elevenlabs/types/eleven_v_3_voice_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..2ee28100d3c2c3279e0cbb23c170cebd4223563e --- /dev/null +++ b/data/src/elevenlabs/types/eleven_v_3_voice_settings.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ElevenV3VoiceSettings(UncheckedBaseModel): + """ + Overrides for the voice's saved settings, applied to one generation. + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + How consistent the voice stays across generations. Lower values give more expressive, varied speech. + """ + + 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/data/src/elevenlabs/types/embed_variant.py b/data/src/elevenlabs/types/embed_variant.py new file mode 100644 index 0000000000000000000000000000000000000000..9090da738ace15da51be06cebfd3a95d313c9b64 --- /dev/null +++ b/data/src/elevenlabs/types/embed_variant.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EmbedVariant = typing.Union[typing.Literal["tiny", "compact", "full", "expandable"], typing.Any] diff --git a/data/src/elevenlabs/types/embedding_model_enum.py b/data/src/elevenlabs/types/embedding_model_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..1844f8e9ae8c90f7361026b9602b73a344b3802f --- /dev/null +++ b/data/src/elevenlabs/types/embedding_model_enum.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EmbeddingModelEnum = typing.Union[ + typing.Literal["e5_mistral_7b_instruct", "multilingual_e5_large_instruct"], typing.Any +] diff --git a/data/src/elevenlabs/types/end_call_tool_config.py b/data/src/elevenlabs/types/end_call_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..fd5fcee0da88bc289f87a92505fb53bf6a5f7dd8 --- /dev/null +++ b/data/src/elevenlabs/types/end_call_tool_config.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EndCallToolConfig(UncheckedBaseModel): + 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/data/src/elevenlabs/types/end_call_tool_result_model.py b/data/src/elevenlabs/types/end_call_tool_result_model.py new file mode 100644 index 0000000000000000000000000000000000000000..cb52b88ccb6198f6ccd072bddb48dc099c1b3cd5 --- /dev/null +++ b/data/src/elevenlabs/types/end_call_tool_result_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EndCallToolResultModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + message: 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/data/src/elevenlabs/types/end_call_trigger_action.py b/data/src/elevenlabs/types/end_call_trigger_action.py new file mode 100644 index 0000000000000000000000000000000000000000..96337967e3a504f2d06a448bfcdb94e4d699e3ae --- /dev/null +++ b/data/src/elevenlabs/types/end_call_trigger_action.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EndCallTriggerAction(UncheckedBaseModel): + 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/data/src/elevenlabs/types/end_procedure_tool_config.py b/data/src/elevenlabs/types/end_procedure_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..742692a371e6aa1c4ad29c74339e30417b2be686 --- /dev/null +++ b/data/src/elevenlabs/types/end_procedure_tool_config.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .end_procedure_tool_config_procedures_value import EndProcedureToolConfigProceduresValue + + +class EndProcedureToolConfig(UncheckedBaseModel): + procedures: typing.Optional[typing.Dict[str, EndProcedureToolConfigProceduresValue]] = 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/data/src/elevenlabs/types/end_procedure_tool_config_procedures_value.py b/data/src/elevenlabs/types/end_procedure_tool_config_procedures_value.py new file mode 100644 index 0000000000000000000000000000000000000000..f7d3809d1b29961ce16530702652f3a41ce2aa31 --- /dev/null +++ b/data/src/elevenlabs/types/end_procedure_tool_config_procedures_value.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .procedure_draft_ref import ProcedureDraftRef +from .procedure_version_ref import ProcedureVersionRef + +EndProcedureToolConfigProceduresValue = typing.Union[ProcedureVersionRef, ProcedureDraftRef] diff --git a/data/src/elevenlabs/types/end_procedure_tool_error_status.py b/data/src/elevenlabs/types/end_procedure_tool_error_status.py new file mode 100644 index 0000000000000000000000000000000000000000..fa53f4a088b935ea5f60b1e5e95b260452cc6f8b --- /dev/null +++ b/data/src/elevenlabs/types/end_procedure_tool_error_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EndProcedureToolErrorStatus = typing.Union[typing.Literal["not_found", "invalid_id"], typing.Any] diff --git a/data/src/elevenlabs/types/end_procedure_tool_result_error_model.py b/data/src/elevenlabs/types/end_procedure_tool_result_error_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6f1152809a283456070cd9bb8a2e82a88e70d931 --- /dev/null +++ b/data/src/elevenlabs/types/end_procedure_tool_result_error_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .end_procedure_tool_error_status import EndProcedureToolErrorStatus + + +class EndProcedureToolResultErrorModel(UncheckedBaseModel): + status: EndProcedureToolErrorStatus + procedure_id: typing.Optional[str] = None + message: 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/data/src/elevenlabs/types/end_procedure_tool_result_success_model.py b/data/src/elevenlabs/types/end_procedure_tool_result_success_model.py new file mode 100644 index 0000000000000000000000000000000000000000..400fe3ed0e33cfb00ce156668ae77744ffb201c5 --- /dev/null +++ b/data/src/elevenlabs/types/end_procedure_tool_result_success_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EndProcedureToolResultSuccessModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + procedure_id: str + procedure_name: str + message: 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/data/src/elevenlabs/types/entity_management_activity_id.py b/data/src/elevenlabs/types/entity_management_activity_id.py new file mode 100644 index 0000000000000000000000000000000000000000..d7c1b8016f77d9165e6e406106c2ad8c716f747f --- /dev/null +++ b/data/src/elevenlabs/types/entity_management_activity_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +EntityManagementActivityId = int diff --git a/data/src/elevenlabs/types/entry_behavior.py b/data/src/elevenlabs/types/entry_behavior.py new file mode 100644 index 0000000000000000000000000000000000000000..cc7425abad1d0f438cec1efe2dbc37d103c30263 --- /dev/null +++ b/data/src/elevenlabs/types/entry_behavior.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EntryBehavior = typing.Union[typing.Literal["generate_immediately", "wait_for_user", "auto"], typing.Any] diff --git a/data/src/elevenlabs/types/environment_auth_connection_locator.py b/data/src/elevenlabs/types/environment_auth_connection_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..1ef98df1eb6877da789df6e83f42185f735d3536 --- /dev/null +++ b/data/src/elevenlabs/types/environment_auth_connection_locator.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EnvironmentAuthConnectionLocator(UncheckedBaseModel): + """ + References an environment variable of type 'auth_connection' by label. + At runtime, resolves to the auth connection for the current environment, + falling back to the default environment. + """ + + env_var_label: 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/data/src/elevenlabs/types/environment_response.py b/data/src/elevenlabs/types/environment_response.py new file mode 100644 index 0000000000000000000000000000000000000000..65f25e1b1f0616f1a7d0fe697f22455a9ef64cfe --- /dev/null +++ b/data/src/elevenlabs/types/environment_response.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EnvironmentResponse(UncheckedBaseModel): + name: str = pydantic.Field() + """ + Name of the environment, e.g. 'staging'. + """ + + updated_at_unix_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + When the environment was created or one of its values last changed. Unset when neither is known. + """ + + created_by_user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Unset for 'production' and when the creator is not known. + """ + + 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/data/src/elevenlabs/types/environment_variable_auth_connection_value.py b/data/src/elevenlabs/types/environment_variable_auth_connection_value.py new file mode 100644 index 0000000000000000000000000000000000000000..35dac06500107919124c3c685859635bce3e9c86 --- /dev/null +++ b/data/src/elevenlabs/types/environment_variable_auth_connection_value.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EnvironmentVariableAuthConnectionValue(UncheckedBaseModel): + auth_connection_id: 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/data/src/elevenlabs/types/environment_variable_auth_connection_value_request.py b/data/src/elevenlabs/types/environment_variable_auth_connection_value_request.py new file mode 100644 index 0000000000000000000000000000000000000000..a20d6598edcd7c99c0e766374cac66f0223529d6 --- /dev/null +++ b/data/src/elevenlabs/types/environment_variable_auth_connection_value_request.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EnvironmentVariableAuthConnectionValueRequest(UncheckedBaseModel): + auth_connection_id: 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/data/src/elevenlabs/types/environment_variable_response.py b/data/src/elevenlabs/types/environment_variable_response.py new file mode 100644 index 0000000000000000000000000000000000000000..45fcf94e0bc07efa4169ce11228da5f67878ac70 --- /dev/null +++ b/data/src/elevenlabs/types/environment_variable_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .environment_variable_response_type import EnvironmentVariableResponseType +from .environment_variable_response_values import EnvironmentVariableResponseValues + + +class EnvironmentVariableResponse(UncheckedBaseModel): + label: str + created_at_unix_secs: int + updated_at_unix_secs: int + created_by_user_id: typing.Optional[str] = None + type: EnvironmentVariableResponseType + id: str + workspace_id: str + values: EnvironmentVariableResponseValues + + 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/data/src/elevenlabs/types/environment_variable_response_type.py b/data/src/elevenlabs/types/environment_variable_response_type.py new file mode 100644 index 0000000000000000000000000000000000000000..477b0723de75354160810136660324751d86fa42 --- /dev/null +++ b/data/src/elevenlabs/types/environment_variable_response_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EnvironmentVariableResponseType = typing.Union[typing.Literal["string", "secret", "auth_connection"], typing.Any] diff --git a/data/src/elevenlabs/types/environment_variable_response_values.py b/data/src/elevenlabs/types/environment_variable_response_values.py new file mode 100644 index 0000000000000000000000000000000000000000..22f2b1c4a2606158809ea2b81c6bfadf9b5cc829 --- /dev/null +++ b/data/src/elevenlabs/types/environment_variable_response_values.py @@ -0,0 +1,12 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .environment_variable_auth_connection_value import EnvironmentVariableAuthConnectionValue +from .environment_variable_secret_value import EnvironmentVariableSecretValue + +EnvironmentVariableResponseValues = typing.Union[ + typing.Dict[str, str], + typing.Dict[str, EnvironmentVariableSecretValue], + typing.Dict[str, EnvironmentVariableAuthConnectionValue], +] diff --git a/data/src/elevenlabs/types/environment_variable_secret_value.py b/data/src/elevenlabs/types/environment_variable_secret_value.py new file mode 100644 index 0000000000000000000000000000000000000000..ce7b16b190d10963acc5239042811517e6f0373d --- /dev/null +++ b/data/src/elevenlabs/types/environment_variable_secret_value.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EnvironmentVariableSecretValue(UncheckedBaseModel): + secret_id: 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/data/src/elevenlabs/types/environment_variable_secret_value_request.py b/data/src/elevenlabs/types/environment_variable_secret_value_request.py new file mode 100644 index 0000000000000000000000000000000000000000..c08e05af47d31d0be1b155d7b2bbcc57a319960d --- /dev/null +++ b/data/src/elevenlabs/types/environment_variable_secret_value_request.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class EnvironmentVariableSecretValueRequest(UncheckedBaseModel): + secret_id: 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/data/src/elevenlabs/types/environment_variables_list_response.py b/data/src/elevenlabs/types/environment_variables_list_response.py new file mode 100644 index 0000000000000000000000000000000000000000..5191b62dc698747d9169aa95856144e049203b60 --- /dev/null +++ b/data/src/elevenlabs/types/environment_variables_list_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .environment_variable_response import EnvironmentVariableResponse + + +class EnvironmentVariablesListResponse(UncheckedBaseModel): + environment_variables: typing.List[EnvironmentVariableResponse] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/environments_list_response.py b/data/src/elevenlabs/types/environments_list_response.py new file mode 100644 index 0000000000000000000000000000000000000000..6c3d4fb03ba743c936676e7153bcc6a328a9b452 --- /dev/null +++ b/data/src/elevenlabs/types/environments_list_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .environment_response import EnvironmentResponse + + +class EnvironmentsListResponse(UncheckedBaseModel): + environments: typing.List[EnvironmentResponse] = pydantic.Field() + """ + All workspace environments, 'production' first. Variables without a value for an environment fall back to their production value. + """ + + 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/data/src/elevenlabs/types/error_payload.py b/data/src/elevenlabs/types/error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..f1b19de0cd1f16ba9423ac1289c00d73232cc1b3 --- /dev/null +++ b/data/src/elevenlabs/types/error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ErrorPayload(UncheckedBaseModel): + """ + Payload for protocol-level errors sent by ElevenLabs before closing the connection. + """ + + type: typing.Literal["error"] = pydantic.Field(default="error") + """ + The message type identifier. + """ + + message: str = pydantic.Field() + """ + Human-readable description of the error. + """ + + 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/data/src/elevenlabs/types/evaluation_criteria_summary_result.py b/data/src/elevenlabs/types/evaluation_criteria_summary_result.py new file mode 100644 index 0000000000000000000000000000000000000000..3acae13831ce9e409b749468c3983503f5d24e86 --- /dev/null +++ b/data/src/elevenlabs/types/evaluation_criteria_summary_result.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .evaluation_success_result import EvaluationSuccessResult + + +class EvaluationCriteriaSummaryResult(UncheckedBaseModel): + result: EvaluationSuccessResult + score: typing.Optional[int] = None + max_score: typing.Optional[int] = 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/data/src/elevenlabs/types/evaluation_result_filter.py b/data/src/elevenlabs/types/evaluation_result_filter.py new file mode 100644 index 0000000000000000000000000000000000000000..83f8e6f547b5c2420be708bc63efae93388cb198 --- /dev/null +++ b/data/src/elevenlabs/types/evaluation_result_filter.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EvaluationResultFilter = typing.Union[typing.Literal["success", "failure", "unknown", "error"], typing.Any] diff --git a/data/src/elevenlabs/types/evaluation_settings_input.py b/data/src/elevenlabs/types/evaluation_settings_input.py new file mode 100644 index 0000000000000000000000000000000000000000..a77d9307bfcd46a6d29cc1fe9076ce7ceaf303b2 --- /dev/null +++ b/data/src/elevenlabs/types/evaluation_settings_input.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .prompt_evaluation_criteria import PromptEvaluationCriteria + + +class EvaluationSettingsInput(UncheckedBaseModel): + """ + Settings to evaluate an agent's performance. + Agents are evaluated against a set of criteria, with success being defined as meeting some combination of those criteria. + """ + + criteria: typing.Optional[typing.List[PromptEvaluationCriteria]] = pydantic.Field(default=None) + """ + Individual criteria that the agent should be evaluated against + """ + + 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/data/src/elevenlabs/types/evaluation_settings_output.py b/data/src/elevenlabs/types/evaluation_settings_output.py new file mode 100644 index 0000000000000000000000000000000000000000..be45db42cd72d00e943f7076b54c34346f339b4a --- /dev/null +++ b/data/src/elevenlabs/types/evaluation_settings_output.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .prompt_evaluation_criteria import PromptEvaluationCriteria + + +class EvaluationSettingsOutput(UncheckedBaseModel): + """ + Settings to evaluate an agent's performance. + Agents are evaluated against a set of criteria, with success being defined as meeting some combination of those criteria. + """ + + criteria: typing.Optional[typing.List[PromptEvaluationCriteria]] = pydantic.Field(default=None) + """ + Individual criteria that the agent should be evaluated against + """ + + 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/data/src/elevenlabs/types/evaluation_success_result.py b/data/src/elevenlabs/types/evaluation_success_result.py new file mode 100644 index 0000000000000000000000000000000000000000..3d18d896b7eec908501b0d217867d0ffbf91cd00 --- /dev/null +++ b/data/src/elevenlabs/types/evaluation_success_result.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EvaluationSuccessResult = typing.Union[typing.Literal["success", "failure", "unknown"], typing.Any] diff --git a/data/src/elevenlabs/types/exact_parameter_evaluation_strategy.py b/data/src/elevenlabs/types/exact_parameter_evaluation_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..7f49438bf8b9bb43f7d713ae2a121ab0a667526e --- /dev/null +++ b/data/src/elevenlabs/types/exact_parameter_evaluation_strategy.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ExactParameterEvaluationStrategy(UncheckedBaseModel): + expected_value: str = pydantic.Field() + """ + The exact string value that the parameter must match. + """ + + 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/data/src/elevenlabs/types/exotel_api_subdomain.py b/data/src/elevenlabs/types/exotel_api_subdomain.py new file mode 100644 index 0000000000000000000000000000000000000000..e37ab04ec4c205c9faddfc442314ae4a94ea74a4 --- /dev/null +++ b/data/src/elevenlabs/types/exotel_api_subdomain.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ExotelApiSubdomain = typing.Union[typing.Literal["api.in.exotel.com", "api.exotel.com"], typing.Any] diff --git a/data/src/elevenlabs/types/exotel_outbound_call_response.py b/data/src/elevenlabs/types/exotel_outbound_call_response.py new file mode 100644 index 0000000000000000000000000000000000000000..11e065d1069f975df3a7b12072c79e7894f60bd4 --- /dev/null +++ b/data/src/elevenlabs/types/exotel_outbound_call_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ExotelOutboundCallResponse(UncheckedBaseModel): + success: bool + message: str + conversation_id: typing.Optional[str] = None + call_sid: typing_extensions.Annotated[ + typing.Optional[str], + FieldMetadata(alias="callSid"), + pydantic.Field(alias="callSid", description="Exotel CallSid for the originated call"), + ] = 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/data/src/elevenlabs/types/experiment_assignment.py b/data/src/elevenlabs/types/experiment_assignment.py new file mode 100644 index 0000000000000000000000000000000000000000..d15c8fb26f1b2f788a6a7e7a6b15025054a83639 --- /dev/null +++ b/data/src/elevenlabs/types/experiment_assignment.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .experiment_assignment_source import ExperimentAssignmentSource + + +class ExperimentAssignment(UncheckedBaseModel): + """ + Experiment membership recorded on a conversation. + """ + + key: str = pydantic.Field() + """ + Experiment key. + """ + + variant: str = pydantic.Field() + """ + Variant identifier: the branch id for server_branch, or the client-supplied variant for client_declared. + """ + + source: ExperimentAssignmentSource + experiment_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The AgentExperiment id, when the assignment maps to a registered experiment. + """ + + 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/data/src/elevenlabs/types/experiment_assignment_source.py b/data/src/elevenlabs/types/experiment_assignment_source.py new file mode 100644 index 0000000000000000000000000000000000000000..95784814147fd93fb79c7b8ef7c8b996779e93d9 --- /dev/null +++ b/data/src/elevenlabs/types/experiment_assignment_source.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ExperimentAssignmentSource = typing.Union[typing.Literal["server_branch", "client_declared"], typing.Any] diff --git a/data/src/elevenlabs/types/expires_after.py b/data/src/elevenlabs/types/expires_after.py new file mode 100644 index 0000000000000000000000000000000000000000..32ca69dc066450132103a7e257024124859b5abd --- /dev/null +++ b/data/src/elevenlabs/types/expires_after.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ExpiresAfter(UncheckedBaseModel): + anchor: typing.Optional[typing.Literal["created_at"]] = None + seconds: int + + 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/data/src/elevenlabs/types/export_options.py b/data/src/elevenlabs/types/export_options.py new file mode 100644 index 0000000000000000000000000000000000000000..48d454a395ea869a2f1d0a8cf40b225656b946cf --- /dev/null +++ b/data/src/elevenlabs/types/export_options.py @@ -0,0 +1,133 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class ExportOptions_Docx(UncheckedBaseModel): + format: typing.Literal["docx"] = "docx" + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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 + + +class ExportOptions_Html(UncheckedBaseModel): + format: typing.Literal["html"] = "html" + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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 + + +class ExportOptions_Pdf(UncheckedBaseModel): + format: typing.Literal["pdf"] = "pdf" + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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 + + +class ExportOptions_SegmentedJson(UncheckedBaseModel): + format: typing.Literal["segmented_json"] = "segmented_json" + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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 + + +class ExportOptions_Srt(UncheckedBaseModel): + format: typing.Literal["srt"] = "srt" + max_characters_per_line: typing.Optional[int] = None + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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 + + +class ExportOptions_Txt(UncheckedBaseModel): + format: typing.Literal["txt"] = "txt" + max_characters_per_line: typing.Optional[int] = None + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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 + + +ExportOptions = typing_extensions.Annotated[ + typing.Union[ + ExportOptions_Docx, + ExportOptions_Html, + ExportOptions_Pdf, + ExportOptions_SegmentedJson, + ExportOptions_Srt, + ExportOptions_Txt, + ], + UnionMetadata(discriminant="format"), +] diff --git a/data/src/elevenlabs/types/external_file_sync_info.py b/data/src/elevenlabs/types/external_file_sync_info.py new file mode 100644 index 0000000000000000000000000000000000000000..ad0e51d5d32fb87caafbdc7f01cab4c7425b5501 --- /dev/null +++ b/data/src/elevenlabs/types/external_file_sync_info.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .external_sync_provider import ExternalSyncProvider + + +class ExternalFileSyncInfo(UncheckedBaseModel): + """ + Tracks the link back to the original file in an external source. + """ + + type: ExternalSyncProvider = pydantic.Field(default="google_drive") + """ + Provider identifier + """ + + source_entity_id: str = pydantic.Field() + """ + Entity ID in the external system + """ + + integration_connection_id: str = pydantic.Field() + """ + Integration connection instance ID + """ + + source_parent_entity_id: str = pydantic.Field() + """ + Folder ID in the external system this file was synced from + """ + + source_mime_type: str = pydantic.Field() + """ + Original MIME type in the external system + """ + + source_modified_time: dt.datetime = pydantic.Field() + """ + Last modified time from the external system + """ + + root_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + KB folder ID of the sync root, used to query all entities under a sync tree + """ + + 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/data/src/elevenlabs/types/external_folder_sync_info.py b/data/src/elevenlabs/types/external_folder_sync_info.py new file mode 100644 index 0000000000000000000000000000000000000000..2339eebd221c655348543d33c4fee7b580c6190b --- /dev/null +++ b/data/src/elevenlabs/types/external_folder_sync_info.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .external_sync_provider import ExternalSyncProvider + + +class ExternalFolderSyncInfo(UncheckedBaseModel): + """ + Metadata for a KB folder that mirrors an external source folder. + """ + + type: ExternalSyncProvider = pydantic.Field(default="google_drive") + """ + Provider identifier + """ + + source_entity_id: str = pydantic.Field() + """ + Entity ID in the external system + """ + + integration_connection_id: str = pydantic.Field() + """ + Integration connection instance ID + """ + + root_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + KB folder ID of the sync root. None means this folder is the root. + """ + + sync_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Opaque cursor for incremental sync, interpreted by the provider + """ + + last_sync_at: typing.Optional[int] = pydantic.Field(default=None) + """ + Unix timestamp of last completed sync + """ + + 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/data/src/elevenlabs/types/external_sync_job_trigger.py b/data/src/elevenlabs/types/external_sync_job_trigger.py new file mode 100644 index 0000000000000000000000000000000000000000..ec9f06009f36424c79fc2253f6f2be825f5c9fbe --- /dev/null +++ b/data/src/elevenlabs/types/external_sync_job_trigger.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ExternalSyncJobTrigger = typing.Union[typing.Literal["on_demand", "on_connect", "auto"], typing.Any] diff --git a/data/src/elevenlabs/types/external_sync_job_type.py b/data/src/elevenlabs/types/external_sync_job_type.py new file mode 100644 index 0000000000000000000000000000000000000000..a2bb9a6f517baf620bb9d4297a5762b12168e9cb --- /dev/null +++ b/data/src/elevenlabs/types/external_sync_job_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ExternalSyncJobType = typing.Union[typing.Literal["full", "incremental"], typing.Any] diff --git a/data/src/elevenlabs/types/external_sync_provider.py b/data/src/elevenlabs/types/external_sync_provider.py new file mode 100644 index 0000000000000000000000000000000000000000..32790d470990475cdb25b60a81b1247cb05b96ab --- /dev/null +++ b/data/src/elevenlabs/types/external_sync_provider.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ExternalSyncProvider = typing.Literal["google_drive"] diff --git a/data/src/elevenlabs/types/feature_status_common_model.py b/data/src/elevenlabs/types/feature_status_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ebbc4b6d4fd10e387abce463300984558b8d56dd --- /dev/null +++ b/data/src/elevenlabs/types/feature_status_common_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class FeatureStatusCommonModel(UncheckedBaseModel): + enabled: typing.Optional[bool] = None + used: 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/data/src/elevenlabs/types/features_usage_common_model.py b/data/src/elevenlabs/types/features_usage_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d57f9330199c556e369f6f79ed59dbc3938b91c5 --- /dev/null +++ b/data/src/elevenlabs/types/features_usage_common_model.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .feature_status_common_model import FeatureStatusCommonModel +from .tests_feature_usage_common_model import TestsFeatureUsageCommonModel +from .workflow_features_usage_common_model import WorkflowFeaturesUsageCommonModel + + +class FeaturesUsageCommonModel(UncheckedBaseModel): + language_detection: typing.Optional[FeatureStatusCommonModel] = None + transfer_to_agent: typing.Optional[FeatureStatusCommonModel] = None + transfer_to_number: typing.Optional[FeatureStatusCommonModel] = None + multivoice: typing.Optional[FeatureStatusCommonModel] = None + dtmf_tones: typing.Optional[FeatureStatusCommonModel] = None + external_mcp_servers: typing.Optional[FeatureStatusCommonModel] = None + pii_zrm_workspace: typing.Optional[bool] = None + pii_zrm_agent: typing.Optional[bool] = None + tool_dynamic_variable_updates: typing.Optional[FeatureStatusCommonModel] = None + is_livekit: typing.Optional[bool] = None + voicemail_detection: typing.Optional[FeatureStatusCommonModel] = None + dtmf_input: typing.Optional[FeatureStatusCommonModel] = None + workflow: typing.Optional[WorkflowFeaturesUsageCommonModel] = None + agent_testing: typing.Optional[TestsFeatureUsageCommonModel] = None + versioning: typing.Optional[FeatureStatusCommonModel] = None + file_input: typing.Optional[FeatureStatusCommonModel] = None + freeform_procedure: typing.Optional[FeatureStatusCommonModel] = None + structured_procedure: typing.Optional[FeatureStatusCommonModel] = 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/data/src/elevenlabs/types/feedback_item.py b/data/src/elevenlabs/types/feedback_item.py new file mode 100644 index 0000000000000000000000000000000000000000..54afd5abd5a7dba1d96eb42e700df03b9de411fe --- /dev/null +++ b/data/src/elevenlabs/types/feedback_item.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FeedbackItem = typing.Any diff --git a/data/src/elevenlabs/types/field_conflict.py b/data/src/elevenlabs/types/field_conflict.py new file mode 100644 index 0000000000000000000000000000000000000000..c87471cf4ccc02428bb7450f73a52bf32e786bf6 --- /dev/null +++ b/data/src/elevenlabs/types/field_conflict.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conflict_section import ConflictSection + + +class FieldConflict(UncheckedBaseModel): + path: str = pydantic.Field() + """ + Identifier of the conflicting field relative to its section: a dot-path within conversation_config/platform_settings (e.g. `tts.voice_id`), a procedure id, or a workflow path: `nodes.`, `edges.`, or the name of a top-level workflow setting. + """ + + section: ConflictSection = pydantic.Field() + """ + Which config section this path belongs to. + """ + + base_value: typing.Optional[typing.Any] = pydantic.Field(default=None) + """ + Value at the common ancestor (merge base). + """ + + source_value: typing.Optional[typing.Any] = pydantic.Field(default=None) + """ + Value on the source branch tip. + """ + + target_value: typing.Optional[typing.Any] = pydantic.Field(default=None) + """ + Value on the target branch tip. + """ + + 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/data/src/elevenlabs/types/file_input_config.py b/data/src/elevenlabs/types/file_input_config.py new file mode 100644 index 0000000000000000000000000000000000000000..3fdbca48cdcd524f036f57338c7bebd51d8cd9d8 --- /dev/null +++ b/data/src/elevenlabs/types/file_input_config.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class FileInputConfig(UncheckedBaseModel): + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, users may attach images, PDFs, or text files in chat when the LLM supports multimodal input. + """ + + max_files_in_memory: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of most-recent files kept in memory during a conversation. Older files are summarized and their bytes freed. + """ + + max_files_per_conversation: typing.Optional[int] = pydantic.Field(default=None) + """ + Total files a user can upload in one conversation. Uploads are billed per file. Use -1 for no limit, or a value >= max_files_in_memory. + """ + + 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/data/src/elevenlabs/types/file_input_config_workflow_override.py b/data/src/elevenlabs/types/file_input_config_workflow_override.py new file mode 100644 index 0000000000000000000000000000000000000000..feec315925ef5ad8d6cfcddc93e077b4bbc7b650 --- /dev/null +++ b/data/src/elevenlabs/types/file_input_config_workflow_override.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class FileInputConfigWorkflowOverride(UncheckedBaseModel): + enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, users may attach images, PDFs, or text files in chat when the LLM supports multimodal input. + """ + + max_files_in_memory: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of most-recent files kept in memory during a conversation. Older files are summarized and their bytes freed. + """ + + max_files_per_conversation: typing.Optional[int] = pydantic.Field(default=None) + """ + Total files a user can upload in one conversation. Uploads are billed per file. Use -1 for no limit, or a value >= max_files_in_memory. + """ + + 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/data/src/elevenlabs/types/file_refresh_status.py b/data/src/elevenlabs/types/file_refresh_status.py new file mode 100644 index 0000000000000000000000000000000000000000..8fe0c058973f51f1ab1cc66836501d001c70489d --- /dev/null +++ b/data/src/elevenlabs/types/file_refresh_status.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .crawl_status import CrawlStatus + + +class FileRefreshStatus(UncheckedBaseModel): + """ + In-flight/last refresh state for an externally-synced KB file. + """ + + status: typing.Optional[CrawlStatus] = None + enqueued_at: typing.Optional[int] = None + started_at: typing.Optional[int] = None + completed_at: typing.Optional[int] = None + last_synced_at: typing.Optional[int] = None + error_message: 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/data/src/elevenlabs/types/final_output.py b/data/src/elevenlabs/types/final_output.py new file mode 100644 index 0000000000000000000000000000000000000000..1633466d33795b77d68266bf513f686e3e391876 --- /dev/null +++ b/data/src/elevenlabs/types/final_output.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class FinalOutput(UncheckedBaseModel): + is_final: typing_extensions.Annotated[ + typing.Optional[typing.Literal[True]], + FieldMetadata(alias="isFinal"), + pydantic.Field( + alias="isFinal", + description="Indicates if the generation is complete. If set to `True`, `audio` will be null.", + ), + ] = 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/data/src/elevenlabs/types/final_output_multi.py b/data/src/elevenlabs/types/final_output_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..5a6ced1df357486b9af57cc38e2093974ccf278a --- /dev/null +++ b/data/src/elevenlabs/types/final_output_multi.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class FinalOutputMulti(UncheckedBaseModel): + """ + Server payload indicating the final output for a specific context. + """ + + is_final: typing_extensions.Annotated[ + typing.Literal[True], + FieldMetadata(alias="isFinal"), + pydantic.Field(alias="isFinal", description="Indicates this is the final message for the context."), + ] = True + context_id: typing_extensions.Annotated[ + typing.Optional[str], + FieldMetadata(alias="contextId"), + pydantic.Field(alias="contextId", description="The context_id for which this is the final message."), + ] = 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/data/src/elevenlabs/types/fine_tuning_response.py b/data/src/elevenlabs/types/fine_tuning_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b88d9a3cdaa880e7f44626234a1cc0d936b62ca1 --- /dev/null +++ b/data/src/elevenlabs/types/fine_tuning_response.py @@ -0,0 +1,93 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .fine_tuning_response_state_value import FineTuningResponseStateValue +from .manual_verification_response import ManualVerificationResponse +from .verification_attempt_response import VerificationAttemptResponse + + +class FineTuningResponse(UncheckedBaseModel): + is_allowed_to_fine_tune: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the user is allowed to fine-tune the voice. + """ + + state: typing.Optional[typing.Dict[str, FineTuningResponseStateValue]] = pydantic.Field(default=None) + """ + The state of the fine-tuning process for each model. + """ + + verification_failures: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of verification failures in the fine-tuning process. + """ + + verification_attempts_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of verification attempts in the fine-tuning process. + """ + + manual_verification_requested: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether a manual verification was requested for the fine-tuning process. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + The language of the fine-tuning process. + """ + + progress: typing.Optional[typing.Dict[str, typing.Optional[float]]] = pydantic.Field(default=None) + """ + The progress of the fine-tuning process. + """ + + message: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None) + """ + The message of the fine-tuning process. + """ + + dataset_duration_seconds: typing.Optional[float] = pydantic.Field(default=None) + """ + The duration of the dataset in seconds. + """ + + verification_attempts: typing.Optional[typing.List[VerificationAttemptResponse]] = pydantic.Field(default=None) + """ + The number of verification attempts. + """ + + slice_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of slice IDs. + """ + + manual_verification: typing.Optional[ManualVerificationResponse] = pydantic.Field(default=None) + """ + The manual verification of the fine-tuning process. + """ + + max_verification_attempts: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum number of verification attempts. + """ + + next_max_verification_attempts_reset_unix_ms: typing.Optional[int] = pydantic.Field(default=None) + """ + The next maximum verification attempts reset time in Unix milliseconds. + """ + + finetuning_state: typing.Optional[typing.Any] = 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/data/src/elevenlabs/types/fine_tuning_response_state_value.py b/data/src/elevenlabs/types/fine_tuning_response_state_value.py new file mode 100644 index 0000000000000000000000000000000000000000..75801fb58415ea148872ab8f6a3e282c7682df59 --- /dev/null +++ b/data/src/elevenlabs/types/fine_tuning_response_state_value.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FineTuningResponseStateValue = typing.Union[ + typing.Literal["not_started", "queued", "fine_tuning", "fine_tuned", "failed", "delayed"], typing.Any +] diff --git a/data/src/elevenlabs/types/finetune_created_by.py b/data/src/elevenlabs/types/finetune_created_by.py new file mode 100644 index 0000000000000000000000000000000000000000..9b247f10a681ca990325c8d38be3ffadd65bcb9c --- /dev/null +++ b/data/src/elevenlabs/types/finetune_created_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FinetuneCreatedBy = typing.Union[typing.Literal["self", "workspace", "elevenlabs"], typing.Any] diff --git a/data/src/elevenlabs/types/finetune_visibility.py b/data/src/elevenlabs/types/finetune_visibility.py new file mode 100644 index 0000000000000000000000000000000000000000..53699dc96398925257690314745f3e181c6a0f32 --- /dev/null +++ b/data/src/elevenlabs/types/finetune_visibility.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FinetuneVisibility = typing.Union[typing.Literal["private", "workspace", "public"], typing.Any] diff --git a/data/src/elevenlabs/types/flush_context.py b/data/src/elevenlabs/types/flush_context.py new file mode 100644 index 0000000000000000000000000000000000000000..464f25f5cd83d9995c0ebd1429ce0c2fd7131422 --- /dev/null +++ b/data/src/elevenlabs/types/flush_context.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class FlushContext(UncheckedBaseModel): + """ + Payload to flush the audio buffer for a specific context. + """ + + context_id: str = pydantic.Field() + """ + The context_id to flush. + """ + + text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to append to the buffer to be flushed. + """ + + flush: bool = pydantic.Field() + """ + If true, flushes the audio buffer for the specified context. If false, the context will remain open and the text will be appended to the buffer to be generated. + """ + + 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/data/src/elevenlabs/types/focus_guardrail.py b/data/src/elevenlabs/types/focus_guardrail.py new file mode 100644 index 0000000000000000000000000000000000000000..971b59ed5dd2adc2e63ea06948ec2aa44e524fc9 --- /dev/null +++ b/data/src/elevenlabs/types/focus_guardrail.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class FocusGuardrail(UncheckedBaseModel): + is_enabled: 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/data/src/elevenlabs/types/forced_alignment_character_response_model.py b/data/src/elevenlabs/types/forced_alignment_character_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9b93d249ab6e235d92d6aeae5f5e75786b19f40b --- /dev/null +++ b/data/src/elevenlabs/types/forced_alignment_character_response_model.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ForcedAlignmentCharacterResponseModel(UncheckedBaseModel): + """ + Model representing a single character with its timing information from the aligner. + """ + + text: str = pydantic.Field() + """ + The character that was transcribed. + """ + + start: float = pydantic.Field() + """ + The start time of the character in seconds. + """ + + end: float = pydantic.Field() + """ + The end time of the character in seconds. + """ + + 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/data/src/elevenlabs/types/forced_alignment_response_model.py b/data/src/elevenlabs/types/forced_alignment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d93713f712229c8ce9c9c14c2ae1afa9966ac75c --- /dev/null +++ b/data/src/elevenlabs/types/forced_alignment_response_model.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .forced_alignment_character_response_model import ForcedAlignmentCharacterResponseModel +from .forced_alignment_word_response_model import ForcedAlignmentWordResponseModel + + +class ForcedAlignmentResponseModel(UncheckedBaseModel): + """ + Model representing the response from the aligner service. + """ + + characters: typing.List[ForcedAlignmentCharacterResponseModel] = pydantic.Field() + """ + List of characters with their timing information. + """ + + words: typing.List[ForcedAlignmentWordResponseModel] = pydantic.Field() + """ + List of words with their timing information. + """ + + loss: float = pydantic.Field() + """ + The average alignment loss/confidence score for the entire transcript, calculated from all characters. + """ + + 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/data/src/elevenlabs/types/forced_alignment_word_response_model.py b/data/src/elevenlabs/types/forced_alignment_word_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1f2f162a71098366863536338b9b9dce73a1cf5a --- /dev/null +++ b/data/src/elevenlabs/types/forced_alignment_word_response_model.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ForcedAlignmentWordResponseModel(UncheckedBaseModel): + """ + Model representing a single word with its timing information from the aligner. + """ + + text: str = pydantic.Field() + """ + The word that was transcribed. + """ + + start: float = pydantic.Field() + """ + The start time of the word in seconds. + """ + + end: float = pydantic.Field() + """ + The end time of the word in seconds. + """ + + loss: float = pydantic.Field() + """ + The average alignment loss/confidence score for this word, calculated from its constituent characters. + """ + + 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/data/src/elevenlabs/types/frustrated_conversation_ref.py b/data/src/elevenlabs/types/frustrated_conversation_ref.py new file mode 100644 index 0000000000000000000000000000000000000000..e5205e1fc147ac14139c0a7c5ad1b3e430191e66 --- /dev/null +++ b/data/src/elevenlabs/types/frustrated_conversation_ref.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .frustrated_conversation_ref_overall_label import FrustratedConversationRefOverallLabel + + +class FrustratedConversationRef(UncheckedBaseModel): + conversation_id: str + agent_id: str + start_time_unix_secs: int + overall_label: FrustratedConversationRefOverallLabel + overall_sentiment_score: float + overall_frustration_score: float + + 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/data/src/elevenlabs/types/frustrated_conversation_ref_overall_label.py b/data/src/elevenlabs/types/frustrated_conversation_ref_overall_label.py new file mode 100644 index 0000000000000000000000000000000000000000..066547e15a95d84327ae30027445b3e80b596155 --- /dev/null +++ b/data/src/elevenlabs/types/frustrated_conversation_ref_overall_label.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +FrustratedConversationRefOverallLabel = typing.Union[typing.Literal["positive", "neutral", "negative"], typing.Any] diff --git a/data/src/elevenlabs/types/gemini_25_flash_image_request.py b/data/src/elevenlabs/types/gemini_25_flash_image_request.py new file mode 100644 index 0000000000000000000000000000000000000000..755225c530b9ff3f4a620b08048f0d3be21cfc89 --- /dev/null +++ b/data/src/elevenlabs/types/gemini_25_flash_image_request.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gemini_25_flash_image_request_aspect_ratio import Gemini25FlashImageRequestAspectRatio +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class Gemini25FlashImageRequest(UncheckedBaseModel): + """ + Request body for the Google Gemini 2.5 Flash image model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 5 reference images to edit or draw from. + """ + + aspect_ratio: typing.Optional[Gemini25FlashImageRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + 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/data/src/elevenlabs/types/gemini_25_flash_image_request_aspect_ratio.py b/data/src/elevenlabs/types/gemini_25_flash_image_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..39fedc47bef27418e5bcc09a795287f4bde70f44 --- /dev/null +++ b/data/src/elevenlabs/types/gemini_25_flash_image_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Gemini25FlashImageRequestAspectRatio = typing.Union[ + typing.Literal["auto", "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"], typing.Any +] diff --git a/data/src/elevenlabs/types/gemini_31_flash_image_request.py b/data/src/elevenlabs/types/gemini_31_flash_image_request.py new file mode 100644 index 0000000000000000000000000000000000000000..58b9bfc801de9f927272e8953a9d581b51ceb110 --- /dev/null +++ b/data/src/elevenlabs/types/gemini_31_flash_image_request.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gemini_31_flash_image_request_aspect_ratio import Gemini31FlashImageRequestAspectRatio +from .gemini_31_flash_image_request_resolution import Gemini31FlashImageRequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class Gemini31FlashImageRequest(UncheckedBaseModel): + """ + Request body for the Google Gemini 3.1 Flash image model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 14 reference images to edit or draw from. + """ + + aspect_ratio: typing.Optional[Gemini31FlashImageRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + resolution: typing.Optional[Gemini31FlashImageRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output image. + """ + + 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/data/src/elevenlabs/types/gemini_31_flash_image_request_aspect_ratio.py b/data/src/elevenlabs/types/gemini_31_flash_image_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..ee234e70505cbe2b154014bd76afa4c4fe712649 --- /dev/null +++ b/data/src/elevenlabs/types/gemini_31_flash_image_request_aspect_ratio.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Gemini31FlashImageRequestAspectRatio = typing.Union[ + typing.Literal[ + "auto", "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9", "1:4", "4:1", "1:8", "8:1" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/gemini_31_flash_image_request_resolution.py b/data/src/elevenlabs/types/gemini_31_flash_image_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..86f2c7fa90410697a2c0fb5a55bd8ba5319a7b48 --- /dev/null +++ b/data/src/elevenlabs/types/gemini_31_flash_image_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Gemini31FlashImageRequestResolution = typing.Union[typing.Literal["512", "1K", "2K", "4K"], typing.Any] diff --git a/data/src/elevenlabs/types/gemini_31_flash_lite_image_request.py b/data/src/elevenlabs/types/gemini_31_flash_lite_image_request.py new file mode 100644 index 0000000000000000000000000000000000000000..00fa893c9e660f6fad888177bd4fd37c475981f4 --- /dev/null +++ b/data/src/elevenlabs/types/gemini_31_flash_lite_image_request.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gemini_31_flash_lite_image_request_aspect_ratio import Gemini31FlashLiteImageRequestAspectRatio +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class Gemini31FlashLiteImageRequest(UncheckedBaseModel): + """ + Request body for the Google Gemini 3.1 Flash Lite image model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 14 reference images to edit or draw from. + """ + + aspect_ratio: typing.Optional[Gemini31FlashLiteImageRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + resolution: typing.Optional[typing.Literal["1K"]] = pydantic.Field(default=None) + """ + The resolution of the output image. + """ + + 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/data/src/elevenlabs/types/gemini_31_flash_lite_image_request_aspect_ratio.py b/data/src/elevenlabs/types/gemini_31_flash_lite_image_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..47db03da55430b820d3bd6fcd38e1accc2501006 --- /dev/null +++ b/data/src/elevenlabs/types/gemini_31_flash_lite_image_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Gemini31FlashLiteImageRequestAspectRatio = typing.Union[ + typing.Literal["auto", "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"], typing.Any +] diff --git a/data/src/elevenlabs/types/gemini_3_pro_image_request.py b/data/src/elevenlabs/types/gemini_3_pro_image_request.py new file mode 100644 index 0000000000000000000000000000000000000000..2cf0ecce5f79dc779381357edf734696976f859d --- /dev/null +++ b/data/src/elevenlabs/types/gemini_3_pro_image_request.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gemini_3_pro_image_request_aspect_ratio import Gemini3ProImageRequestAspectRatio +from .gemini_3_pro_image_request_resolution import Gemini3ProImageRequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class Gemini3ProImageRequest(UncheckedBaseModel): + """ + Request body for the Google Gemini 3 Pro image model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 10 reference images to edit or draw from. + """ + + aspect_ratio: typing.Optional[Gemini3ProImageRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + resolution: typing.Optional[Gemini3ProImageRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output image. + """ + + 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/data/src/elevenlabs/types/gemini_3_pro_image_request_aspect_ratio.py b/data/src/elevenlabs/types/gemini_3_pro_image_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..7dc487a7898a08ec877a06b9277de6190a6c44fb --- /dev/null +++ b/data/src/elevenlabs/types/gemini_3_pro_image_request_aspect_ratio.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Gemini3ProImageRequestAspectRatio = typing.Union[ + typing.Literal["auto", "1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"], typing.Any +] diff --git a/data/src/elevenlabs/types/gemini_3_pro_image_request_resolution.py b/data/src/elevenlabs/types/gemini_3_pro_image_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..cfa75e25566974ef5de975a67153253a33ac1e83 --- /dev/null +++ b/data/src/elevenlabs/types/gemini_3_pro_image_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Gemini3ProImageRequestResolution = typing.Union[typing.Literal["1K", "2K", "4K"], typing.Any] diff --git a/data/src/elevenlabs/types/gender.py b/data/src/elevenlabs/types/gender.py new file mode 100644 index 0000000000000000000000000000000000000000..2da834a99c2cda4386afcf1a5952988125da1912 --- /dev/null +++ b/data/src/elevenlabs/types/gender.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Gender = typing.Any diff --git a/data/src/elevenlabs/types/generate_voice_request.py b/data/src/elevenlabs/types/generate_voice_request.py new file mode 100644 index 0000000000000000000000000000000000000000..cfe442169e71757d49f900e92e5ddc684781cd40 --- /dev/null +++ b/data/src/elevenlabs/types/generate_voice_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GenerateVoiceRequest = typing.Any diff --git a/data/src/elevenlabs/types/generation_chunk_input.py b/data/src/elevenlabs/types/generation_chunk_input.py new file mode 100644 index 0000000000000000000000000000000000000000..c34c468ccd8234b0456371222cd20cb7eccf1744 --- /dev/null +++ b/data/src/elevenlabs/types/generation_chunk_input.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_ref_chunk import AudioRefChunk +from .condition_strength import ConditionStrength +from .generation_chunk_input_context_adherence import GenerationChunkInputContextAdherence + + +class GenerationChunkInput(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text config to be generated for this chunk. Can contain an optional section name in square brackets at the beginning, e.g. [Verse 1], lyrics lines, and inline directions in curly braces, e.g. {scratching}. Section names must be between 1 and 100 characters. At most 30 lines are allowed, each at most 200 characters. + """ + + duration_ms: int = pydantic.Field() + """ + The duration of the chunk in milliseconds. Must be between 3000ms and 120000ms. + """ + + positive_styles: typing.List[str] = pydantic.Field() + """ + The styles and musical directions that should be present in this chunk. Use English language for best results. The styles for the first chunk are the most important as they set the overall tone and genre. Styles for subsequent chunks can be used to add nuance, progression, emphasis, or change the direction of the song. Aim to have at least 6-7 styles in early chunks until the direction is established. Generic styles like 'great production quality' are good default styles to append to the list. + """ + + negative_styles: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The styles and musical directions that should not be present in this chunk. Use English language for best results. Leaving empty is a good default, only use this field if you want to explicitly avoid a particular style or direction. + """ + + context_adherence: typing.Optional[GenerationChunkInputContextAdherence] = pydantic.Field(default=None) + """ + How much the model adheres to the context of its surrounding chunks. Low adherence means the model can deviate from the context and be more creative. High adherence means the model will be more consistent with the context. + """ + + conditioning_ref: typing.Optional[AudioRefChunk] = pydantic.Field(default=None) + """ + The audio reference to condition the generation on. The first chunk is the most important as it will influence the generation of all subsequent chunks. Thus, if you want to apply conditioning to the entire song, start conditioning from the first chunk. + """ + + condition_strength: typing.Optional[ConditionStrength] = pydantic.Field(default=None) + """ + How strongly the model adheres to the conditioning reference. Low strength means the model will be more creative and deviate from the reference. High strength means the model will be more consistent with the reference. + """ + + 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/data/src/elevenlabs/types/generation_chunk_input_context_adherence.py b/data/src/elevenlabs/types/generation_chunk_input_context_adherence.py new file mode 100644 index 0000000000000000000000000000000000000000..b392bd030824b63b23184c30a0d38963ad58a9ca --- /dev/null +++ b/data/src/elevenlabs/types/generation_chunk_input_context_adherence.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GenerationChunkInputContextAdherence = typing.Union[typing.Literal["low", "medium", "high"], typing.Any] diff --git a/data/src/elevenlabs/types/generation_chunk_output.py b/data/src/elevenlabs/types/generation_chunk_output.py new file mode 100644 index 0000000000000000000000000000000000000000..cbcfa343dd685ec587be6f9252f4e644d82a7eb5 --- /dev/null +++ b/data/src/elevenlabs/types/generation_chunk_output.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_ref_chunk import AudioRefChunk +from .condition_strength import ConditionStrength +from .generation_chunk_output_context_adherence import GenerationChunkOutputContextAdherence + + +class GenerationChunkOutput(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text config to be generated for this chunk. Can contain an optional section name in square brackets at the beginning, e.g. [Verse 1], lyrics lines, and inline directions in curly braces, e.g. {scratching}. Section names must be between 1 and 100 characters. At most 30 lines are allowed, each at most 200 characters. + """ + + duration_ms: int = pydantic.Field() + """ + The duration of the chunk in milliseconds. Must be between 3000ms and 120000ms. + """ + + positive_styles: typing.List[str] = pydantic.Field() + """ + The styles and musical directions that should be present in this chunk. Use English language for best results. The styles for the first chunk are the most important as they set the overall tone and genre. Styles for subsequent chunks can be used to add nuance, progression, emphasis, or change the direction of the song. Aim to have at least 6-7 styles in early chunks until the direction is established. Generic styles like 'great production quality' are good default styles to append to the list. + """ + + negative_styles: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The styles and musical directions that should not be present in this chunk. Use English language for best results. Leaving empty is a good default, only use this field if you want to explicitly avoid a particular style or direction. + """ + + context_adherence: typing.Optional[GenerationChunkOutputContextAdherence] = pydantic.Field(default=None) + """ + How much the model adheres to the context of its surrounding chunks. Low adherence means the model can deviate from the context and be more creative. High adherence means the model will be more consistent with the context. + """ + + conditioning_ref: typing.Optional[AudioRefChunk] = pydantic.Field(default=None) + """ + The audio reference to condition the generation on. The first chunk is the most important as it will influence the generation of all subsequent chunks. Thus, if you want to apply conditioning to the entire song, start conditioning from the first chunk. + """ + + condition_strength: typing.Optional[ConditionStrength] = pydantic.Field(default=None) + """ + How strongly the model adheres to the conditioning reference. Low strength means the model will be more creative and deviate from the reference. High strength means the model will be more consistent with the reference. + """ + + 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/data/src/elevenlabs/types/generation_chunk_output_context_adherence.py b/data/src/elevenlabs/types/generation_chunk_output_context_adherence.py new file mode 100644 index 0000000000000000000000000000000000000000..e5fd6a0a6da511c8e2c1463125ba5da2849fac58 --- /dev/null +++ b/data/src/elevenlabs/types/generation_chunk_output_context_adherence.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GenerationChunkOutputContextAdherence = typing.Union[typing.Literal["low", "medium", "high"], typing.Any] diff --git a/data/src/elevenlabs/types/generation_config.py b/data/src/elevenlabs/types/generation_config.py new file mode 100644 index 0000000000000000000000000000000000000000..0fbe517cca84f3e972d178840de3e7ef0a116d36 --- /dev/null +++ b/data/src/elevenlabs/types/generation_config.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GenerationConfig(UncheckedBaseModel): + chunk_length_schedule: typing.Optional[typing.List[float]] = pydantic.Field(default=None) + """ + This is an advanced setting that most users shouldn't need to use. It relates to our + generation schedule. + + Our WebSocket service incorporates a buffer system designed to optimize the Time To First Byte (TTFB) while maintaining high-quality streaming. + + All text sent to the WebSocket endpoint is added to this buffer and only when that buffer reaches a certain size is an audio generation attempted. This is because our model provides higher quality audio when the model has longer inputs, and can deduce more context about how the text should be delivered. + + The buffer ensures smooth audio data delivery and is automatically emptied with a final audio generation either when the stream is closed, or upon sending a `flush` command. We have advanced settings for changing the chunk schedule, which can improve latency at the cost of quality by generating audio more frequently with smaller text inputs. + + The `chunk_length_schedule` determines the minimum amount of text that needs to be sent and present in our + buffer before audio starts being generated. This is to maximise the amount of context available to + the model to improve audio quality, whilst balancing latency of the returned audio chunks. + + The default value for `chunk_length_schedule` is: [120, 160, 250, 290]. + + This means that the first chunk of audio will not be generated until you send text that + totals at least 120 characters long. The next chunk of audio will only be generated once a + further 160 characters have been sent. The third audio chunk will be generated after the + next 250 characters. Then the fourth, and beyond, will be generated in sets of at least 290 characters. + + Customize this array to suit your needs. If you want to generate audio more frequently + to optimise latency, you can reduce the values in the array. Note that setting the values + too low may result in lower quality audio. Please test and adjust as needed. + + Each item should be in the range 50-500. + """ + + 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/data/src/elevenlabs/types/generation_reference.py b/data/src/elevenlabs/types/generation_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..13386a06010442d31638aa58801e924deb88346b --- /dev/null +++ b/data/src/elevenlabs/types/generation_reference.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GenerationReference(UncheckedBaseModel): + """ + The output of a prior generation on this API. + """ + + generation_id: str = pydantic.Field() + """ + The ID of the generation whose output to use, as returned when the generation was created. + """ + + 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/data/src/elevenlabs/types/generation_source_context.py b/data/src/elevenlabs/types/generation_source_context.py new file mode 100644 index 0000000000000000000000000000000000000000..015f6285f57baf27655d0ac1f772d54213e9e7d3 --- /dev/null +++ b/data/src/elevenlabs/types/generation_source_context.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .reference_video import ReferenceVideo + + +class GenerationSourceContext(UncheckedBaseModel): + source_type: typing.Optional[typing.Literal["generation"]] = None + generation_id: str + prompt: typing.Optional[str] = None + model_id: str + model_provider: typing.Optional[str] = None + generation_session_id: typing.Optional[str] = None + session_iteration_id: typing.Optional[str] = None + model_parameters: typing.Optional[typing.Dict[str, typing.Any]] = None + extend_video: typing.Optional[ReferenceVideo] = 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/data/src/elevenlabs/types/genesys_bot_outcome.py b/data/src/elevenlabs/types/genesys_bot_outcome.py new file mode 100644 index 0000000000000000000000000000000000000000..5ea4628d667d6cdc3de0752a74def78bfde6ddc5 --- /dev/null +++ b/data/src/elevenlabs/types/genesys_bot_outcome.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GenesysBotOutcome = typing.Union[typing.Literal["success", "escalate"], typing.Any] diff --git a/data/src/elevenlabs/types/genesys_region.py b/data/src/elevenlabs/types/genesys_region.py new file mode 100644 index 0000000000000000000000000000000000000000..c744ad738559debf1be908508007f8ee24c70e8b --- /dev/null +++ b/data/src/elevenlabs/types/genesys_region.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GenesysRegion = typing.Union[ + typing.Literal[ + "us_east_1", + "eu_west_1", + "ap_southeast_2", + "ap_northeast_1", + "eu_central_1", + "us_west_2", + "ca_central_1", + "ap_northeast_2", + "eu_west_2", + "ap_south_1", + "us_east_2", + "sa_east_1", + "me_central_1", + "ap_northeast_3", + "eu_central_2", + "mx_central_1", + "ap_southeast_1", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/get_agent_config_params.py b/data/src/elevenlabs/types/get_agent_config_params.py new file mode 100644 index 0000000000000000000000000000000000000000..2e61757997f30d2949f5d26146de98d9bf0f0e42 --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_config_params.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetAgentConfigParams(UncheckedBaseModel): + """ + Return the full editable config of a single receptionist, including the + current ``additional_instructions`` text. + + ``list_customer_facing_agents`` is intentionally lightweight (metadata and a + truncated greeting preview) and omits ``additional_instructions``. Call this + tool whenever you need the current full text before calling + ``update_agent_config`` on ``first_message`` or ``additional_instructions`` + so you can preserve what is already there. + """ + + smb_tool_type: typing.Optional[typing.Literal["get_agent_config"]] = 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/data/src/elevenlabs/types/get_agent_conversation_tickets_page_response_model.py b/data/src/elevenlabs/types/get_agent_conversation_tickets_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d54bc32ceb8d3d954f80d4719f6d31144fc5f282 --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_conversation_tickets_page_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_conversation_ticket_response_model import AgentConversationTicketResponseModel + + +class GetAgentConversationTicketsPageResponseModel(UncheckedBaseModel): + agent_conversation_tickets: typing.List[AgentConversationTicketResponseModel] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_agent_embed_response_model.py b/data/src/elevenlabs/types/get_agent_embed_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..0c72dfc31d529c7bf9882e6a2d99a081626e3e4e --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_embed_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .widget_config_response import WidgetConfigResponse + + +class GetAgentEmbedResponseModel(UncheckedBaseModel): + agent_id: str + widget_config: WidgetConfigResponse + + 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/data/src/elevenlabs/types/get_agent_knowledgebase_size_response_model.py b/data/src/elevenlabs/types/get_agent_knowledgebase_size_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d94234f7cbfb8cecf2c80a8b28594986bda87a7d --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_knowledgebase_size_response_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetAgentKnowledgebaseSizeResponseModel(UncheckedBaseModel): + number_of_pages: float + + 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/data/src/elevenlabs/types/get_agent_link_response_model.py b/data/src/elevenlabs/types/get_agent_link_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4909ce0b90115daf4320183b18f7dd28677a02d4 --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_link_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_token_response_model import ConversationTokenResponseModel + + +class GetAgentLinkResponseModel(UncheckedBaseModel): + agent_id: str = pydantic.Field() + """ + The ID of the agent + """ + + token: typing.Optional[ConversationTokenResponseModel] = pydantic.Field(default=None) + """ + The token data for the agent + """ + + 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/data/src/elevenlabs/types/get_agent_response_model.py b/data/src/elevenlabs/types/get_agent_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..62b0d41d4660d61e17dc8a4be2cd38cde54ac52b --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_response_model.py @@ -0,0 +1,106 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_metadata_response_model import AgentMetadataResponseModel +from .agent_platform_settings_response_model import AgentPlatformSettingsResponseModel +from .agent_workflow_response_model import AgentWorkflowResponseModel +from .conversational_config import ConversationalConfig +from .get_agent_response_model_phone_numbers_item import GetAgentResponseModelPhoneNumbersItem +from .get_whats_app_account_response import GetWhatsAppAccountResponse +from .procedure_ref_response_model import ProcedureRefResponseModel +from .resource_access_info import ResourceAccessInfo + + +class GetAgentResponseModel(UncheckedBaseModel): + agent_id: str = pydantic.Field() + """ + The ID of the agent + """ + + name: str = pydantic.Field() + """ + The name of the agent + """ + + conversation_config: ConversationalConfig = pydantic.Field() + """ + The conversation configuration of the agent + """ + + metadata: AgentMetadataResponseModel = pydantic.Field() + """ + The metadata of the agent + """ + + platform_settings: typing.Optional[AgentPlatformSettingsResponseModel] = pydantic.Field(default=None) + """ + The platform settings of the agent + """ + + phone_numbers: typing.Optional[typing.List[GetAgentResponseModelPhoneNumbersItem]] = pydantic.Field(default=None) + """ + The phone numbers of the agent + """ + + whatsapp_accounts: typing.Optional[typing.List[GetWhatsAppAccountResponse]] = pydantic.Field(default=None) + """ + WhatsApp accounts assigned to the agent + """ + + workflow: typing.Optional[AgentWorkflowResponseModel] = pydantic.Field(default=None) + """ + The workflow of the agent + """ + + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information of the agent for the user + """ + + tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Agent tags used to categorize the agent + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the version the agent is on + """ + + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the branch the agent is on + """ + + main_branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the main branch for this agent + """ + + procedures: typing.Optional[typing.Dict[str, ProcedureRefResponseModel]] = pydantic.Field(default=None) + """ + Procedures keyed by procedure_id. + """ + + default_hold_audio_url: typing.Optional[str] = pydantic.Field(default=None) + """ + URL of the default hold tone played to queued callers when no custom hold audio is uploaded, so the dashboard can preview it. + """ + + 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 + + +update_forward_refs(GetAgentResponseModel) diff --git a/data/src/elevenlabs/types/get_agent_response_model_phone_numbers_item.py b/data/src/elevenlabs/types/get_agent_response_model_phone_numbers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..b78b69dad96f4fc49ffe0a7280633939cb00a052 --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_response_model_phone_numbers_item.py @@ -0,0 +1,86 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .get_phone_number_inbound_sip_trunk_config_response_model import GetPhoneNumberInboundSipTrunkConfigResponseModel +from .get_phone_number_outbound_sip_trunk_config_response_model import GetPhoneNumberOutboundSipTrunkConfigResponseModel +from .livekit_stack_type import LivekitStackType +from .phone_number_agent_info import PhoneNumberAgentInfo + + +class GetAgentResponseModelPhoneNumbersItem_Exotel(UncheckedBaseModel): + provider: typing.Literal["exotel"] = "exotel" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class GetAgentResponseModelPhoneNumbersItem_SipTrunk(UncheckedBaseModel): + provider: typing.Literal["sip_trunk"] = "sip_trunk" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = None + provider_config: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + outbound_trunk: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + inbound_trunk: typing.Optional[GetPhoneNumberInboundSipTrunkConfigResponseModel] = None + livekit_stack: LivekitStackType + store_sip_messages: 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 + + +class GetAgentResponseModelPhoneNumbersItem_Twilio(UncheckedBaseModel): + provider: typing.Literal["twilio"] = "twilio" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +GetAgentResponseModelPhoneNumbersItem = typing_extensions.Annotated[ + typing.Union[ + GetAgentResponseModelPhoneNumbersItem_Exotel, + GetAgentResponseModelPhoneNumbersItem_SipTrunk, + GetAgentResponseModelPhoneNumbersItem_Twilio, + ], + UnionMetadata(discriminant="provider"), +] diff --git a/data/src/elevenlabs/types/get_agent_test_folder_response_model.py b/data/src/elevenlabs/types/get_agent_test_folder_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..875539400c93f6815ce94be6463ea75cb15399b3 --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_test_folder_response_model.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_test_folder_path_segment_response_model import AgentTestFolderPathSegmentResponseModel + + +class GetAgentTestFolderResponseModel(UncheckedBaseModel): + id: str + name: str + folder_path: typing.Optional[typing.List[AgentTestFolderPathSegmentResponseModel]] = pydantic.Field(default=None) + """ + The path from the root folder to the current folder. + """ + + children_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of direct children (tests and subfolders) in this folder + """ + + 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/data/src/elevenlabs/types/get_agent_topics_response_model.py b/data/src/elevenlabs/types/get_agent_topics_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..23624d4c7dccf0da1c2f75dab82f9e15b09a3726 --- /dev/null +++ b/data/src/elevenlabs/types/get_agent_topics_response_model.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_topic_response_model import AgentTopicResponseModel + + +class GetAgentTopicsResponseModel(UncheckedBaseModel): + topics: typing.List[AgentTopicResponseModel] + window_start_unix_secs: int + window_end_unix_secs: int + aggregated_run_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of daily topic-discovery runs the returned metrics were summed over. + """ + + has_more: typing.Optional[bool] = None + next_cursor: 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/data/src/elevenlabs/types/get_agents_page_response_model.py b/data/src/elevenlabs/types/get_agents_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..78aa2d9601507ad825825faa513c55c09de18849 --- /dev/null +++ b/data/src/elevenlabs/types/get_agents_page_response_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_summary_response_model import AgentSummaryResponseModel + + +class GetAgentsPageResponseModel(UncheckedBaseModel): + agents: typing.List[AgentSummaryResponseModel] = pydantic.Field() + """ + A list of agents and their metadata + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + The next cursor to paginate through the agents + """ + + has_more: bool = pydantic.Field() + """ + Whether there are more agents to paginate through + """ + + 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/data/src/elevenlabs/types/get_analytics_summary_params.py b/data/src/elevenlabs/types/get_analytics_summary_params.py new file mode 100644 index 0000000000000000000000000000000000000000..35db5925a43432323e9cfba56937bfd037d8ade9 --- /dev/null +++ b/data/src/elevenlabs/types/get_analytics_summary_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetAnalyticsSummaryParams(UncheckedBaseModel): + """ + Get a summary of key business analytics for a time period. + """ + + smb_tool_type: typing.Optional[typing.Literal["get_analytics_summary"]] = 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/data/src/elevenlabs/types/get_appointment_by_confirmation_number_params.py b/data/src/elevenlabs/types/get_appointment_by_confirmation_number_params.py new file mode 100644 index 0000000000000000000000000000000000000000..d890e3d685e43fcaddeec508dcfcf5e6aeec8462 --- /dev/null +++ b/data/src/elevenlabs/types/get_appointment_by_confirmation_number_params.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetAppointmentByConfirmationNumberParams(UncheckedBaseModel): + """ + Look up an appointment by the booking confirmation number the caller quotes. + + The confirmation number is the 8-character code shown on the booking + confirmation page (e.g. ``#01ABCDEF``). Callers may read it back with or + without the leading ``#`` and with varied spacing; the tool normalizes + the input and does a prefix match on the stored calendar item id. + """ + + smb_tool_type: typing.Optional[typing.Literal["get_appointment_by_confirmation_number"]] = 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/data/src/elevenlabs/types/get_audio_isolation_history_response_model.py b/data/src/elevenlabs/types/get_audio_isolation_history_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..dc0939c94a1740567847c725ec4d363224b498d4 --- /dev/null +++ b/data/src/elevenlabs/types/get_audio_isolation_history_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_isolation_history_item_response_model import AudioIsolationHistoryItemResponseModel + + +class GetAudioIsolationHistoryResponseModel(UncheckedBaseModel): + items: typing.List[AudioIsolationHistoryItemResponseModel] + has_more: bool + + 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/data/src/elevenlabs/types/get_audio_native_project_settings_response_model.py b/data/src/elevenlabs/types/get_audio_native_project_settings_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2daa1a1ffdd5c024cb16625f1d5a6bc1b68ecfa2 --- /dev/null +++ b/data/src/elevenlabs/types/get_audio_native_project_settings_response_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_native_project_settings_response_model import AudioNativeProjectSettingsResponseModel + + +class GetAudioNativeProjectSettingsResponseModel(UncheckedBaseModel): + enabled: bool = pydantic.Field() + """ + Whether the project is enabled. + """ + + snapshot_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the latest snapshot of the project. + """ + + settings: typing.Optional[AudioNativeProjectSettingsResponseModel] = pydantic.Field(default=None) + """ + The settings of the project. + """ + + 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/data/src/elevenlabs/types/get_booking_page_settings_params.py b/data/src/elevenlabs/types/get_booking_page_settings_params.py new file mode 100644 index 0000000000000000000000000000000000000000..cacd548025f00f48f3ae8013e22f50323360c583 --- /dev/null +++ b/data/src/elevenlabs/types/get_booking_page_settings_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetBookingPageSettingsParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["get_booking_page_settings"]] = 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/data/src/elevenlabs/types/get_booking_slug_status_params.py b/data/src/elevenlabs/types/get_booking_slug_status_params.py new file mode 100644 index 0000000000000000000000000000000000000000..bb4dc49d3d6c9c9cd66aa265f1a7e0cfd948bec0 --- /dev/null +++ b/data/src/elevenlabs/types/get_booking_slug_status_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetBookingSlugStatusParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["get_booking_slug_status"]] = 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/data/src/elevenlabs/types/get_chapter_request.py b/data/src/elevenlabs/types/get_chapter_request.py new file mode 100644 index 0000000000000000000000000000000000000000..5edd481183ce308b7c609962e97a6cd7b9fe5b7a --- /dev/null +++ b/data/src/elevenlabs/types/get_chapter_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetChapterRequest = typing.Any diff --git a/data/src/elevenlabs/types/get_chapter_snapshots_request.py b/data/src/elevenlabs/types/get_chapter_snapshots_request.py new file mode 100644 index 0000000000000000000000000000000000000000..2c5cbefe7ac89941342a3d58e1dbafb86e0645a0 --- /dev/null +++ b/data/src/elevenlabs/types/get_chapter_snapshots_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetChapterSnapshotsRequest = typing.Any diff --git a/data/src/elevenlabs/types/get_chapters_request.py b/data/src/elevenlabs/types/get_chapters_request.py new file mode 100644 index 0000000000000000000000000000000000000000..006e8188006fc859fa18f90967cf696d515872c2 --- /dev/null +++ b/data/src/elevenlabs/types/get_chapters_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetChaptersRequest = typing.Any diff --git a/data/src/elevenlabs/types/get_chapters_response.py b/data/src/elevenlabs/types/get_chapters_response.py new file mode 100644 index 0000000000000000000000000000000000000000..3d5e3833b651239721ed7aead811d76b47a5b73a --- /dev/null +++ b/data/src/elevenlabs/types/get_chapters_response.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .chapter_response import ChapterResponse + + +class GetChaptersResponse(UncheckedBaseModel): + chapters: typing.List[ChapterResponse] + + 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/data/src/elevenlabs/types/get_client_appointments_params.py b/data/src/elevenlabs/types/get_client_appointments_params.py new file mode 100644 index 0000000000000000000000000000000000000000..3a16e64880e7dd9fc9e0af0d42fa61820a398108 --- /dev/null +++ b/data/src/elevenlabs/types/get_client_appointments_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetClientAppointmentsParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["get_client_appointments"]] = None + include_cancelled: 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/data/src/elevenlabs/types/get_client_by_phone_params.py b/data/src/elevenlabs/types/get_client_by_phone_params.py new file mode 100644 index 0000000000000000000000000000000000000000..e573e8197cf6ae7334ced1d87c3b039e81e05c2c --- /dev/null +++ b/data/src/elevenlabs/types/get_client_by_phone_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetClientByPhoneParams(UncheckedBaseModel): + """ + Look up a client by their exact phone number. + """ + + smb_tool_type: typing.Optional[typing.Literal["get_client_by_phone"]] = 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/data/src/elevenlabs/types/get_client_orders_params.py b/data/src/elevenlabs/types/get_client_orders_params.py new file mode 100644 index 0000000000000000000000000000000000000000..f75eadda99ae012ea7e4afd464d860a6c21ff278 --- /dev/null +++ b/data/src/elevenlabs/types/get_client_orders_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetClientOrdersParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["get_client_orders"]] = None + include_cancelled: 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/data/src/elevenlabs/types/get_conv_ai_dashboard_settings_response_model.py b/data/src/elevenlabs/types/get_conv_ai_dashboard_settings_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c4613b0d8764663d1596214c79e13b53e61582f5 --- /dev/null +++ b/data/src/elevenlabs/types/get_conv_ai_dashboard_settings_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_conv_ai_dashboard_settings_response_model_charts_item import GetConvAiDashboardSettingsResponseModelChartsItem + + +class GetConvAiDashboardSettingsResponseModel(UncheckedBaseModel): + charts: typing.Optional[typing.List[GetConvAiDashboardSettingsResponseModelChartsItem]] = 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/data/src/elevenlabs/types/get_conv_ai_dashboard_settings_response_model_charts_item.py b/data/src/elevenlabs/types/get_conv_ai_dashboard_settings_response_model_charts_item.py new file mode 100644 index 0000000000000000000000000000000000000000..a89d1aeb1ba11db95b8d72eb9516df863750f9d4 --- /dev/null +++ b/data/src/elevenlabs/types/get_conv_ai_dashboard_settings_response_model_charts_item.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class GetConvAiDashboardSettingsResponseModelChartsItem_CallSuccess(UncheckedBaseModel): + type: typing.Literal["call_success"] = "call_success" + 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 + + +class GetConvAiDashboardSettingsResponseModelChartsItem_Criteria(UncheckedBaseModel): + type: typing.Literal["criteria"] = "criteria" + name: str + criteria_id: 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 + + +class GetConvAiDashboardSettingsResponseModelChartsItem_DataCollection(UncheckedBaseModel): + type: typing.Literal["data_collection"] = "data_collection" + name: str + data_collection_id: 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 + + +GetConvAiDashboardSettingsResponseModelChartsItem = typing_extensions.Annotated[ + typing.Union[ + GetConvAiDashboardSettingsResponseModelChartsItem_CallSuccess, + GetConvAiDashboardSettingsResponseModelChartsItem_Criteria, + GetConvAiDashboardSettingsResponseModelChartsItem_DataCollection, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_conv_ai_settings_response_model.py b/data/src/elevenlabs/types/get_conv_ai_settings_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a6815fb23839da7b57a314441829c0f250d43c6b --- /dev/null +++ b/data/src/elevenlabs/types/get_conv_ai_settings_response_model.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conv_ai_webhooks import ConvAiWebhooks +from .conversation_initiation_client_data_webhook import ConversationInitiationClientDataWebhook +from .livekit_stack_type import LivekitStackType + + +class GetConvAiSettingsResponseModel(UncheckedBaseModel): + conversation_initiation_client_data_webhook: typing.Optional[ConversationInitiationClientDataWebhook] = None + webhooks: typing.Optional[ConvAiWebhooks] = None + can_use_mcp_servers: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the workspace can use MCP servers + """ + + rag_retention_period_days: typing.Optional[int] = None + conversation_embedding_retention_days: typing.Optional[int] = pydantic.Field(default=None) + """ + Days to retain conversation embeddings. None means use the system default (30 days). + """ + + default_livekit_stack: typing.Optional[LivekitStackType] = 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/data/src/elevenlabs/types/get_conversation_response_model.py b/data/src/elevenlabs/types/get_conversation_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..072e6055a63fe775aa27eae6fc02c29faab6fe79 --- /dev/null +++ b/data/src/elevenlabs/types/get_conversation_response_model.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_analysis_common_model import ConversationHistoryAnalysisCommonModel +from .conversation_history_metadata_common_model import ConversationHistoryMetadataCommonModel +from .conversation_history_transcript_response_model import ConversationHistoryTranscriptResponseModel +from .conversation_initiation_client_data_request_output import ConversationInitiationClientDataRequestOutput +from .get_conversation_response_model_status import GetConversationResponseModelStatus +from .visited_agent_ref import VisitedAgentRef + + +class GetConversationResponseModel(UncheckedBaseModel): + agent_id: str + agent_name: typing.Optional[str] = None + conversation_product: typing.Optional[str] = None + status: GetConversationResponseModelStatus + user_id: typing.Optional[str] = None + branch_id: typing.Optional[str] = None + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the agent version used for this conversation + """ + + metadata: ConversationHistoryMetadataCommonModel + analysis: typing.Optional[ConversationHistoryAnalysisCommonModel] = None + visited_agents: typing.Optional[typing.List[VisitedAgentRef]] = None + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestOutput] = None + environment: typing.Optional[str] = None + conversation_id: str + has_audio: bool + has_user_audio: bool + has_response_audio: bool + has_auxiliary_audio: bool + transcript: typing.List[ConversationHistoryTranscriptResponseModel] + tag_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Conversation tag ids assigned to this conversation. + """ + + otlp_traces: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + OpenTelemetry trace payload when the request uses format=opentelemetry; otherwise omitted. + """ + + 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 + + +update_forward_refs(GetConversationResponseModel) diff --git a/data/src/elevenlabs/types/get_conversation_response_model_status.py b/data/src/elevenlabs/types/get_conversation_response_model_status.py new file mode 100644 index 0000000000000000000000000000000000000000..949b9fb7ac3bc8aa4210added77f394d79b8e128 --- /dev/null +++ b/data/src/elevenlabs/types/get_conversation_response_model_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetConversationResponseModelStatus = typing.Union[ + typing.Literal["initiated", "in-progress", "processing", "done", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/types/get_conversation_summary_response_model.py b/data/src/elevenlabs/types/get_conversation_summary_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..645fe362c3d46925603947fe835704e761b3b2e3 --- /dev/null +++ b/data/src/elevenlabs/types/get_conversation_summary_response_model.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_summary_message_model import ConversationSummaryMessageModel +from .evaluation_success_result import EvaluationSuccessResult +from .get_conversation_summary_response_model_status import GetConversationSummaryResponseModelStatus + + +class GetConversationSummaryResponseModel(UncheckedBaseModel): + conversation_id: str + agent_id: str + status: GetConversationSummaryResponseModelStatus + call_summary_title: typing.Optional[str] = pydantic.Field(default=None) + """ + Short generated title for the conversation. + """ + + transcript_summary: typing.Optional[str] = pydantic.Field(default=None) + """ + Generated natural-language summary of the call. + """ + + call_successful: typing.Optional[EvaluationSuccessResult] = None + message_count: int = pydantic.Field() + """ + Number of plain chat message turns in the conversation. + """ + + messages: typing.Optional[typing.List[ConversationSummaryMessageModel]] = pydantic.Field(default=None) + """ + The plain chat messages (role and text only). Included only when message_count does not exceed the requested max_messages; otherwise null and messages_omitted is true. + """ + + messages_omitted: typing.Optional[bool] = pydantic.Field(default=None) + """ + True when the chat messages were omitted because the conversation was too long. Fetch the full transcript for the messages. + """ + + note: str = pydantic.Field() + """ + Guidance telling the agent how to get the full transcript. + """ + + 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/data/src/elevenlabs/types/get_conversation_summary_response_model_status.py b/data/src/elevenlabs/types/get_conversation_summary_response_model_status.py new file mode 100644 index 0000000000000000000000000000000000000000..757dcd4257c5128843667f1ca31561005cec8686 --- /dev/null +++ b/data/src/elevenlabs/types/get_conversation_summary_response_model_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetConversationSummaryResponseModelStatus = typing.Union[ + typing.Literal["initiated", "in-progress", "processing", "done", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/types/get_conversation_tags_page_response_model.py b/data/src/elevenlabs/types/get_conversation_tags_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f19be04f057adadc92123e3ef266f03b2f29c738 --- /dev/null +++ b/data/src/elevenlabs/types/get_conversation_tags_page_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_tag_response_model import ConversationTagResponseModel + + +class GetConversationTagsPageResponseModel(UncheckedBaseModel): + conversation_tags: typing.List[ConversationTagResponseModel] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_conversation_users_page_response_model.py b/data/src/elevenlabs/types/get_conversation_users_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d304252a1bea09732c71475eeb57950f262000a7 --- /dev/null +++ b/data/src/elevenlabs/types/get_conversation_users_page_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_user_response_model import ConversationUserResponseModel + + +class GetConversationUsersPageResponseModel(UncheckedBaseModel): + users: typing.List[ConversationUserResponseModel] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_conversations_page_response_model.py b/data/src/elevenlabs/types/get_conversations_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..07eda444dcbb284714d5061b58c17e15a6d6bf76 --- /dev/null +++ b/data/src/elevenlabs/types/get_conversations_page_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_summary_response_model import ConversationSummaryResponseModel + + +class GetConversationsPageResponseModel(UncheckedBaseModel): + conversations: typing.List[ConversationSummaryResponseModel] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_crawl_job_response_model.py b/data/src/elevenlabs/types/get_crawl_job_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..87f51ae5e38bb3d6b6dd8437a926446edba9461b --- /dev/null +++ b/data/src/elevenlabs/types/get_crawl_job_response_model.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .crawl_status import CrawlStatus +from .crawl_type import CrawlType + + +class GetCrawlJobResponseModel(UncheckedBaseModel): + type: typing.Optional[CrawlType] = None + seed_url: str + pattern: typing.Optional[str] = None + max_pages: int + auto_discover: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to automatically discover and enqueue additional pages found while crawling. + """ + + status: typing.Optional[CrawlStatus] = None + pages_identified: typing.Optional[int] = None + pages_scraped: typing.Optional[int] = None + pages_skipped: typing.Optional[int] = None + pages_failed: typing.Optional[int] = None + root_folder_id: str + updated_at: int + id: str + created_at: int + + 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/data/src/elevenlabs/types/get_knowledge_base_dependent_agents_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_dependent_agents_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d51e39b776988942d22b805b3f2310ecddfaf158 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_dependent_agents_response_model.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dependent_branch_info import DependentBranchInfo +from .get_knowledge_base_dependent_agents_response_model_agents_item import ( + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem, +) + + +class GetKnowledgeBaseDependentAgentsResponseModel(UncheckedBaseModel): + agents: typing.List[GetKnowledgeBaseDependentAgentsResponseModelAgentsItem] + branches: typing.Optional[typing.List[DependentBranchInfo]] = None + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_knowledge_base_dependent_agents_response_model_agents_item.py b/data/src/elevenlabs/types/get_knowledge_base_dependent_agents_response_model_agents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..80c361e7e371cd223a4c2061c14e7ffaac41aec4 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_dependent_agents_response_model_agents_item.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +GetKnowledgeBaseDependentAgentsResponseModelAgentsItem = typing_extensions.Annotated[ + typing.Union[ + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Available, + GetKnowledgeBaseDependentAgentsResponseModelAgentsItem_Unknown, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_knowledge_base_file_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_file_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..66358cc627a442b5685a6f0546bbbd5e48cbed2f --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_file_response_model.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auto_sync_info import AutoSyncInfo +from .content_format import ContentFormat +from .document_usage_mode_enum import DocumentUsageModeEnum +from .external_file_sync_info import ExternalFileSyncInfo +from .file_refresh_status import FileRefreshStatus +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseFileResponseModel(UncheckedBaseModel): + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder, or null if the document is at the root level. + """ + + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + filename: str + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = pydantic.Field(default=None) + """ + In-flight or last refresh state for an externally-synced file. Used by clients to render sync progress and disable re-sync while a refresh is queued or processing. + """ + + is_frozen: 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/data/src/elevenlabs/types/get_knowledge_base_folder_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_folder_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5e092af6d30e2ff87a2842a9a9e07d7230d247b9 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_folder_response_model.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auto_sync_info import AutoSyncInfo +from .document_usage_mode_enum import DocumentUsageModeEnum +from .external_folder_sync_info import ExternalFolderSyncInfo +from .kb_external_sync_job import KbExternalSyncJob +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseFolderResponseModel(UncheckedBaseModel): + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder, or null if the document is at the root level. + """ + + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + children_count: int + document_count: int = pydantic.Field() + """ + Number of non-folder documents anywhere in this folder's subtree (recursive). Counting stops past 1000; + """ + + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: typing.Optional[bool] = None + active_sync_job: typing.Optional[KbExternalSyncJob] = pydantic.Field(default=None) + """ + Most recent (in-flight or terminal) external sync job for this folder, if any. Used by clients to render sync progress. + """ + + 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/data/src/elevenlabs/types/get_knowledge_base_list_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_list_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ac55f634c6628e13a6e4794ef221f43932a8dcec --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_list_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_knowledge_base_list_response_model_documents_item import GetKnowledgeBaseListResponseModelDocumentsItem + + +class GetKnowledgeBaseListResponseModel(UncheckedBaseModel): + documents: typing.List[GetKnowledgeBaseListResponseModelDocumentsItem] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_knowledge_base_list_response_model_documents_item.py b/data/src/elevenlabs/types/get_knowledge_base_list_response_model_documents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..55858b8aadaaa357359e0c49b319ac8c75cdfa28 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_list_response_model_documents_item.py @@ -0,0 +1,138 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .auto_sync_info import AutoSyncInfo +from .document_usage_mode_enum import DocumentUsageModeEnum +from .external_file_sync_info import ExternalFileSyncInfo +from .external_folder_sync_info import ExternalFolderSyncInfo +from .file_refresh_status import FileRefreshStatus +from .get_knowledge_base_summary_file_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_folder_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_text_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_url_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem, +) +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseListResponseModelDocumentsItem_File(UncheckedBaseModel): + type: typing.Literal["file"] = "file" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem] + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = None + is_frozen: 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 + + +class GetKnowledgeBaseListResponseModelDocumentsItem_Folder(UncheckedBaseModel): + type: typing.Literal["folder"] = "folder" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem] + children_count: int + document_count: int + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: 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 + + +class GetKnowledgeBaseListResponseModelDocumentsItem_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem] + + 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 + + +class GetKnowledgeBaseListResponseModelDocumentsItem_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem] + url: str + auto_sync_info: typing.Optional[AutoSyncInfo] = 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 + + +GetKnowledgeBaseListResponseModelDocumentsItem = typing_extensions.Annotated[ + typing.Union[ + GetKnowledgeBaseListResponseModelDocumentsItem_File, + GetKnowledgeBaseListResponseModelDocumentsItem_Folder, + GetKnowledgeBaseListResponseModelDocumentsItem_Text, + GetKnowledgeBaseListResponseModelDocumentsItem_Url, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_knowledge_base_summary_file_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_summary_file_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1fea851271eba82311fa48aa4a38062d6303b37e --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_summary_file_response_model.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auto_sync_info import AutoSyncInfo +from .document_usage_mode_enum import DocumentUsageModeEnum +from .external_file_sync_info import ExternalFileSyncInfo +from .file_refresh_status import FileRefreshStatus +from .get_knowledge_base_summary_file_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem, +) +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseSummaryFileResponseModel(UncheckedBaseModel): + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder, or null if the document is at the root level. + """ + + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + dependent_agents: typing.List[GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem] = pydantic.Field() + """ + This field is deprecated and will be removed in the future, use the separate endpoint to get dependent agents instead. + """ + + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = None + is_frozen: 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/data/src/elevenlabs/types/get_knowledge_base_summary_file_response_model_dependent_agents_item.py b/data/src/elevenlabs/types/get_knowledge_base_summary_file_response_model_dependent_agents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..b2b67b0c37c59b991ed6d246855ea87a37a2c6f4 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_summary_file_response_model_dependent_agents_item.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem = typing_extensions.Annotated[ + typing.Union[ + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem_Unknown, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_knowledge_base_summary_folder_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_summary_folder_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..32206463fe904e9ac6ce02e12b80d31b4ebab287 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_summary_folder_response_model.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auto_sync_info import AutoSyncInfo +from .document_usage_mode_enum import DocumentUsageModeEnum +from .external_folder_sync_info import ExternalFolderSyncInfo +from .get_knowledge_base_summary_folder_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem, +) +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseSummaryFolderResponseModel(UncheckedBaseModel): + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder, or null if the document is at the root level. + """ + + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + dependent_agents: typing.List[GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem] = pydantic.Field() + """ + This field is deprecated and will be removed in the future, use the separate endpoint to get dependent agents instead. + """ + + children_count: int + document_count: int = pydantic.Field() + """ + Number of non-folder documents anywhere in this folder's subtree (recursive). Counting stops past 1000; + """ + + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: 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/data/src/elevenlabs/types/get_knowledge_base_summary_folder_response_model_dependent_agents_item.py b/data/src/elevenlabs/types/get_knowledge_base_summary_folder_response_model_dependent_agents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..0143e625f7a47fcbc89e726a053dc17ffe921ab6 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_summary_folder_response_model_dependent_agents_item.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem = typing_extensions.Annotated[ + typing.Union[ + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem_Unknown, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_knowledge_base_summary_text_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_summary_text_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8f0376f05305d0b7497e5fe9b4df57228cf30536 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_summary_text_response_model.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .document_usage_mode_enum import DocumentUsageModeEnum +from .get_knowledge_base_summary_text_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem, +) +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseSummaryTextResponseModel(UncheckedBaseModel): + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder, or null if the document is at the root level. + """ + + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + dependent_agents: typing.List[GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem] = pydantic.Field() + """ + This field is deprecated and will be removed in the future, use the separate endpoint to get dependent agents instead. + """ + + 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/data/src/elevenlabs/types/get_knowledge_base_summary_text_response_model_dependent_agents_item.py b/data/src/elevenlabs/types/get_knowledge_base_summary_text_response_model_dependent_agents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..da58464b00d08743310bf1f3765601bf530ec882 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_summary_text_response_model_dependent_agents_item.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem = typing_extensions.Annotated[ + typing.Union[ + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem_Unknown, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_knowledge_base_summary_url_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_summary_url_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d048258393f122d8fef44e0410350274b52c3cfb --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_summary_url_response_model.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auto_sync_info import AutoSyncInfo +from .document_usage_mode_enum import DocumentUsageModeEnum +from .get_knowledge_base_summary_url_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem, +) +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseSummaryUrlResponseModel(UncheckedBaseModel): + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder, or null if the document is at the root level. + """ + + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + dependent_agents: typing.List[GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem] = pydantic.Field() + """ + This field is deprecated and will be removed in the future, use the separate endpoint to get dependent agents instead. + """ + + url: str + auto_sync_info: typing.Optional[AutoSyncInfo] = 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/data/src/elevenlabs/types/get_knowledge_base_summary_url_response_model_dependent_agents_item.py b/data/src/elevenlabs/types/get_knowledge_base_summary_url_response_model_dependent_agents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..7a462757337ca8e81ad97184fb3301008e79a25b --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_summary_url_response_model_dependent_agents_item.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem = typing_extensions.Annotated[ + typing.Union[ + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Available, + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem_Unknown, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_knowledge_base_text_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_text_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..507b69e41a2afe5ed470dfadf02d477496184c13 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_text_response_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_format import ContentFormat +from .document_usage_mode_enum import DocumentUsageModeEnum +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseTextResponseModel(UncheckedBaseModel): + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder, or null if the document is at the root level. + """ + + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = 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/data/src/elevenlabs/types/get_knowledge_base_url_response_model.py b/data/src/elevenlabs/types/get_knowledge_base_url_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3e0c45ca4ea099e478543a3c2325790abfaa8a37 --- /dev/null +++ b/data/src/elevenlabs/types/get_knowledge_base_url_response_model.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auto_sync_info import AutoSyncInfo +from .content_format import ContentFormat +from .document_usage_mode_enum import DocumentUsageModeEnum +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_response_model import KnowledgeBaseFolderPathSegmentResponseModel +from .resource_access_info import ResourceAccessInfo + + +class GetKnowledgeBaseUrlResponseModel(UncheckedBaseModel): + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder, or null if the document is at the root level. + """ + + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentResponseModel]] = pydantic.Field( + default=None + ) + """ + The folder path segments leading to this entity, from root to parent folder. + """ + + url: str + extracted_inner_html: str + content_format: typing.Optional[ContentFormat] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = 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/data/src/elevenlabs/types/get_library_voices_response.py b/data/src/elevenlabs/types/get_library_voices_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b650ba2ce24c8b213c9b9ea2bc0546f660f05083 --- /dev/null +++ b/data/src/elevenlabs/types/get_library_voices_response.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .library_voice_response import LibraryVoiceResponse + + +class GetLibraryVoicesResponse(UncheckedBaseModel): + voices: typing.List[LibraryVoiceResponse] = pydantic.Field() + """ + The list of shared voices + """ + + has_more: bool = pydantic.Field() + """ + Whether there are more shared voices in subsequent pages. + """ + + total_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The total number of shared voices matching the query. + """ + + last_sort_id: 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/data/src/elevenlabs/types/get_live_count_response.py b/data/src/elevenlabs/types/get_live_count_response.py new file mode 100644 index 0000000000000000000000000000000000000000..47b963bb2d8aee28b9a0a84c3b340166ad58f1a9 --- /dev/null +++ b/data/src/elevenlabs/types/get_live_count_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetLiveCountResponse(UncheckedBaseModel): + count: int = pydantic.Field() + """ + The number of active ongoing conversations. + """ + + 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/data/src/elevenlabs/types/get_or_create_rag_index_request_model.py b/data/src/elevenlabs/types/get_or_create_rag_index_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..efceed5bb304b8ddc02fba7f5d98037b4ec85837 --- /dev/null +++ b/data/src/elevenlabs/types/get_or_create_rag_index_request_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .embedding_model_enum import EmbeddingModelEnum + + +class GetOrCreateRagIndexRequestModel(UncheckedBaseModel): + document_id: str = pydantic.Field() + """ + ID of the knowledgebase document for which to retrieve the index + """ + + create_if_missing: bool = pydantic.Field() + """ + Whether to create the RAG index if it does not exist + """ + + model: EmbeddingModelEnum = pydantic.Field() + """ + Embedding model to use for the RAG index + """ + + 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/data/src/elevenlabs/types/get_order_by_confirmation_number_params.py b/data/src/elevenlabs/types/get_order_by_confirmation_number_params.py new file mode 100644 index 0000000000000000000000000000000000000000..91729b01104e2a79d342d07c8089447f662f802c --- /dev/null +++ b/data/src/elevenlabs/types/get_order_by_confirmation_number_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetOrderByConfirmationNumberParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["get_order_by_confirmation_number"]] = 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/data/src/elevenlabs/types/get_phone_number_exotel_response_model.py b/data/src/elevenlabs/types/get_phone_number_exotel_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e6f01ef11a849622ab5358ab77f55bbcd5dc82b5 --- /dev/null +++ b/data/src/elevenlabs/types/get_phone_number_exotel_response_model.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .phone_number_agent_info import PhoneNumberAgentInfo + + +class GetPhoneNumberExotelResponseModel(UncheckedBaseModel): + phone_number: str = pydantic.Field() + """ + Phone number + """ + + label: str = pydantic.Field() + """ + Label for the phone number + """ + + supports_inbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports inbound calls + """ + + supports_outbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls + """ + + phone_number_id: str = pydantic.Field() + """ + The ID of the phone number + """ + + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = pydantic.Field(default=None) + """ + The agent that is assigned to the phone number + """ + + 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/data/src/elevenlabs/types/get_phone_number_inbound_sip_trunk_config_response_model.py b/data/src/elevenlabs/types/get_phone_number_inbound_sip_trunk_config_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..841833a65c8c2cea2d4b2e8eacad62c60025caee --- /dev/null +++ b/data/src/elevenlabs/types/get_phone_number_inbound_sip_trunk_config_response_model.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .sip_media_encryption_enum import SipMediaEncryptionEnum + + +class GetPhoneNumberInboundSipTrunkConfigResponseModel(UncheckedBaseModel): + allowed_addresses: typing.List[str] = pydantic.Field() + """ + List of IP addresses that are allowed to use the trunk. Each item in the list can be an individual IP address or a Classless Inter-Domain Routing notation representing a CIDR block. + """ + + allowed_numbers: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of phone numbers that are allowed to use the trunk. + """ + + media_encryption: SipMediaEncryptionEnum + has_auth_credentials: bool = pydantic.Field() + """ + Whether authentication credentials are configured + """ + + username: typing.Optional[str] = pydantic.Field(default=None) + """ + SIP trunk username (if available) + """ + + remote_domains: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Domains of remote SIP servers used to validate TLS certificates. + """ + + attributes_to_headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Map of dynamic variable name to header name for attributes_to_headers + """ + + 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/data/src/elevenlabs/types/get_phone_number_outbound_sip_trunk_config_response_model.py b/data/src/elevenlabs/types/get_phone_number_outbound_sip_trunk_config_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..0cfc49c3e31d34aefc8ad09639e4a7382fdb9b5d --- /dev/null +++ b/data/src/elevenlabs/types/get_phone_number_outbound_sip_trunk_config_response_model.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .media_codec import MediaCodec +from .sip_media_encryption_enum import SipMediaEncryptionEnum +from .sip_trunk_transport_enum import SipTrunkTransportEnum + + +class GetPhoneNumberOutboundSipTrunkConfigResponseModel(UncheckedBaseModel): + """ + SIP Trunk configuration details for a phone number + """ + + address: str = pydantic.Field() + """ + Hostname or IP the SIP INVITE is sent to + """ + + transport: SipTrunkTransportEnum = pydantic.Field() + """ + Protocol to use for SIP transport + """ + + media_encryption: SipMediaEncryptionEnum = pydantic.Field() + """ + Whether or not to encrypt media (data layer). + """ + + headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + SIP headers for INVITE request + """ + + attributes_to_headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Map of dynamic variable name to header name for attributes_to_headers + """ + + has_auth_credentials: bool = pydantic.Field() + """ + Whether authentication credentials are configured + """ + + username: typing.Optional[str] = pydantic.Field(default=None) + """ + SIP trunk username (if available) + """ + + has_outbound_trunk: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether a LiveKit SIP outbound trunk is configured + """ + + enabled_codecs: typing.Optional[typing.List[MediaCodec]] = pydantic.Field(default=None) + """ + Media codecs that are offered in the SDP for outbound calls. If empty, all supported codecs are offered. + """ + + 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/data/src/elevenlabs/types/get_phone_number_response.py b/data/src/elevenlabs/types/get_phone_number_response.py new file mode 100644 index 0000000000000000000000000000000000000000..da642dcb8db55dc4aafe8eb56c855695f2826059 --- /dev/null +++ b/data/src/elevenlabs/types/get_phone_number_response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetPhoneNumberResponse = typing.Any diff --git a/data/src/elevenlabs/types/get_phone_number_sip_trunk_response_model.py b/data/src/elevenlabs/types/get_phone_number_sip_trunk_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4d48b29c4d44297de6e75137de64973e0017c941 --- /dev/null +++ b/data/src/elevenlabs/types/get_phone_number_sip_trunk_response_model.py @@ -0,0 +1,73 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_phone_number_inbound_sip_trunk_config_response_model import GetPhoneNumberInboundSipTrunkConfigResponseModel +from .get_phone_number_outbound_sip_trunk_config_response_model import GetPhoneNumberOutboundSipTrunkConfigResponseModel +from .livekit_stack_type import LivekitStackType +from .phone_number_agent_info import PhoneNumberAgentInfo + + +class GetPhoneNumberSipTrunkResponseModel(UncheckedBaseModel): + phone_number: str = pydantic.Field() + """ + Phone number + """ + + label: str = pydantic.Field() + """ + Label for the phone number + """ + + supports_inbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports inbound calls + """ + + supports_outbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls + """ + + phone_number_id: str = pydantic.Field() + """ + The ID of the phone number + """ + + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = pydantic.Field(default=None) + """ + The agent that is assigned to the phone number + """ + + provider_config: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + outbound_trunk: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = pydantic.Field(default=None) + """ + Configuration of the Outbound SIP trunk - if configured. + """ + + inbound_trunk: typing.Optional[GetPhoneNumberInboundSipTrunkConfigResponseModel] = pydantic.Field(default=None) + """ + Configuration of the Inbound SIP trunk - if configured. + """ + + livekit_stack: LivekitStackType = pydantic.Field() + """ + Type of Livekit stack used for this number. + """ + + store_sip_messages: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to store SIP messages for this phone number. + """ + + 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/data/src/elevenlabs/types/get_phone_number_twilio_response_model.py b/data/src/elevenlabs/types/get_phone_number_twilio_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9dd11372c705f8e78c42baf8d077be2affae7621 --- /dev/null +++ b/data/src/elevenlabs/types/get_phone_number_twilio_response_model.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .phone_number_agent_info import PhoneNumberAgentInfo + + +class GetPhoneNumberTwilioResponseModel(UncheckedBaseModel): + phone_number: str = pydantic.Field() + """ + Phone number + """ + + label: str = pydantic.Field() + """ + Label for the phone number + """ + + supports_inbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports inbound calls + """ + + supports_outbound: typing.Optional[bool] = pydantic.Field(default=None) + """ + This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls + """ + + phone_number_id: str = pydantic.Field() + """ + The ID of the phone number + """ + + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = pydantic.Field(default=None) + """ + The agent that is assigned to the phone number + """ + + 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/data/src/elevenlabs/types/get_phone_numbers_page_response_model.py b/data/src/elevenlabs/types/get_phone_numbers_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..168d4b060554245dbd27c14317ac998e7e9b8384 --- /dev/null +++ b/data/src/elevenlabs/types/get_phone_numbers_page_response_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_phone_numbers_page_response_model_phone_numbers_item import GetPhoneNumbersPageResponseModelPhoneNumbersItem + + +class GetPhoneNumbersPageResponseModel(UncheckedBaseModel): + phone_numbers: typing.List[GetPhoneNumbersPageResponseModelPhoneNumbersItem] = pydantic.Field() + """ + The phone numbers on this page + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Pass this value as `cursor` to fetch the next page. Null when there are no more results. + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there are more results available + """ + + 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/data/src/elevenlabs/types/get_phone_numbers_page_response_model_phone_numbers_item.py b/data/src/elevenlabs/types/get_phone_numbers_page_response_model_phone_numbers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..6c792e396940a33fce277f96e35051d47c73a0e1 --- /dev/null +++ b/data/src/elevenlabs/types/get_phone_numbers_page_response_model_phone_numbers_item.py @@ -0,0 +1,86 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .get_phone_number_inbound_sip_trunk_config_response_model import GetPhoneNumberInboundSipTrunkConfigResponseModel +from .get_phone_number_outbound_sip_trunk_config_response_model import GetPhoneNumberOutboundSipTrunkConfigResponseModel +from .livekit_stack_type import LivekitStackType +from .phone_number_agent_info import PhoneNumberAgentInfo + + +class GetPhoneNumbersPageResponseModelPhoneNumbersItem_Exotel(UncheckedBaseModel): + provider: typing.Literal["exotel"] = "exotel" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class GetPhoneNumbersPageResponseModelPhoneNumbersItem_SipTrunk(UncheckedBaseModel): + provider: typing.Literal["sip_trunk"] = "sip_trunk" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = None + provider_config: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + outbound_trunk: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + inbound_trunk: typing.Optional[GetPhoneNumberInboundSipTrunkConfigResponseModel] = None + livekit_stack: LivekitStackType + store_sip_messages: 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 + + +class GetPhoneNumbersPageResponseModelPhoneNumbersItem_Twilio(UncheckedBaseModel): + provider: typing.Literal["twilio"] = "twilio" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +GetPhoneNumbersPageResponseModelPhoneNumbersItem = typing_extensions.Annotated[ + typing.Union[ + GetPhoneNumbersPageResponseModelPhoneNumbersItem_Exotel, + GetPhoneNumbersPageResponseModelPhoneNumbersItem_SipTrunk, + GetPhoneNumbersPageResponseModelPhoneNumbersItem_Twilio, + ], + UnionMetadata(discriminant="provider"), +] diff --git a/data/src/elevenlabs/types/get_project_request.py b/data/src/elevenlabs/types/get_project_request.py new file mode 100644 index 0000000000000000000000000000000000000000..ea6d71b018285a3711bcb96d0beb5dd69b97ba41 --- /dev/null +++ b/data/src/elevenlabs/types/get_project_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetProjectRequest = typing.Any diff --git a/data/src/elevenlabs/types/get_projects_request.py b/data/src/elevenlabs/types/get_projects_request.py new file mode 100644 index 0000000000000000000000000000000000000000..3d4ff95d84f0b1eff9e718b742c8460666f39924 --- /dev/null +++ b/data/src/elevenlabs/types/get_projects_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetProjectsRequest = typing.Any diff --git a/data/src/elevenlabs/types/get_projects_response.py b/data/src/elevenlabs/types/get_projects_response.py new file mode 100644 index 0000000000000000000000000000000000000000..76b8052b827dbaff919426cb694c115445392e3e --- /dev/null +++ b/data/src/elevenlabs/types/get_projects_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .project_response import ProjectResponse + + +class GetProjectsResponse(UncheckedBaseModel): + projects: typing.List[ProjectResponse] = pydantic.Field() + """ + A list of projects with their metadata. + """ + + 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/data/src/elevenlabs/types/get_pronunciation_dictionaries_metadata_response_model.py b/data/src/elevenlabs/types/get_pronunciation_dictionaries_metadata_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1cac99a88769103a1d7fac582aa99d1311e743ea --- /dev/null +++ b/data/src/elevenlabs/types/get_pronunciation_dictionaries_metadata_response_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_pronunciation_dictionary_metadata_response import GetPronunciationDictionaryMetadataResponse + + +class GetPronunciationDictionariesMetadataResponseModel(UncheckedBaseModel): + pronunciation_dictionaries: typing.List[GetPronunciationDictionaryMetadataResponse] = pydantic.Field() + """ + A list of pronunciation dictionaries and their metadata. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + The next cursor to use for pagination. + """ + + has_more: bool = pydantic.Field() + """ + Whether there are more pronunciation dictionaries to fetch. + """ + + 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/data/src/elevenlabs/types/get_pronunciation_dictionaries_response.py b/data/src/elevenlabs/types/get_pronunciation_dictionaries_response.py new file mode 100644 index 0000000000000000000000000000000000000000..8879dcd7105936a8b0bf9df25239aa4d3ca03bbc --- /dev/null +++ b/data/src/elevenlabs/types/get_pronunciation_dictionaries_response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetPronunciationDictionariesResponse = typing.Any diff --git a/data/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response.py b/data/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response.py new file mode 100644 index 0000000000000000000000000000000000000000..cbd83d86aea985c1f5994adb6f83cb0aaddab8e0 --- /dev/null +++ b/data/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response.py @@ -0,0 +1,68 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_pronunciation_dictionary_metadata_response_permission_on_resource import ( + GetPronunciationDictionaryMetadataResponsePermissionOnResource, +) + + +class GetPronunciationDictionaryMetadataResponse(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The ID of the pronunciation dictionary. + """ + + latest_version_id: str = pydantic.Field() + """ + The ID of the latest version of the pronunciation dictionary. + """ + + latest_version_rules_num: int = pydantic.Field() + """ + The number of rules in the latest version of the pronunciation dictionary. + """ + + name: str = pydantic.Field() + """ + The name of the pronunciation dictionary. + """ + + permission_on_resource: typing.Optional[GetPronunciationDictionaryMetadataResponsePermissionOnResource] = ( + pydantic.Field(default=None) + ) + """ + The permission on the resource of the pronunciation dictionary. + """ + + created_by: str = pydantic.Field() + """ + The user ID of the creator of the pronunciation dictionary. + """ + + creation_time_unix: int = pydantic.Field() + """ + The creation time of the pronunciation dictionary in Unix timestamp. + """ + + archived_time_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The archive time of the pronunciation dictionary in Unix timestamp. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the pronunciation dictionary. + """ + + 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/data/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response_permission_on_resource.py b/data/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response_permission_on_resource.py new file mode 100644 index 0000000000000000000000000000000000000000..64329b37761f1b5cb8fddb3fbfc9b7f36c7e2c35 --- /dev/null +++ b/data/src/elevenlabs/types/get_pronunciation_dictionary_metadata_response_permission_on_resource.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetPronunciationDictionaryMetadataResponsePermissionOnResource = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/get_pronunciation_dictionary_response.py b/data/src/elevenlabs/types/get_pronunciation_dictionary_response.py new file mode 100644 index 0000000000000000000000000000000000000000..06dd7eab0b8bdfcab719e18106e9489e2c2642df --- /dev/null +++ b/data/src/elevenlabs/types/get_pronunciation_dictionary_response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetPronunciationDictionaryResponse = typing.Any diff --git a/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model.py b/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..706ee1c41f1fdefd43e17809e1994d091863c8af --- /dev/null +++ b/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model.py @@ -0,0 +1,76 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_pronunciation_dictionary_with_rules_response_model_permission_on_resource import ( + GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource, +) +from .get_pronunciation_dictionary_with_rules_response_model_rules_item import ( + GetPronunciationDictionaryWithRulesResponseModelRulesItem, +) + + +class GetPronunciationDictionaryWithRulesResponseModel(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The ID of the pronunciation dictionary. + """ + + latest_version_id: str = pydantic.Field() + """ + The ID of the latest version of the pronunciation dictionary. + """ + + latest_version_rules_num: int = pydantic.Field() + """ + The number of rules in the latest version of the pronunciation dictionary. + """ + + name: str = pydantic.Field() + """ + The name of the pronunciation dictionary. + """ + + permission_on_resource: typing.Optional[GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource] = ( + pydantic.Field(default=None) + ) + """ + The permission on the resource of the pronunciation dictionary. + """ + + created_by: str = pydantic.Field() + """ + The user ID of the creator of the pronunciation dictionary. + """ + + creation_time_unix: int = pydantic.Field() + """ + The creation time of the pronunciation dictionary in Unix timestamp. + """ + + archived_time_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The archive time of the pronunciation dictionary in Unix timestamp. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the pronunciation dictionary. + """ + + rules: typing.List[GetPronunciationDictionaryWithRulesResponseModelRulesItem] = pydantic.Field() + """ + The rules in the latest version of the pronunciation dictionary. + """ + + 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/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model_permission_on_resource.py b/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model_permission_on_resource.py new file mode 100644 index 0000000000000000000000000000000000000000..b38d907010fc61194871934aa51c7a279e583b9f --- /dev/null +++ b/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model_permission_on_resource.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GetPronunciationDictionaryWithRulesResponseModelPermissionOnResource = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model_rules_item.py b/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model_rules_item.py new file mode 100644 index 0000000000000000000000000000000000000000..22d6b5fee53173c50543377743b35e52cb5c88e4 --- /dev/null +++ b/data/src/elevenlabs/types/get_pronunciation_dictionary_with_rules_response_model_rules_item.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class GetPronunciationDictionaryWithRulesResponseModelRulesItem_Alias(UncheckedBaseModel): + type: typing.Literal["alias"] = "alias" + string_to_replace: str + case_sensitive: typing.Optional[bool] = None + word_boundaries: typing.Optional[bool] = None + alias: 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 + + +class GetPronunciationDictionaryWithRulesResponseModelRulesItem_Phoneme(UncheckedBaseModel): + type: typing.Literal["phoneme"] = "phoneme" + string_to_replace: str + case_sensitive: typing.Optional[bool] = None + word_boundaries: typing.Optional[bool] = None + phoneme: str + alphabet: 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 + + +GetPronunciationDictionaryWithRulesResponseModelRulesItem = typing_extensions.Annotated[ + typing.Union[ + GetPronunciationDictionaryWithRulesResponseModelRulesItem_Alias, + GetPronunciationDictionaryWithRulesResponseModelRulesItem_Phoneme, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_response_unit_test_response_model.py b/data/src/elevenlabs/types/get_response_unit_test_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b1a945ff21eb6bdcac1002756e267b06fd963698 --- /dev/null +++ b/data/src/elevenlabs/types/get_response_unit_test_response_model.py @@ -0,0 +1,73 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_failure_response_example import AgentFailureResponseExample +from .agent_successful_response_example import AgentSuccessfulResponseExample +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from .conversation_initiation_source import ConversationInitiationSource +from .resource_access_info import ResourceAccessInfo +from .test_from_conversation_metadata_output import TestFromConversationMetadataOutput + + +class GetResponseUnitTestResponseModel(UncheckedBaseModel): + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information for the requesting user on this test. + """ + + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + success_condition: typing.Optional[str] = pydantic.Field(default=None) + """ + A prompt that evaluates whether the agent's response is successful. Should return True or False. + """ + + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = pydantic.Field(default=None) + """ + Non-empty list of example responses that should be considered successful + """ + + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = pydantic.Field(default=None) + """ + Non-empty list of example responses that should be considered failures + """ + + id: str + 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 + + +update_forward_refs(GetResponseUnitTestResponseModel) diff --git a/data/src/elevenlabs/types/get_schedule_params.py b/data/src/elevenlabs/types/get_schedule_params.py new file mode 100644 index 0000000000000000000000000000000000000000..6958b38f3cff833cbde264c17237915c4e8fa329 --- /dev/null +++ b/data/src/elevenlabs/types/get_schedule_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetScheduleParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["get_schedule"]] = None + include_location_filter: 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/data/src/elevenlabs/types/get_secret_dependencies_response_model.py b/data/src/elevenlabs/types/get_secret_dependencies_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c0fba4faddc8bd648efdc41335fcf58d5d8db7f6 --- /dev/null +++ b/data/src/elevenlabs/types/get_secret_dependencies_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_secret_dependencies_response_model_dependencies import GetSecretDependenciesResponseModelDependencies + + +class GetSecretDependenciesResponseModel(UncheckedBaseModel): + dependencies: GetSecretDependenciesResponseModelDependencies + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Cursor for fetching the next page of dependencies + """ + + 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/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies.py b/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies.py new file mode 100644 index 0000000000000000000000000000000000000000..e53c7f889cf40b77a09e5fd4b456599df33a95bb --- /dev/null +++ b/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .dependent_phone_number_identifier import DependentPhoneNumberIdentifier +from .get_secret_dependencies_response_model_dependencies_one_item import ( + GetSecretDependenciesResponseModelDependenciesOneItem, +) +from .get_secret_dependencies_response_model_dependencies_zero_item import ( + GetSecretDependenciesResponseModelDependenciesZeroItem, +) + +GetSecretDependenciesResponseModelDependencies = typing.Union[ + typing.List[GetSecretDependenciesResponseModelDependenciesZeroItem], + typing.List[GetSecretDependenciesResponseModelDependenciesOneItem], + typing.List[DependentPhoneNumberIdentifier], +] diff --git a/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies_one_item.py b/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies_one_item.py new file mode 100644 index 0000000000000000000000000000000000000000..21d325d6567a5e966486bb458eaab64bab7319e8 --- /dev/null +++ b/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies_one_item.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class GetSecretDependenciesResponseModelDependenciesOneItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class GetSecretDependenciesResponseModelDependenciesOneItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +GetSecretDependenciesResponseModelDependenciesOneItem = typing_extensions.Annotated[ + typing.Union[ + GetSecretDependenciesResponseModelDependenciesOneItem_Available, + GetSecretDependenciesResponseModelDependenciesOneItem_Unknown, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies_zero_item.py b/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies_zero_item.py new file mode 100644 index 0000000000000000000000000000000000000000..78a3fdd5077520efebdfa1994e420df1c0dc73ec --- /dev/null +++ b/data/src/elevenlabs/types/get_secret_dependencies_response_model_dependencies_zero_item.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_tool_identifier_access_level import DependentAvailableToolIdentifierAccessLevel + + +class GetSecretDependenciesResponseModelDependenciesZeroItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableToolIdentifierAccessLevel + + 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 + + +class GetSecretDependenciesResponseModelDependenciesZeroItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + id: 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 + + +GetSecretDependenciesResponseModelDependenciesZeroItem = typing_extensions.Annotated[ + typing.Union[ + GetSecretDependenciesResponseModelDependenciesZeroItem_Available, + GetSecretDependenciesResponseModelDependenciesZeroItem_Unknown, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_simulation_test_response_model.py b/data/src/elevenlabs/types/get_simulation_test_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..86fa005c2976399f48e97dc6945e373ffb76c6f5 --- /dev/null +++ b/data/src/elevenlabs/types/get_simulation_test_response_model.py @@ -0,0 +1,106 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from .conversation_initiation_source import ConversationInitiationSource +from .llm import Llm +from .resource_access_info import ResourceAccessInfo +from .simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from .test_from_conversation_metadata_output import TestFromConversationMetadataOutput +from .tool_response_mock_config_output import ToolResponseMockConfigOutput + + +class GetSimulationTestResponseModel(UncheckedBaseModel): + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information for the requesting user on this test. + """ + + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + success_condition: typing.Optional[str] = pydantic.Field(default=None) + """ + Deprecated legacy single success criterion. Use success_conditions instead. At least one of success_condition or success_conditions is required. + """ + + success_conditions: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of prompts that evaluate whether the simulation was successful. If provided, all criteria are evaluated and merged into a final result. Capped at the maximum number of evaluation criteria. + """ + + simulation_scenario: typing.Optional[str] = pydantic.Field(default=None) + """ + Description of the simulation scenario and user persona for simulation tests. + """ + + simulation_max_turns: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of conversation turns for simulation tests. + """ + + simulation_environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to use when running this simulation test. If not provided, defaults to 'production'. + """ + + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = pydantic.Field(default=None) + """ + Configuration for which tools to mock and fallback behavior. + """ + + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigOutput]]] = pydantic.Field( + default=None + ) + """ + Test-specific response mocks, keyed by tool ID. Applied ahead of the tool's shared mocks and only within this test. Only take effect for tools that are mocked (see tool_mock_config). + """ + + evaluation_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model to use for evaluating simulation results. + """ + + simulated_user_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model for the simulated user. + """ + + id: str + 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 + + +update_forward_refs(GetSimulationTestResponseModel) diff --git a/data/src/elevenlabs/types/get_sip_log_messages_response.py b/data/src/elevenlabs/types/get_sip_log_messages_response.py new file mode 100644 index 0000000000000000000000000000000000000000..9b0606d54673f1e1b2e9a6811842e14746daaf8b --- /dev/null +++ b/data/src/elevenlabs/types/get_sip_log_messages_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .sip_log_message import SipLogMessage + + +class GetSipLogMessagesResponse(UncheckedBaseModel): + sip_messages: typing.List[SipLogMessage] + next_cursor: typing.Optional[str] = None + has_more: 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/data/src/elevenlabs/types/get_speech_history_response.py b/data/src/elevenlabs/types/get_speech_history_response.py new file mode 100644 index 0000000000000000000000000000000000000000..a34331b3702878505448015a70b8f2b19dadd2bf --- /dev/null +++ b/data/src/elevenlabs/types/get_speech_history_response.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .speech_history_item_response import SpeechHistoryItemResponse + + +class GetSpeechHistoryResponse(UncheckedBaseModel): + history: typing.List[SpeechHistoryItemResponse] = pydantic.Field() + """ + A list of speech history items. + """ + + last_history_item_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the last history item. + """ + + has_more: bool = pydantic.Field() + """ + Whether there are more history items to fetch. + """ + + scanned_until: typing.Optional[int] = pydantic.Field(default=None) + """ + The timestamp of the last history item. + """ + + 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/data/src/elevenlabs/types/get_test_invocations_page_response_model.py b/data/src/elevenlabs/types/get_test_invocations_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f33f5d16bdc2fb87fccdbcb032f3f3ecc20146d8 --- /dev/null +++ b/data/src/elevenlabs/types/get_test_invocations_page_response_model.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .list_response_meta import ListResponseMeta +from .test_invocation_summary_response_model import TestInvocationSummaryResponseModel + + +class GetTestInvocationsPageResponseModel(UncheckedBaseModel): + meta: typing.Optional[ListResponseMeta] = None + results: typing.List[TestInvocationSummaryResponseModel] + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Cursor for the next page of results + """ + + has_more: bool = pydantic.Field() + """ + Whether there are more results available + """ + + 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/data/src/elevenlabs/types/get_test_suite_invocation_response_model.py b/data/src/elevenlabs/types/get_test_suite_invocation_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4e19753089b43ed057d174c88c5f3599eb31a44e --- /dev/null +++ b/data/src/elevenlabs/types/get_test_suite_invocation_response_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .bucketing_status import BucketingStatus +from .test_run_result_summary import TestRunResultSummary +from .unit_test_run_response_model import UnitTestRunResponseModel + + +class GetTestSuiteInvocationResponseModel(UncheckedBaseModel): + id: str + agent_id: typing.Optional[str] = None + branch_id: typing.Optional[str] = None + version_id: typing.Optional[str] = None + ran_against_draft: typing.Optional[bool] = None + created_at: typing.Optional[int] = None + folder_id: typing.Optional[str] = None + repeat_count: typing.Optional[int] = None + cancelled: typing.Optional[bool] = None + bucketing_status: typing.Optional[BucketingStatus] = pydantic.Field(default=None) + """ + None when repeat_count==1 (no bucketing). Otherwise tracks bucketing lifecycle. + """ + + result_groups: typing.Optional[typing.List[TestRunResultSummary]] = None + test_runs: typing.List[UnitTestRunResponseModel] + + 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 + + +update_forward_refs(GetTestSuiteInvocationResponseModel) diff --git a/data/src/elevenlabs/types/get_tests_page_response_model.py b/data/src/elevenlabs/types/get_tests_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1a750dde1b1ad814cd353fba71cefab723b96b8a --- /dev/null +++ b/data/src/elevenlabs/types/get_tests_page_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .unit_test_summary_response_model import UnitTestSummaryResponseModel + + +class GetTestsPageResponseModel(UncheckedBaseModel): + tests: typing.List[UnitTestSummaryResponseModel] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_tests_summaries_by_ids_response_model.py b/data/src/elevenlabs/types/get_tests_summaries_by_ids_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b395fcd22d62d0d46e9787d2e88071352467b702 --- /dev/null +++ b/data/src/elevenlabs/types/get_tests_summaries_by_ids_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .unit_test_summary_response_model import UnitTestSummaryResponseModel + + +class GetTestsSummariesByIdsResponseModel(UncheckedBaseModel): + tests: typing.Dict[str, UnitTestSummaryResponseModel] = pydantic.Field() + """ + Dictionary mapping test IDs to their summary information + """ + + 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/data/src/elevenlabs/types/get_tool_call_unit_test_response_model.py b/data/src/elevenlabs/types/get_tool_call_unit_test_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8ad82985ab84083bb347aba880ccc39fe9da8d2c --- /dev/null +++ b/data/src/elevenlabs/types/get_tool_call_unit_test_response_model.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from .conversation_initiation_source import ConversationInitiationSource +from .resource_access_info import ResourceAccessInfo +from .test_from_conversation_metadata_output import TestFromConversationMetadataOutput +from .unit_test_tool_call_evaluation_model_output import UnitTestToolCallEvaluationModelOutput + + +class GetToolCallUnitTestResponseModel(UncheckedBaseModel): + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information for the requesting user on this test. + """ + + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelOutput] = pydantic.Field(default=None) + """ + How to evaluate the agent's tool call (if any). If empty, the tool call is not evaluated. + """ + + check_any_tool_matches: typing.Optional[bool] = pydantic.Field(default=None) + """ + If set to True this test will pass if any tool call returned by the LLM matches the criteria. Otherwise it will fail if more than one tool is returned by the agent. + """ + + id: str + 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 + + +update_forward_refs(GetToolCallUnitTestResponseModel) diff --git a/data/src/elevenlabs/types/get_tool_dependent_agents_response_model.py b/data/src/elevenlabs/types/get_tool_dependent_agents_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..569e6a8e0433a449c5ad38968b2a1c79eb2f329d --- /dev/null +++ b/data/src/elevenlabs/types/get_tool_dependent_agents_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dependent_branch_info import DependentBranchInfo +from .get_tool_dependent_agents_response_model_agents_item import GetToolDependentAgentsResponseModelAgentsItem + + +class GetToolDependentAgentsResponseModel(UncheckedBaseModel): + agents: typing.List[GetToolDependentAgentsResponseModelAgentsItem] + branches: typing.Optional[typing.List[DependentBranchInfo]] = None + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_tool_dependent_agents_response_model_agents_item.py b/data/src/elevenlabs/types/get_tool_dependent_agents_response_model_agents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..c2cd5b581b3742ffb3ce3fbccb0a77102a7d8a43 --- /dev/null +++ b/data/src/elevenlabs/types/get_tool_dependent_agents_response_model_agents_item.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class GetToolDependentAgentsResponseModelAgentsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class GetToolDependentAgentsResponseModelAgentsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +GetToolDependentAgentsResponseModelAgentsItem = typing_extensions.Annotated[ + typing.Union[ + GetToolDependentAgentsResponseModelAgentsItem_Available, GetToolDependentAgentsResponseModelAgentsItem_Unknown + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/get_tool_executions_page_response_model.py b/data/src/elevenlabs/types/get_tool_executions_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f1f2753175547ccebc01019ac4c3c97574d62a07 --- /dev/null +++ b/data/src/elevenlabs/types/get_tool_executions_page_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .tool_execution_response_model import ToolExecutionResponseModel + + +class GetToolExecutionsPageResponseModel(UncheckedBaseModel): + executions: typing.List[ToolExecutionResponseModel] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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/data/src/elevenlabs/types/get_user_voice_collections_response_model.py b/data/src/elevenlabs/types/get_user_voice_collections_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..650fe61dfb13b592c0f3ca6eb93e8fb86bbe1a99 --- /dev/null +++ b/data/src/elevenlabs/types/get_user_voice_collections_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .user_voice_collection_response_model import UserVoiceCollectionResponseModel + + +class GetUserVoiceCollectionsResponseModel(UncheckedBaseModel): + collections: typing.List[UserVoiceCollectionResponseModel] = pydantic.Field() + """ + The voice collections the caller can access, sorted by title. + """ + + 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/data/src/elevenlabs/types/get_voice_accents_response_model.py b/data/src/elevenlabs/types/get_voice_accents_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2263fee581b5de0f3302c630f250e7bbbde94e6a --- /dev/null +++ b/data/src/elevenlabs/types/get_voice_accents_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .voice_accent_response_model import VoiceAccentResponseModel + + +class GetVoiceAccentsResponseModel(UncheckedBaseModel): + accents: typing.List[VoiceAccentResponseModel] = pydantic.Field() + """ + A list of available voice accents. + """ + + 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/data/src/elevenlabs/types/get_voices_response.py b/data/src/elevenlabs/types/get_voices_response.py new file mode 100644 index 0000000000000000000000000000000000000000..2065c2ee86e4e01c125f2035dcb48846a1d55e32 --- /dev/null +++ b/data/src/elevenlabs/types/get_voices_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .voice import Voice + + +class GetVoicesResponse(UncheckedBaseModel): + voices: typing.List[Voice] = pydantic.Field() + """ + A list of available voices. + """ + + 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/data/src/elevenlabs/types/get_voices_v_2_response.py b/data/src/elevenlabs/types/get_voices_v_2_response.py new file mode 100644 index 0000000000000000000000000000000000000000..13ddebeddae4ab957c461fa4425ac44b24baf35a --- /dev/null +++ b/data/src/elevenlabs/types/get_voices_v_2_response.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .voice import Voice + + +class GetVoicesV2Response(UncheckedBaseModel): + voices: typing.List[Voice] = pydantic.Field() + """ + The list of voices matching the query. + """ + + has_more: bool = pydantic.Field() + """ + Indicates whether there are more voices available in subsequent pages. Use this flag (and next_page_token) for reliable pagination instead of relying on total_count. + """ + + total_count: int = pydantic.Field() + """ + The total count of voices matching the query. This value is a live snapshot that reflects the current state of the database and may change between requests as users create, modify, or delete voices. For reliable pagination, use the has_more flag instead of relying on this value. Only request this field when you actually need the total count (e.g., for display purposes), as calculating it incurs a performance cost. + """ + + next_page_token: typing.Optional[str] = pydantic.Field(default=None) + """ + Token to retrieve the next page of results. Pass this value to the next request to continue pagination. Null if there are no more results. + """ + + 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/data/src/elevenlabs/types/get_whats_app_account_response.py b/data/src/elevenlabs/types/get_whats_app_account_response.py new file mode 100644 index 0000000000000000000000000000000000000000..02d421b1b30481535ec4fcdc53e8622efff31a6f --- /dev/null +++ b/data/src/elevenlabs/types/get_whats_app_account_response.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_account_type import WhatsAppAccountType + + +class GetWhatsAppAccountResponse(UncheckedBaseModel): + business_account_id: str + phone_number_id: str + business_account_name: str + phone_number_name: str + phone_number: str + account_type: typing.Optional[WhatsAppAccountType] = pydantic.Field(default=None) + """ + Which Embedded Signup flow produced this account. + """ + + assigned_agent_id: typing.Optional[str] = None + enable_messaging: typing.Optional[bool] = None + enable_audio_message_response: typing.Optional[bool] = None + enable_typing_indicator: typing.Optional[bool] = None + assigned_agent_name: typing.Optional[str] = None + is_token_expired: 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/data/src/elevenlabs/types/get_workspace_plan_params.py b/data/src/elevenlabs/types/get_workspace_plan_params.py new file mode 100644 index 0000000000000000000000000000000000000000..89b619007dcdb3b698b26274144e1696812f12cf --- /dev/null +++ b/data/src/elevenlabs/types/get_workspace_plan_params.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GetWorkspacePlanParams(UncheckedBaseModel): + """ + Read the workspace's current Reception plan and its hard limits. + + Call this before answering any plan, pricing, trial, or limit question so + the assistant stops guessing (e.g. telling a paying owner they're on the + trial, or hallucinating concurrent-call / receptionist / voice-cloning + caps). The tool exposes only the shape of the plan — a display name; + whether it's trial / paid / untiered; the entitlement caps (max + receptionists, phone numbers, active locations, team members, concurrent + calls, voice-cloning quota) alongside the current counts; and whether + there's a payment issue. It deliberately does NOT return list prices or + dollar amounts, nor the trial / renewal end date: pricing and renewal + dates are a product decision and live in the Settings > Billing plan + picker. + """ + + smb_tool_type: typing.Optional[typing.Literal["get_workspace_plan"]] = 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/data/src/elevenlabs/types/get_workspace_secrets_response_model.py b/data/src/elevenlabs/types/get_workspace_secrets_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4e92519128a9555aa4b3aeb398a60503cc7ace6c --- /dev/null +++ b/data/src/elevenlabs/types/get_workspace_secrets_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conv_ai_workspace_stored_secret_config import ConvAiWorkspaceStoredSecretConfig + + +class GetWorkspaceSecretsResponseModel(UncheckedBaseModel): + secrets: typing.List[ConvAiWorkspaceStoredSecretConfig] + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Cursor for fetching the next page of secrets + """ + + 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/data/src/elevenlabs/types/gpt_image_15_request.py b/data/src/elevenlabs/types/gpt_image_15_request.py new file mode 100644 index 0000000000000000000000000000000000000000..9b1fbbe15a8d44212f31d849def2bbc11e1af8e8 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_15_request.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gpt_image_15_request_aspect_ratio import GptImage15RequestAspectRatio +from .gpt_image_15_request_background import GptImage15RequestBackground +from .gpt_image_15_request_quality import GptImage15RequestQuality +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class GptImage15Request(UncheckedBaseModel): + """ + Request body for the OpenAI GPT Image 1.5 model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 5 reference images to edit or draw from. + """ + + mask: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + An image whose fully transparent areas mark where the first reference image may be edited; requires `images`. + """ + + quality: typing.Optional[GptImage15RequestQuality] = pydantic.Field(default=None) + """ + The quality of the output image. + """ + + background: typing.Optional[GptImage15RequestBackground] = pydantic.Field(default=None) + """ + The background of the output image. With `auto`, the model picks the background that suits the image. + """ + + aspect_ratio: typing.Optional[GptImage15RequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. + """ + + 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/data/src/elevenlabs/types/gpt_image_15_request_aspect_ratio.py b/data/src/elevenlabs/types/gpt_image_15_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..5518a502e9b234aeed10208f8bf24bafcc287bdb --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_15_request_aspect_ratio.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage15RequestAspectRatio = typing.Union[typing.Literal["1:1", "3:2", "2:3"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_15_request_background.py b/data/src/elevenlabs/types/gpt_image_15_request_background.py new file mode 100644 index 0000000000000000000000000000000000000000..b623f5ee321c5d90160d0c5a68a47304bf8f4497 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_15_request_background.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage15RequestBackground = typing.Union[typing.Literal["transparent", "opaque", "auto"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_15_request_quality.py b/data/src/elevenlabs/types/gpt_image_15_request_quality.py new file mode 100644 index 0000000000000000000000000000000000000000..bafa567302327f1d6f75a84d7e4ff65abaee0a24 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_15_request_quality.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage15RequestQuality = typing.Union[typing.Literal["low", "medium", "high"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_1_request.py b/data/src/elevenlabs/types/gpt_image_1_request.py new file mode 100644 index 0000000000000000000000000000000000000000..00c7054a60999fa01247241e340df9c5d28b369d --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_1_request.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gpt_image_1_request_aspect_ratio import GptImage1RequestAspectRatio +from .gpt_image_1_request_background import GptImage1RequestBackground +from .gpt_image_1_request_quality import GptImage1RequestQuality +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class GptImage1Request(UncheckedBaseModel): + """ + Request body for the OpenAI GPT Image 1 model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 5 reference images to edit or draw from. + """ + + mask: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + An image whose fully transparent areas mark where the first reference image may be edited; requires `images`. + """ + + quality: typing.Optional[GptImage1RequestQuality] = pydantic.Field(default=None) + """ + The quality of the output image. + """ + + background: typing.Optional[GptImage1RequestBackground] = pydantic.Field(default=None) + """ + The background of the output image. With `auto`, the model picks the background that suits the image. + """ + + aspect_ratio: typing.Optional[GptImage1RequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. + """ + + 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/data/src/elevenlabs/types/gpt_image_1_request_aspect_ratio.py b/data/src/elevenlabs/types/gpt_image_1_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..ab3e3e8aa10210037992e4d336f489ac20a7afa9 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_1_request_aspect_ratio.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage1RequestAspectRatio = typing.Union[typing.Literal["1:1", "3:2", "2:3"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_1_request_background.py b/data/src/elevenlabs/types/gpt_image_1_request_background.py new file mode 100644 index 0000000000000000000000000000000000000000..2250608037a7d3bd2980f60230a0f365d2f2b7e1 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_1_request_background.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage1RequestBackground = typing.Union[typing.Literal["transparent", "opaque", "auto"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_1_request_quality.py b/data/src/elevenlabs/types/gpt_image_1_request_quality.py new file mode 100644 index 0000000000000000000000000000000000000000..028a36c63b078a82baa7c56664e642d5e9306b0a --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_1_request_quality.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage1RequestQuality = typing.Union[typing.Literal["low", "medium", "high"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_25_flare_request.py b/data/src/elevenlabs/types/gpt_image_25_flare_request.py new file mode 100644 index 0000000000000000000000000000000000000000..76fb72a7fa6dc6a78c19c026f95fdade54f769a8 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_25_flare_request.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gpt_image_25_flare_request_aspect_ratio import GptImage25FlareRequestAspectRatio +from .gpt_image_25_flare_request_quality import GptImage25FlareRequestQuality +from .gpt_image_25_flare_request_resolution import GptImage25FlareRequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class GptImage25FlareRequest(UncheckedBaseModel): + """ + Request body for the OpenAI GPT Image 2.5 Flare model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 10 reference images to edit or draw from. + """ + + mask: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + An image whose fully transparent areas mark where the first reference image may be edited; requires `images`. + """ + + quality: typing.Optional[GptImage25FlareRequestQuality] = pydantic.Field(default=None) + """ + The quality of the output image. + """ + + aspect_ratio: typing.Optional[GptImage25FlareRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + resolution: typing.Optional[GptImage25FlareRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output image. + """ + + 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/data/src/elevenlabs/types/gpt_image_25_flare_request_aspect_ratio.py b/data/src/elevenlabs/types/gpt_image_25_flare_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..c93e04697f168f6e02034c72bb2947839921d92c --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_25_flare_request_aspect_ratio.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage25FlareRequestAspectRatio = typing.Union[ + typing.Literal[ + "auto", "1:1", "4:5", "5:4", "3:4", "4:3", "2:3", "3:2", "1:2", "2:1", "9:16", "16:9", "21:9", "1:3", "3:1" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/gpt_image_25_flare_request_quality.py b/data/src/elevenlabs/types/gpt_image_25_flare_request_quality.py new file mode 100644 index 0000000000000000000000000000000000000000..b0221fbf3bfa75888bfb716c954408d8c5cc669f --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_25_flare_request_quality.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage25FlareRequestQuality = typing.Union[typing.Literal["low", "medium", "high", "xhigh", "max"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_25_flare_request_resolution.py b/data/src/elevenlabs/types/gpt_image_25_flare_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..e0b2bc18159da92e46bc14b9d2806d38c64b25f7 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_25_flare_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage25FlareRequestResolution = typing.Union[typing.Literal["1K", "2K", "4K"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_25_sunburst_request.py b/data/src/elevenlabs/types/gpt_image_25_sunburst_request.py new file mode 100644 index 0000000000000000000000000000000000000000..58d3443a53614cecb3b20cb495ef9b7b50866f79 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_25_sunburst_request.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gpt_image_25_sunburst_request_aspect_ratio import GptImage25SunburstRequestAspectRatio +from .gpt_image_25_sunburst_request_quality import GptImage25SunburstRequestQuality +from .gpt_image_25_sunburst_request_resolution import GptImage25SunburstRequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class GptImage25SunburstRequest(UncheckedBaseModel): + """ + Request body for the OpenAI GPT Image 2.5 Sunburst model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 10 reference images to edit or draw from. + """ + + mask: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + An image whose fully transparent areas mark where the first reference image may be edited; requires `images`. + """ + + quality: typing.Optional[GptImage25SunburstRequestQuality] = pydantic.Field(default=None) + """ + The quality of the output image. + """ + + aspect_ratio: typing.Optional[GptImage25SunburstRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + resolution: typing.Optional[GptImage25SunburstRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output image. + """ + + 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/data/src/elevenlabs/types/gpt_image_25_sunburst_request_aspect_ratio.py b/data/src/elevenlabs/types/gpt_image_25_sunburst_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..02babd356d9f84be13a960ff0f5410543b00555c --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_25_sunburst_request_aspect_ratio.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage25SunburstRequestAspectRatio = typing.Union[ + typing.Literal[ + "auto", "1:1", "4:5", "5:4", "3:4", "4:3", "2:3", "3:2", "1:2", "2:1", "9:16", "16:9", "21:9", "1:3", "3:1" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/gpt_image_25_sunburst_request_quality.py b/data/src/elevenlabs/types/gpt_image_25_sunburst_request_quality.py new file mode 100644 index 0000000000000000000000000000000000000000..dcb2dae753b44b18261f1df8d5ca39af1b77b711 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_25_sunburst_request_quality.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage25SunburstRequestQuality = typing.Union[typing.Literal["low", "medium", "high", "xhigh", "max"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_25_sunburst_request_resolution.py b/data/src/elevenlabs/types/gpt_image_25_sunburst_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..0e314c2567da754425b33ca8a3efa3415dcb8c7c --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_25_sunburst_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage25SunburstRequestResolution = typing.Union[typing.Literal["1K", "2K", "4K"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_2_request.py b/data/src/elevenlabs/types/gpt_image_2_request.py new file mode 100644 index 0000000000000000000000000000000000000000..29fe4df7d416a7c9dce7a8416ce2f7af97da5d03 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_2_request.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .gpt_image_2_request_aspect_ratio import GptImage2RequestAspectRatio +from .gpt_image_2_request_quality import GptImage2RequestQuality +from .gpt_image_2_request_resolution import GptImage2RequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class GptImage2Request(UncheckedBaseModel): + """ + Request body for the OpenAI GPT Image 2 model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the image to generate. + """ + + images: typing.Optional[typing.List[ImageReference]] = pydantic.Field(default=None) + """ + Up to 10 reference images to edit or draw from. + """ + + mask: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + An image whose fully transparent areas mark where the first reference image may be edited; requires `images`. + """ + + quality: typing.Optional[GptImage2RequestQuality] = pydantic.Field(default=None) + """ + The quality of the output image. + """ + + aspect_ratio: typing.Optional[GptImage2RequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output image. With `auto`, the model picks an aspect ratio based on the inputs. + """ + + resolution: typing.Optional[GptImage2RequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output image. + """ + + 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/data/src/elevenlabs/types/gpt_image_2_request_aspect_ratio.py b/data/src/elevenlabs/types/gpt_image_2_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..3d7f794a6931017e2f043dd4d1e2deeda6d81c5c --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_2_request_aspect_ratio.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage2RequestAspectRatio = typing.Union[ + typing.Literal[ + "auto", "1:1", "4:5", "5:4", "3:4", "4:3", "2:3", "3:2", "1:2", "2:1", "9:16", "16:9", "21:9", "1:3", "3:1" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/gpt_image_2_request_quality.py b/data/src/elevenlabs/types/gpt_image_2_request_quality.py new file mode 100644 index 0000000000000000000000000000000000000000..521e234499ae93f441c196747d998b3e3dd098b0 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_2_request_quality.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage2RequestQuality = typing.Union[typing.Literal["low", "medium", "high"], typing.Any] diff --git a/data/src/elevenlabs/types/gpt_image_2_request_resolution.py b/data/src/elevenlabs/types/gpt_image_2_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..5c55e01cd08161d76fe2d045ea0385d44290bd14 --- /dev/null +++ b/data/src/elevenlabs/types/gpt_image_2_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GptImage2RequestResolution = typing.Union[typing.Literal["1K", "2K", "4K"], typing.Any] diff --git a/data/src/elevenlabs/types/group_management_activity_id.py b/data/src/elevenlabs/types/group_management_activity_id.py new file mode 100644 index 0000000000000000000000000000000000000000..7534a1a396c507dd8b2087f86d943b0b5e01a9a2 --- /dev/null +++ b/data/src/elevenlabs/types/group_management_activity_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +GroupManagementActivityId = int diff --git a/data/src/elevenlabs/types/guardrail_execution_mode.py b/data/src/elevenlabs/types/guardrail_execution_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..b1b0ecdbf545289d2c3f50c07844a9445846094e --- /dev/null +++ b/data/src/elevenlabs/types/guardrail_execution_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GuardrailExecutionMode = typing.Union[typing.Literal["streaming", "blocking"], typing.Any] diff --git a/data/src/elevenlabs/types/guardrail_type.py b/data/src/elevenlabs/types/guardrail_type.py new file mode 100644 index 0000000000000000000000000000000000000000..87d663b7db67fb1e67bd240bb713146c0fd1b8d5 --- /dev/null +++ b/data/src/elevenlabs/types/guardrail_type.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +GuardrailType = typing.Union[ + typing.Literal[ + "custom", + "prompt_injection", + "self_harm_intent", + "violence_graphic", + "sexual", + "violence", + "harassment", + "sexual_minors", + "self_harm", + "self_harm_instructions", + "harassment_threatening", + "hate", + "hate_threatening", + "profanity", + "religion_or_politics", + "medical_and_legal", + "guardrail", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/guardrails_result.py b/data/src/elevenlabs/types/guardrails_result.py new file mode 100644 index 0000000000000000000000000000000000000000..b240255970ce463ee20cbb848d569219028024ca --- /dev/null +++ b/data/src/elevenlabs/types/guardrails_result.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class GuardrailsResult(UncheckedBaseModel): + triggered: 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/data/src/elevenlabs/types/guardrails_v_1_input.py b/data/src/elevenlabs/types/guardrails_v_1_input.py new file mode 100644 index 0000000000000000000000000000000000000000..b0315b0d02078c1f65c536de59fb49fe473b7c34 --- /dev/null +++ b/data/src/elevenlabs/types/guardrails_v_1_input.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_guardrail_input import ContentGuardrailInput +from .custom_guardrail_input import CustomGuardrailInput +from .focus_guardrail import FocusGuardrail +from .prompt_injection_guardrail import PromptInjectionGuardrail + + +class GuardrailsV1Input(UncheckedBaseModel): + version: typing.Optional[typing.Literal["1"]] = None + focus: typing.Optional[FocusGuardrail] = None + prompt_injection: typing.Optional[PromptInjectionGuardrail] = None + content: typing.Optional[ContentGuardrailInput] = None + custom: typing.Optional[CustomGuardrailInput] = 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/data/src/elevenlabs/types/guardrails_v_1_output.py b/data/src/elevenlabs/types/guardrails_v_1_output.py new file mode 100644 index 0000000000000000000000000000000000000000..f5b47ae9fc59f026d69f70eb444a3c748888980c --- /dev/null +++ b/data/src/elevenlabs/types/guardrails_v_1_output.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .content_guardrail_output import ContentGuardrailOutput +from .custom_guardrail_output import CustomGuardrailOutput +from .focus_guardrail import FocusGuardrail +from .prompt_injection_guardrail import PromptInjectionGuardrail + + +class GuardrailsV1Output(UncheckedBaseModel): + version: typing.Optional[typing.Literal["1"]] = None + focus: typing.Optional[FocusGuardrail] = None + prompt_injection: typing.Optional[PromptInjectionGuardrail] = None + content: typing.Optional[ContentGuardrailOutput] = None + custom: typing.Optional[CustomGuardrailOutput] = 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/data/src/elevenlabs/types/hiding_reason.py b/data/src/elevenlabs/types/hiding_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..a0ef6ee208c61250c653eb56257afbff19f95b91 --- /dev/null +++ b/data/src/elevenlabs/types/hiding_reason.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +HidingReason = typing.Literal["smb_assistant"] diff --git a/data/src/elevenlabs/types/history_alignment_response_model.py b/data/src/elevenlabs/types/history_alignment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b393b924e7987763a6156b7281ce4d8628328ec5 --- /dev/null +++ b/data/src/elevenlabs/types/history_alignment_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class HistoryAlignmentResponseModel(UncheckedBaseModel): + characters: typing.List[str] = pydantic.Field() + """ + The characters in the alignment. + """ + + character_start_times_seconds: typing.List[float] = pydantic.Field() + """ + The start times of the characters in seconds. + """ + + character_end_times_seconds: typing.List[float] = pydantic.Field() + """ + The end times of the characters in seconds. + """ + + 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/data/src/elevenlabs/types/history_alignments_response_model.py b/data/src/elevenlabs/types/history_alignments_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c8e57b38614753d27aef5413dd61c7e7ed8103bb --- /dev/null +++ b/data/src/elevenlabs/types/history_alignments_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .history_alignment_response_model import HistoryAlignmentResponseModel + + +class HistoryAlignmentsResponseModel(UncheckedBaseModel): + alignment: HistoryAlignmentResponseModel = pydantic.Field() + """ + The alignment of the text. + """ + + normalized_alignment: HistoryAlignmentResponseModel = pydantic.Field() + """ + The normalized alignment of the text. + """ + + 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/data/src/elevenlabs/types/history_item_response.py b/data/src/elevenlabs/types/history_item_response.py new file mode 100644 index 0000000000000000000000000000000000000000..2e24264825001ed0babd3c6947a9edcf82292e91 --- /dev/null +++ b/data/src/elevenlabs/types/history_item_response.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class HistoryItemResponse(UncheckedBaseModel): + state: typing.Optional[typing.Any] = None + voice_category: typing.Optional[typing.Any] = 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/data/src/elevenlabs/types/html_export_options.py b/data/src/elevenlabs/types/html_export_options.py new file mode 100644 index 0000000000000000000000000000000000000000..8121cc4776be2e4d160254162a76d46f61578c41 --- /dev/null +++ b/data/src/elevenlabs/types/html_export_options.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class HtmlExportOptions(UncheckedBaseModel): + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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/data/src/elevenlabs/types/http_request_model.py b/data/src/elevenlabs/types/http_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c09ffacf4ef0c890541ecb0d9b53ff025da8683e --- /dev/null +++ b/data/src/elevenlabs/types/http_request_model.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .url_model import UrlModel + + +class HttpRequestModel(UncheckedBaseModel): + """ + HTTP request details. + + Spec: https://schema.ocsf.io/1.6.0/objects/http_request + """ + + http_method: str = pydantic.Field() + """ + HTTP method (GET, POST, etc.) + """ + + url: UrlModel = pydantic.Field() + """ + Request URL object + """ + + user_agent: typing.Optional[str] = pydantic.Field(default=None) + """ + User agent string + """ + + x_forwarded_for: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + X-Forwarded-For header as a list + """ + + 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/data/src/elevenlabs/types/http_validation_error.py b/data/src/elevenlabs/types/http_validation_error.py new file mode 100644 index 0000000000000000000000000000000000000000..188935a00b37a5a7ac5c9a28a0beb8b90fb1ba30 --- /dev/null +++ b/data/src/elevenlabs/types/http_validation_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .validation_error import ValidationError + + +class HttpValidationError(UncheckedBaseModel): + detail: typing.Optional[typing.List[ValidationError]] = 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/data/src/elevenlabs/types/icon.py b/data/src/elevenlabs/types/icon.py new file mode 100644 index 0000000000000000000000000000000000000000..c5c3ca8cbd4b7b3a680b11f6d6c3535d5d731885 --- /dev/null +++ b/data/src/elevenlabs/types/icon.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .icon_theme import IconTheme + + +class Icon(UncheckedBaseModel): + """ + An optionally-sized icon for display in a user interface (2025-11-25+). + """ + + src: str + mime_type: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="mimeType"), pydantic.Field(alias="mimeType") + ] = None + sizes: typing.Optional[typing.List[str]] = None + theme: typing.Optional[IconTheme] = 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/data/src/elevenlabs/types/icon_theme.py b/data/src/elevenlabs/types/icon_theme.py new file mode 100644 index 0000000000000000000000000000000000000000..83d955244024bb9b44b29f0d50eb3998ab5b1426 --- /dev/null +++ b/data/src/elevenlabs/types/icon_theme.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +IconTheme = typing.Union[typing.Literal["light", "dark"], typing.Any] diff --git a/data/src/elevenlabs/types/image_analysis.py b/data/src/elevenlabs/types/image_analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..5f6e48aca2c145319ad2ac6b290b3d47551d854c --- /dev/null +++ b/data/src/elevenlabs/types/image_analysis.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .image_analysis_result import ImageAnalysisResult +from .image_analysis_status import ImageAnalysisStatus + + +class ImageAnalysis(UncheckedBaseModel): + status: ImageAnalysisStatus + data: typing.Optional[ImageAnalysisResult] = None + updated_at_ms: typing.Optional[int] = 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/data/src/elevenlabs/types/image_analysis_result.py b/data/src/elevenlabs/types/image_analysis_result.py new file mode 100644 index 0000000000000000000000000000000000000000..70cf860e1fa0f8af8858b9b124142dde4d9305a1 --- /dev/null +++ b/data/src/elevenlabs/types/image_analysis_result.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .image_subject import ImageSubject + + +class ImageAnalysisResult(UncheckedBaseModel): + title: str + description: str + content_type: typing.Optional[str] = None + mood_and_style: typing.Optional[str] = None + composition_notes: typing.Optional[str] = None + visible_text: typing.Optional[str] = pydantic.Field(default=None) + """ + Readable text overlaid or shown in the image, if any. + """ + + subjects: typing.Optional[typing.List[ImageSubject]] = 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/data/src/elevenlabs/types/image_analysis_status.py b/data/src/elevenlabs/types/image_analysis_status.py new file mode 100644 index 0000000000000000000000000000000000000000..c43a46e935edc3f82c50d8150efe71e15d759f3d --- /dev/null +++ b/data/src/elevenlabs/types/image_analysis_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ImageAnalysisStatus = typing.Union[typing.Literal["processing", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/image_avatar.py b/data/src/elevenlabs/types/image_avatar.py new file mode 100644 index 0000000000000000000000000000000000000000..4104991c67f5b3d5891252af771b8e0c1516e69b --- /dev/null +++ b/data/src/elevenlabs/types/image_avatar.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ImageAvatar(UncheckedBaseModel): + url: typing.Optional[str] = pydantic.Field(default=None) + """ + The URL of the avatar + """ + + 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/data/src/elevenlabs/types/image_generation_request.py b/data/src/elevenlabs/types/image_generation_request.py new file mode 100644 index 0000000000000000000000000000000000000000..a32fdb4fb0869598858934ae47ea3edb406cd26f --- /dev/null +++ b/data/src/elevenlabs/types/image_generation_request.py @@ -0,0 +1,264 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .bytedance_seedream_5_lite_request_aspect_ratio import BytedanceSeedream5LiteRequestAspectRatio +from .bytedance_seedream_5_lite_request_resolution import BytedanceSeedream5LiteRequestResolution +from .bytedance_seedream_5_pro_request_aspect_ratio import BytedanceSeedream5ProRequestAspectRatio +from .bytedance_seedream_5_pro_request_resolution import BytedanceSeedream5ProRequestResolution +from .gemini_3_pro_image_request_aspect_ratio import Gemini3ProImageRequestAspectRatio +from .gemini_3_pro_image_request_resolution import Gemini3ProImageRequestResolution +from .gemini_25_flash_image_request_aspect_ratio import Gemini25FlashImageRequestAspectRatio +from .gemini_31_flash_image_request_aspect_ratio import Gemini31FlashImageRequestAspectRatio +from .gemini_31_flash_image_request_resolution import Gemini31FlashImageRequestResolution +from .gemini_31_flash_lite_image_request_aspect_ratio import Gemini31FlashLiteImageRequestAspectRatio +from .gpt_image_1_request_aspect_ratio import GptImage1RequestAspectRatio +from .gpt_image_1_request_background import GptImage1RequestBackground +from .gpt_image_1_request_quality import GptImage1RequestQuality +from .gpt_image_2_request_aspect_ratio import GptImage2RequestAspectRatio +from .gpt_image_2_request_quality import GptImage2RequestQuality +from .gpt_image_2_request_resolution import GptImage2RequestResolution +from .gpt_image_15_request_aspect_ratio import GptImage15RequestAspectRatio +from .gpt_image_15_request_background import GptImage15RequestBackground +from .gpt_image_15_request_quality import GptImage15RequestQuality +from .gpt_image_25_flare_request_aspect_ratio import GptImage25FlareRequestAspectRatio +from .gpt_image_25_flare_request_quality import GptImage25FlareRequestQuality +from .gpt_image_25_flare_request_resolution import GptImage25FlareRequestResolution +from .gpt_image_25_sunburst_request_aspect_ratio import GptImage25SunburstRequestAspectRatio +from .gpt_image_25_sunburst_request_quality import GptImage25SunburstRequestQuality +from .gpt_image_25_sunburst_request_resolution import GptImage25SunburstRequestResolution +from .image_reference import ImageReference +from .webhook_target import WebhookTarget + + +class ImageGenerationRequest_BytedanceSeedream5Lite(UncheckedBaseModel): + model_id: typing.Literal["bytedance-seedream-5-lite"] = "bytedance-seedream-5-lite" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + aspect_ratio: typing.Optional[BytedanceSeedream5LiteRequestAspectRatio] = None + seed: typing.Optional[int] = None + resolution: typing.Optional[BytedanceSeedream5LiteRequestResolution] = 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 + + +class ImageGenerationRequest_BytedanceSeedream5Pro(UncheckedBaseModel): + model_id: typing.Literal["bytedance-seedream-5-pro"] = "bytedance-seedream-5-pro" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + aspect_ratio: typing.Optional[BytedanceSeedream5ProRequestAspectRatio] = None + seed: typing.Optional[int] = None + resolution: typing.Optional[BytedanceSeedream5ProRequestResolution] = 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 + + +class ImageGenerationRequest_Gemini25FlashImage(UncheckedBaseModel): + model_id: typing.Literal["gemini-2.5-flash-image"] = "gemini-2.5-flash-image" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + aspect_ratio: typing.Optional[Gemini25FlashImageRequestAspectRatio] = 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 + + +class ImageGenerationRequest_Gemini3ProImage(UncheckedBaseModel): + model_id: typing.Literal["gemini-3-pro-image"] = "gemini-3-pro-image" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + aspect_ratio: typing.Optional[Gemini3ProImageRequestAspectRatio] = None + resolution: typing.Optional[Gemini3ProImageRequestResolution] = 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 + + +class ImageGenerationRequest_Gemini31FlashImage(UncheckedBaseModel): + model_id: typing.Literal["gemini-3.1-flash-image"] = "gemini-3.1-flash-image" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + aspect_ratio: typing.Optional[Gemini31FlashImageRequestAspectRatio] = None + resolution: typing.Optional[Gemini31FlashImageRequestResolution] = 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 + + +class ImageGenerationRequest_Gemini31FlashLiteImage(UncheckedBaseModel): + model_id: typing.Literal["gemini-3.1-flash-lite-image"] = "gemini-3.1-flash-lite-image" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + aspect_ratio: typing.Optional[Gemini31FlashLiteImageRequestAspectRatio] = None + resolution: typing.Optional[typing.Literal["1K"]] = 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 + + +class ImageGenerationRequest_GptImage1(UncheckedBaseModel): + model_id: typing.Literal["gpt-image-1"] = "gpt-image-1" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + mask: typing.Optional[ImageReference] = None + quality: typing.Optional[GptImage1RequestQuality] = None + background: typing.Optional[GptImage1RequestBackground] = None + aspect_ratio: typing.Optional[GptImage1RequestAspectRatio] = 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 + + +class ImageGenerationRequest_GptImage15(UncheckedBaseModel): + model_id: typing.Literal["gpt-image-1.5"] = "gpt-image-1.5" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + mask: typing.Optional[ImageReference] = None + quality: typing.Optional[GptImage15RequestQuality] = None + background: typing.Optional[GptImage15RequestBackground] = None + aspect_ratio: typing.Optional[GptImage15RequestAspectRatio] = 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 + + +class ImageGenerationRequest_GptImage2(UncheckedBaseModel): + model_id: typing.Literal["gpt-image-2"] = "gpt-image-2" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + mask: typing.Optional[ImageReference] = None + quality: typing.Optional[GptImage2RequestQuality] = None + aspect_ratio: typing.Optional[GptImage2RequestAspectRatio] = None + resolution: typing.Optional[GptImage2RequestResolution] = 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 + + +class ImageGenerationRequest_GptImage25Flare(UncheckedBaseModel): + model_id: typing.Literal["gpt-image-2.5-flare"] = "gpt-image-2.5-flare" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + mask: typing.Optional[ImageReference] = None + quality: typing.Optional[GptImage25FlareRequestQuality] = None + aspect_ratio: typing.Optional[GptImage25FlareRequestAspectRatio] = None + resolution: typing.Optional[GptImage25FlareRequestResolution] = 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 + + +class ImageGenerationRequest_GptImage25Sunburst(UncheckedBaseModel): + model_id: typing.Literal["gpt-image-2.5-sunburst"] = "gpt-image-2.5-sunburst" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + images: typing.Optional[typing.List[ImageReference]] = None + mask: typing.Optional[ImageReference] = None + quality: typing.Optional[GptImage25SunburstRequestQuality] = None + aspect_ratio: typing.Optional[GptImage25SunburstRequestAspectRatio] = None + resolution: typing.Optional[GptImage25SunburstRequestResolution] = 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 + + +ImageGenerationRequest = typing_extensions.Annotated[ + typing.Union[ + ImageGenerationRequest_BytedanceSeedream5Lite, + ImageGenerationRequest_BytedanceSeedream5Pro, + ImageGenerationRequest_Gemini25FlashImage, + ImageGenerationRequest_Gemini3ProImage, + ImageGenerationRequest_Gemini31FlashImage, + ImageGenerationRequest_Gemini31FlashLiteImage, + ImageGenerationRequest_GptImage1, + ImageGenerationRequest_GptImage15, + ImageGenerationRequest_GptImage2, + ImageGenerationRequest_GptImage25Flare, + ImageGenerationRequest_GptImage25Sunburst, + ], + UnionMetadata(discriminant="model_id"), +] diff --git a/data/src/elevenlabs/types/image_reference.py b/data/src/elevenlabs/types/image_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..4198d4114164784d8670551a125605be3eb520ee --- /dev/null +++ b/data/src/elevenlabs/types/image_reference.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .inline_image_reference_mime_type import InlineImageReferenceMimeType + + +class ImageReference_Asset(UncheckedBaseModel): + type: typing.Literal["asset"] = "asset" + asset_id: 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 + + +class ImageReference_Generation(UncheckedBaseModel): + type: typing.Literal["generation"] = "generation" + generation_id: 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 + + +class ImageReference_InlineBase64(UncheckedBaseModel): + type: typing.Literal["inline_base64"] = "inline_base64" + content_base_64: typing_extensions.Annotated[ + str, FieldMetadata(alias="content_base64"), pydantic.Field(alias="content_base64") + ] + mime_type: InlineImageReferenceMimeType + + 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 + + +ImageReference = typing_extensions.Annotated[ + typing.Union[ImageReference_Asset, ImageReference_Generation, ImageReference_InlineBase64], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/image_schema.py b/data/src/elevenlabs/types/image_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..3883572d8c676d994405c919bfde5f4fb791c158 --- /dev/null +++ b/data/src/elevenlabs/types/image_schema.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ImageSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: 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/data/src/elevenlabs/types/image_subject.py b/data/src/elevenlabs/types/image_subject.py new file mode 100644 index 0000000000000000000000000000000000000000..ed083e5359d56668d399190dbce70d5172229f84 --- /dev/null +++ b/data/src/elevenlabs/types/image_subject.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ImageSubject(UncheckedBaseModel): + name: str + description: 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/data/src/elevenlabs/types/inbound_sip_trunk_config_request_model.py b/data/src/elevenlabs/types/inbound_sip_trunk_config_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..935b03691ccc1da0cac86f655f7d7f3643dfbdda --- /dev/null +++ b/data/src/elevenlabs/types/inbound_sip_trunk_config_request_model.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .sip_media_encryption_enum import SipMediaEncryptionEnum +from .sip_trunk_credentials_request_model import SipTrunkCredentialsRequestModel + + +class InboundSipTrunkConfigRequestModel(UncheckedBaseModel): + allowed_addresses: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of IP addresses that are allowed to use the trunk. Each item in the list can be an individual IP address or a Classless Inter-Domain Routing notation representing a CIDR block. + """ + + allowed_numbers: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of phone numbers that are allowed to use the trunk. + """ + + media_encryption: typing.Optional[SipMediaEncryptionEnum] = pydantic.Field(default=None) + """ + Whether or not to encrypt media (data layer). + """ + + credentials: typing.Optional[SipTrunkCredentialsRequestModel] = pydantic.Field(default=None) + """ + Optional digest authentication credentials (username/password). + """ + + remote_domains: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Domains of remote SIP servers used to validate TLS certificates. + """ + + attributes_to_headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Map of dynamic variable name to header name for attributes_to_headers + """ + + 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/data/src/elevenlabs/types/init_payload.py b/data/src/elevenlabs/types/init_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..220cc3038f214321d8f9b523be8ff7c9db4cedcf --- /dev/null +++ b/data/src/elevenlabs/types/init_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class InitPayload(UncheckedBaseModel): + """ + Payload for the session initialisation message sent by ElevenLabs. + """ + + type: typing.Literal["init"] = pydantic.Field(default="init") + """ + The message type identifier. + """ + + conversation_id: str = pydantic.Field() + """ + Unique identifier for this conversation session. + """ + + 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/data/src/elevenlabs/types/initialise_context.py b/data/src/elevenlabs/types/initialise_context.py new file mode 100644 index 0000000000000000000000000000000000000000..725e8c0d7bf7e2a3af326c3ae0c11a14e8867762 --- /dev/null +++ b/data/src/elevenlabs/types/initialise_context.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .generation_config import GenerationConfig +from .pronunciation_dictionary_locator import PronunciationDictionaryLocator +from .realtime_voice_settings import RealtimeVoiceSettings + + +class InitialiseContext(UncheckedBaseModel): + """ + Payload to initialize or re-initialize a TTS context with specific settings and initial text for multi-stream connections. + """ + + text: str = pydantic.Field() + """ + The initial text to synthesize. Should end with a single space. + """ + + voice_settings: typing.Optional[RealtimeVoiceSettings] = None + generation_config: typing.Optional[GenerationConfig] = None + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryLocator]] = pydantic.Field( + default=None + ) + """ + Optional list of pronunciation dictionary locators to be used for this context. + """ + + xi_api_key: typing.Optional[str] = pydantic.Field(default=None) + """ + Your ElevenLabs API key. Required if not provided in the WebSocket connection's header or query parameters. This applies to the (re)initialization of this specific context. + """ + + authorization: typing.Optional[str] = pydantic.Field(default=None) + """ + Your authorization bearer token. Required if not provided in the WebSocket connection's header or query parameters. This applies to the (re)initialization of this specific context. + """ + + context_id: typing.Optional[str] = pydantic.Field(default=None) + """ + An identifier for the text-to-speech context. If omitted, a default context ID may be assigned by the server. If provided, this message will create a new context with this ID or re-initialize an existing one with the new settings and text. + """ + + 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/data/src/elevenlabs/types/initialize_connection.py b/data/src/elevenlabs/types/initialize_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..bb5a166c9861ff57480c8a0995d94f93fafbe3a1 --- /dev/null +++ b/data/src/elevenlabs/types/initialize_connection.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .generation_config import GenerationConfig +from .pronunciation_dictionary_locator import PronunciationDictionaryLocator +from .realtime_voice_settings import RealtimeVoiceSettings + + +class InitializeConnection(UncheckedBaseModel): + text: typing.Literal[" "] = pydantic.Field(default=" ") + """ + The initial text that must be sent is a blank space. + """ + + voice_settings: typing.Optional[RealtimeVoiceSettings] = None + generation_config: typing.Optional[GenerationConfig] = None + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryLocator]] = pydantic.Field( + default=None + ) + """ + Optional list of pronunciation dictionary locators. If provided, these dictionaries will be used to + modify pronunciation of matching text. Must only be provided in the first message. + + Note: Pronunciation dictionary matches will only be respected within a provided chunk. + """ + + xi_api_key: typing_extensions.Annotated[ + typing.Optional[str], + FieldMetadata(alias="xi-api-key"), + pydantic.Field( + alias="xi-api-key", + description="Your ElevenLabs API key. This can only be included in the first message and is not needed if present in the header.", + ), + ] = None + authorization: typing.Optional[str] = pydantic.Field(default=None) + """ + Your authorization bearer token. This can only be included in the first message and is not needed if present in the header. + """ + + 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/data/src/elevenlabs/types/initialize_connection_multi.py b/data/src/elevenlabs/types/initialize_connection_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..cb4b89db43934b292c4f3543b260f59fb84cf419 --- /dev/null +++ b/data/src/elevenlabs/types/initialize_connection_multi.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .generation_config import GenerationConfig +from .pronunciation_dictionary_locator import PronunciationDictionaryLocator +from .realtime_voice_settings import RealtimeVoiceSettings + + +class InitializeConnectionMulti(UncheckedBaseModel): + """ + Payload to initialize a new context in a multi-stream WebSocket connection. + """ + + text: typing.Literal[" "] = pydantic.Field(default=" ") + """ + Must be a single space character to initiate the context. + """ + + voice_settings: typing.Optional[RealtimeVoiceSettings] = None + generation_config: typing.Optional[GenerationConfig] = None + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryLocator]] = pydantic.Field( + default=None + ) + """ + Optional pronunciation dictionaries for this context. + """ + + xi_api_key: typing.Optional[str] = pydantic.Field(default=None) + """ + Your ElevenLabs API key (if not in header). For this context's first message only. + """ + + authorization: typing.Optional[str] = pydantic.Field(default=None) + """ + Your authorization bearer token (if not in header). For this context's first message only. + """ + + context_id: typing.Optional[str] = pydantic.Field(default=None) + """ + A unique identifier for the first context created in the websocket. If not provided, a default context will be used. + """ + + 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/data/src/elevenlabs/types/inline_audio_reference.py b/data/src/elevenlabs/types/inline_audio_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..c5a29c4e557be2b0c34c2346e38114081accd5f7 --- /dev/null +++ b/data/src/elevenlabs/types/inline_audio_reference.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .inline_audio_reference_mime_type import InlineAudioReferenceMimeType + + +class InlineAudioReference(UncheckedBaseModel): + """ + Audio passed inline as base64. The audio is stored as an ephemeral + asset with no guaranteed retention: it may be deleted at any time after + the generation completes. To keep an input and reuse it across + generations, upload it via the assets API (`POST /v1/assets`) and pass + an `asset` reference instead. + """ + + content_base_64: typing_extensions.Annotated[ + str, + FieldMetadata(alias="content_base64"), + pydantic.Field( + alias="content_base64", + description="The media file's bytes, base64-encoded (standard alphabet). Up to 25MB decoded.", + ), + ] + mime_type: InlineAudioReferenceMimeType = pydantic.Field() + """ + The MIME type of the encoded audio. + """ + + 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/data/src/elevenlabs/types/inline_audio_reference_mime_type.py b/data/src/elevenlabs/types/inline_audio_reference_mime_type.py new file mode 100644 index 0000000000000000000000000000000000000000..19decdf87805c84f5bc2d147f10f4a54ead8e11a --- /dev/null +++ b/data/src/elevenlabs/types/inline_audio_reference_mime_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InlineAudioReferenceMimeType = typing.Union[typing.Literal["audio/mpeg", "audio/wav"], typing.Any] diff --git a/data/src/elevenlabs/types/inline_base_64_reference.py b/data/src/elevenlabs/types/inline_base_64_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..6bb2cdd4f3b367997eadbf5451a9e9e3c6760c47 --- /dev/null +++ b/data/src/elevenlabs/types/inline_base_64_reference.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .inline_base_64_reference_mime_type import InlineBase64ReferenceMimeType + + +class InlineBase64Reference(UncheckedBaseModel): + """ + Media passed inline as base64. Stored as an ephemeral asset with no + guaranteed retention. To keep an input and reuse it, upload via + ``POST /v1/assets`` and pass an ``asset`` reference instead. + """ + + content_base_64: typing_extensions.Annotated[ + str, + FieldMetadata(alias="content_base64"), + pydantic.Field( + alias="content_base64", + description="The media file's bytes, base64-encoded (standard alphabet). Up to 25MB decoded.", + ), + ] + mime_type: InlineBase64ReferenceMimeType = pydantic.Field() + """ + The MIME type of the encoded media. + """ + + 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/data/src/elevenlabs/types/inline_base_64_reference_mime_type.py b/data/src/elevenlabs/types/inline_base_64_reference_mime_type.py new file mode 100644 index 0000000000000000000000000000000000000000..1024c242316fdb12b5b4c007a73d003f5d3b4abd --- /dev/null +++ b/data/src/elevenlabs/types/inline_base_64_reference_mime_type.py @@ -0,0 +1,19 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InlineBase64ReferenceMimeType = typing.Union[ + typing.Literal[ + "image/jpeg", + "image/png", + "image/webp", + "image/heic", + "image/heif", + "audio/mpeg", + "audio/wav", + "video/mp4", + "video/quicktime", + "video/webm", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/inline_image_reference.py b/data/src/elevenlabs/types/inline_image_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..c4ed2043024c7f04e87832b7f7baf4eb6136332b --- /dev/null +++ b/data/src/elevenlabs/types/inline_image_reference.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .inline_image_reference_mime_type import InlineImageReferenceMimeType + + +class InlineImageReference(UncheckedBaseModel): + """ + An image passed inline as base64. The image is stored as an ephemeral + asset with no guaranteed retention: it may be deleted at any time after + the generation completes. To keep an input and reuse it across + generations, upload it via the assets API (`POST /v1/assets`) and pass + an `asset` reference instead. + """ + + content_base_64: typing_extensions.Annotated[ + str, + FieldMetadata(alias="content_base64"), + pydantic.Field( + alias="content_base64", + description="The media file's bytes, base64-encoded (standard alphabet). Up to 25MB decoded.", + ), + ] + mime_type: InlineImageReferenceMimeType = pydantic.Field() + """ + The MIME type of the encoded image. + """ + + 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/data/src/elevenlabs/types/inline_image_reference_mime_type.py b/data/src/elevenlabs/types/inline_image_reference_mime_type.py new file mode 100644 index 0000000000000000000000000000000000000000..fd0d89e9149abbdf9f3616213ae1387b9785ee52 --- /dev/null +++ b/data/src/elevenlabs/types/inline_image_reference_mime_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InlineImageReferenceMimeType = typing.Union[ + typing.Literal["image/jpeg", "image/png", "image/webp", "image/heic", "image/heif"], typing.Any +] diff --git a/data/src/elevenlabs/types/inline_video_reference.py b/data/src/elevenlabs/types/inline_video_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..5698138f7cd71ebf41849fe4b346617f485be8e0 --- /dev/null +++ b/data/src/elevenlabs/types/inline_video_reference.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .inline_video_reference_mime_type import InlineVideoReferenceMimeType + + +class InlineVideoReference(UncheckedBaseModel): + """ + A video passed inline as base64. The video is stored as an ephemeral + asset with no guaranteed retention: it may be deleted at any time after + the generation completes. To keep an input and reuse it across + generations, upload it via the assets API (`POST /v1/assets`) and pass + an `asset` reference instead. + """ + + content_base_64: typing_extensions.Annotated[ + str, + FieldMetadata(alias="content_base64"), + pydantic.Field( + alias="content_base64", + description="The media file's bytes, base64-encoded (standard alphabet). Up to 25MB decoded.", + ), + ] + mime_type: InlineVideoReferenceMimeType = pydantic.Field() + """ + The MIME type of the encoded video. + """ + + 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/data/src/elevenlabs/types/inline_video_reference_mime_type.py b/data/src/elevenlabs/types/inline_video_reference_mime_type.py new file mode 100644 index 0000000000000000000000000000000000000000..da7bead47edbc7f1b9edaaa302b417d52576c642 --- /dev/null +++ b/data/src/elevenlabs/types/inline_video_reference_mime_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InlineVideoReferenceMimeType = typing.Union[typing.Literal["video/mp4", "video/quicktime", "video/webm"], typing.Any] diff --git a/data/src/elevenlabs/types/input_audio_chunk_payload.py b/data/src/elevenlabs/types/input_audio_chunk_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..4cf025508b2f6e0de287fb24c70ecc2b8e9ef264 --- /dev/null +++ b/data/src/elevenlabs/types/input_audio_chunk_payload.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class InputAudioChunkPayload(UncheckedBaseModel): + """ + Payload for sending audio chunks from client to server. + """ + + message_type: typing.Literal["input_audio_chunk"] = pydantic.Field(default="input_audio_chunk") + """ + The message type identifier. + """ + + audio_base_64: str = pydantic.Field() + """ + Base64-encoded audio data. + """ + + commit: bool = pydantic.Field() + """ + Whether to commit the transcription after this chunk. + """ + + sample_rate: int = pydantic.Field() + """ + Sample rate of the audio in Hz. + """ + + previous_text: typing.Optional[str] = pydantic.Field(default=None) + """ + Send text context to the model. Can only be sent alongside the first audio chunk. If sent in a subsequent chunk, an error will be returned. + """ + + 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/data/src/elevenlabs/types/integer_schema.py b/data/src/elevenlabs/types/integer_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..db426bcff144d6c908a0541372a94137550cd94e --- /dev/null +++ b/data/src/elevenlabs/types/integer_schema.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class IntegerSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: 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/data/src/elevenlabs/types/integration_type.py b/data/src/elevenlabs/types/integration_type.py new file mode 100644 index 0000000000000000000000000000000000000000..fd262cf8e96fff84ac605326e6066766582be9be --- /dev/null +++ b/data/src/elevenlabs/types/integration_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +IntegrationType = typing.Union[typing.Literal["mcp_server", "mcp_integration"], typing.Any] diff --git a/data/src/elevenlabs/types/interaction_budget.py b/data/src/elevenlabs/types/interaction_budget.py new file mode 100644 index 0000000000000000000000000000000000000000..8e148d7bd3bb4603f6937fc9157f4d21e0aa4ab9 --- /dev/null +++ b/data/src/elevenlabs/types/interaction_budget.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InteractionBudget = typing.Union[typing.Literal["realtime", "5_minutes", "10_minutes", "1_hour"], typing.Any] diff --git a/data/src/elevenlabs/types/internal_alerting_webhook_notifier.py b/data/src/elevenlabs/types/internal_alerting_webhook_notifier.py new file mode 100644 index 0000000000000000000000000000000000000000..288061fc198766c4ff3b7d484073d45f1b56965a --- /dev/null +++ b/data/src/elevenlabs/types/internal_alerting_webhook_notifier.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .alerting_webhook_header import AlertingWebhookHeader +from .alerting_webhook_method import AlertingWebhookMethod + + +class InternalAlertingWebhookNotifier(UncheckedBaseModel): + type: typing.Optional[typing.Literal["webhook"]] = None + url: str = pydantic.Field() + """ + The URL to send alert lifecycle notifications to. + """ + + method: typing.Optional[AlertingWebhookMethod] = pydantic.Field(default=None) + """ + HTTP method used when calling the webhook URL. + """ + + headers: typing.Optional[typing.List[AlertingWebhookHeader]] = pydantic.Field(default=None) + """ + Custom request headers sent with every notification. Secret header values are encrypted at rest and never returned by the API. + """ + + 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/data/src/elevenlabs/types/internal_sampling_config_response_model.py b/data/src/elevenlabs/types/internal_sampling_config_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4efed6f1cbbfc4fce2b58180a573b38e820b520e --- /dev/null +++ b/data/src/elevenlabs/types/internal_sampling_config_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class InternalSamplingConfigResponseModel(UncheckedBaseModel): + focus: typing.Optional[float] = None + similarity: typing.Optional[float] = None + stability: 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/data/src/elevenlabs/types/invoice_response.py b/data/src/elevenlabs/types/invoice_response.py new file mode 100644 index 0000000000000000000000000000000000000000..4bf6928b2bdaf22a32d44244daaf581e25b913af --- /dev/null +++ b/data/src/elevenlabs/types/invoice_response.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .discount_response_model import DiscountResponseModel +from .invoice_response_payment_intent_status import InvoiceResponsePaymentIntentStatus +from .invoice_response_payment_intent_statusses_item import InvoiceResponsePaymentIntentStatussesItem + + +class InvoiceResponse(UncheckedBaseModel): + amount_due_cents: int = pydantic.Field() + """ + The amount due in cents. + """ + + subtotal_cents: typing.Optional[int] = pydantic.Field(default=None) + """ + The subtotal amount in cents before tax (exclusive of tax and discounts). + """ + + tax_cents: typing.Optional[int] = pydantic.Field(default=None) + """ + The tax amount in cents. + """ + + discount_percent_off: typing.Optional[float] = pydantic.Field(default=None) + """ + Deprecated. Use [discounts] instead. The discount applied to the invoice. E.g. [20.0f] for 20% off. + """ + + discount_amount_off: typing.Optional[float] = pydantic.Field(default=None) + """ + Deprecated. Use [discounts] instead. The discount applied to the invoice. E.g. [20.0f] for 20 cents off. + """ + + discounts: typing.List[DiscountResponseModel] = pydantic.Field() + """ + The discounts applied to the invoice. + """ + + next_payment_attempt_unix: int = pydantic.Field() + """ + The Unix timestamp of the next payment attempt. -1 when there is no next payment attempt. + """ + + payment_intent_status: typing.Optional[InvoiceResponsePaymentIntentStatus] = pydantic.Field(default=None) + """ + Deprecated. Use [payment_intent_statusses] instead. The status of this invoice's first payment intent. None when there is no payment intent. + """ + + payment_intent_statusses: typing.List[InvoiceResponsePaymentIntentStatussesItem] = pydantic.Field() + """ + The statuses of this invoice's payment intents. Empty list when there are no payment intents. + """ + + 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/data/src/elevenlabs/types/invoice_response_payment_intent_status.py b/data/src/elevenlabs/types/invoice_response_payment_intent_status.py new file mode 100644 index 0000000000000000000000000000000000000000..0681b01f206162026a0828b2b952a7a98a83aaed --- /dev/null +++ b/data/src/elevenlabs/types/invoice_response_payment_intent_status.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InvoiceResponsePaymentIntentStatus = typing.Union[ + typing.Literal[ + "canceled", + "processing", + "requires_action", + "requires_capture", + "requires_confirmation", + "requires_payment_method", + "succeeded", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/invoice_response_payment_intent_statusses_item.py b/data/src/elevenlabs/types/invoice_response_payment_intent_statusses_item.py new file mode 100644 index 0000000000000000000000000000000000000000..f48bb061c5cd25fb9faf9271c9554d3a18102483 --- /dev/null +++ b/data/src/elevenlabs/types/invoice_response_payment_intent_statusses_item.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +InvoiceResponsePaymentIntentStatussesItem = typing.Union[ + typing.Literal[ + "canceled", + "processing", + "requires_action", + "requires_capture", + "requires_confirmation", + "requires_payment_method", + "succeeded", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/item_id.py b/data/src/elevenlabs/types/item_id.py new file mode 100644 index 0000000000000000000000000000000000000000..84514dfe5ee6555fd4349a11efe4c1e0bdccc248 --- /dev/null +++ b/data/src/elevenlabs/types/item_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +ItemId = str diff --git a/data/src/elevenlabs/types/kb_external_sync_job.py b/data/src/elevenlabs/types/kb_external_sync_job.py new file mode 100644 index 0000000000000000000000000000000000000000..b27d4675bbba6ccad0bec6ac0d5050947a8bb076 --- /dev/null +++ b/data/src/elevenlabs/types/kb_external_sync_job.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .crawl_status import CrawlStatus +from .external_sync_job_trigger import ExternalSyncJobTrigger +from .external_sync_job_type import ExternalSyncJobType +from .external_sync_provider import ExternalSyncProvider + + +class KbExternalSyncJob(UncheckedBaseModel): + type: ExternalSyncProvider = "google_drive" + folder_id: str + integration_connection_id: str + triggered_by: ExternalSyncJobTrigger + status: typing.Optional[CrawlStatus] = None + sync_type: typing.Optional[ExternalSyncJobType] = None + items_identified: typing.Optional[int] = None + items_processed: typing.Optional[int] = None + error_message: typing.Optional[str] = None + started_at: typing.Optional[int] = None + completed_at: typing.Optional[int] = None + updated_at: int + id: str + created_at: int + + 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/data/src/elevenlabs/types/keep_context_alive.py b/data/src/elevenlabs/types/keep_context_alive.py new file mode 100644 index 0000000000000000000000000000000000000000..5ffff32a43648fed4178e0b4806ce1f43005b7a2 --- /dev/null +++ b/data/src/elevenlabs/types/keep_context_alive.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KeepContextAlive(UncheckedBaseModel): + """ + Payload to keep a specific context alive by resetting its inactivity timeout. Empty text is ignored but resets the clock. + """ + + text: typing.Literal[""] = pydantic.Field(default="") + """ + An empty string. This text is ignored by the server but its presence resets the inactivity timeout for the specified context. + """ + + context_id: str = pydantic.Field() + """ + The identifier of the context to keep alive. + """ + + 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/data/src/elevenlabs/types/knowledge_base_bulk_delete_successful_response_model.py b/data/src/elevenlabs/types/knowledge_base_bulk_delete_successful_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b1da8cfde86f91cea45e0a3ce038137a23de2315 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_bulk_delete_successful_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_deleted_response_model import KnowledgeBaseDeletedResponseModel + + +class KnowledgeBaseBulkDeleteSuccessfulResponseModel(UncheckedBaseModel): + data: KnowledgeBaseDeletedResponseModel + + 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/data/src/elevenlabs/types/knowledge_base_content_search_response_model.py b/data/src/elevenlabs/types/knowledge_base_content_search_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8afd8b4c88397eef13255cab3714ac6e45d04eb4 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_content_search_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_content_search_result import KnowledgeBaseContentSearchResult + + +class KnowledgeBaseContentSearchResponseModel(UncheckedBaseModel): + results: typing.List[KnowledgeBaseContentSearchResult] + next_cursor: 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/data/src/elevenlabs/types/knowledge_base_content_search_result.py b/data/src/elevenlabs/types/knowledge_base_content_search_result.py new file mode 100644 index 0000000000000000000000000000000000000000..ff2bd50725aca1a594676a2cf955692d1b6b020c --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_content_search_result.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_content_search_result_document import KnowledgeBaseContentSearchResultDocument +from .search_highlight_segment import SearchHighlightSegment + + +class KnowledgeBaseContentSearchResult(UncheckedBaseModel): + document: KnowledgeBaseContentSearchResultDocument + search_snippet: typing.Optional[typing.List[SearchHighlightSegment]] = None + score: float + + 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/data/src/elevenlabs/types/knowledge_base_content_search_result_document.py b/data/src/elevenlabs/types/knowledge_base_content_search_result_document.py new file mode 100644 index 0000000000000000000000000000000000000000..0286d9d9b0a3a6266601720a17f7ee83f6610464 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_content_search_result_document.py @@ -0,0 +1,138 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .auto_sync_info import AutoSyncInfo +from .document_usage_mode_enum import DocumentUsageModeEnum +from .external_file_sync_info import ExternalFileSyncInfo +from .external_folder_sync_info import ExternalFolderSyncInfo +from .file_refresh_status import FileRefreshStatus +from .get_knowledge_base_summary_file_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_folder_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_text_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_url_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem, +) +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) +from .resource_access_info import ResourceAccessInfo + + +class KnowledgeBaseContentSearchResultDocument_File(UncheckedBaseModel): + type: typing.Literal["file"] = "file" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem] + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = None + is_frozen: 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 + + +class KnowledgeBaseContentSearchResultDocument_Folder(UncheckedBaseModel): + type: typing.Literal["folder"] = "folder" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem] + children_count: int + document_count: int + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: 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 + + +class KnowledgeBaseContentSearchResultDocument_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem] + + 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 + + +class KnowledgeBaseContentSearchResultDocument_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem] + url: str + auto_sync_info: typing.Optional[AutoSyncInfo] = 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 + + +KnowledgeBaseContentSearchResultDocument = typing_extensions.Annotated[ + typing.Union[ + KnowledgeBaseContentSearchResultDocument_File, + KnowledgeBaseContentSearchResultDocument_Folder, + KnowledgeBaseContentSearchResultDocument_Text, + KnowledgeBaseContentSearchResultDocument_Url, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/knowledge_base_deleted_response_model.py b/data/src/elevenlabs/types/knowledge_base_deleted_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..0a0a9e28022f871dbddb477943cf790dc061abb5 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_deleted_response_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KnowledgeBaseDeletedResponseModel(UncheckedBaseModel): + id: 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/data/src/elevenlabs/types/knowledge_base_dependent_type.py b/data/src/elevenlabs/types/knowledge_base_dependent_type.py new file mode 100644 index 0000000000000000000000000000000000000000..15e623a7e903258747b272fb433fc709b6595f28 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_dependent_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +KnowledgeBaseDependentType = typing.Union[typing.Literal["direct", "transitive", "all"], typing.Any] diff --git a/data/src/elevenlabs/types/knowledge_base_document_chunk_response_model.py b/data/src/elevenlabs/types/knowledge_base_document_chunk_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..61b317d2b81c397e8851f1efbfa5425bc8a7c8c9 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_document_chunk_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KnowledgeBaseDocumentChunkResponseModel(UncheckedBaseModel): + id: str + name: str + content: 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/data/src/elevenlabs/types/knowledge_base_document_chunks_response_model.py b/data/src/elevenlabs/types/knowledge_base_document_chunks_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b06bdc10fbf9de5980913218b484dd9767503c79 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_document_chunks_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_document_chunk_response_model import KnowledgeBaseDocumentChunkResponseModel + + +class KnowledgeBaseDocumentChunksResponseModel(UncheckedBaseModel): + chunks: typing.List[KnowledgeBaseDocumentChunkResponseModel] + next_cursor: 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/data/src/elevenlabs/types/knowledge_base_document_metadata_response_model.py b/data/src/elevenlabs/types/knowledge_base_document_metadata_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..883f83cd7db0f66ee810cd1db2b1f175736ab80c --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_document_metadata_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KnowledgeBaseDocumentMetadataResponseModel(UncheckedBaseModel): + created_at_unix_secs: int + last_updated_at_unix_secs: int + size_bytes: int + + 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/data/src/elevenlabs/types/knowledge_base_document_type.py b/data/src/elevenlabs/types/knowledge_base_document_type.py new file mode 100644 index 0000000000000000000000000000000000000000..06a0713f1d79906d2ef1d34d3138f376268f2328 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_document_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +KnowledgeBaseDocumentType = typing.Union[typing.Literal["file", "url", "text", "folder"], typing.Any] diff --git a/data/src/elevenlabs/types/knowledge_base_folder_path_segment_response_model.py b/data/src/elevenlabs/types/knowledge_base_folder_path_segment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c2231241fd0a0dee23f784353f47e2a60b72879c --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_folder_path_segment_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KnowledgeBaseFolderPathSegmentResponseModel(UncheckedBaseModel): + id: str + name: 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/data/src/elevenlabs/types/knowledge_base_folder_path_segment_summary_response_model.py b/data/src/elevenlabs/types/knowledge_base_folder_path_segment_summary_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ae3406e1a068db44c191bc602a0593db89c74fb7 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_folder_path_segment_summary_response_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KnowledgeBaseFolderPathSegmentSummaryResponseModel(UncheckedBaseModel): + id: 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/data/src/elevenlabs/types/knowledge_base_locator.py b/data/src/elevenlabs/types/knowledge_base_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..f7c23635e7ed0f3afa563d3ab49d60d4dd0bf2ef --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_locator.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .document_usage_mode_enum import DocumentUsageModeEnum +from .knowledge_base_document_type import KnowledgeBaseDocumentType + + +class KnowledgeBaseLocator(UncheckedBaseModel): + type: KnowledgeBaseDocumentType = pydantic.Field() + """ + The type of the knowledge base + """ + + name: str = pydantic.Field() + """ + The name of the knowledge base + """ + + id: str = pydantic.Field() + """ + The ID of the knowledge base + """ + + usage_mode: typing.Optional[DocumentUsageModeEnum] = pydantic.Field(default=None) + """ + The usage mode of the knowledge base + """ + + 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/data/src/elevenlabs/types/knowledge_base_rag_chunk_model.py b/data/src/elevenlabs/types/knowledge_base_rag_chunk_model.py new file mode 100644 index 0000000000000000000000000000000000000000..383206bcc5b6721b1ee3033f0fe2902ba5446438 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_rag_chunk_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KnowledgeBaseRagChunkModel(UncheckedBaseModel): + chunk_id: str + document_id: str + content: 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/data/src/elevenlabs/types/knowledge_base_rag_tool_config.py b/data/src/elevenlabs/types/knowledge_base_rag_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..12825ab89fd826510b6454888319a200d9e024fb --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_rag_tool_config.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KnowledgeBaseRagToolConfig(UncheckedBaseModel): + 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/data/src/elevenlabs/types/knowledge_base_rag_tool_result_model.py b/data/src/elevenlabs/types/knowledge_base_rag_tool_result_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a72e310d634cc4bd110c73966d62ba3afb357c20 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_rag_tool_result_model.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_rag_chunk_model import KnowledgeBaseRagChunkModel +from .knowledge_base_rag_tool_status import KnowledgeBaseRagToolStatus + + +class KnowledgeBaseRagToolResultModel(UncheckedBaseModel): + status: typing.Optional[KnowledgeBaseRagToolStatus] = None + chunk_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of relevant chunks retrieved + """ + + message: typing.Optional[str] = pydantic.Field(default=None) + """ + Human-readable status for the LLM about the search results + """ + + chunks: typing.Optional[typing.List[KnowledgeBaseRagChunkModel]] = pydantic.Field(default=None) + """ + Retrieved chunks; populated only in the rag-result-in-tool-result mode + """ + + 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/data/src/elevenlabs/types/knowledge_base_rag_tool_status.py b/data/src/elevenlabs/types/knowledge_base_rag_tool_status.py new file mode 100644 index 0000000000000000000000000000000000000000..1b540ced9e613a2ac5b276aa2c3fd2bbada58fac --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_rag_tool_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +KnowledgeBaseRagToolStatus = typing.Union[typing.Literal["success", "no_documents", "no_results"], typing.Any] diff --git a/data/src/elevenlabs/types/knowledge_base_sort_by.py b/data/src/elevenlabs/types/knowledge_base_sort_by.py new file mode 100644 index 0000000000000000000000000000000000000000..6d53be14e3e60d5fdfeb6e66c79b8524fb4bb0ec --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_sort_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +KnowledgeBaseSortBy = typing.Union[typing.Literal["name", "created_at", "updated_at", "size"], typing.Any] diff --git a/data/src/elevenlabs/types/knowledge_base_source_file_url_response_model.py b/data/src/elevenlabs/types/knowledge_base_source_file_url_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..237c817b4008f2b53368b4e4687c907f13cf1d3a --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_source_file_url_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class KnowledgeBaseSourceFileUrlResponseModel(UncheckedBaseModel): + signed_url: str = pydantic.Field() + """ + Signed URL to download the source file directly + """ + + 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/data/src/elevenlabs/types/knowledge_base_summary_batch_successful_response_model.py b/data/src/elevenlabs/types/knowledge_base_summary_batch_successful_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..bb7c6460c05fdf5494b454b74af420714ceaba1b --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_summary_batch_successful_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_summary_batch_successful_response_model_data import ( + KnowledgeBaseSummaryBatchSuccessfulResponseModelData, +) + + +class KnowledgeBaseSummaryBatchSuccessfulResponseModel(UncheckedBaseModel): + data: KnowledgeBaseSummaryBatchSuccessfulResponseModelData + + 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/data/src/elevenlabs/types/knowledge_base_summary_batch_successful_response_model_data.py b/data/src/elevenlabs/types/knowledge_base_summary_batch_successful_response_model_data.py new file mode 100644 index 0000000000000000000000000000000000000000..89c70858a1fa308e3b8e665d24a516d3c5912329 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_summary_batch_successful_response_model_data.py @@ -0,0 +1,138 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .auto_sync_info import AutoSyncInfo +from .document_usage_mode_enum import DocumentUsageModeEnum +from .external_file_sync_info import ExternalFileSyncInfo +from .external_folder_sync_info import ExternalFolderSyncInfo +from .file_refresh_status import FileRefreshStatus +from .get_knowledge_base_summary_file_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_folder_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_text_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem, +) +from .get_knowledge_base_summary_url_response_model_dependent_agents_item import ( + GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem, +) +from .knowledge_base_document_metadata_response_model import KnowledgeBaseDocumentMetadataResponseModel +from .knowledge_base_folder_path_segment_summary_response_model import ( + KnowledgeBaseFolderPathSegmentSummaryResponseModel, +) +from .resource_access_info import ResourceAccessInfo + + +class KnowledgeBaseSummaryBatchSuccessfulResponseModelData_File(UncheckedBaseModel): + type: typing.Literal["file"] = "file" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryFileResponseModelDependentAgentsItem] + external_sync_info: typing.Optional[ExternalFileSyncInfo] = None + auto_sync_info: typing.Optional[AutoSyncInfo] = None + refresh_status: typing.Optional[FileRefreshStatus] = None + is_frozen: 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 + + +class KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Folder(UncheckedBaseModel): + type: typing.Literal["folder"] = "folder" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryFolderResponseModelDependentAgentsItem] + children_count: int + document_count: int + auto_sync_info: typing.Optional[AutoSyncInfo] = None + external_sync_info: typing.Optional[ExternalFolderSyncInfo] = None + is_frozen: 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 + + +class KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryTextResponseModelDependentAgentsItem] + + 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 + + +class KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Url(UncheckedBaseModel): + type: typing.Literal["url"] = "url" + id: str + name: str + metadata: KnowledgeBaseDocumentMetadataResponseModel + supported_usages: typing.List[DocumentUsageModeEnum] + access_info: ResourceAccessInfo + folder_parent_id: typing.Optional[str] = None + folder_path: typing.Optional[typing.List[KnowledgeBaseFolderPathSegmentSummaryResponseModel]] = None + dependent_agents: typing.List[GetKnowledgeBaseSummaryUrlResponseModelDependentAgentsItem] + url: str + auto_sync_info: typing.Optional[AutoSyncInfo] = 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 + + +KnowledgeBaseSummaryBatchSuccessfulResponseModelData = typing_extensions.Annotated[ + typing.Union[ + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_File, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Folder, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Text, + KnowledgeBaseSummaryBatchSuccessfulResponseModelData_Url, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/knowledge_base_tool_config.py b/data/src/elevenlabs/types/knowledge_base_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..868552a92db7c324b823a450fcadb8fc5cbd9cc1 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_tool_config.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .search_strategy import SearchStrategy + + +class KnowledgeBaseToolConfig(UncheckedBaseModel): + enabled_strategies: typing.Optional[typing.List[SearchStrategy]] = 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/data/src/elevenlabs/types/knowledge_base_tool_info.py b/data/src/elevenlabs/types/knowledge_base_tool_info.py new file mode 100644 index 0000000000000000000000000000000000000000..bfa52bc0305dca12c5e4c7ca1c52a61fda1a3716 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_tool_info.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .search_strategy import SearchStrategy + + +class KnowledgeBaseToolInfo(UncheckedBaseModel): + enabled_strategies: typing.Optional[typing.List[SearchStrategy]] = pydantic.Field(default=None) + """ + Search strategies exposed to the model. Must be non-empty. + """ + + 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/data/src/elevenlabs/types/knowledge_base_tool_result_model.py b/data/src/elevenlabs/types/knowledge_base_tool_result_model.py new file mode 100644 index 0000000000000000000000000000000000000000..056b59d20a3b4609ee6d028bb67c11055dfe9720 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_tool_result_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_tool_status import KnowledgeBaseToolStatus + + +class KnowledgeBaseToolResultModel(UncheckedBaseModel): + status: typing.Optional[KnowledgeBaseToolStatus] = None + chunk_count: typing.Optional[int] = None + message: 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/data/src/elevenlabs/types/knowledge_base_tool_status.py b/data/src/elevenlabs/types/knowledge_base_tool_status.py new file mode 100644 index 0000000000000000000000000000000000000000..016fae5229c1739aebc81630da545c34d7adc7e4 --- /dev/null +++ b/data/src/elevenlabs/types/knowledge_base_tool_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +KnowledgeBaseToolStatus = typing.Union[typing.Literal["success", "no_matching_documents", "no_results"], typing.Any] diff --git a/data/src/elevenlabs/types/language_added_response.py b/data/src/elevenlabs/types/language_added_response.py new file mode 100644 index 0000000000000000000000000000000000000000..c689f04e8be54fcce15939caeea6d76cf4d2b0b3 --- /dev/null +++ b/data/src/elevenlabs/types/language_added_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LanguageAddedResponse(UncheckedBaseModel): + version: int + + 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/data/src/elevenlabs/types/language_detection_tool_config.py b/data/src/elevenlabs/types/language_detection_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..fae6045c5ba78841ae33444f003cb7cbecdbb9ab --- /dev/null +++ b/data/src/elevenlabs/types/language_detection_tool_config.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LanguageDetectionToolConfig(UncheckedBaseModel): + only_at_conversation_start: typing.Optional[bool] = pydantic.Field(default=None) + """ + If no language switch happens in the first 2 user turns, later attempts fail and the conversation stays in the current language. If the language switches during those turns, later switching stays available. Enable to reduce the possibility of false switching. + """ + + 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/data/src/elevenlabs/types/language_detection_tool_result_model.py b/data/src/elevenlabs/types/language_detection_tool_result_model.py new file mode 100644 index 0000000000000000000000000000000000000000..eefba73dfca671e301abd7017fb16016f6830064 --- /dev/null +++ b/data/src/elevenlabs/types/language_detection_tool_result_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LanguageDetectionToolResultModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + language: 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/data/src/elevenlabs/types/language_info.py b/data/src/elevenlabs/types/language_info.py new file mode 100644 index 0000000000000000000000000000000000000000..eba6c7b0f94423e47d1f94861e436ac6e22cd2f2 --- /dev/null +++ b/data/src/elevenlabs/types/language_info.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LanguageInfo(UncheckedBaseModel): + code: str = pydantic.Field() + """ + The language code (e.g. 'en', 'fr', 'es-ES'). + """ + + label: str = pydantic.Field() + """ + The human-readable language name (e.g. 'English', 'French', 'Spanish (Spain)'). + """ + + 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/data/src/elevenlabs/types/language_pair_info.py b/data/src/elevenlabs/types/language_pair_info.py new file mode 100644 index 0000000000000000000000000000000000000000..348fe5c682e87288f8a414d604967f4694f5295b --- /dev/null +++ b/data/src/elevenlabs/types/language_pair_info.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .language_info import LanguageInfo + + +class LanguagePairInfo(UncheckedBaseModel): + source_language: LanguageInfo = pydantic.Field() + """ + The source language. + """ + + destination_languages: typing.List[LanguageInfo] = pydantic.Field() + """ + The available destination languages for this source language. + """ + + 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/data/src/elevenlabs/types/language_preset_input.py b/data/src/elevenlabs/types/language_preset_input.py new file mode 100644 index 0000000000000000000000000000000000000000..11239cc0f16d8a71a32dd471b67fca420a38b232 --- /dev/null +++ b/data/src/elevenlabs/types/language_preset_input.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_config_client_override_input import ConversationConfigClientOverrideInput +from .language_preset_translation import LanguagePresetTranslation + + +class LanguagePresetInput(UncheckedBaseModel): + overrides: ConversationConfigClientOverrideInput = pydantic.Field() + """ + The overrides for the language preset + """ + + first_message_translation: typing.Optional[LanguagePresetTranslation] = pydantic.Field(default=None) + """ + The translation of the first message + """ + + soft_timeout_translation: typing.Optional[LanguagePresetTranslation] = pydantic.Field(default=None) + """ + The translation of the soft timeout message + """ + + 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/data/src/elevenlabs/types/language_preset_output.py b/data/src/elevenlabs/types/language_preset_output.py new file mode 100644 index 0000000000000000000000000000000000000000..231ec5fb384a7760561c5b0559baff73a2f5c79f --- /dev/null +++ b/data/src/elevenlabs/types/language_preset_output.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_config_client_override_output import ConversationConfigClientOverrideOutput +from .language_preset_translation import LanguagePresetTranslation + + +class LanguagePresetOutput(UncheckedBaseModel): + overrides: ConversationConfigClientOverrideOutput = pydantic.Field() + """ + The overrides for the language preset + """ + + first_message_translation: typing.Optional[LanguagePresetTranslation] = pydantic.Field(default=None) + """ + The translation of the first message + """ + + soft_timeout_translation: typing.Optional[LanguagePresetTranslation] = pydantic.Field(default=None) + """ + The translation of the soft timeout message + """ + + 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/data/src/elevenlabs/types/language_preset_translation.py b/data/src/elevenlabs/types/language_preset_translation.py new file mode 100644 index 0000000000000000000000000000000000000000..644a91749df60c062c25810eb18f1770014af7b8 --- /dev/null +++ b/data/src/elevenlabs/types/language_preset_translation.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LanguagePresetTranslation(UncheckedBaseModel): + source_hash: str + text: 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/data/src/elevenlabs/types/language_response.py b/data/src/elevenlabs/types/language_response.py new file mode 100644 index 0000000000000000000000000000000000000000..c6db2cf6baece8ea62751b3b76a1e848071b41c1 --- /dev/null +++ b/data/src/elevenlabs/types/language_response.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LanguageResponse(UncheckedBaseModel): + language_id: str = pydantic.Field() + """ + The unique identifier of the language. + """ + + name: str = pydantic.Field() + """ + The name of the language. + """ + + 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/data/src/elevenlabs/types/languages_response.py b/data/src/elevenlabs/types/languages_response.py new file mode 100644 index 0000000000000000000000000000000000000000..f1b7d4029d3b3b6fb62f945cfdd1ac03147b3c48 --- /dev/null +++ b/data/src/elevenlabs/types/languages_response.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .language_info import LanguageInfo +from .language_pair_info import LanguagePairInfo + + +class LanguagesResponse_Pair(UncheckedBaseModel): + kind: typing.Literal["pair"] = "pair" + language_pairs: typing.List[LanguagePairInfo] + + 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 + + +class LanguagesResponse_Single(UncheckedBaseModel): + kind: typing.Literal["single"] = "single" + languages: typing.List[LanguageInfo] + + 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 + + +LanguagesResponse = typing_extensions.Annotated[ + typing.Union[LanguagesResponse_Pair, LanguagesResponse_Single], UnionMetadata(discriminant="kind") +] diff --git a/data/src/elevenlabs/types/leave_message_params.py b/data/src/elevenlabs/types/leave_message_params.py new file mode 100644 index 0000000000000000000000000000000000000000..a3c803807ac88ae48d669e53d69f533c93399e65 --- /dev/null +++ b/data/src/elevenlabs/types/leave_message_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LeaveMessageParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["leave_message"]] = 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/data/src/elevenlabs/types/library_voice_response.py b/data/src/elevenlabs/types/library_voice_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b4d6129dc4c03415bb41ad93f8de2fbe036412e7 --- /dev/null +++ b/data/src/elevenlabs/types/library_voice_response.py @@ -0,0 +1,189 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .library_voice_response_category import LibraryVoiceResponseCategory +from .verified_voice_language_response_model import VerifiedVoiceLanguageResponseModel + + +class LibraryVoiceResponse(UncheckedBaseModel): + public_owner_id: str = pydantic.Field() + """ + The public owner id of the voice. + """ + + voice_id: str = pydantic.Field() + """ + The id of the voice. + """ + + date_unix: int = pydantic.Field() + """ + The date the voice was added to the library in Unix time. + """ + + name: str = pydantic.Field() + """ + The name of the voice. + """ + + accent: str = pydantic.Field() + """ + The accent of the voice. + """ + + gender: str = pydantic.Field() + """ + The gender of the voice. + """ + + age: str = pydantic.Field() + """ + The age of the voice. + """ + + descriptive: str = pydantic.Field() + """ + The descriptive of the voice. + """ + + use_case: str = pydantic.Field() + """ + The use case of the voice. + """ + + category: LibraryVoiceResponseCategory = pydantic.Field() + """ + The category of the voice. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + The language of the voice. + """ + + locale: typing.Optional[str] = pydantic.Field(default=None) + """ + The locale of the voice. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the voice. + """ + + preview_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The preview URL of the voice. + """ + + usage_character_count_1_y: typing_extensions.Annotated[ + int, + FieldMetadata(alias="usage_character_count_1y"), + pydantic.Field( + alias="usage_character_count_1y", description="The usage character count of the voice in the last year." + ), + ] + usage_character_count_7_d: typing_extensions.Annotated[ + int, + FieldMetadata(alias="usage_character_count_7d"), + pydantic.Field( + alias="usage_character_count_7d", description="The usage character count of the voice in the last 7 days." + ), + ] + play_api_usage_character_count_1_y: typing_extensions.Annotated[ + int, + FieldMetadata(alias="play_api_usage_character_count_1y"), + pydantic.Field( + alias="play_api_usage_character_count_1y", + description="The play API usage character count of the voice in the last year.", + ), + ] + cloned_by_count: int = pydantic.Field() + """ + The number of times the voice has been cloned. + """ + + rate: typing.Optional[float] = pydantic.Field(default=None) + """ + The rate multiplier of the voice. + """ + + fiat_rate: typing.Optional[float] = pydantic.Field(default=None) + """ + The rate of the voice in USD per 1000 credits. null if default + """ + + free_users_allowed: bool = pydantic.Field() + """ + Whether free users are allowed to use the voice. + """ + + live_moderation_enabled: bool = pydantic.Field() + """ + Whether live moderation is enabled for the voice. + """ + + featured: bool = pydantic.Field() + """ + Whether the voice is featured. + """ + + verified_languages: typing.Optional[typing.List[VerifiedVoiceLanguageResponseModel]] = pydantic.Field(default=None) + """ + The verified languages of the voice. + """ + + notice_period: typing.Optional[int] = pydantic.Field(default=None) + """ + The notice period of the voice. + """ + + instagram_username: typing.Optional[str] = pydantic.Field(default=None) + """ + The Instagram username of the voice. + """ + + twitter_username: typing.Optional[str] = pydantic.Field(default=None) + """ + The Twitter username of the voice. + """ + + youtube_username: typing.Optional[str] = pydantic.Field(default=None) + """ + The YouTube username of the voice. + """ + + tiktok_username: typing.Optional[str] = pydantic.Field(default=None) + """ + The TikTok username of the voice. + """ + + image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The image URL of the voice. + """ + + is_added_by_user: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the voice was added by the user. + """ + + is_bookmarked: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the voice is bookmarked by the current user. Only relevant when is_added_by_user is True. + """ + + 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/data/src/elevenlabs/types/library_voice_response_category.py b/data/src/elevenlabs/types/library_voice_response_category.py new file mode 100644 index 0000000000000000000000000000000000000000..072d0cb1a4f7f2af157eef189c2076c2bc1e26f5 --- /dev/null +++ b/data/src/elevenlabs/types/library_voice_response_category.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LibraryVoiceResponseCategory = typing.Union[ + typing.Literal["generated", "cloned", "premade", "professional", "famous", "high_quality"], typing.Any +] diff --git a/data/src/elevenlabs/types/list_agent_procedures_params.py b/data/src/elevenlabs/types/list_agent_procedures_params.py new file mode 100644 index 0000000000000000000000000000000000000000..df8fe0cbca0cca4ee43a441d9880bc37e0fa27ea --- /dev/null +++ b/data/src/elevenlabs/types/list_agent_procedures_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListAgentProceduresParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["list_agent_procedures"]] = 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/data/src/elevenlabs/types/list_agent_references_params.py b/data/src/elevenlabs/types/list_agent_references_params.py new file mode 100644 index 0000000000000000000000000000000000000000..d633d9f02da6cfcf7bee9999b3c5758f1a87ea14 --- /dev/null +++ b/data/src/elevenlabs/types/list_agent_references_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListAgentReferencesParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["list_agent_references"]] = 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/data/src/elevenlabs/types/list_agent_rules_params.py b/data/src/elevenlabs/types/list_agent_rules_params.py new file mode 100644 index 0000000000000000000000000000000000000000..1f40fbedee94b5cb7d70b00e4cc4c13da01f9c88 --- /dev/null +++ b/data/src/elevenlabs/types/list_agent_rules_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListAgentRulesParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["list_agent_rules"]] = 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/data/src/elevenlabs/types/list_assets_params.py b/data/src/elevenlabs/types/list_assets_params.py new file mode 100644 index 0000000000000000000000000000000000000000..846ac7a30bc0d2789df5d66b7138614dbafa3db8 --- /dev/null +++ b/data/src/elevenlabs/types/list_assets_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListAssetsParams(UncheckedBaseModel): + list_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None + smb_tool_type: typing.Optional[typing.Literal["list_assets"]] = 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/data/src/elevenlabs/types/list_auth_connections_response.py b/data/src/elevenlabs/types/list_auth_connections_response.py new file mode 100644 index 0000000000000000000000000000000000000000..0477a455003cc26357a8f0995a4aaebd76d05e89 --- /dev/null +++ b/data/src/elevenlabs/types/list_auth_connections_response.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .list_auth_connections_response_auth_connections_item import ListAuthConnectionsResponseAuthConnectionsItem + + +class ListAuthConnectionsResponse(UncheckedBaseModel): + auth_connections: typing.List[ListAuthConnectionsResponseAuthConnectionsItem] + + 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/data/src/elevenlabs/types/list_auth_connections_response_auth_connections_item.py b/data/src/elevenlabs/types/list_auth_connections_response_auth_connections_item.py new file mode 100644 index 0000000000000000000000000000000000000000..a374ab21a71487560b8298e3b72260fbb3bccc0b --- /dev/null +++ b/data/src/elevenlabs/types/list_auth_connections_response_auth_connections_item.py @@ -0,0 +1,396 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .api_integration_o_auth_2_auth_code_response_scope_separator import ( + ApiIntegrationOAuth2AuthCodeResponseScopeSeparator, +) +from .api_integration_o_auth_2_custom_app_response_scope_separator import ( + ApiIntegrationOAuth2CustomAppResponseScopeSeparator, +) +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus +from .o_auth_2_jwt_response_algorithm import OAuth2JwtResponseAlgorithm +from .o_auth_2_jwt_response_token_response_field import OAuth2JwtResponseTokenResponseField +from .private_key_jwt_response_algorithm import PrivateKeyJwtResponseAlgorithm + + +class ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2AuthCode(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["api_integration_oauth2_auth_code"] = "api_integration_oauth2_auth_code" + name: str + provider: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + scope_separator: typing.Optional[ApiIntegrationOAuth2AuthCodeResponseScopeSeparator] = None + expires_at: str + integration_id: str + credential_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2CustomApp(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["api_integration_oauth2_custom_app"] = "api_integration_oauth2_custom_app" + name: str + provider: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + scope_separator: typing.Optional[ApiIntegrationOAuth2CustomAppResponseScopeSeparator] = None + expires_at: str + integration_id: str + credential_id: str + client_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_BasicAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["basic_auth"] = "basic_auth" + name: str + provider: str + username: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_BearerAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["bearer_auth"] = "bearer_auth" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_CustomHeaderAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["custom_header_auth"] = "custom_header_auth" + name: str + provider: str + header_name: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_Mtls(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["mtls"] = "mtls" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_Oauth2ClientCredentials(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["oauth2_client_credentials"] = "oauth2_client_credentials" + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + basic_auth_in_header: typing.Optional[bool] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: typing.Optional[str] = None + custom_headers: typing.Optional[typing.Dict[str, 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_Oauth2Jwt(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["oauth2_jwt"] = "oauth2_jwt" + name: str + provider: str + algorithm: typing.Optional[OAuth2JwtResponseAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: str + audience: str + subject: str + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + token_url: str + scopes: typing.Optional[typing.List[str]] = None + token_response_field: typing.Optional[OAuth2JwtResponseTokenResponseField] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_PrivateKeyJwt(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["private_key_jwt"] = "private_key_jwt" + name: str + provider: str + algorithm: typing.Optional[PrivateKeyJwtResponseAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: str + audience: str + subject: str + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_RefreshTokenAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["refresh_token_auth"] = "refresh_token_auth" + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_SlackBotAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["slack_bot_auth"] = "slack_bot_auth" + name: str + provider: typing.Optional[typing.Literal["Slack"]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_UrlSecret(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["url_secret"] = "url_secret" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class ListAuthConnectionsResponseAuthConnectionsItem_WhatsappAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["whatsapp_auth"] = "whatsapp_auth" + name: str + provider: typing.Optional[typing.Literal["whatsapp"]] = None + phone_number_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +ListAuthConnectionsResponseAuthConnectionsItem = typing_extensions.Annotated[ + typing.Union[ + ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2AuthCode, + ListAuthConnectionsResponseAuthConnectionsItem_ApiIntegrationOauth2CustomApp, + ListAuthConnectionsResponseAuthConnectionsItem_BasicAuth, + ListAuthConnectionsResponseAuthConnectionsItem_BearerAuth, + ListAuthConnectionsResponseAuthConnectionsItem_CustomHeaderAuth, + ListAuthConnectionsResponseAuthConnectionsItem_Mtls, + ListAuthConnectionsResponseAuthConnectionsItem_Oauth2ClientCredentials, + ListAuthConnectionsResponseAuthConnectionsItem_Oauth2Jwt, + ListAuthConnectionsResponseAuthConnectionsItem_PrivateKeyJwt, + ListAuthConnectionsResponseAuthConnectionsItem_RefreshTokenAuth, + ListAuthConnectionsResponseAuthConnectionsItem_SlackBotAuth, + ListAuthConnectionsResponseAuthConnectionsItem_UrlSecret, + ListAuthConnectionsResponseAuthConnectionsItem_WhatsappAuth, + ], + UnionMetadata(discriminant="auth_type"), +] diff --git a/data/src/elevenlabs/types/list_calendar_events_params.py b/data/src/elevenlabs/types/list_calendar_events_params.py new file mode 100644 index 0000000000000000000000000000000000000000..0dbb0cd5170041c6a4f98260853a4117a7d75470 --- /dev/null +++ b/data/src/elevenlabs/types/list_calendar_events_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListCalendarEventsParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["list_calendar_events"]] = None + include_cancelled: 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/data/src/elevenlabs/types/list_client_interactions_params.py b/data/src/elevenlabs/types/list_client_interactions_params.py new file mode 100644 index 0000000000000000000000000000000000000000..9f48809e968b417317cc7a94d191800a7231ca76 --- /dev/null +++ b/data/src/elevenlabs/types/list_client_interactions_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListClientInteractionsParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["list_client_interactions"]] = 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/data/src/elevenlabs/types/list_clients_params.py b/data/src/elevenlabs/types/list_clients_params.py new file mode 100644 index 0000000000000000000000000000000000000000..c608c44759c635e63a2179f75a92492259e7b655 --- /dev/null +++ b/data/src/elevenlabs/types/list_clients_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListClientsParams(UncheckedBaseModel): + """ + List clients ordered by most recently updated, with an optional limit. + """ + + smb_tool_type: typing.Optional[typing.Literal["list_clients"]] = 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/data/src/elevenlabs/types/list_crawl_jobs_response_model.py b/data/src/elevenlabs/types/list_crawl_jobs_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a50829be95d84f1def5fe0e9cb7bb009f45003df --- /dev/null +++ b/data/src/elevenlabs/types/list_crawl_jobs_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_crawl_job_response_model import GetCrawlJobResponseModel + + +class ListCrawlJobsResponseModel(UncheckedBaseModel): + crawl_jobs: typing.List[GetCrawlJobResponseModel] + next_cursor: 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/data/src/elevenlabs/types/list_customer_facing_agents_params.py b/data/src/elevenlabs/types/list_customer_facing_agents_params.py new file mode 100644 index 0000000000000000000000000000000000000000..e9c2caae159fba5e62650dbe84f543b5d23d6091 --- /dev/null +++ b/data/src/elevenlabs/types/list_customer_facing_agents_params.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListCustomerFacingAgentsParams(UncheckedBaseModel): + """ + List every customer-facing agent on the workspace. + + The assistant uses this whenever it needs to act on a specific customer-facing + agent (rules, config edits, etc.) so it can pick the right ``agent_id`` to pass + to mutating tools. Mirrors the ``list_services`` / ``list_clients`` + pattern: read once, then mutate by id. + """ + + smb_tool_type: typing.Optional[typing.Literal["list_customer_facing_agents"]] = 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/data/src/elevenlabs/types/list_group_sessions_params.py b/data/src/elevenlabs/types/list_group_sessions_params.py new file mode 100644 index 0000000000000000000000000000000000000000..08d9d0d074b94ed032b24ad50d064a2f0b307203 --- /dev/null +++ b/data/src/elevenlabs/types/list_group_sessions_params.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListGroupSessionsParams(UncheckedBaseModel): + """ + List scheduled group sessions for a group service in a date range. + + Group services are scheduled in advance (e.g. yoga classes, workshops) and + callers register against an existing session. Use this for group services; + use ``check_service_availability`` for appointment / rental services. + """ + + smb_tool_type: typing.Optional[typing.Literal["list_group_sessions"]] = 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/data/src/elevenlabs/types/list_holidays_params.py b/data/src/elevenlabs/types/list_holidays_params.py new file mode 100644 index 0000000000000000000000000000000000000000..ccd65a2dbe40d4adc37db4813835bf9b9b54cab7 --- /dev/null +++ b/data/src/elevenlabs/types/list_holidays_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListHolidaysParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["list_holidays"]] = 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/data/src/elevenlabs/types/list_locations_params.py b/data/src/elevenlabs/types/list_locations_params.py new file mode 100644 index 0000000000000000000000000000000000000000..3a13fb14a8e7def13d59de5597a67c212a7902e0 --- /dev/null +++ b/data/src/elevenlabs/types/list_locations_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListLocationsParams(UncheckedBaseModel): + """ + Params + Reception-proxied ``run()`` for list_locations. + """ + + smb_tool_type: typing.Optional[typing.Literal["list_locations"]] = 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/data/src/elevenlabs/types/list_mcp_tools_response_model.py b/data/src/elevenlabs/types/list_mcp_tools_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..0c41b54bf8e1cfd2cfd1758b22fadb3b95335cb9 --- /dev/null +++ b/data/src/elevenlabs/types/list_mcp_tools_response_model.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mcp_tool_approval_status import McpToolApprovalStatus +from .tool import Tool + + +class ListMcpToolsResponseModel(UncheckedBaseModel): + """ + Response model for testing tools available on an MCP server. + """ + + success: bool = pydantic.Field() + """ + Indicates if the operation was successful. + """ + + tools: typing.List[Tool] = pydantic.Field() + """ + A list of tools available on the MCP server. + """ + + tool_approval_statuses: typing.Optional[typing.List[McpToolApprovalStatus]] = pydantic.Field(default=None) + """ + Derived approval states for currently discovered tools. Populated only for persisted MCP servers using per-tool approval; otherwise empty. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + Error message if the operation was not successful. + """ + + 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/data/src/elevenlabs/types/list_orders_response.py b/data/src/elevenlabs/types/list_orders_response.py new file mode 100644 index 0000000000000000000000000000000000000000..98a82be4db57a9e5c6ec244e2abed1a438377f59 --- /dev/null +++ b/data/src/elevenlabs/types/list_orders_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .order_summary import OrderSummary + + +class ListOrdersResponse(UncheckedBaseModel): + orders: typing.List[OrderSummary] = pydantic.Field() + """ + The list of orders matching the query. + """ + + 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/data/src/elevenlabs/types/list_procedures_response_model.py b/data/src/elevenlabs/types/list_procedures_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..81ff807da4f6160b1f2259564248ad3dfe0575c9 --- /dev/null +++ b/data/src/elevenlabs/types/list_procedures_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .procedure_list_item_response_model import ProcedureListItemResponseModel + + +class ListProceduresResponseModel(UncheckedBaseModel): + procedures: typing.List[ProcedureListItemResponseModel] = pydantic.Field() + """ + Procedures on the branch with their draft-aware metadata. + """ + + 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/data/src/elevenlabs/types/list_products_params.py b/data/src/elevenlabs/types/list_products_params.py new file mode 100644 index 0000000000000000000000000000000000000000..ad42e26048358354c4b431ff63d1cb3f3c0aa65e --- /dev/null +++ b/data/src/elevenlabs/types/list_products_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListProductsParams(UncheckedBaseModel): + list_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None + smb_tool_type: typing.Optional[typing.Literal["list_products"]] = 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/data/src/elevenlabs/types/list_response_agent_branch_summary.py b/data/src/elevenlabs/types/list_response_agent_branch_summary.py new file mode 100644 index 0000000000000000000000000000000000000000..fa89ef1ab86f5dc15a9e76917b4e6613b948f068 --- /dev/null +++ b/data/src/elevenlabs/types/list_response_agent_branch_summary.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_branch_summary import AgentBranchSummary +from .list_response_meta import ListResponseMeta + + +class ListResponseAgentBranchSummary(UncheckedBaseModel): + meta: typing.Optional[ListResponseMeta] = None + results: typing.List[AgentBranchSummary] + + 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/data/src/elevenlabs/types/list_response_agent_deployment_history_item.py b/data/src/elevenlabs/types/list_response_agent_deployment_history_item.py new file mode 100644 index 0000000000000000000000000000000000000000..4c039206cb062438a27e03dab57d02f6bd015bf5 --- /dev/null +++ b/data/src/elevenlabs/types/list_response_agent_deployment_history_item.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_deployment_history_item import AgentDeploymentHistoryItem +from .list_response_meta import ListResponseMeta + + +class ListResponseAgentDeploymentHistoryItem(UncheckedBaseModel): + meta: typing.Optional[ListResponseMeta] = None + results: typing.List[AgentDeploymentHistoryItem] + + 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/data/src/elevenlabs/types/list_response_meta.py b/data/src/elevenlabs/types/list_response_meta.py new file mode 100644 index 0000000000000000000000000000000000000000..76530dbe82ea5926d0be50ff8ef2ccd7770d4c62 --- /dev/null +++ b/data/src/elevenlabs/types/list_response_meta.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListResponseMeta(UncheckedBaseModel): + total: typing.Optional[int] = None + page: typing.Optional[int] = None + page_size: typing.Optional[int] = 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/data/src/elevenlabs/types/list_services_params.py b/data/src/elevenlabs/types/list_services_params.py new file mode 100644 index 0000000000000000000000000000000000000000..338395b99e8b238e5f98162df2e7eb9e66c64fd7 --- /dev/null +++ b/data/src/elevenlabs/types/list_services_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListServicesParams(UncheckedBaseModel): + list_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None + smb_tool_type: typing.Optional[typing.Literal["list_services"]] = 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/data/src/elevenlabs/types/list_speech_engines_response.py b/data/src/elevenlabs/types/list_speech_engines_response.py new file mode 100644 index 0000000000000000000000000000000000000000..fe8e248e313a389358a52f877ad77d10aba33025 --- /dev/null +++ b/data/src/elevenlabs/types/list_speech_engines_response.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .speech_engine_summary_response import SpeechEngineSummaryResponse + + +class ListSpeechEnginesResponse(UncheckedBaseModel): + speech_engines: typing.List[SpeechEngineSummaryResponse] = pydantic.Field() + """ + The speech engines matching the query + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Cursor for fetching the next page + """ + + has_more: bool = pydantic.Field() + """ + Whether there are more results + """ + + 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/data/src/elevenlabs/types/list_staff_params.py b/data/src/elevenlabs/types/list_staff_params.py new file mode 100644 index 0000000000000000000000000000000000000000..0a9bad1cdcda9489890624fcce68a4c1561b2bb3 --- /dev/null +++ b/data/src/elevenlabs/types/list_staff_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListStaffParams(UncheckedBaseModel): + list_kwargs: typing.Optional[typing.Dict[str, typing.Any]] = None + smb_tool_type: typing.Optional[typing.Literal["list_staff"]] = 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/data/src/elevenlabs/types/list_transfer_rules_params.py b/data/src/elevenlabs/types/list_transfer_rules_params.py new file mode 100644 index 0000000000000000000000000000000000000000..6ecaa712b28d601aad0b15c2775497ed965a3090 --- /dev/null +++ b/data/src/elevenlabs/types/list_transfer_rules_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ListTransferRulesParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["list_transfer_rules"]] = 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/data/src/elevenlabs/types/list_whats_app_accounts_response.py b/data/src/elevenlabs/types/list_whats_app_accounts_response.py new file mode 100644 index 0000000000000000000000000000000000000000..28ef1b57d9af0eb290e2a2ad79b7007badc98bea --- /dev/null +++ b/data/src/elevenlabs/types/list_whats_app_accounts_response.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .get_whats_app_account_response import GetWhatsAppAccountResponse + + +class ListWhatsAppAccountsResponse(UncheckedBaseModel): + items: typing.List[GetWhatsAppAccountResponse] + + 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/data/src/elevenlabs/types/literal_json_schema_property.py b/data/src/elevenlabs/types/literal_json_schema_property.py new file mode 100644 index 0000000000000000000000000000000000000000..db5fb5e58fe6f66f9b17472c7c488e1b76bfd20c --- /dev/null +++ b/data/src/elevenlabs/types/literal_json_schema_property.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .allowed_values import AllowedValues +from .literal_json_schema_property_constant_value import LiteralJsonSchemaPropertyConstantValue +from .literal_json_schema_property_type import LiteralJsonSchemaPropertyType + + +class LiteralJsonSchemaProperty(UncheckedBaseModel): + """ + Schema property for literal JSON types. IMPORTANT: Only ONE of the following fields can be set: description (LLM provides value), dynamic_variable (value from variable), is_system_provided (system provides value), constant_value (fixed value), or is_omitted (parameter is omitted). These are mutually exclusive. + """ + + type: LiteralJsonSchemaPropertyType + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the property. When set, the LLM will provide the value based on this description. Mutually exclusive with dynamic_variable, is_system_provided, constant_value, and is_omitted. + """ + + enum: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of allowed string values for string type parameters + """ + + is_system_provided: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, the value will be populated by the system at runtime. Used by API Integration Webhook tools for templating. Mutually exclusive with description, dynamic_variable, constant_value, and is_omitted. + """ + + dynamic_variable: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the dynamic variable to use for this property's value. Mutually exclusive with description, is_system_provided, constant_value, and is_omitted. + """ + + allowed_values: typing.Optional[AllowedValues] = pydantic.Field(default=None) + """ + Server-side rejection guard for an LLM-provided value: the runtime rejects any value outside the permitted set this object names, and the set is not advertised to the LLM as an enum. Only supported when the value source is `description`; combining it with dynamic_variable, is_system_provided, constant_value, or is_omitted is rejected. + """ + + allowed_values_dynamic_variable: typing.Optional[str] = pydantic.Field(default=None) + """ + DEPRECATED: use `allowed_values` instead. When set, the LLM provides the value but the runtime rejects any value not present in the list held by this dynamic variable (must be a JSON array such as ["ws_alpha", "ws_beta"]). Use to let the LLM pick from a server-verified set (e.g. the IDs the current user is allowed to access). Requires description; mutually exclusive with dynamic_variable, is_system_provided, constant_value, and is_omitted. + """ + + constant_value: typing.Optional[LiteralJsonSchemaPropertyConstantValue] = pydantic.Field(default=None) + """ + A constant value to use for this property. Mutually exclusive with description, dynamic_variable, is_system_provided, and is_omitted. + """ + + is_omitted: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, this parameter will be completely omitted from the request. Only valid for optional parameters. Mutually exclusive with description, dynamic_variable, is_system_provided, and constant_value. + """ + + 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/data/src/elevenlabs/types/literal_json_schema_property_constant_value.py b/data/src/elevenlabs/types/literal_json_schema_property_constant_value.py new file mode 100644 index 0000000000000000000000000000000000000000..db5ba937e18d00d59cf269f1bf0824e86a6c3baf --- /dev/null +++ b/data/src/elevenlabs/types/literal_json_schema_property_constant_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LiteralJsonSchemaPropertyConstantValue = typing.Union[str, int, float, bool] diff --git a/data/src/elevenlabs/types/literal_json_schema_property_type.py b/data/src/elevenlabs/types/literal_json_schema_property_type.py new file mode 100644 index 0000000000000000000000000000000000000000..bbebbdc8f59d00f3669016ad7090f982998eb4e3 --- /dev/null +++ b/data/src/elevenlabs/types/literal_json_schema_property_type.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LiteralJsonSchemaPropertyType = typing.Union[ + typing.Literal["boolean"], + typing.Literal["string"], + typing.Literal["integer"], + typing.Literal["number"], + typing.List[str], +] diff --git a/data/src/elevenlabs/types/livekit_stack_type.py b/data/src/elevenlabs/types/livekit_stack_type.py new file mode 100644 index 0000000000000000000000000000000000000000..81e505417e0f4d98269cfecd8273e965dff41855 --- /dev/null +++ b/data/src/elevenlabs/types/livekit_stack_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LivekitStackType = typing.Union[typing.Literal["standard", "static"], typing.Any] diff --git a/data/src/elevenlabs/types/llm.py b/data/src/elevenlabs/types/llm.py new file mode 100644 index 0000000000000000000000000000000000000000..dcb36bfe8bb6a7f346b118542830c9567b7d48cd --- /dev/null +++ b/data/src/elevenlabs/types/llm.py @@ -0,0 +1,120 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Llm = typing.Union[ + typing.Literal[ + "gpt-4o-mini", + "gpt-4o", + "gpt-4", + "gpt-4-turbo", + "gpt-4.1", + "gpt-4.1-mini", + "gpt-4.1-nano", + "gpt-5", + "gpt-5.1", + "gpt-5.2", + "gpt-5.2-chat-latest", + "gpt-5.4", + "gpt-5.4-mini", + "gpt-5.4-nano", + "gpt-5.5", + "gpt-5.6-sol", + "gpt-5.6-terra", + "gpt-5.6-luna", + "gpt-6-astra", + "gpt-6-sol", + "gpt-6-luna", + "gpt-6.1-sol", + "gpt-5-mini", + "gpt-5-nano", + "gpt-3.5-turbo", + "gemini-1.5-pro", + "gemini-1.5-flash", + "gemini-2.0-flash", + "gemini-2.0-flash-lite", + "gemini-2.5-flash-lite", + "gemini-2.5-flash", + "gemini-3-pro-preview", + "gemini-3-flash-preview", + "gemini-3.1-pro-preview", + "gemini-3.1-flash-lite-preview", + "gemini-3.1-flash-lite", + "gemini-3.5-flash", + "gemini-3.5-flash-lite", + "gemini-3.6-flash", + "gemini-3.7-flash", + "gemini-3.8-flash", + "gemini-4-argon", + "claude-sonnet-4-5", + "claude-opus-4-6", + "claude-opus-4-7", + "claude-opus-4-8", + "claude-opus-5", + "claude-opus-5-5", + "claude-sonnet-4-6", + "claude-sonnet-5", + "claude-sonnet-5-5", + "claude-sonnet-4", + "claude-haiku-4-5", + "claude-haiku-5-5", + "claude-3-7-sonnet", + "claude-3-5-sonnet", + "claude-3-5-sonnet-v1", + "claude-3-haiku", + "grok-beta", + "custom-llm", + "qwen3-4b", + "qwen3-30b-a3b", + "qwen36-35b-a3b", + "qwen35-397b-a17b", + "gpt-oss-20b", + "gpt-oss-120b", + "glm-45-air-fp8", + "glm-52", + "deepseek-v41-flash", + "nemotron-35-super-vl-nvfp4", + "gemini-2.5-flash-preview-09-2025", + "gemini-2.5-flash-lite-preview-09-2025", + "gemini-2.5-flash-preview-05-20", + "gemini-2.5-flash-preview-04-17", + "gemini-2.5-flash-lite-preview-06-17", + "gemini-2.0-flash-lite-001", + "gemini-2.0-flash-001", + "gemini-1.5-flash-002", + "gemini-1.5-flash-001", + "gemini-1.5-pro-002", + "gemini-1.5-pro-001", + "claude-sonnet-4@20250514", + "claude-sonnet-4-5@20250929", + "claude-haiku-4-5@20251001", + "claude-3-7-sonnet@20250219", + "claude-3-5-sonnet@20240620", + "claude-3-5-sonnet-v2@20241022", + "claude-3-haiku@20240307", + "gpt-5-2025-08-07", + "gpt-5.1-2025-11-13", + "gpt-5.2-2025-12-11", + "gpt-5.4-2026-03-05", + "gpt-5.4-mini-2026-03-17", + "gpt-5.4-nano-2026-03-17", + "gpt-5.5-2026-04-23", + "gpt-5-mini-2025-08-07", + "gpt-5-nano-2025-08-07", + "gpt-4.1-2025-04-14", + "gpt-4.1-mini-2025-04-14", + "gpt-4.1-nano-2025-04-14", + "gpt-4o-mini-2024-07-18", + "gpt-4o-2024-11-20", + "gpt-4o-2024-08-06", + "gpt-4o-2024-05-13", + "gpt-4-0613", + "gpt-4-0314", + "gpt-4-turbo-2024-04-09", + "gpt-3.5-turbo-0125", + "gpt-3.5-turbo-1106", + "watt-tool-8b", + "watt-tool-70b", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/llm_category_usage.py b/data/src/elevenlabs/types/llm_category_usage.py new file mode 100644 index 0000000000000000000000000000000000000000..715de809f07e44107261b998e95ab14465d303d6 --- /dev/null +++ b/data/src/elevenlabs/types/llm_category_usage.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_usage_output import LlmUsageOutput + + +class LlmCategoryUsage(UncheckedBaseModel): + irreversible_generation: typing.Optional[LlmUsageOutput] = None + initiated_generation: typing.Optional[LlmUsageOutput] = 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/data/src/elevenlabs/types/llm_deprecation_config_model.py b/data/src/elevenlabs/types/llm_deprecation_config_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e80097ef34041a81fc65fa0b249192f997bc7bf1 --- /dev/null +++ b/data/src/elevenlabs/types/llm_deprecation_config_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LlmDeprecationConfigModel(UncheckedBaseModel): + warning_start_days: int = pydantic.Field() + """ + Number of days before the provider deprecation date when warnings start being shown. + """ + + fallback_start_days: int = pydantic.Field() + """ + Number of days before the provider deprecation date when traffic starts being routed to the replacement model. + """ + + fallback_complete_days: int = pydantic.Field() + """ + Number of days before the provider deprecation date when all traffic is routed to the replacement model. + """ + + fallback_start_percentage: int = pydantic.Field() + """ + Percentage of traffic routed to the replacement model when fallback begins. + """ + + fallback_complete_percentage: int = pydantic.Field() + """ + Percentage of traffic routed to the replacement model when fallback is complete. + """ + + 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/data/src/elevenlabs/types/llm_deprecation_info_model.py b/data/src/elevenlabs/types/llm_deprecation_info_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f9f7d250b8b5aacb8cab1b47f0602fa45813659e --- /dev/null +++ b/data/src/elevenlabs/types/llm_deprecation_info_model.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm import Llm +from .llm_deprecation_config_model import LlmDeprecationConfigModel + + +class LlmDeprecationInfoModel(UncheckedBaseModel): + llm: Llm = pydantic.Field() + """ + The identifier of the deprecated LLM model. + """ + + is_deprecated: bool = pydantic.Field() + """ + Whether this model is currently deprecated. True if the model is immediately deprecated or within the warning period. + """ + + is_in_warning_period: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether this model is currently in the warning period before deprecation. + """ + + is_in_fallback_period: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether traffic is currently being progressively routed to the replacement model. + """ + + fallback_percentage: typing.Optional[int] = pydantic.Field(default=None) + """ + Current percentage of traffic being routed to the replacement model (0-100). + """ + + provider_deprecation_date: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + The date when the model provider will deprecate this model. Null for immediately deprecated models. + """ + + replacement_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + The model that replaces this deprecated model. Traffic will be automatically routed to this model. + """ + + deprecation_config: typing.Optional[LlmDeprecationConfigModel] = pydantic.Field(default=None) + """ + Custom deprecation timing configuration for this model. Null if using the default configuration. + """ + + 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/data/src/elevenlabs/types/llm_info_model.py b/data/src/elevenlabs/types/llm_info_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6ef3c50d5481efdc39e9de985a3a525b228274c2 --- /dev/null +++ b/data/src/elevenlabs/types/llm_info_model.py @@ -0,0 +1,72 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm import Llm +from .llm_deprecation_info_model import LlmDeprecationInfoModel +from .llm_reasoning_effort import LlmReasoningEffort +from .regional_processing_surcharge_info import RegionalProcessingSurchargeInfo + + +class LlmInfoModel(UncheckedBaseModel): + llm: Llm = pydantic.Field() + """ + The model identifier. + """ + + is_checkpoint: bool = pydantic.Field() + """ + Whether this is a pinned checkpoint version of a model rather than a top-level alias. + """ + + max_tokens_limit: int = pydantic.Field() + """ + Maximum number of output tokens the model can generate. + """ + + max_context_limit: int = pydantic.Field() + """ + Maximum number of input context tokens the model supports. + """ + + supports_image_input: bool = pydantic.Field() + """ + Whether the model supports image file inputs during conversations. + """ + + supports_document_input: bool = pydantic.Field() + """ + Whether the model supports document (PDF) file inputs during conversations. + """ + + supports_parallel_tool_calls: bool = pydantic.Field() + """ + Whether the model supports calling multiple tools in parallel. + """ + + available_reasoning_efforts: typing.Optional[typing.List[LlmReasoningEffort]] = pydantic.Field(default=None) + """ + Available reasoning effort levels for this model. Null if the model does not support configurable reasoning. + """ + + deprecation_info: typing.Optional[LlmDeprecationInfoModel] = pydantic.Field(default=None) + """ + Deprecation information if this model is deprecated or scheduled for deprecation. Null if the model is not affected. + """ + + regional_processing_surcharge: typing.Optional[RegionalProcessingSurchargeInfo] = pydantic.Field(default=None) + """ + Regional processing surcharge details if this model has additional costs in the current deployment region. Null if no surcharge applies. + """ + + 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/data/src/elevenlabs/types/llm_input_output_tokens_usage.py b/data/src/elevenlabs/types/llm_input_output_tokens_usage.py new file mode 100644 index 0000000000000000000000000000000000000000..009b9151dbd2fc662dd1ce85f77a21d1bf85daa9 --- /dev/null +++ b/data/src/elevenlabs/types/llm_input_output_tokens_usage.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_tokens_category_usage import LlmTokensCategoryUsage + + +class LlmInputOutputTokensUsage(UncheckedBaseModel): + input: typing.Optional[LlmTokensCategoryUsage] = None + input_cache_read: typing.Optional[LlmTokensCategoryUsage] = None + input_cache_write: typing.Optional[LlmTokensCategoryUsage] = None + output_total: typing.Optional[LlmTokensCategoryUsage] = 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/data/src/elevenlabs/types/llm_list_response_model.py b/data/src/elevenlabs/types/llm_list_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3ed1267a1f8635ded1c812d60931706bac6515f1 --- /dev/null +++ b/data/src/elevenlabs/types/llm_list_response_model.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_deprecation_config_model import LlmDeprecationConfigModel +from .llm_info_model import LlmInfoModel + + +class LlmListResponseModel(UncheckedBaseModel): + llms: typing.List[LlmInfoModel] = pydantic.Field() + """ + List of all available LLM models that can be used with agents. + """ + + default_deprecation_config: LlmDeprecationConfigModel = pydantic.Field() + """ + The default deprecation timing configuration used for models without a custom override. + """ + + 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/data/src/elevenlabs/types/llm_literal_json_schema_property.py b/data/src/elevenlabs/types/llm_literal_json_schema_property.py new file mode 100644 index 0000000000000000000000000000000000000000..062617ad589a835861cf3e5e579e0957c3427215 --- /dev/null +++ b/data/src/elevenlabs/types/llm_literal_json_schema_property.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_literal_json_schema_property_type import LlmLiteralJsonSchemaPropertyType + + +class LlmLiteralJsonSchemaProperty(UncheckedBaseModel): + type: LlmLiteralJsonSchemaPropertyType + description: str + enum: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of allowed string values for string type parameters + """ + + 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/data/src/elevenlabs/types/llm_literal_json_schema_property_type.py b/data/src/elevenlabs/types/llm_literal_json_schema_property_type.py new file mode 100644 index 0000000000000000000000000000000000000000..837503a8f6d52ebe2aa06d63927f5119f236544d --- /dev/null +++ b/data/src/elevenlabs/types/llm_literal_json_schema_property_type.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LlmLiteralJsonSchemaPropertyType = typing.Union[ + typing.Literal["boolean"], + typing.Literal["string"], + typing.Literal["integer"], + typing.Literal["number"], + typing.List[str], +] diff --git a/data/src/elevenlabs/types/llm_parameter_evaluation_strategy.py b/data/src/elevenlabs/types/llm_parameter_evaluation_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..707d53569f6bfb1da40745271f70d682a28b330d --- /dev/null +++ b/data/src/elevenlabs/types/llm_parameter_evaluation_strategy.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LlmParameterEvaluationStrategy(UncheckedBaseModel): + description: str = pydantic.Field() + """ + A description of the evaluation strategy to use for the test. + """ + + 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/data/src/elevenlabs/types/llm_reasoning_effort.py b/data/src/elevenlabs/types/llm_reasoning_effort.py new file mode 100644 index 0000000000000000000000000000000000000000..e843c1bb695756b89decb747150a8d6e46731e12 --- /dev/null +++ b/data/src/elevenlabs/types/llm_reasoning_effort.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LlmReasoningEffort = typing.Union[ + typing.Literal["none", "minimal", "low", "medium", "high", "xhigh", "max"], typing.Any +] diff --git a/data/src/elevenlabs/types/llm_schema_override.py b/data/src/elevenlabs/types/llm_schema_override.py new file mode 100644 index 0000000000000000000000000000000000000000..9939f696179f6f3c6dc775b06c11c191c442dd3f --- /dev/null +++ b/data/src/elevenlabs/types/llm_schema_override.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LlmSchemaOverride(UncheckedBaseModel): + prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + Prompt override for the LLM. If not provided, the original schema description is used. + """ + + 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/data/src/elevenlabs/types/llm_tokens_category_usage.py b/data/src/elevenlabs/types/llm_tokens_category_usage.py new file mode 100644 index 0000000000000000000000000000000000000000..823d6e2249e5771e7f12c44fc0bae67c71f9da03 --- /dev/null +++ b/data/src/elevenlabs/types/llm_tokens_category_usage.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LlmTokensCategoryUsage(UncheckedBaseModel): + tokens: typing.Optional[int] = None + price: 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/data/src/elevenlabs/types/llm_usage_calculator_llm_response_model.py b/data/src/elevenlabs/types/llm_usage_calculator_llm_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..601ad039e0e46ccce9bce2634ddcb587e0740f4b --- /dev/null +++ b/data/src/elevenlabs/types/llm_usage_calculator_llm_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm import Llm + + +class LlmUsageCalculatorLlmResponseModel(UncheckedBaseModel): + llm: Llm + price_per_minute: float + price_per_message: float + + 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/data/src/elevenlabs/types/llm_usage_calculator_response_model.py b/data/src/elevenlabs/types/llm_usage_calculator_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..117194645a1e239858a080b88c3c316560d27472 --- /dev/null +++ b/data/src/elevenlabs/types/llm_usage_calculator_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_usage_calculator_llm_response_model import LlmUsageCalculatorLlmResponseModel + + +class LlmUsageCalculatorResponseModel(UncheckedBaseModel): + llm_prices: typing.List[LlmUsageCalculatorLlmResponseModel] + + 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/data/src/elevenlabs/types/llm_usage_input.py b/data/src/elevenlabs/types/llm_usage_input.py new file mode 100644 index 0000000000000000000000000000000000000000..8ab42b20a3ba6ea115373adae8b8a2172f75528e --- /dev/null +++ b/data/src/elevenlabs/types/llm_usage_input.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_input_output_tokens_usage import LlmInputOutputTokensUsage + + +class LlmUsageInput(UncheckedBaseModel): + model_usage: typing.Optional[typing.Dict[str, LlmInputOutputTokensUsage]] = 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/data/src/elevenlabs/types/llm_usage_output.py b/data/src/elevenlabs/types/llm_usage_output.py new file mode 100644 index 0000000000000000000000000000000000000000..80f93404e3ad0fd448aea83d0b8e3dacbedc553f --- /dev/null +++ b/data/src/elevenlabs/types/llm_usage_output.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm_input_output_tokens_usage import LlmInputOutputTokensUsage + + +class LlmUsageOutput(UncheckedBaseModel): + model_usage: typing.Optional[typing.Dict[str, LlmInputOutputTokensUsage]] = 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/data/src/elevenlabs/types/load_memory_entry_tool_error_status.py b/data/src/elevenlabs/types/load_memory_entry_tool_error_status.py new file mode 100644 index 0000000000000000000000000000000000000000..5451588624bc66612553735b6bf180d4bbb5ddf8 --- /dev/null +++ b/data/src/elevenlabs/types/load_memory_entry_tool_error_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LoadMemoryEntryToolErrorStatus = typing.Union[typing.Literal["not_found", "invalid_id"], typing.Any] diff --git a/data/src/elevenlabs/types/loadable_memory_entry.py b/data/src/elevenlabs/types/loadable_memory_entry.py new file mode 100644 index 0000000000000000000000000000000000000000..14dded8c832019bf2692ff66c13744c0a448b8c6 --- /dev/null +++ b/data/src/elevenlabs/types/loadable_memory_entry.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class LoadableMemoryEntry(UncheckedBaseModel): + entry_id: str + summary: str + text: 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/data/src/elevenlabs/types/lock_reason.py b/data/src/elevenlabs/types/lock_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..fcd84008899c885997ec826b642b02833923395d --- /dev/null +++ b/data/src/elevenlabs/types/lock_reason.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +LockReason = typing.Union[ + typing.Literal["trial_ended", "subscription_downgrade", "exposed_publicly", "self_disabled"], typing.Any +] diff --git a/data/src/elevenlabs/types/manual_source.py b/data/src/elevenlabs/types/manual_source.py new file mode 100644 index 0000000000000000000000000000000000000000..af11d1ae281b9e0fa1df294bffc291af3f6779cb --- /dev/null +++ b/data/src/elevenlabs/types/manual_source.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ManualSource(UncheckedBaseModel): + type: typing.Optional[typing.Literal["manual"]] = None + created_by_user_id: str + notes: 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/data/src/elevenlabs/types/manual_verification_file_response.py b/data/src/elevenlabs/types/manual_verification_file_response.py new file mode 100644 index 0000000000000000000000000000000000000000..62a667d74cbd4c8767932d37a41a8af8867ed2d8 --- /dev/null +++ b/data/src/elevenlabs/types/manual_verification_file_response.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ManualVerificationFileResponse(UncheckedBaseModel): + file_id: str = pydantic.Field() + """ + The ID of the file. + """ + + file_name: str = pydantic.Field() + """ + The name of the file. + """ + + mime_type: str = pydantic.Field() + """ + The MIME type of the file. + """ + + size_bytes: int = pydantic.Field() + """ + The size of the file in bytes. + """ + + upload_date_unix: int = pydantic.Field() + """ + The date of the file in Unix time. + """ + + 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/data/src/elevenlabs/types/manual_verification_response.py b/data/src/elevenlabs/types/manual_verification_response.py new file mode 100644 index 0000000000000000000000000000000000000000..524c7ffd445111b776dc3db8ce5cd3870f26b0b6 --- /dev/null +++ b/data/src/elevenlabs/types/manual_verification_response.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .manual_verification_file_response import ManualVerificationFileResponse + + +class ManualVerificationResponse(UncheckedBaseModel): + extra_text: str = pydantic.Field() + """ + The extra text of the manual verification. + """ + + request_time_unix: int = pydantic.Field() + """ + The date of the manual verification in Unix time. + """ + + files: typing.List[ManualVerificationFileResponse] = pydantic.Field() + """ + The files of the manual verification. + """ + + 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/data/src/elevenlabs/types/match_anything_parameter_evaluation_strategy.py b/data/src/elevenlabs/types/match_anything_parameter_evaluation_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..58fc5090299ce8717582e9c7369d151d3b89850f --- /dev/null +++ b/data/src/elevenlabs/types/match_anything_parameter_evaluation_strategy.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MatchAnythingParameterEvaluationStrategy(UncheckedBaseModel): + 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/data/src/elevenlabs/types/mcp_approval_policy.py b/data/src/elevenlabs/types/mcp_approval_policy.py new file mode 100644 index 0000000000000000000000000000000000000000..c5f21ea50b98b78b5717f8435a608c61b7f6ca64 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_approval_policy.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +McpApprovalPolicy = typing.Union[ + typing.Literal["auto_approve_all", "require_approval_all", "require_approval_per_tool"], typing.Any +] diff --git a/data/src/elevenlabs/types/mcp_approved_tool_definition.py b/data/src/elevenlabs/types/mcp_approved_tool_definition.py new file mode 100644 index 0000000000000000000000000000000000000000..70a6a43ca0defe66103b6134234a95338a21f103 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_approved_tool_definition.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class McpApprovedToolDefinition(UncheckedBaseModel): + """ + Snapshot of the MCP tool definition that was approved. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The MCP server-provided tool description at approval time + """ + + input_schema: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + The MCP server-provided JSON input schema at approval time + """ + + 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/data/src/elevenlabs/types/mcp_server_config_input.py b/data/src/elevenlabs/types/mcp_server_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..ac4fd7dc8f8cadc8abcaa90af1ed73498dccca7a --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_input.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mcp_approval_policy import McpApprovalPolicy +from .mcp_server_config_input_auth_connection import McpServerConfigInputAuthConnection +from .mcp_server_config_input_request_headers_value import McpServerConfigInputRequestHeadersValue +from .mcp_server_config_input_request_meta_value import McpServerConfigInputRequestMetaValue +from .mcp_server_config_input_secret_token import McpServerConfigInputSecretToken +from .mcp_server_config_input_url import McpServerConfigInputUrl +from .mcp_server_transport import McpServerTransport +from .mcp_tool_approval_hash import McpToolApprovalHash +from .mcp_tool_config_override_input import McpToolConfigOverrideInput +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode + + +class McpServerConfigInput(UncheckedBaseModel): + approval_policy: typing.Optional[McpApprovalPolicy] = None + tool_approval_hashes: typing.Optional[typing.List[McpToolApprovalHash]] = pydantic.Field(default=None) + """ + List of tool approval hashes for per-tool approval when approval_policy is REQUIRE_APPROVAL_PER_TOOL + """ + + transport: typing.Optional[McpServerTransport] = pydantic.Field(default=None) + """ + The transport type used to connect to the MCP server + """ + + url: McpServerConfigInputUrl = pydantic.Field() + """ + The URL of the MCP server, if this contains a secret please store as a workspace secret, otherwise store as a plain string. Must use https + """ + + secret_token: typing.Optional[McpServerConfigInputSecretToken] = pydantic.Field(default=None) + """ + The secret token (Authorization header) stored as a workspace secret or in-place secret + """ + + request_headers: typing.Optional[typing.Dict[str, McpServerConfigInputRequestHeadersValue]] = pydantic.Field( + default=None + ) + """ + The headers included in the request + """ + + request_meta: typing.Optional[typing.Dict[str, McpServerConfigInputRequestMetaValue]] = pydantic.Field(default=None) + """ + Entries sent in the MCP `_meta` field of tools/call requests. Values may be JSON scalars, or references to a workspace secret, dynamic variable, or environment variable resolved per call. + """ + + auth_connection: typing.Optional[McpServerConfigInputAuthConnection] = pydantic.Field(default=None) + """ + Optional auth connection to use for authentication with this MCP server + """ + + name: str + description: typing.Optional[str] = None + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, all tools from this MCP server will require pre-tool execution speech. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. Applies to every tool from this MCP server unless overridden per tool. + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while any tool from this MCP server is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. Applies to every tool from this MCP server unless overridden per tool. + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution for all tools from this MCP server + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play for all tools from this MCP server + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + Determines when and how all tools from this MCP server execute: 'immediate' executes the tool right away when requested by the LLM, 'post_tool_speech' waits for the agent to finish speaking before executing, 'async' runs the tool in the background without blocking - best for long-running operations. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for each MCP tool call to complete. Must be between 5 and 300 seconds (inclusive). + """ + + tool_config_overrides: typing.Optional[typing.List[McpToolConfigOverrideInput]] = pydantic.Field(default=None) + """ + List of per-tool configuration overrides that override the server-level defaults for specific tools + """ + + disable_compression: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to disable HTTP compression for this MCP server. Enable this if the server does not support compressed responses. + """ + + 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/data/src/elevenlabs/types/mcp_server_config_input_auth_connection.py b/data/src/elevenlabs/types/mcp_server_config_input_auth_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..f8a4a44ca5eaf4d2c27a9e33c0174d8af7db4052 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_input_auth_connection.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .auth_connection_locator import AuthConnectionLocator +from .environment_auth_connection_locator import EnvironmentAuthConnectionLocator + +McpServerConfigInputAuthConnection = typing.Union[AuthConnectionLocator, EnvironmentAuthConnectionLocator] diff --git a/data/src/elevenlabs/types/mcp_server_config_input_request_headers_value.py b/data/src/elevenlabs/types/mcp_server_config_input_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..c4c660499efaddfe684673ec43fc8bf9b2f3c186 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_input_request_headers_value.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable +from .conv_ai_env_var_locator import ConvAiEnvVarLocator +from .conv_ai_secret_locator import ConvAiSecretLocator + +McpServerConfigInputRequestHeadersValue = typing.Union[ + str, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator +] diff --git a/data/src/elevenlabs/types/mcp_server_config_input_request_meta_value.py b/data/src/elevenlabs/types/mcp_server_config_input_request_meta_value.py new file mode 100644 index 0000000000000000000000000000000000000000..2c94e5bac9166d62db82d2869a0a04491b7b359e --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_input_request_meta_value.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable +from .conv_ai_env_var_locator import ConvAiEnvVarLocator +from .conv_ai_secret_locator import ConvAiSecretLocator + +McpServerConfigInputRequestMetaValue = typing.Union[ + str, int, float, bool, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator +] diff --git a/data/src/elevenlabs/types/mcp_server_config_input_secret_token.py b/data/src/elevenlabs/types/mcp_server_config_input_secret_token.py new file mode 100644 index 0000000000000000000000000000000000000000..82df5ee91ab5dfd2f2e80fd4ffebef78979bec1f --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_input_secret_token.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_secret_locator import ConvAiSecretLocator +from .conv_ai_user_secret_db_model import ConvAiUserSecretDbModel + +McpServerConfigInputSecretToken = typing.Union[ConvAiSecretLocator, ConvAiUserSecretDbModel] diff --git a/data/src/elevenlabs/types/mcp_server_config_input_url.py b/data/src/elevenlabs/types/mcp_server_config_input_url.py new file mode 100644 index 0000000000000000000000000000000000000000..48b3ab2a1e90d32090a07a16d65a14b083059837 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_input_url.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_secret_locator import ConvAiSecretLocator + +McpServerConfigInputUrl = typing.Union[str, ConvAiSecretLocator] diff --git a/data/src/elevenlabs/types/mcp_server_config_output.py b/data/src/elevenlabs/types/mcp_server_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..30ade7f47a97fd99442f88790062fe85faf1201c --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_output.py @@ -0,0 +1,124 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mcp_approval_policy import McpApprovalPolicy +from .mcp_server_config_output_auth_connection import McpServerConfigOutputAuthConnection +from .mcp_server_config_output_request_headers_value import McpServerConfigOutputRequestHeadersValue +from .mcp_server_config_output_request_meta_value import McpServerConfigOutputRequestMetaValue +from .mcp_server_config_output_secret_token import McpServerConfigOutputSecretToken +from .mcp_server_config_output_url import McpServerConfigOutputUrl +from .mcp_server_transport import McpServerTransport +from .mcp_tool_approval_hash import McpToolApprovalHash +from .mcp_tool_config_override_output import McpToolConfigOverrideOutput +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode + + +class McpServerConfigOutput(UncheckedBaseModel): + approval_policy: typing.Optional[McpApprovalPolicy] = None + tool_approval_hashes: typing.Optional[typing.List[McpToolApprovalHash]] = pydantic.Field(default=None) + """ + List of tool approval hashes for per-tool approval when approval_policy is REQUIRE_APPROVAL_PER_TOOL + """ + + transport: typing.Optional[McpServerTransport] = pydantic.Field(default=None) + """ + The transport type used to connect to the MCP server + """ + + url: McpServerConfigOutputUrl = pydantic.Field() + """ + The URL of the MCP server, if this contains a secret please store as a workspace secret, otherwise store as a plain string. Must use https + """ + + secret_token: typing.Optional[McpServerConfigOutputSecretToken] = pydantic.Field(default=None) + """ + The secret token (Authorization header) stored as a workspace secret or in-place secret + """ + + request_headers: typing.Optional[typing.Dict[str, McpServerConfigOutputRequestHeadersValue]] = pydantic.Field( + default=None + ) + """ + The headers included in the request + """ + + request_meta: typing.Optional[typing.Dict[str, McpServerConfigOutputRequestMetaValue]] = pydantic.Field( + default=None + ) + """ + Entries sent in the MCP `_meta` field of tools/call requests. Values may be JSON scalars, or references to a workspace secret, dynamic variable, or environment variable resolved per call. + """ + + auth_connection: typing.Optional[McpServerConfigOutputAuthConnection] = pydantic.Field(default=None) + """ + Optional auth connection to use for authentication with this MCP server + """ + + name: str + description: typing.Optional[str] = None + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, all tools from this MCP server will require pre-tool execution speech. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. Applies to every tool from this MCP server unless overridden per tool. + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while any tool from this MCP server is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. Applies to every tool from this MCP server unless overridden per tool. + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution for all tools from this MCP server + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play for all tools from this MCP server + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + Determines when and how all tools from this MCP server execute: 'immediate' executes the tool right away when requested by the LLM, 'post_tool_speech' waits for the agent to finish speaking before executing, 'async' runs the tool in the background without blocking - best for long-running operations. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for each MCP tool call to complete. Must be between 5 and 300 seconds (inclusive). + """ + + tool_config_overrides: typing.Optional[typing.List[McpToolConfigOverrideOutput]] = pydantic.Field(default=None) + """ + List of per-tool configuration overrides that override the server-level defaults for specific tools + """ + + disable_compression: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to disable HTTP compression for this MCP server. Enable this if the server does not support compressed responses. + """ + + 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/data/src/elevenlabs/types/mcp_server_config_output_auth_connection.py b/data/src/elevenlabs/types/mcp_server_config_output_auth_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..6abf937b8fcf3f1964e977f6e1416c89ede2d16e --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_output_auth_connection.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .auth_connection_locator import AuthConnectionLocator +from .environment_auth_connection_locator import EnvironmentAuthConnectionLocator + +McpServerConfigOutputAuthConnection = typing.Union[AuthConnectionLocator, EnvironmentAuthConnectionLocator] diff --git a/data/src/elevenlabs/types/mcp_server_config_output_request_headers_value.py b/data/src/elevenlabs/types/mcp_server_config_output_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..8e23b77991a0b2cae4c6548ab2edea097eadba05 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_output_request_headers_value.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable +from .conv_ai_env_var_locator import ConvAiEnvVarLocator +from .conv_ai_secret_locator import ConvAiSecretLocator + +McpServerConfigOutputRequestHeadersValue = typing.Union[ + str, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator +] diff --git a/data/src/elevenlabs/types/mcp_server_config_output_request_meta_value.py b/data/src/elevenlabs/types/mcp_server_config_output_request_meta_value.py new file mode 100644 index 0000000000000000000000000000000000000000..149d415b841a50d3b78f843845637eb1a6239b81 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_output_request_meta_value.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable +from .conv_ai_env_var_locator import ConvAiEnvVarLocator +from .conv_ai_secret_locator import ConvAiSecretLocator + +McpServerConfigOutputRequestMetaValue = typing.Union[ + str, int, float, bool, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator +] diff --git a/data/src/elevenlabs/types/mcp_server_config_output_secret_token.py b/data/src/elevenlabs/types/mcp_server_config_output_secret_token.py new file mode 100644 index 0000000000000000000000000000000000000000..25244c4d25acd965a54208ade24248351ea21a88 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_output_secret_token.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_secret_locator import ConvAiSecretLocator +from .conv_ai_user_secret_db_model import ConvAiUserSecretDbModel + +McpServerConfigOutputSecretToken = typing.Union[ConvAiSecretLocator, ConvAiUserSecretDbModel] diff --git a/data/src/elevenlabs/types/mcp_server_config_output_url.py b/data/src/elevenlabs/types/mcp_server_config_output_url.py new file mode 100644 index 0000000000000000000000000000000000000000..0d4c3c187248778505e203f27cef1204500a9fbf --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_config_output_url.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_secret_locator import ConvAiSecretLocator + +McpServerConfigOutputUrl = typing.Union[str, ConvAiSecretLocator] diff --git a/data/src/elevenlabs/types/mcp_server_metadata_response_model.py b/data/src/elevenlabs/types/mcp_server_metadata_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..bc8837bfe6131fcc291b9d09249b916db16a8930 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_metadata_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class McpServerMetadataResponseModel(UncheckedBaseModel): + created_at: int + owner_user_id: 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/data/src/elevenlabs/types/mcp_server_response_model.py b/data/src/elevenlabs/types/mcp_server_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..921da8b18d0861e7209949f4c08b3376f341b36a --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_response_model.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mcp_server_config_output import McpServerConfigOutput +from .mcp_server_metadata_response_model import McpServerMetadataResponseModel +from .mcp_server_response_model_dependent_agents_item import McpServerResponseModelDependentAgentsItem +from .resource_access_info import ResourceAccessInfo + + +class McpServerResponseModel(UncheckedBaseModel): + """ + Response model representing an MCP Server configuration. + """ + + id: str + config: McpServerConfigOutput + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information of the MCP Server + """ + + dependent_agents: typing.Optional[typing.List[McpServerResponseModelDependentAgentsItem]] = pydantic.Field( + default=None + ) + """ + List of agents that depend on this MCP Server. + """ + + metadata: McpServerMetadataResponseModel = pydantic.Field() + """ + The metadata of the MCP Server + """ + + 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/data/src/elevenlabs/types/mcp_server_response_model_dependent_agents_item.py b/data/src/elevenlabs/types/mcp_server_response_model_dependent_agents_item.py new file mode 100644 index 0000000000000000000000000000000000000000..95db36e87d2130b9102d0a25342f0dd288fcd922 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_response_model_dependent_agents_item.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dependent_available_agent_identifier_access_level import DependentAvailableAgentIdentifierAccessLevel + + +class McpServerResponseModelDependentAgentsItem_Available(UncheckedBaseModel): + type: typing.Literal["available"] = "available" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: str + name: str + created_at_unix_secs: int + access_level: DependentAvailableAgentIdentifierAccessLevel + + 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 + + +class McpServerResponseModelDependentAgentsItem_Unknown(UncheckedBaseModel): + type: typing.Literal["unknown"] = "unknown" + referenced_resource_ids: typing.Optional[typing.List[str]] = None + id: 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 + + +McpServerResponseModelDependentAgentsItem = typing_extensions.Annotated[ + typing.Union[ + McpServerResponseModelDependentAgentsItem_Available, McpServerResponseModelDependentAgentsItem_Unknown + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/mcp_server_transport.py b/data/src/elevenlabs/types/mcp_server_transport.py new file mode 100644 index 0000000000000000000000000000000000000000..01c718e33bc8e3497c10595a5c0e3c939909c515 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_server_transport.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +McpServerTransport = typing.Union[typing.Literal["SSE", "STREAMABLE_HTTP"], typing.Any] diff --git a/data/src/elevenlabs/types/mcp_servers_response_model.py b/data/src/elevenlabs/types/mcp_servers_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..691bcd7e59af6c1264eac59e7e267b554cf9da3e --- /dev/null +++ b/data/src/elevenlabs/types/mcp_servers_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mcp_server_response_model import McpServerResponseModel + + +class McpServersResponseModel(UncheckedBaseModel): + """ + Response model for a list of MCP Server configurations. + """ + + mcp_servers: typing.List[McpServerResponseModel] + + 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/data/src/elevenlabs/types/mcp_tool_approval_hash.py b/data/src/elevenlabs/types/mcp_tool_approval_hash.py new file mode 100644 index 0000000000000000000000000000000000000000..173c789f9f9a8d28e5257331650246f15ee76372 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_approval_hash.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mcp_tool_approval_policy import McpToolApprovalPolicy + + +class McpToolApprovalHash(UncheckedBaseModel): + """ + Model for storing tool approval hashes for per-tool approval. + """ + + tool_name: str = pydantic.Field() + """ + The name of the MCP tool + """ + + tool_hash: str = pydantic.Field() + """ + SHA256 hash of the tool's parameters and description + """ + + approval_policy: typing.Optional[McpToolApprovalPolicy] = pydantic.Field(default=None) + """ + The approval policy for this tool + """ + + 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/data/src/elevenlabs/types/mcp_tool_approval_policy.py b/data/src/elevenlabs/types/mcp_tool_approval_policy.py new file mode 100644 index 0000000000000000000000000000000000000000..e29fa28ff15827547598cf851e24f7015032b386 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_approval_policy.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +McpToolApprovalPolicy = typing.Union[typing.Literal["auto_approved", "requires_approval"], typing.Any] diff --git a/data/src/elevenlabs/types/mcp_tool_approval_state.py b/data/src/elevenlabs/types/mcp_tool_approval_state.py new file mode 100644 index 0000000000000000000000000000000000000000..9a093f151ca62359d1eca257f00ae1f01e5caebc --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_approval_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +McpToolApprovalState = typing.Union[typing.Literal["up_to_date", "needs_review", "not_approved"], typing.Any] diff --git a/data/src/elevenlabs/types/mcp_tool_approval_status.py b/data/src/elevenlabs/types/mcp_tool_approval_status.py new file mode 100644 index 0000000000000000000000000000000000000000..32ee52383a1b1f29bf2d44759aee7f53880f449c --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_approval_status.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mcp_approved_tool_definition import McpApprovedToolDefinition +from .mcp_tool_approval_policy import McpToolApprovalPolicy +from .mcp_tool_approval_state import McpToolApprovalState + + +class McpToolApprovalStatus(UncheckedBaseModel): + """ + Derived approval state for a currently discovered MCP tool. + """ + + tool_id: str = pydantic.Field() + """ + Canonical MCP tool identifier in the form mcp:: + """ + + state: McpToolApprovalState = pydantic.Field() + """ + Whether a stored approval exists and still matches the live tool definition + """ + + approval_policy: typing.Optional[McpToolApprovalPolicy] = pydantic.Field(default=None) + """ + Stored execution policy. Set when the tool has an approval. + """ + + approved_definition: typing.Optional[McpApprovedToolDefinition] = pydantic.Field(default=None) + """ + Previously approved definition, included when the tool needs review and a snapshot exists. + """ + + 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/data/src/elevenlabs/types/mcp_tool_config_override_input.py b/data/src/elevenlabs/types/mcp_tool_config_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..9bb5910b28def061d20a854506c1605f0e38adef --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_config_override_input.py @@ -0,0 +1,88 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_assignment import DynamicVariableAssignment +from .mcp_tool_config_override_input_input_overrides_value import McpToolConfigOverrideInputInputOverridesValue +from .mcp_tool_config_override_input_tool_call_sound import McpToolConfigOverrideInputToolCallSound +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .tool_response_mock_config_input import ToolResponseMockConfigInput + + +class McpToolConfigOverrideInput(UncheckedBaseModel): + tool_name: str = pydantic.Field() + """ + The name of the MCP tool + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + If set, overrides the server's pre_tool_speech setting for this tool. + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + If set, overrides the server's interruption_mode setting for this tool. + """ + + tool_call_sound: typing.Optional[McpToolConfigOverrideInputToolCallSound] = pydantic.Field(default=None) + """ + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + If set, overrides the server's tool_call_sound_behavior setting for this tool + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + If set, overrides the server's execution_mode setting for this tool + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + If set, overrides the server's response timeout for this MCP tool (seconds). + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Dynamic variable assignments for this MCP tool + """ + + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideInputInputOverridesValue]] + ] = pydantic.Field(default=None) + """ + Mapping of json path to input override configuration + """ + + response_mocks: typing.Optional[typing.List[ToolResponseMockConfigInput]] = pydantic.Field(default=None) + """ + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + """ + + 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/data/src/elevenlabs/types/mcp_tool_config_override_input_input_overrides_value.py b/data/src/elevenlabs/types/mcp_tool_config_override_input_input_overrides_value.py new file mode 100644 index 0000000000000000000000000000000000000000..e7ca0b90aaa1d36b34a0a6db9f6e0f789a0d5253 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_config_override_input_input_overrides_value.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .constant_schema_override_constant_value import ConstantSchemaOverrideConstantValue + + +class McpToolConfigOverrideInputInputOverridesValue_Constant(UncheckedBaseModel): + source: typing.Literal["constant"] = "constant" + constant_value: typing.Optional[ConstantSchemaOverrideConstantValue] = 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 + + +class McpToolConfigOverrideInputInputOverridesValue_DynamicVariable(UncheckedBaseModel): + source: typing.Literal["dynamic_variable"] = "dynamic_variable" + dynamic_variable: 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 + + +class McpToolConfigOverrideInputInputOverridesValue_Llm(UncheckedBaseModel): + source: typing.Literal["llm"] = "llm" + prompt: 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 + + +class McpToolConfigOverrideInputInputOverridesValue_Omit(UncheckedBaseModel): + source: typing.Literal["omit"] = "omit" + + 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 + + +McpToolConfigOverrideInputInputOverridesValue = typing_extensions.Annotated[ + typing.Union[ + McpToolConfigOverrideInputInputOverridesValue_Constant, + McpToolConfigOverrideInputInputOverridesValue_DynamicVariable, + McpToolConfigOverrideInputInputOverridesValue_Llm, + McpToolConfigOverrideInputInputOverridesValue_Omit, + ], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/types/mcp_tool_config_override_input_tool_call_sound.py b/data/src/elevenlabs/types/mcp_tool_config_override_input_tool_call_sound.py new file mode 100644 index 0000000000000000000000000000000000000000..f740dd455ff5f17f7c9116409102170870e2af5b --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_config_override_input_tool_call_sound.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .tool_call_sound_type import ToolCallSoundType + +McpToolConfigOverrideInputToolCallSound = typing.Union[ToolCallSoundType, typing.Literal["off"]] diff --git a/data/src/elevenlabs/types/mcp_tool_config_override_output.py b/data/src/elevenlabs/types/mcp_tool_config_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..7f6ac8e21257a268c8ede4e4bacf80c72ef8ee85 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_config_override_output.py @@ -0,0 +1,88 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_assignment import DynamicVariableAssignment +from .mcp_tool_config_override_output_input_overrides_value import McpToolConfigOverrideOutputInputOverridesValue +from .mcp_tool_config_override_output_tool_call_sound import McpToolConfigOverrideOutputToolCallSound +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .tool_response_mock_config_output import ToolResponseMockConfigOutput + + +class McpToolConfigOverrideOutput(UncheckedBaseModel): + tool_name: str = pydantic.Field() + """ + The name of the MCP tool + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + If set, overrides the server's pre_tool_speech setting for this tool. + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If set, overrides the server's disable_interruptions setting for this tool. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + If set, overrides the server's interruption_mode setting for this tool. + """ + + tool_call_sound: typing.Optional[McpToolConfigOverrideOutputToolCallSound] = pydantic.Field(default=None) + """ + Overrides the server's tool_call_sound setting for this tool. A sound name plays that sound; 'off' overrides to no sound (silence); null means do not override (inherit the server default). + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + If set, overrides the server's tool_call_sound_behavior setting for this tool + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + If set, overrides the server's execution_mode setting for this tool + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + If set, overrides the server's response timeout for this MCP tool (seconds). + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Dynamic variable assignments for this MCP tool + """ + + input_overrides: typing.Optional[ + typing.Dict[str, typing.Optional[McpToolConfigOverrideOutputInputOverridesValue]] + ] = pydantic.Field(default=None) + """ + Mapping of json path to input override configuration + """ + + response_mocks: typing.Optional[typing.List[ToolResponseMockConfigOutput]] = pydantic.Field(default=None) + """ + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + """ + + 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/data/src/elevenlabs/types/mcp_tool_config_override_output_input_overrides_value.py b/data/src/elevenlabs/types/mcp_tool_config_override_output_input_overrides_value.py new file mode 100644 index 0000000000000000000000000000000000000000..a0415deda6bb5f7dd38eca3f05701da005e471f9 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_config_override_output_input_overrides_value.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .constant_schema_override_constant_value import ConstantSchemaOverrideConstantValue + + +class McpToolConfigOverrideOutputInputOverridesValue_Constant(UncheckedBaseModel): + source: typing.Literal["constant"] = "constant" + constant_value: typing.Optional[ConstantSchemaOverrideConstantValue] = 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 + + +class McpToolConfigOverrideOutputInputOverridesValue_DynamicVariable(UncheckedBaseModel): + source: typing.Literal["dynamic_variable"] = "dynamic_variable" + dynamic_variable: 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 + + +class McpToolConfigOverrideOutputInputOverridesValue_Llm(UncheckedBaseModel): + source: typing.Literal["llm"] = "llm" + prompt: 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 + + +class McpToolConfigOverrideOutputInputOverridesValue_Omit(UncheckedBaseModel): + source: typing.Literal["omit"] = "omit" + + 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 + + +McpToolConfigOverrideOutputInputOverridesValue = typing_extensions.Annotated[ + typing.Union[ + McpToolConfigOverrideOutputInputOverridesValue_Constant, + McpToolConfigOverrideOutputInputOverridesValue_DynamicVariable, + McpToolConfigOverrideOutputInputOverridesValue_Llm, + McpToolConfigOverrideOutputInputOverridesValue_Omit, + ], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/types/mcp_tool_config_override_output_tool_call_sound.py b/data/src/elevenlabs/types/mcp_tool_config_override_output_tool_call_sound.py new file mode 100644 index 0000000000000000000000000000000000000000..490951b740af55da5d26757b10ac7d824b8bcb85 --- /dev/null +++ b/data/src/elevenlabs/types/mcp_tool_config_override_output_tool_call_sound.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .tool_call_sound_type import ToolCallSoundType + +McpToolConfigOverrideOutputToolCallSound = typing.Union[ToolCallSoundType, typing.Literal["off"]] diff --git a/data/src/elevenlabs/types/media_codec.py b/data/src/elevenlabs/types/media_codec.py new file mode 100644 index 0000000000000000000000000000000000000000..0b6feaea3f8aca98795e017ab77a93ea20b28638 --- /dev/null +++ b/data/src/elevenlabs/types/media_codec.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MediaCodec = typing.Union[typing.Literal["G722/8000", "PCMU/8000", "PCMA/8000"], typing.Any] diff --git a/data/src/elevenlabs/types/media_generation_completed_response.py b/data/src/elevenlabs/types/media_generation_completed_response.py new file mode 100644 index 0000000000000000000000000000000000000000..36d03bc792d84e30af8f9c753624778c7128a9ff --- /dev/null +++ b/data/src/elevenlabs/types/media_generation_completed_response.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MediaGenerationCompletedResponse(UncheckedBaseModel): + """ + A completed media generation and its output. + """ + + id: str = pydantic.Field() + """ + The unique identifier of the generation. + """ + + content_url: str = pydantic.Field() + """ + A signed URL to download the generated media from. It expires about an hour after this response is returned; fetch the generation again for a fresh URL. + """ + + content_mime_type: str = pydantic.Field() + """ + The MIME type of the generated media. + """ + + 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/data/src/elevenlabs/types/media_generation_create_response.py b/data/src/elevenlabs/types/media_generation_create_response.py new file mode 100644 index 0000000000000000000000000000000000000000..395d38ee189b541282feede512be88911d4e1752 --- /dev/null +++ b/data/src/elevenlabs/types/media_generation_create_response.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MediaGenerationCreateResponse(UncheckedBaseModel): + """ + A newly queued media generation; fetch the GET endpoint for the output. + """ + + id: str = pydantic.Field() + """ + The unique identifier of the generation. Pass it to the corresponding GET endpoint to retrieve the output. + """ + + status: typing.Literal["pending"] = pydantic.Field(default="pending") + """ + A newly created generation is always `pending`. + """ + + 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/data/src/elevenlabs/types/media_generation_failed_response.py b/data/src/elevenlabs/types/media_generation_failed_response.py new file mode 100644 index 0000000000000000000000000000000000000000..93a0ea02190f9617e0ac7b500516ea29956a5587 --- /dev/null +++ b/data/src/elevenlabs/types/media_generation_failed_response.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .media_generation_failed_response_failure_reason import MediaGenerationFailedResponseFailureReason + + +class MediaGenerationFailedResponse(UncheckedBaseModel): + """ + A failed media generation and why it failed. + """ + + id: str = pydantic.Field() + """ + The unique identifier of the generation. + """ + + failure_reason: MediaGenerationFailedResponseFailureReason = pydantic.Field() + """ + The category of failure. + """ + + error_message: str = pydantic.Field() + """ + A human-readable description of the failure. Failed generations are not charged. + """ + + 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/data/src/elevenlabs/types/media_generation_failed_response_failure_reason.py b/data/src/elevenlabs/types/media_generation_failed_response_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..cff684005439f22217cca5de612a17c60cc46ed5 --- /dev/null +++ b/data/src/elevenlabs/types/media_generation_failed_response_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MediaGenerationFailedResponseFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/media_generation_in_progress_response.py b/data/src/elevenlabs/types/media_generation_in_progress_response.py new file mode 100644 index 0000000000000000000000000000000000000000..6a64e33c024dfe65b1a547f2867e5c9cd9078e67 --- /dev/null +++ b/data/src/elevenlabs/types/media_generation_in_progress_response.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MediaGenerationInProgressResponse(UncheckedBaseModel): + """ + A media generation that has not finished yet. + """ + + id: str = pydantic.Field() + """ + The unique identifier of the generation. + """ + + 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/data/src/elevenlabs/types/media_generation_list_response.py b/data/src/elevenlabs/types/media_generation_list_response.py new file mode 100644 index 0000000000000000000000000000000000000000..da6cca3ee04a53134f6d298864f79e87d5b9136c --- /dev/null +++ b/data/src/elevenlabs/types/media_generation_list_response.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .media_generation_response import MediaGenerationResponse + + +class MediaGenerationListResponse(UncheckedBaseModel): + """ + One page of the caller's generations, newest first. + """ + + generations: typing.List[MediaGenerationResponse] = pydantic.Field() + """ + The generations on this page, newest first. Each item has the same shape as the corresponding GET endpoint's response. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Pass as `cursor` to fetch the next page. `null` when there is no further page. + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether more generations exist beyond this page. + """ + + 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/data/src/elevenlabs/types/media_generation_response.py b/data/src/elevenlabs/types/media_generation_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b1a80a7ee2a51727862c786d0a45d7b9b3003e45 --- /dev/null +++ b/data/src/elevenlabs/types/media_generation_response.py @@ -0,0 +1,82 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .media_generation_failed_response_failure_reason import MediaGenerationFailedResponseFailureReason + + +class MediaGenerationResponse_Completed(UncheckedBaseModel): + status: typing.Literal["completed"] = "completed" + id: str + content_url: str + content_mime_type: 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 + + +class MediaGenerationResponse_Failed(UncheckedBaseModel): + status: typing.Literal["failed"] = "failed" + id: str + failure_reason: MediaGenerationFailedResponseFailureReason + error_message: 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 + + +class MediaGenerationResponse_Generating(UncheckedBaseModel): + status: typing.Literal["generating"] = "generating" + id: 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 + + +class MediaGenerationResponse_Pending(UncheckedBaseModel): + status: typing.Literal["pending"] = "pending" + id: 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 + + +MediaGenerationResponse = typing_extensions.Annotated[ + typing.Union[ + MediaGenerationResponse_Completed, + MediaGenerationResponse_Failed, + MediaGenerationResponse_Generating, + MediaGenerationResponse_Pending, + ], + UnionMetadata(discriminant="status"), +] diff --git a/data/src/elevenlabs/types/media_id.py b/data/src/elevenlabs/types/media_id.py new file mode 100644 index 0000000000000000000000000000000000000000..aadddb561fa533f34d68046fd5e649828c68f6ce --- /dev/null +++ b/data/src/elevenlabs/types/media_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +MediaId = str diff --git a/data/src/elevenlabs/types/memory_entry_search_result.py b/data/src/elevenlabs/types/memory_entry_search_result.py new file mode 100644 index 0000000000000000000000000000000000000000..c6e161806186209b5ce0c7def4cbda37f843f125 --- /dev/null +++ b/data/src/elevenlabs/types/memory_entry_search_result.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .memory_entry_search_result_source import MemoryEntrySearchResultSource + + +class MemoryEntrySearchResult(UncheckedBaseModel): + entry_id: str + version: int + summary: typing.Optional[str] = None + text: typing.Optional[str] = None + source: typing.Optional[MemoryEntrySearchResultSource] = 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/data/src/elevenlabs/types/memory_entry_search_result_source.py b/data/src/elevenlabs/types/memory_entry_search_result_source.py new file mode 100644 index 0000000000000000000000000000000000000000..d8ed73194b2d5dd1a2d9cfa2b4f1e99970ae598c --- /dev/null +++ b/data/src/elevenlabs/types/memory_entry_search_result_source.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conversation_source import ConversationSource +from .manual_source import ManualSource + +MemoryEntrySearchResultSource = typing.Union[ConversationSource, ManualSource] diff --git a/data/src/elevenlabs/types/merge_preview_response_model.py b/data/src/elevenlabs/types/merge_preview_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..eb4fcf5f81a8857816f727960f0a999d825a6979 --- /dev/null +++ b/data/src/elevenlabs/types/merge_preview_response_model.py @@ -0,0 +1,124 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_metadata_response_model import AgentMetadataResponseModel +from .agent_platform_settings_response_model import AgentPlatformSettingsResponseModel +from .agent_workflow_response_model import AgentWorkflowResponseModel +from .conversational_config import ConversationalConfig +from .field_conflict import FieldConflict +from .get_whats_app_account_response import GetWhatsAppAccountResponse +from .merge_preview_response_model_phone_numbers_item import MergePreviewResponseModelPhoneNumbersItem +from .procedure_ref_response_model import ProcedureRefResponseModel +from .resource_access_info import ResourceAccessInfo + + +class MergePreviewResponseModel(UncheckedBaseModel): + agent_id: str = pydantic.Field() + """ + The ID of the agent + """ + + name: str = pydantic.Field() + """ + The name of the agent + """ + + conversation_config: ConversationalConfig = pydantic.Field() + """ + The conversation configuration of the agent + """ + + metadata: AgentMetadataResponseModel = pydantic.Field() + """ + The metadata of the agent + """ + + platform_settings: typing.Optional[AgentPlatformSettingsResponseModel] = pydantic.Field(default=None) + """ + The platform settings of the agent + """ + + phone_numbers: typing.Optional[typing.List[MergePreviewResponseModelPhoneNumbersItem]] = pydantic.Field( + default=None + ) + """ + The phone numbers of the agent + """ + + whatsapp_accounts: typing.Optional[typing.List[GetWhatsAppAccountResponse]] = pydantic.Field(default=None) + """ + WhatsApp accounts assigned to the agent + """ + + workflow: typing.Optional[AgentWorkflowResponseModel] = pydantic.Field(default=None) + """ + The workflow of the agent + """ + + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information of the agent for the user + """ + + tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Agent tags used to categorize the agent + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the version the agent is on + """ + + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the branch the agent is on + """ + + main_branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the main branch for this agent + """ + + procedures: typing.Optional[typing.Dict[str, ProcedureRefResponseModel]] = pydantic.Field(default=None) + """ + Procedures keyed by procedure_id. + """ + + default_hold_audio_url: typing.Optional[str] = pydantic.Field(default=None) + """ + URL of the default hold tone played to queued callers when no custom hold audio is uploaded, so the dashboard can preview it. + """ + + overridden_fields: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Dot-paths of config fields where both branches modified the same field relative to their common ancestor (conflicts). Present regardless of which side wins the conflict. + """ + + conflicts: typing.Optional[typing.List[FieldConflict]] = pydantic.Field(default=None) + """ + Structured view of the same conflicts as overridden_fields, each carrying the value on the base (common ancestor), source branch, and target branch so the divergence can be presented and resolved field-by-field. + """ + + source_identical_to_target: typing.Optional[bool] = pydantic.Field(default=None) + """ + True when the merge/rebase would be a no-op, i.e. the merged result is identical to the source branch tip. The rebase endpoint rejects in this case. + """ + + 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 + + +update_forward_refs(MergePreviewResponseModel) diff --git a/data/src/elevenlabs/types/merge_preview_response_model_phone_numbers_item.py b/data/src/elevenlabs/types/merge_preview_response_model_phone_numbers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..ca1b928cf1a6d222d17fb6f8604d125d434756e9 --- /dev/null +++ b/data/src/elevenlabs/types/merge_preview_response_model_phone_numbers_item.py @@ -0,0 +1,86 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .get_phone_number_inbound_sip_trunk_config_response_model import GetPhoneNumberInboundSipTrunkConfigResponseModel +from .get_phone_number_outbound_sip_trunk_config_response_model import GetPhoneNumberOutboundSipTrunkConfigResponseModel +from .livekit_stack_type import LivekitStackType +from .phone_number_agent_info import PhoneNumberAgentInfo + + +class MergePreviewResponseModelPhoneNumbersItem_Exotel(UncheckedBaseModel): + provider: typing.Literal["exotel"] = "exotel" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +class MergePreviewResponseModelPhoneNumbersItem_SipTrunk(UncheckedBaseModel): + provider: typing.Literal["sip_trunk"] = "sip_trunk" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = None + provider_config: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + outbound_trunk: typing.Optional[GetPhoneNumberOutboundSipTrunkConfigResponseModel] = None + inbound_trunk: typing.Optional[GetPhoneNumberInboundSipTrunkConfigResponseModel] = None + livekit_stack: LivekitStackType + store_sip_messages: 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 + + +class MergePreviewResponseModelPhoneNumbersItem_Twilio(UncheckedBaseModel): + provider: typing.Literal["twilio"] = "twilio" + phone_number: str + label: str + supports_inbound: typing.Optional[bool] = None + supports_outbound: typing.Optional[bool] = None + phone_number_id: str + assigned_agent: typing.Optional[PhoneNumberAgentInfo] = 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 + + +MergePreviewResponseModelPhoneNumbersItem = typing_extensions.Annotated[ + typing.Union[ + MergePreviewResponseModelPhoneNumbersItem_Exotel, + MergePreviewResponseModelPhoneNumbersItem_SipTrunk, + MergePreviewResponseModelPhoneNumbersItem_Twilio, + ], + UnionMetadata(discriminant="provider"), +] diff --git a/data/src/elevenlabs/types/merge_proposal_close_reason.py b/data/src/elevenlabs/types/merge_proposal_close_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..29f37aeb4fd655281ff59339fb4d1a4771555542 --- /dev/null +++ b/data/src/elevenlabs/types/merge_proposal_close_reason.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MergeProposalCloseReason = typing.Union[typing.Literal["withdrawn", "rejected", "branch_archived"], typing.Any] diff --git a/data/src/elevenlabs/types/merge_proposal_comment.py b/data/src/elevenlabs/types/merge_proposal_comment.py new file mode 100644 index 0000000000000000000000000000000000000000..1ecacf18d6c89830c17f5bc91daee9389d7b2f06 --- /dev/null +++ b/data/src/elevenlabs/types/merge_proposal_comment.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MergeProposalComment(UncheckedBaseModel): + id: str + user_id: str + body: str + created_at: int + + 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/data/src/elevenlabs/types/merge_proposal_review.py b/data/src/elevenlabs/types/merge_proposal_review.py new file mode 100644 index 0000000000000000000000000000000000000000..4623dcfbebc8c7ad288bf976156803ff7032d3bc --- /dev/null +++ b/data/src/elevenlabs/types/merge_proposal_review.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .merge_proposal_review_reviewer_role import MergeProposalReviewReviewerRole +from .merge_proposal_review_state import MergeProposalReviewState + + +class MergeProposalReview(UncheckedBaseModel): + user_id: str + state: MergeProposalReviewState + submitted_at: int + comment: typing.Optional[str] = None + reviewer_role: typing.Optional[MergeProposalReviewReviewerRole] = 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/data/src/elevenlabs/types/merge_proposal_review_reviewer_role.py b/data/src/elevenlabs/types/merge_proposal_review_reviewer_role.py new file mode 100644 index 0000000000000000000000000000000000000000..56c1282c2c50aa2792960ff79b97f0f577932da9 --- /dev/null +++ b/data/src/elevenlabs/types/merge_proposal_review_reviewer_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MergeProposalReviewReviewerRole = typing.Union[typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any] diff --git a/data/src/elevenlabs/types/merge_proposal_review_state.py b/data/src/elevenlabs/types/merge_proposal_review_state.py new file mode 100644 index 0000000000000000000000000000000000000000..dbe881167524514d520a26238e5f183f2f9f282b --- /dev/null +++ b/data/src/elevenlabs/types/merge_proposal_review_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MergeProposalReviewState = typing.Union[typing.Literal["approved", "changes_requested"], typing.Any] diff --git a/data/src/elevenlabs/types/merge_proposal_status.py b/data/src/elevenlabs/types/merge_proposal_status.py new file mode 100644 index 0000000000000000000000000000000000000000..11bd3613d1efe64970606b05a444f4732528f0a5 --- /dev/null +++ b/data/src/elevenlabs/types/merge_proposal_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MergeProposalStatus = typing.Union[typing.Literal["open", "merged", "closed"], typing.Any] diff --git a/data/src/elevenlabs/types/merged_outcome.py b/data/src/elevenlabs/types/merged_outcome.py new file mode 100644 index 0000000000000000000000000000000000000000..69eb58b9acf592f63a2cd1a906836095fe7691b5 --- /dev/null +++ b/data/src/elevenlabs/types/merged_outcome.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MergedOutcome(UncheckedBaseModel): + version_id: str + at: int + by_user_id: 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/data/src/elevenlabs/types/message_search_sort_by.py b/data/src/elevenlabs/types/message_search_sort_by.py new file mode 100644 index 0000000000000000000000000000000000000000..e3b8a23ea18158593131451cb0fb84f49ace1745 --- /dev/null +++ b/data/src/elevenlabs/types/message_search_sort_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MessageSearchSortBy = typing.Union[typing.Literal["search_score", "created_at"], typing.Any] diff --git a/data/src/elevenlabs/types/messages_search_response.py b/data/src/elevenlabs/types/messages_search_response.py new file mode 100644 index 0000000000000000000000000000000000000000..c040494cda40b27cd8d7c41ced41c4f29a8f1bdb --- /dev/null +++ b/data/src/elevenlabs/types/messages_search_response.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .list_response_meta import ListResponseMeta +from .messages_search_result import MessagesSearchResult + + +class MessagesSearchResponse(UncheckedBaseModel): + meta: typing.Optional[ListResponseMeta] = None + results: typing.List[MessagesSearchResult] + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Cursor for the next page of results + """ + + has_more: bool = pydantic.Field() + """ + Whether there are more results available + """ + + 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/data/src/elevenlabs/types/messages_search_result.py b/data/src/elevenlabs/types/messages_search_result.py new file mode 100644 index 0000000000000000000000000000000000000000..ff03df51de57d6e4737c65147b9e59107bacf715 --- /dev/null +++ b/data/src/elevenlabs/types/messages_search_result.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .search_highlight_segment import SearchHighlightSegment + + +class MessagesSearchResult(UncheckedBaseModel): + """ + transcript_index: index of the message in the conversation transcript + chunk_text: text of the transcript; transcript messages if very long could have several chunks. + chunk_highlights: chunk_text split into matched/unmatched segments for highlighting. + Only populated for keyword/text search, not semantic search. + score: similarity score of the message to the search query + """ + + conversation_id: str + agent_id: str + agent_name: typing.Optional[str] = None + transcript_index: int + chunk_text: str + chunk_highlights: typing.Optional[typing.List[SearchHighlightSegment]] = None + score: float + conversation_start_time_unix_secs: int + + 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/data/src/elevenlabs/types/metric_record.py b/data/src/elevenlabs/types/metric_record.py new file mode 100644 index 0000000000000000000000000000000000000000..96a2af6a81645454bf1140fbfd7441e680908c58 --- /dev/null +++ b/data/src/elevenlabs/types/metric_record.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MetricRecord(UncheckedBaseModel): + elapsed_time: float + + 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/data/src/elevenlabs/types/metric_type.py b/data/src/elevenlabs/types/metric_type.py new file mode 100644 index 0000000000000000000000000000000000000000..3b634fb570a568fc91b3f1a85ab8b0533e88e924 --- /dev/null +++ b/data/src/elevenlabs/types/metric_type.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MetricType = typing.Union[ + typing.Literal[ + "credits", + "tts_characters", + "minutes_used", + "request_count", + "ttfb_avg", + "ttfb_p95", + "fiat_units_spent", + "concurrency", + "concurrency_average", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/mock_no_match_behavior.py b/data/src/elevenlabs/types/mock_no_match_behavior.py new file mode 100644 index 0000000000000000000000000000000000000000..01b1165ff49a6a43a5f40dffd0c83282cfa43d8c --- /dev/null +++ b/data/src/elevenlabs/types/mock_no_match_behavior.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MockNoMatchBehavior = typing.Union[typing.Literal["call_real_tool", "raise_error"], typing.Any] diff --git a/data/src/elevenlabs/types/mocking_strategy.py b/data/src/elevenlabs/types/mocking_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..009268b494ff46cc3b8c37ecffffd257f435b02a --- /dev/null +++ b/data/src/elevenlabs/types/mocking_strategy.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MockingStrategy = typing.Union[typing.Literal["all", "selected", "none"], typing.Any] diff --git a/data/src/elevenlabs/types/model.py b/data/src/elevenlabs/types/model.py new file mode 100644 index 0000000000000000000000000000000000000000..882b4338ac826852d5a37efd1bbc9d5f910c3a0f --- /dev/null +++ b/data/src/elevenlabs/types/model.py @@ -0,0 +1,105 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .language_response import LanguageResponse +from .model_rates_response_model import ModelRatesResponseModel + + +class Model(UncheckedBaseModel): + model_id: str = pydantic.Field() + """ + The unique identifier of the model. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the model. + """ + + can_be_finetuned: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model can be finetuned. + """ + + can_do_text_to_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model can do text-to-speech. + """ + + can_do_voice_conversion: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model can do voice conversion. + """ + + can_use_style: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model can use style. + """ + + can_use_speaker_boost: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model can use speaker boost. + """ + + serves_pro_voices: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model serves pro voices. + """ + + token_cost_factor: typing.Optional[float] = pydantic.Field(default=None) + """ + The cost factor for the model. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the model. + """ + + requires_alpha_access: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model requires alpha access. + """ + + max_characters_request_free_user: typing.Optional[int] = pydantic.Field(default=None) + """ + Deprecated. Not enforced; use `maximum_text_length_per_request` instead. + """ + + max_characters_request_subscribed_user: typing.Optional[int] = pydantic.Field(default=None) + """ + Deprecated. Not enforced; use `maximum_text_length_per_request` instead. + """ + + maximum_text_length_per_request: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum number of input text characters accepted per request for this model. Longer requests are rejected. + """ + + languages: typing.Optional[typing.List[LanguageResponse]] = pydantic.Field(default=None) + """ + The languages supported by the model. + """ + + model_rates: typing.Optional[ModelRatesResponseModel] = pydantic.Field(default=None) + """ + The rates for the model. + """ + + concurrency_group: typing.Optional[str] = pydantic.Field(default=None) + """ + The concurrency group for the model. + """ + + 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/data/src/elevenlabs/types/model_rates_response_model.py b/data/src/elevenlabs/types/model_rates_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c4893ed722d586a6c403ca8588a8715e37a42210 --- /dev/null +++ b/data/src/elevenlabs/types/model_rates_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ModelRatesResponseModel(UncheckedBaseModel): + character_cost_multiplier: float = pydantic.Field() + """ + The cost multiplier for characters. + """ + + cost_discount_multiplier: typing.Optional[float] = pydantic.Field(default=None) + """ + Discount multiplier applied to cost estimates. Defaults to 1.0 (no discount). + """ + + 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/data/src/elevenlabs/types/moderation_config.py b/data/src/elevenlabs/types/moderation_config.py new file mode 100644 index 0000000000000000000000000000000000000000..4dbe9a8afe4212379b226a351924d1a236c2ffbf --- /dev/null +++ b/data/src/elevenlabs/types/moderation_config.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .threshold_guardrail import ThresholdGuardrail + + +class ModerationConfig(UncheckedBaseModel): + sexual: typing.Optional[ThresholdGuardrail] = None + violence: typing.Optional[ThresholdGuardrail] = None + violence_graphic: typing.Optional[ThresholdGuardrail] = None + harassment: typing.Optional[ThresholdGuardrail] = None + harassment_threatening: typing.Optional[ThresholdGuardrail] = None + hate: typing.Optional[ThresholdGuardrail] = None + hate_threatening: typing.Optional[ThresholdGuardrail] = None + self_harm_instructions: typing.Optional[ThresholdGuardrail] = None + self_harm: typing.Optional[ThresholdGuardrail] = None + self_harm_intent: typing.Optional[ThresholdGuardrail] = None + sexual_minors: typing.Optional[ThresholdGuardrail] = 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/data/src/elevenlabs/types/moderation_guardrail_input.py b/data/src/elevenlabs/types/moderation_guardrail_input.py new file mode 100644 index 0000000000000000000000000000000000000000..b4bf0960320aeaac85622ed0697b4950098d35ea --- /dev/null +++ b/data/src/elevenlabs/types/moderation_guardrail_input.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .guardrail_execution_mode import GuardrailExecutionMode +from .moderation_config import ModerationConfig + + +class ModerationGuardrailInput(UncheckedBaseModel): + execution_mode: typing.Optional[GuardrailExecutionMode] = None + config: typing.Optional[ModerationConfig] = 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/data/src/elevenlabs/types/moderation_guardrail_output.py b/data/src/elevenlabs/types/moderation_guardrail_output.py new file mode 100644 index 0000000000000000000000000000000000000000..604bf6360e2e0b3b1c8d9cc233b2a8095517994a --- /dev/null +++ b/data/src/elevenlabs/types/moderation_guardrail_output.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .guardrail_execution_mode import GuardrailExecutionMode +from .moderation_config import ModerationConfig + + +class ModerationGuardrailOutput(UncheckedBaseModel): + execution_mode: typing.Optional[GuardrailExecutionMode] = None + config: typing.Optional[ModerationConfig] = 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/data/src/elevenlabs/types/moderation_status_response_model.py b/data/src/elevenlabs/types/moderation_status_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..414d8066b3388b92e243a7951168c487ec1f9f81 --- /dev/null +++ b/data/src/elevenlabs/types/moderation_status_response_model.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .moderation_status_response_model_safety_status import ModerationStatusResponseModelSafetyStatus +from .moderation_status_response_model_warning_status import ModerationStatusResponseModelWarningStatus + + +class ModerationStatusResponseModel(UncheckedBaseModel): + is_in_probation: bool = pydantic.Field() + """ + Whether the user is in probation. + """ + + enterprise_check_nogo_voice: bool = pydantic.Field() + """ + Whether the user's enterprise check nogo voice is enabled. + """ + + enterprise_check_block_nogo_voice: bool = pydantic.Field() + """ + Whether the user's enterprise check block nogo voice is enabled. + """ + + never_live_moderate: bool = pydantic.Field() + """ + Whether the user's never live moderate is enabled. + """ + + nogo_voice_similar_voice_upload_count: int = pydantic.Field() + """ + The number of similar voice uploads that have been blocked. + """ + + enterprise_background_moderation_enabled: bool = pydantic.Field() + """ + Whether the user's enterprise background moderation is enabled. + """ + + is_ivc_captcha_required: bool = pydantic.Field() + """ + Whether captcha is required when creating IVCs. + """ + + safety_status: typing.Optional[ModerationStatusResponseModelSafetyStatus] = pydantic.Field(default=None) + """ + The safety status of the user. + """ + + warning_status: typing.Optional[ModerationStatusResponseModelWarningStatus] = pydantic.Field(default=None) + """ + The warning status of the user. + """ + + on_watchlist: bool = pydantic.Field() + """ + Whether the user is on the watchlist. + """ + + 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/data/src/elevenlabs/types/moderation_status_response_model_safety_status.py b/data/src/elevenlabs/types/moderation_status_response_model_safety_status.py new file mode 100644 index 0000000000000000000000000000000000000000..cb0591b4d0f48a150592186653b896843ffda4a1 --- /dev/null +++ b/data/src/elevenlabs/types/moderation_status_response_model_safety_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ModerationStatusResponseModelSafetyStatus = typing.Union[ + typing.Literal["appeal_approved", "appeal_denied", "false_positive"], typing.Any +] diff --git a/data/src/elevenlabs/types/moderation_status_response_model_warning_status.py b/data/src/elevenlabs/types/moderation_status_response_model_warning_status.py new file mode 100644 index 0000000000000000000000000000000000000000..3869962f92aad298a95113edae466e01c30e9def --- /dev/null +++ b/data/src/elevenlabs/types/moderation_status_response_model_warning_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ModerationStatusResponseModelWarningStatus = typing.Union[typing.Literal["warning", "warning_cleared"], typing.Any] diff --git a/data/src/elevenlabs/types/mtls_auth_response.py b/data/src/elevenlabs/types/mtls_auth_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b375ca610ce41353a103b6b09fcc03c0ddb0c291 --- /dev/null +++ b/data/src/elevenlabs/types/mtls_auth_response.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class MtlsAuthResponse(UncheckedBaseModel): + """ + Response model for mTLS auth connections. + """ + + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/multichannel_speech_to_text_response_model.py b/data/src/elevenlabs/types/multichannel_speech_to_text_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..72911705305f791b55b584b1e64a9eee4fd1169b --- /dev/null +++ b/data/src/elevenlabs/types/multichannel_speech_to_text_response_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .speech_to_text_chunk_response_model import SpeechToTextChunkResponseModel + + +class MultichannelSpeechToTextResponseModel(UncheckedBaseModel): + """ + Response model for multichannel speech-to-text transcription. + """ + + transcripts: typing.List[SpeechToTextChunkResponseModel] = pydantic.Field() + """ + List of transcripts, one for each audio channel. Each transcript contains the text and word-level details for its respective channel. + """ + + transcription_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The transcription ID of the response. + """ + + audio_duration_secs: typing.Optional[float] = pydantic.Field(default=None) + """ + The duration of the audio that was transcribed across all channels in seconds. + """ + + 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/data/src/elevenlabs/types/multipart_music_response.py b/data/src/elevenlabs/types/multipart_music_response.py new file mode 100644 index 0000000000000000000000000000000000000000..f51df48020145ebec626652cfa6ef3ff952c2803 --- /dev/null +++ b/data/src/elevenlabs/types/multipart_music_response.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .detailed_music_response import DetailedMusicResponse + + +class MultipartMusicResponse(UncheckedBaseModel): + """ + Multipart response structure with JSON metadata and binary audio + """ + + metadata: DetailedMusicResponse = pydantic.Field() + """ + JSON metadata about the generated audio + """ + + audio: bytes = pydantic.Field() + """ + Binary audio data in the requested format + """ + + 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/data/src/elevenlabs/types/music_allowed_output_formats.py b/data/src/elevenlabs/types/music_allowed_output_formats.py new file mode 100644 index 0000000000000000000000000000000000000000..26a3b5caeda7d3a3f0c9693c85c0bcef42f87993 --- /dev/null +++ b/data/src/elevenlabs/types/music_allowed_output_formats.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .allowed_output_formats import AllowedOutputFormats +from .music_only_output_formats import MusicOnlyOutputFormats + +MusicAllowedOutputFormats = typing.Union[AllowedOutputFormats, MusicOnlyOutputFormats] diff --git a/data/src/elevenlabs/types/music_explore_song_source_context.py b/data/src/elevenlabs/types/music_explore_song_source_context.py new file mode 100644 index 0000000000000000000000000000000000000000..bc055d1d21651632568486d9675f6b4ffedee3c3 --- /dev/null +++ b/data/src/elevenlabs/types/music_explore_song_source_context.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class MusicExploreSongSourceContext(UncheckedBaseModel): + music_explore_song_id: str + title: typing.Optional[str] = None + description: typing.Optional[str] = None + bpm: typing.Optional[int] = None + vocals: typing.Optional[str] = None + lyrics: 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/data/src/elevenlabs/types/music_finetune_failure_reason.py b/data/src/elevenlabs/types/music_finetune_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..e6abff70cd45c995c7e7171547e3a47ee87b4c19 --- /dev/null +++ b/data/src/elevenlabs/types/music_finetune_failure_reason.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicFinetuneFailureReason = typing.Union[ + typing.Literal["audio_processing_failed", "copyright_violation", "training_failed"], typing.Any +] diff --git a/data/src/elevenlabs/types/music_finetune_page_response_model.py b/data/src/elevenlabs/types/music_finetune_page_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..818437bf5c5274bcf1953766835312970dc12e3a --- /dev/null +++ b/data/src/elevenlabs/types/music_finetune_page_response_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .music_finetune_response_model import MusicFinetuneResponseModel + + +class MusicFinetunePageResponseModel(UncheckedBaseModel): + finetunes: typing.List[MusicFinetuneResponseModel] = pydantic.Field() + """ + The finetunes in this page. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Cursor to pass as `cursor` to fetch the next page; `null` when there are no more results. + """ + + has_more: bool = pydantic.Field() + """ + Whether more finetunes are available beyond this page. + """ + + 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/data/src/elevenlabs/types/music_finetune_response_model.py b/data/src/elevenlabs/types/music_finetune_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ba76a09ea3eddebb353ee202bbd02cd9586d2666 --- /dev/null +++ b/data/src/elevenlabs/types/music_finetune_response_model.py @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .finetune_created_by import FinetuneCreatedBy +from .finetune_visibility import FinetuneVisibility +from .music_finetune_failure_reason import MusicFinetuneFailureReason +from .music_finetune_status import MusicFinetuneStatus + + +class MusicFinetuneResponseModel(UncheckedBaseModel): + id: str = pydantic.Field() + """ + Unique identifier of the finetune. + """ + + name: str = pydantic.Field() + """ + Name of the finetune. + """ + + tags: typing.List[str] = pydantic.Field() + """ + Tags associated with the finetune. + """ + + primary_genre: typing.Optional[str] = pydantic.Field(default=None) + """ + Primary musical genre of the finetune. + """ + + model_id: str = pydantic.Field() + """ + The base music model the finetune was trained on. + """ + + created_at: dt.datetime = pydantic.Field() + """ + When the finetune was created (UTC). + """ + + visibility: FinetuneVisibility = pydantic.Field() + """ + Who can access this finetune: `private` (only you), `workspace` (members of your workspace), `public` (ElevenLabs-curated, available to everyone). + """ + + created_by: FinetuneCreatedBy = pydantic.Field() + """ + Who created the finetune: `self`, `workspace`, or `elevenlabs`. + """ + + status: MusicFinetuneStatus = pydantic.Field() + """ + Training lifecycle status: pending, in_progress, completed, failed, and blocked. + """ + + training_progress: float = pydantic.Field() + """ + Training progress from 0.0 to 1.0. + """ + + failure_reason: typing.Optional[MusicFinetuneFailureReason] = pydantic.Field(default=None) + """ + Reason the finetune failed or was blocked, if applicable. + """ + + 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/data/src/elevenlabs/types/music_finetune_status.py b/data/src/elevenlabs/types/music_finetune_status.py new file mode 100644 index 0000000000000000000000000000000000000000..f6748f60e4514401b6e07d4e03c46cde39606c03 --- /dev/null +++ b/data/src/elevenlabs/types/music_finetune_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicFinetuneStatus = typing.Union[ + typing.Literal["pending", "in_progress", "completed", "failed", "blocked"], typing.Any +] diff --git a/data/src/elevenlabs/types/music_generation_mode.py b/data/src/elevenlabs/types/music_generation_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..45ff3a38ddd0209ece404de749d245e7a1b5b99a --- /dev/null +++ b/data/src/elevenlabs/types/music_generation_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicGenerationMode = typing.Union[typing.Literal["track", "loop", "ambience", "video_to_music"], typing.Any] diff --git a/data/src/elevenlabs/types/music_model_id.py b/data/src/elevenlabs/types/music_model_id.py new file mode 100644 index 0000000000000000000000000000000000000000..8b34ec9973549f036a040cae2f1d16daf98f0ea0 --- /dev/null +++ b/data/src/elevenlabs/types/music_model_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicModelId = typing.Union[typing.Literal["music_v1", "music_v2", "music_v2_5"], typing.Any] diff --git a/data/src/elevenlabs/types/music_only_output_formats.py b/data/src/elevenlabs/types/music_only_output_formats.py new file mode 100644 index 0000000000000000000000000000000000000000..819652d5b1133eaed447c1fc2ad404e40edfefeb --- /dev/null +++ b/data/src/elevenlabs/types/music_only_output_formats.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +MusicOnlyOutputFormats = typing.Union[ + typing.Literal["mp3_48000_128", "mp3_48000_192", "mp3_48000_240", "mp3_48000_320"], typing.Any +] diff --git a/data/src/elevenlabs/types/music_output_format.py b/data/src/elevenlabs/types/music_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..33bf00e7f574a9ee9278e87b2a14cff683e7c21c --- /dev/null +++ b/data/src/elevenlabs/types/music_output_format.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .music_allowed_output_formats import MusicAllowedOutputFormats + +MusicOutputFormat = typing.Union[MusicAllowedOutputFormats, typing.Literal["auto"]] diff --git a/data/src/elevenlabs/types/music_prompt.py b/data/src/elevenlabs/types/music_prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..51007a1ab2bdc0772895f87649928d399f07c5af --- /dev/null +++ b/data/src/elevenlabs/types/music_prompt.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .song_section import SongSection + + +class MusicPrompt(UncheckedBaseModel): + """ + Composition plan for the `music_v1` model. Using this field with any other model will result in an error. + """ + + positive_global_styles: typing.List[str] = pydantic.Field() + """ + The styles and musical directions that should be present in the entire song. Use English language for best result. + """ + + negative_global_styles: typing.List[str] = pydantic.Field() + """ + The styles and musical directions that should not be present in the entire song. Use English language for best result. + """ + + sections: typing.List[SongSection] = pydantic.Field() + """ + The sections of the song. + """ + + 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/data/src/elevenlabs/types/music_upload_response.py b/data/src/elevenlabs/types/music_upload_response.py new file mode 100644 index 0000000000000000000000000000000000000000..8bf0dc68995f781cc116f9949401d8c16f552f9c --- /dev/null +++ b/data/src/elevenlabs/types/music_upload_response.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .music_upload_response_composition_plan import MusicUploadResponseCompositionPlan +from .word_timestamp import WordTimestamp + + +class MusicUploadResponse(UncheckedBaseModel): + """ + Response model for music upload endpoint. + """ + + song_id: str = pydantic.Field() + """ + Unique identifier for the uploaded song + """ + + composition_plan: typing.Optional[MusicUploadResponseCompositionPlan] = pydantic.Field(default=None) + """ + The composition plan extracted from the uploaded song. Only present if `extract_composition_plan` was provided in the request body. + """ + + words_timestamps: typing.Optional[typing.List[WordTimestamp]] = pydantic.Field(default=None) + """ + Word-level timestamps transcribed from the uploaded song. Only present if `with_timestamps` was True in the request body + """ + + waveform_visual: typing.Optional[typing.List[int]] = pydantic.Field(default=None) + """ + A low-resolution waveform of the uploaded song, for showing a preview of it. Holds 4 values per second of audio, from -1000 to 1000. Stereo is mixed down to a single channel. Only present if `with_waveform_visual` was True in the request body. + """ + + 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/data/src/elevenlabs/types/music_upload_response_composition_plan.py b/data/src/elevenlabs/types/music_upload_response_composition_plan.py new file mode 100644 index 0000000000000000000000000000000000000000..229104e1e09b5b08e96ae88cfd8d9687200956fa --- /dev/null +++ b/data/src/elevenlabs/types/music_upload_response_composition_plan.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .composition_plan import CompositionPlan +from .music_prompt import MusicPrompt + +MusicUploadResponseCompositionPlan = typing.Union[MusicPrompt, CompositionPlan] diff --git a/data/src/elevenlabs/types/non_streaming_output_formats.py b/data/src/elevenlabs/types/non_streaming_output_formats.py new file mode 100644 index 0000000000000000000000000000000000000000..42b4b54ff27302ba34c4196de3b8b445680bb588 --- /dev/null +++ b/data/src/elevenlabs/types/non_streaming_output_formats.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +NonStreamingOutputFormats = typing.Union[ + typing.Literal["wav_8000", "wav_16000", "wav_22050", "wav_24000", "wav_32000", "wav_44100", "wav_48000"], typing.Any +] diff --git a/data/src/elevenlabs/types/normalized_alignment.py b/data/src/elevenlabs/types/normalized_alignment.py new file mode 100644 index 0000000000000000000000000000000000000000..18329c6d6cbc55651c46fe9f8c0e075614a3b8dd --- /dev/null +++ b/data/src/elevenlabs/types/normalized_alignment.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class NormalizedAlignment(UncheckedBaseModel): + """ + Alignment information for the generated audio given the input normalized text sequence. + """ + + char_start_times_ms: typing_extensions.Annotated[ + typing.Optional[typing.List[int]], + FieldMetadata(alias="charStartTimesMs"), + pydantic.Field( + alias="charStartTimesMs", + description="A list of starting times (in milliseconds) for each character in the normalized text as it\ncorresponds to the audio. For instance, the character 'H' starts at time 0 ms in the audio.\nNote these times are relative to the returned chunk from the model, and not the\nfull audio response.", + ), + ] = None + char_durations_ms: typing_extensions.Annotated[ + typing.Optional[typing.List[int]], + FieldMetadata(alias="charDurationsMs"), + pydantic.Field( + alias="charDurationsMs", + description="A list of durations (in milliseconds) for each character in the normalized text as it\ncorresponds to the audio. For instance, the character 'H' lasts for 3 ms in the audio.\nNote these times are relative to the returned chunk from the model, and not the\nfull audio response.", + ), + ] = None + chars: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of characters in the normalized text sequence. For instance, the first character is 'H'. + Note that this list may contain spaces, punctuation, and other special characters. + The length of this list should be the same as the lengths of `charStartTimesMs` and `charDurationsMs`. + """ + + 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/data/src/elevenlabs/types/number_schema.py b/data/src/elevenlabs/types/number_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..f5492555e4b9533e5808242eb4b47ca2e396a054 --- /dev/null +++ b/data/src/elevenlabs/types/number_schema.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class NumberSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: typing.Optional[str] = None + enum: typing.Optional[typing.List[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/data/src/elevenlabs/types/numeric_distribution_aggregate.py b/data/src/elevenlabs/types/numeric_distribution_aggregate.py new file mode 100644 index 0000000000000000000000000000000000000000..0b4871502dd12c902556e7f5a2af6f134da9371e --- /dev/null +++ b/data/src/elevenlabs/types/numeric_distribution_aggregate.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class NumericDistributionAggregate(UncheckedBaseModel): + count: typing.Optional[int] = None + sum: typing.Optional[float] = None + min: typing.Optional[float] = None + max: 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/data/src/elevenlabs/types/o_auth_2_client_creds_response.py b/data/src/elevenlabs/types/o_auth_2_client_creds_response.py new file mode 100644 index 0000000000000000000000000000000000000000..acba4927979aa51af43bcc33b67fdce319d38dc3 --- /dev/null +++ b/data/src/elevenlabs/types/o_auth_2_client_creds_response.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class OAuth2ClientCredsResponse(UncheckedBaseModel): + """ + Response model for oauth2 client creds + """ + + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + basic_auth_in_header: typing.Optional[bool] = pydantic.Field(default=None) + """ + If True, send client credentials in Authorization header as Basic Auth instead of request body + """ + + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: typing.Optional[str] = None + custom_headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Custom headers configured for OAuth2 token requests + """ + + 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/data/src/elevenlabs/types/o_auth_2_jwt_response.py b/data/src/elevenlabs/types/o_auth_2_jwt_response.py new file mode 100644 index 0000000000000000000000000000000000000000..c9e1750a753f1011b10e3085292771b6389ac373 --- /dev/null +++ b/data/src/elevenlabs/types/o_auth_2_jwt_response.py @@ -0,0 +1,84 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus +from .o_auth_2_jwt_response_algorithm import OAuth2JwtResponseAlgorithm +from .o_auth_2_jwt_response_token_response_field import OAuth2JwtResponseTokenResponseField + + +class OAuth2JwtResponse(UncheckedBaseModel): + """ + Response model for OAuth2 JWT auth connections + """ + + name: str + provider: str + algorithm: typing.Optional[OAuth2JwtResponseAlgorithm] = pydantic.Field(default=None) + """ + JWT signing algorithm + """ + + key_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Key ID (kid) for JWT header - useful for key rotation + """ + + issuer: str = pydantic.Field() + """ + JWT issuer (iss claim) + """ + + audience: str = pydantic.Field() + """ + JWT audience (aud claim) + """ + + subject: str = pydantic.Field() + """ + JWT subject (sub claim) + """ + + expiration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + Token expiration time in seconds + """ + + extra_params: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Additional custom claims to include in the JWT + """ + + token_url: str = pydantic.Field() + """ + Token endpoint URL for exchanging JWT for access token + """ + + scopes: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + OAuth2 scopes to request when exchanging JWT for access token + """ + + token_response_field: typing.Optional[OAuth2JwtResponseTokenResponseField] = pydantic.Field(default=None) + """ + Token field to extract from the token endpoint response. + """ + + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/o_auth_2_jwt_response_algorithm.py b/data/src/elevenlabs/types/o_auth_2_jwt_response_algorithm.py new file mode 100644 index 0000000000000000000000000000000000000000..5819ba32d2a60973398a5380aa136fb50b0d42fd --- /dev/null +++ b/data/src/elevenlabs/types/o_auth_2_jwt_response_algorithm.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OAuth2JwtResponseAlgorithm = typing.Union[ + typing.Literal["HS256", "HS384", "HS512", "RS256", "RS384", "RS512"], typing.Any +] diff --git a/data/src/elevenlabs/types/o_auth_2_jwt_response_token_response_field.py b/data/src/elevenlabs/types/o_auth_2_jwt_response_token_response_field.py new file mode 100644 index 0000000000000000000000000000000000000000..c335979190bb543d04cdfbce6f84f76e6be22330 --- /dev/null +++ b/data/src/elevenlabs/types/o_auth_2_jwt_response_token_response_field.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OAuth2JwtResponseTokenResponseField = typing.Union[typing.Literal["access_token", "id_token"], typing.Any] diff --git a/data/src/elevenlabs/types/o_tel_attribute.py b/data/src/elevenlabs/types/o_tel_attribute.py new file mode 100644 index 0000000000000000000000000000000000000000..66ba19c461dbf05cf1df7f71029fa0723dc843b9 --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_attribute.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .o_tel_attribute_value_value import OTelAttributeValueValue + + +class OTelAttribute(UncheckedBaseModel): + key: str + value: typing.Dict[str, OTelAttributeValueValue] + + 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/data/src/elevenlabs/types/o_tel_attribute_value_value.py b/data/src/elevenlabs/types/o_tel_attribute_value_value.py new file mode 100644 index 0000000000000000000000000000000000000000..fd602ab2b3dc5518a1d47e315ebd5028ff56ca99 --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_attribute_value_value.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OTelAttributeValueValue = typing.Union[str, bool, float] diff --git a/data/src/elevenlabs/types/o_tel_resource.py b/data/src/elevenlabs/types/o_tel_resource.py new file mode 100644 index 0000000000000000000000000000000000000000..074f5437959a28b927fe9b8cb115285c1b1ff3fc --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_resource.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .o_tel_attribute import OTelAttribute + + +class OTelResource(UncheckedBaseModel): + attributes: typing.List[OTelAttribute] + + 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/data/src/elevenlabs/types/o_tel_resource_spans.py b/data/src/elevenlabs/types/o_tel_resource_spans.py new file mode 100644 index 0000000000000000000000000000000000000000..7d1308fe71bb34a658c17fb2cfd1e30c3a640c98 --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_resource_spans.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .o_tel_resource import OTelResource +from .o_tel_scope_spans import OTelScopeSpans + + +class OTelResourceSpans(UncheckedBaseModel): + resource: OTelResource + scope_spans: typing_extensions.Annotated[ + typing.List[OTelScopeSpans], FieldMetadata(alias="scopeSpans"), pydantic.Field(alias="scopeSpans") + ] + + 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/data/src/elevenlabs/types/o_tel_scope.py b/data/src/elevenlabs/types/o_tel_scope.py new file mode 100644 index 0000000000000000000000000000000000000000..1e23e59c319a3bb15634473de50f0166862eb1f8 --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_scope.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OTelScope(UncheckedBaseModel): + name: str + version: 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/data/src/elevenlabs/types/o_tel_scope_spans.py b/data/src/elevenlabs/types/o_tel_scope_spans.py new file mode 100644 index 0000000000000000000000000000000000000000..ec666559089840af634cfe40d2ca7d629011045e --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_scope_spans.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .o_tel_scope import OTelScope +from .o_tel_span import OTelSpan + + +class OTelScopeSpans(UncheckedBaseModel): + scope: OTelScope + spans: typing.List[OTelSpan] + + 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/data/src/elevenlabs/types/o_tel_span.py b/data/src/elevenlabs/types/o_tel_span.py new file mode 100644 index 0000000000000000000000000000000000000000..1decb17d3a68fd9bd07d0158c88a5b70d6954817 --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_span.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .o_tel_attribute import OTelAttribute +from .o_tel_status import OTelStatus + + +class OTelSpan(UncheckedBaseModel): + trace_id: typing_extensions.Annotated[str, FieldMetadata(alias="traceId"), pydantic.Field(alias="traceId")] + span_id: typing_extensions.Annotated[str, FieldMetadata(alias="spanId"), pydantic.Field(alias="spanId")] + parent_span_id: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="parentSpanId"), pydantic.Field(alias="parentSpanId") + ] = None + name: str + kind: int + start_time_unix_nano: typing_extensions.Annotated[ + str, FieldMetadata(alias="startTimeUnixNano"), pydantic.Field(alias="startTimeUnixNano") + ] + end_time_unix_nano: typing_extensions.Annotated[ + str, FieldMetadata(alias="endTimeUnixNano"), pydantic.Field(alias="endTimeUnixNano") + ] + attributes: typing.List[OTelAttribute] + status: OTelStatus + + 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/data/src/elevenlabs/types/o_tel_status.py b/data/src/elevenlabs/types/o_tel_status.py new file mode 100644 index 0000000000000000000000000000000000000000..c22f4133107cd8a8aa6e70261060acdcdd53c784 --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_status.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OTelStatus(UncheckedBaseModel): + code: int + message: 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/data/src/elevenlabs/types/o_tel_trace_payload.py b/data/src/elevenlabs/types/o_tel_trace_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..12e6f8622d5d6ccd884751a61f3c55a371b0150e --- /dev/null +++ b/data/src/elevenlabs/types/o_tel_trace_payload.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .o_tel_resource_spans import OTelResourceSpans + + +class OTelTracePayload(UncheckedBaseModel): + resource_spans: typing_extensions.Annotated[ + typing.List[OTelResourceSpans], FieldMetadata(alias="resourceSpans"), pydantic.Field(alias="resourceSpans") + ] + + 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/data/src/elevenlabs/types/object_json_schema_property_input.py b/data/src/elevenlabs/types/object_json_schema_property_input.py new file mode 100644 index 0000000000000000000000000000000000000000..fa84c0e2aa97e76e162c9e6aa0463b85e45f1e63 --- /dev/null +++ b/data/src/elevenlabs/types/object_json_schema_property_input.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .object_json_schema_property_input_property_kind import ObjectJsonSchemaPropertyInputPropertyKind +from .required_constraints import RequiredConstraints + + +class ObjectJsonSchemaPropertyInput(UncheckedBaseModel): + property_kind: typing.Optional[ObjectJsonSchemaPropertyInputPropertyKind] = None + description: typing.Optional[str] = None + dynamic_variable: typing.Optional[str] = pydantic.Field(default=None) + """ + When set, the entire parameter is populated from this dynamic variable at runtime. Mutually exclusive with description (LLM-provided value), constant_value, and is_omitted. + """ + + constant_value: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + When set, the entire object uses this constant JSON value at runtime. Mutually exclusive with description (LLM-provided object), dynamic_variable, and is_omitted. + """ + + is_omitted: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, this parameter will be completely omitted from the request. Only valid for optional parameters. Mutually exclusive with description, dynamic_variable, and constant_value. + """ + + type: typing.Optional[typing.Literal["object"]] = None + required: typing.Optional[typing.List[str]] = None + properties: typing.Optional[typing.Dict[str, "ObjectJsonSchemaPropertyInputPropertiesValue"]] = None + required_constraints: typing.Optional[RequiredConstraints] = 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 + + +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, I001 +from .array_json_schema_property_input_items import ArrayJsonSchemaPropertyInputItems # noqa: E402, I001 +from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + ObjectJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInput=ArrayJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInputItems=ArrayJsonSchemaPropertyInputItems, + ObjectJsonSchemaPropertyInputPropertiesValue=ObjectJsonSchemaPropertyInputPropertiesValue, +) diff --git a/data/src/elevenlabs/types/object_json_schema_property_input_properties_value.py b/data/src/elevenlabs/types/object_json_schema_property_input_properties_value.py new file mode 100644 index 0000000000000000000000000000000000000000..c423b0ae7193581d075d1dd58079328b9c3774f6 --- /dev/null +++ b/data/src/elevenlabs/types/object_json_schema_property_input_properties_value.py @@ -0,0 +1,14 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .literal_json_schema_property import LiteralJsonSchemaProperty + +if typing.TYPE_CHECKING: + from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput + from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput +ObjectJsonSchemaPropertyInputPropertiesValue = typing.Union[ + LiteralJsonSchemaProperty, "ObjectJsonSchemaPropertyInput", "ArrayJsonSchemaPropertyInput" +] diff --git a/data/src/elevenlabs/types/object_json_schema_property_input_property_kind.py b/data/src/elevenlabs/types/object_json_schema_property_input_property_kind.py new file mode 100644 index 0000000000000000000000000000000000000000..46b0ec4e331c121fe566f6eff94c3683c4729dfe --- /dev/null +++ b/data/src/elevenlabs/types/object_json_schema_property_input_property_kind.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ObjectJsonSchemaPropertyInputPropertyKind = typing.Union[typing.Literal["array", "object"], typing.Any] diff --git a/data/src/elevenlabs/types/object_json_schema_property_output.py b/data/src/elevenlabs/types/object_json_schema_property_output.py new file mode 100644 index 0000000000000000000000000000000000000000..9d1624b07c0b6bcf9f1738b4ae82283f65b53dbf --- /dev/null +++ b/data/src/elevenlabs/types/object_json_schema_property_output.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .required_constraints import RequiredConstraints + + +class ObjectJsonSchemaPropertyOutput(UncheckedBaseModel): + description: typing.Optional[str] = None + dynamic_variable: typing.Optional[str] = pydantic.Field(default=None) + """ + When set, the entire parameter is populated from this dynamic variable at runtime. Mutually exclusive with description (LLM-provided value), constant_value, and is_omitted. + """ + + constant_value: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + When set, the entire object uses this constant JSON value at runtime. Mutually exclusive with description (LLM-provided object), dynamic_variable, and is_omitted. + """ + + is_omitted: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, this parameter will be completely omitted from the request. Only valid for optional parameters. Mutually exclusive with description, dynamic_variable, and constant_value. + """ + + type: typing.Optional[typing.Literal["object"]] = None + required: typing.Optional[typing.List[str]] = None + properties: typing.Optional[typing.Dict[str, "ObjectJsonSchemaPropertyOutputPropertiesValue"]] = None + required_constraints: typing.Optional[RequiredConstraints] = 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 + + +from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, I001 +from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems # noqa: E402, I001 +from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + ObjectJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutput=ArrayJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems, + ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue, +) diff --git a/data/src/elevenlabs/types/object_json_schema_property_output_properties_value.py b/data/src/elevenlabs/types/object_json_schema_property_output_properties_value.py new file mode 100644 index 0000000000000000000000000000000000000000..bb463ec98738f3997602c3c7fbe0252edd4029c0 --- /dev/null +++ b/data/src/elevenlabs/types/object_json_schema_property_output_properties_value.py @@ -0,0 +1,14 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .literal_json_schema_property import LiteralJsonSchemaProperty + +if typing.TYPE_CHECKING: + from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput + from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput +ObjectJsonSchemaPropertyOutputPropertiesValue = typing.Union[ + LiteralJsonSchemaProperty, "ObjectJsonSchemaPropertyOutput", "ArrayJsonSchemaPropertyOutput" +] diff --git a/data/src/elevenlabs/types/object_schema.py b/data/src/elevenlabs/types/object_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..e83c5cba7dfdb0e5f17c3129d5ed88943d68a0d1 --- /dev/null +++ b/data/src/elevenlabs/types/object_schema.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ObjectSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: typing.Optional[str] = None + properties: typing.Optional[typing.Dict[str, "ContentSchema"]] = None + required: typing.Optional[typing.List[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 + + +from .array_schema import ArraySchema # noqa: E402, I001 +from .content_schema import ContentSchema # noqa: E402, I001 + +update_forward_refs(ObjectSchema, ArraySchema=ArraySchema, ContentSchema=ContentSchema) diff --git a/data/src/elevenlabs/types/omit_schema_override.py b/data/src/elevenlabs/types/omit_schema_override.py new file mode 100644 index 0000000000000000000000000000000000000000..7589c06a0c35a1d06b788af98a0c4d5c5335cdd9 --- /dev/null +++ b/data/src/elevenlabs/types/omit_schema_override.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OmitSchemaOverride(UncheckedBaseModel): + 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/data/src/elevenlabs/types/open_ai_audio_config_input.py b/data/src/elevenlabs/types/open_ai_audio_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..6f554ae7bf7e4251488f0691492fa35e652be43e --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_config_input.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_audio_input_config_input import OpenAiAudioInputConfigInput +from .open_ai_audio_output_config_input import OpenAiAudioOutputConfigInput + + +class OpenAiAudioConfigInput(UncheckedBaseModel): + input: typing.Optional[OpenAiAudioInputConfigInput] = None + output: typing.Optional[OpenAiAudioOutputConfigInput] = 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/data/src/elevenlabs/types/open_ai_audio_config_output.py b/data/src/elevenlabs/types/open_ai_audio_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..1b7f1e1c7f4c7d4c2bae54a7037f0c7b7647baad --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_config_output.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_audio_input_config_output import OpenAiAudioInputConfigOutput +from .open_ai_audio_output_config_output import OpenAiAudioOutputConfigOutput + + +class OpenAiAudioConfigOutput(UncheckedBaseModel): + input: typing.Optional[OpenAiAudioInputConfigOutput] = None + output: typing.Optional[OpenAiAudioOutputConfigOutput] = 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/data/src/elevenlabs/types/open_ai_audio_format.py b/data/src/elevenlabs/types/open_ai_audio_format.py new file mode 100644 index 0000000000000000000000000000000000000000..ffde5984967340543fdf6d4bdb6929b9d415193b --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OpenAiAudioFormat = typing.Union[typing.Literal["audio/pcm", "audio/pcmu", "audio/pcma"], typing.Any] diff --git a/data/src/elevenlabs/types/open_ai_audio_input_config_input.py b/data/src/elevenlabs/types/open_ai_audio_input_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..384216127197de94e918c0eaf2bd963120e2b8a9 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_input_config_input.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_input_pacing import AudioInputPacing +from .open_ai_audio_input_format import OpenAiAudioInputFormat +from .open_ai_audio_input_transcription import OpenAiAudioInputTranscription +from .open_ai_turn_detection import OpenAiTurnDetection + + +class OpenAiAudioInputConfigInput(UncheckedBaseModel): + format: typing.Optional[OpenAiAudioInputFormat] = None + transcription: typing.Optional[OpenAiAudioInputTranscription] = None + turn_detection: typing.Optional[OpenAiTurnDetection] = None + pacing: typing.Optional[AudioInputPacing] = 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/data/src/elevenlabs/types/open_ai_audio_input_config_output.py b/data/src/elevenlabs/types/open_ai_audio_input_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..c01d91a32bf615735b367ca7ece0e72b4ec2d461 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_input_config_output.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_input_pacing import AudioInputPacing +from .open_ai_audio_input_format import OpenAiAudioInputFormat +from .open_ai_audio_input_transcription import OpenAiAudioInputTranscription +from .open_ai_turn_detection import OpenAiTurnDetection + + +class OpenAiAudioInputConfigOutput(UncheckedBaseModel): + format: typing.Optional[OpenAiAudioInputFormat] = None + transcription: typing.Optional[OpenAiAudioInputTranscription] = None + turn_detection: typing.Optional[OpenAiTurnDetection] = None + pacing: typing.Optional[AudioInputPacing] = 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/data/src/elevenlabs/types/open_ai_audio_input_format.py b/data/src/elevenlabs/types/open_ai_audio_input_format.py new file mode 100644 index 0000000000000000000000000000000000000000..d6509a5590099fb27f6ea1784f733130d1dd95a2 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_input_format.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_audio_format import OpenAiAudioFormat + + +class OpenAiAudioInputFormat(UncheckedBaseModel): + type: typing.Optional[OpenAiAudioFormat] = None + rate: typing.Optional[int] = 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/data/src/elevenlabs/types/open_ai_audio_input_transcription.py b/data/src/elevenlabs/types/open_ai_audio_input_transcription.py new file mode 100644 index 0000000000000000000000000000000000000000..702af2a6c1c81a8b4121179af93e3af88d101f71 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_input_transcription.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OpenAiAudioInputTranscription(UncheckedBaseModel): + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Language code of the conversation (e.g. en, es, pt-br), used for transcription, speech and the model's reply language. Defaults to en. + """ + + 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/data/src/elevenlabs/types/open_ai_audio_output_config_input.py b/data/src/elevenlabs/types/open_ai_audio_output_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..be1abe6d82888c87deae32db8188e2287a3336fc --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_output_config_input.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_audio_output_format import OpenAiAudioOutputFormat + + +class OpenAiAudioOutputConfigInput(UncheckedBaseModel): + format: typing.Optional[OpenAiAudioOutputFormat] = None + voice: 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/data/src/elevenlabs/types/open_ai_audio_output_config_output.py b/data/src/elevenlabs/types/open_ai_audio_output_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..8dc1584dcc1a894f00218c524b0284426b359b06 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_output_config_output.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_audio_output_format import OpenAiAudioOutputFormat + + +class OpenAiAudioOutputConfigOutput(UncheckedBaseModel): + format: typing.Optional[OpenAiAudioOutputFormat] = None + voice: 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/data/src/elevenlabs/types/open_ai_audio_output_format.py b/data/src/elevenlabs/types/open_ai_audio_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..322330490a01a57373b72532aa89bf83ee140735 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_audio_output_format.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_audio_format import OpenAiAudioFormat + + +class OpenAiAudioOutputFormat(UncheckedBaseModel): + type: typing.Optional[OpenAiAudioFormat] = 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/data/src/elevenlabs/types/open_ai_function_tool.py b/data/src/elevenlabs/types/open_ai_function_tool.py new file mode 100644 index 0000000000000000000000000000000000000000..7291269bbfb239406958848e0923fa4cef74fae0 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_function_tool.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OpenAiFunctionTool(UncheckedBaseModel): + name: str + description: typing.Optional[str] = None + parameters: typing.Optional[typing.Dict[str, typing.Any]] = 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/data/src/elevenlabs/types/open_ai_session_config_input.py b/data/src/elevenlabs/types/open_ai_session_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..504ee7db500b870e1aff43801f56d8b3babbf8ef --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_input.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_audio_config_input import OpenAiAudioConfigInput +from .open_ai_session_config_input_max_response_output_tokens import OpenAiSessionConfigInputMaxResponseOutputTokens +from .open_ai_session_config_input_tool_choice import OpenAiSessionConfigInputToolChoice +from .open_ai_session_config_input_tools_item import OpenAiSessionConfigInputToolsItem +from .open_ai_session_config_input_tracing import OpenAiSessionConfigInputTracing +from .open_ai_session_config_input_truncation import OpenAiSessionConfigInputTruncation +from .open_ai_session_config_input_turn_detection import OpenAiSessionConfigInputTurnDetection +from .realtime_model import RealtimeModel + + +class OpenAiSessionConfigInput(UncheckedBaseModel): + type: typing.Optional[typing.Literal["realtime"]] = None + model: typing.Optional[RealtimeModel] = None + instructions: typing.Optional[str] = None + output_modalities: typing.Optional[typing.List[str]] = None + audio: typing.Optional[OpenAiAudioConfigInput] = None + tools: typing.Optional[typing.List[OpenAiSessionConfigInputToolsItem]] = None + tool_choice: typing.Optional[OpenAiSessionConfigInputToolChoice] = None + temperature: typing.Optional[float] = None + max_response_output_tokens: typing.Optional[OpenAiSessionConfigInputMaxResponseOutputTokens] = None + max_duration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum wall-clock duration of the session in seconds. The session is closed with code 1000 once it is exceeded. + """ + + turn_detection: typing.Optional[OpenAiSessionConfigInputTurnDetection] = None + tracing: typing.Optional[OpenAiSessionConfigInputTracing] = None + include: typing.Optional[typing.List[str]] = None + parallel_tool_calls: typing.Optional[bool] = None + reasoning: typing.Optional[typing.Dict[str, typing.Any]] = None + truncation: typing.Optional[OpenAiSessionConfigInputTruncation] = None + prompt: typing.Optional[typing.Dict[str, typing.Any]] = 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/data/src/elevenlabs/types/open_ai_session_config_input_max_response_output_tokens.py b/data/src/elevenlabs/types/open_ai_session_config_input_max_response_output_tokens.py new file mode 100644 index 0000000000000000000000000000000000000000..8078e8f629e1efa400aedd23666ebc1b4d4b7790 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_input_max_response_output_tokens.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OpenAiSessionConfigInputMaxResponseOutputTokens = typing.Union[int, typing.Literal["inf"]] diff --git a/data/src/elevenlabs/types/open_ai_session_config_input_tool_choice.py b/data/src/elevenlabs/types/open_ai_session_config_input_tool_choice.py new file mode 100644 index 0000000000000000000000000000000000000000..e16f93dc200118f375350883b0b6d2504d68f711 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_input_tool_choice.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .open_ai_tool_choice_function import OpenAiToolChoiceFunction + +OpenAiSessionConfigInputToolChoice = typing.Union[str, OpenAiToolChoiceFunction] diff --git a/data/src/elevenlabs/types/open_ai_session_config_input_tools_item.py b/data/src/elevenlabs/types/open_ai_session_config_input_tools_item.py new file mode 100644 index 0000000000000000000000000000000000000000..41215cddc2284142e4b01e5a7493f6f0588802b8 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_input_tools_item.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .open_aimcp_tool_require_approval import OpenAimcpToolRequireApproval + + +class OpenAiSessionConfigInputToolsItem_Function(UncheckedBaseModel): + type: typing.Literal["function"] = "function" + name: str + description: typing.Optional[str] = None + parameters: typing.Optional[typing.Dict[str, typing.Any]] = 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 + + +class OpenAiSessionConfigInputToolsItem_Mcp(UncheckedBaseModel): + type: typing.Literal["mcp"] = "mcp" + server_label: str + server_url: str + authorization: typing.Optional[str] = None + allowed_tools: typing.Optional[typing.List[str]] = None + require_approval: typing.Optional[OpenAimcpToolRequireApproval] = 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 + + +OpenAiSessionConfigInputToolsItem = typing_extensions.Annotated[ + typing.Union[OpenAiSessionConfigInputToolsItem_Function, OpenAiSessionConfigInputToolsItem_Mcp], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/open_ai_session_config_input_tracing.py b/data/src/elevenlabs/types/open_ai_session_config_input_tracing.py new file mode 100644 index 0000000000000000000000000000000000000000..930d5ef3ab24cf58a99b8bfacc76a0dde7d9ebb8 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_input_tracing.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .open_ai_tracing_configuration import OpenAiTracingConfiguration + +OpenAiSessionConfigInputTracing = typing.Union[typing.Literal["auto"], OpenAiTracingConfiguration] diff --git a/data/src/elevenlabs/types/open_ai_session_config_input_truncation.py b/data/src/elevenlabs/types/open_ai_session_config_input_truncation.py new file mode 100644 index 0000000000000000000000000000000000000000..58b8d8c05379d9a2418d16f0733a6b292dcfd4c6 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_input_truncation.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OpenAiSessionConfigInputTruncation = typing.Union[str, typing.Dict[str, typing.Any]] diff --git a/data/src/elevenlabs/types/open_ai_session_config_input_turn_detection.py b/data/src/elevenlabs/types/open_ai_session_config_input_turn_detection.py new file mode 100644 index 0000000000000000000000000000000000000000..96c5408c26a97de86e3bfd7ef559a45cd0a84d03 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_input_turn_detection.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .open_ai_turn_detection import OpenAiTurnDetection + +OpenAiSessionConfigInputTurnDetection = typing.Union[OpenAiTurnDetection, str] diff --git a/data/src/elevenlabs/types/open_ai_session_config_output.py b/data/src/elevenlabs/types/open_ai_session_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..06fa52bef02aea9992b5ebf9d3491d399a50ee6c --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_output.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_audio_config_output import OpenAiAudioConfigOutput +from .open_ai_session_config_output_max_response_output_tokens import OpenAiSessionConfigOutputMaxResponseOutputTokens +from .open_ai_session_config_output_tool_choice import OpenAiSessionConfigOutputToolChoice +from .open_ai_session_config_output_tools_item import OpenAiSessionConfigOutputToolsItem +from .open_ai_session_config_output_tracing import OpenAiSessionConfigOutputTracing +from .realtime_model import RealtimeModel + + +class OpenAiSessionConfigOutput(UncheckedBaseModel): + type: typing.Optional[typing.Literal["realtime"]] = None + model: typing.Optional[RealtimeModel] = None + instructions: typing.Optional[str] = None + output_modalities: typing.Optional[typing.List[str]] = None + audio: typing.Optional[OpenAiAudioConfigOutput] = None + tools: typing.Optional[typing.List[OpenAiSessionConfigOutputToolsItem]] = None + tool_choice: typing.Optional[OpenAiSessionConfigOutputToolChoice] = None + temperature: typing.Optional[float] = None + max_response_output_tokens: typing.Optional[OpenAiSessionConfigOutputMaxResponseOutputTokens] = None + max_duration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum wall-clock duration of the session in seconds. The session is closed with code 1000 once it is exceeded. + """ + + tracing: typing.Optional[OpenAiSessionConfigOutputTracing] = 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/data/src/elevenlabs/types/open_ai_session_config_output_max_response_output_tokens.py b/data/src/elevenlabs/types/open_ai_session_config_output_max_response_output_tokens.py new file mode 100644 index 0000000000000000000000000000000000000000..6e9fe630dc592ff9381646904c7b46f0bdfae57f --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_output_max_response_output_tokens.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OpenAiSessionConfigOutputMaxResponseOutputTokens = typing.Union[int, typing.Literal["inf"]] diff --git a/data/src/elevenlabs/types/open_ai_session_config_output_tool_choice.py b/data/src/elevenlabs/types/open_ai_session_config_output_tool_choice.py new file mode 100644 index 0000000000000000000000000000000000000000..6613f8ebf637fff19f4eb76d9dd7bc3842632b68 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_output_tool_choice.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .open_ai_tool_choice_function import OpenAiToolChoiceFunction + +OpenAiSessionConfigOutputToolChoice = typing.Union[str, OpenAiToolChoiceFunction] diff --git a/data/src/elevenlabs/types/open_ai_session_config_output_tools_item.py b/data/src/elevenlabs/types/open_ai_session_config_output_tools_item.py new file mode 100644 index 0000000000000000000000000000000000000000..4cd7254b555d5ffef7008f67e0dd7363ed730dc4 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_output_tools_item.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .open_aimcp_tool_require_approval import OpenAimcpToolRequireApproval + + +class OpenAiSessionConfigOutputToolsItem_Function(UncheckedBaseModel): + type: typing.Literal["function"] = "function" + name: str + description: typing.Optional[str] = None + parameters: typing.Optional[typing.Dict[str, typing.Any]] = 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 + + +class OpenAiSessionConfigOutputToolsItem_Mcp(UncheckedBaseModel): + type: typing.Literal["mcp"] = "mcp" + server_label: str + server_url: str + authorization: typing.Optional[str] = None + allowed_tools: typing.Optional[typing.List[str]] = None + require_approval: typing.Optional[OpenAimcpToolRequireApproval] = 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 + + +OpenAiSessionConfigOutputToolsItem = typing_extensions.Annotated[ + typing.Union[OpenAiSessionConfigOutputToolsItem_Function, OpenAiSessionConfigOutputToolsItem_Mcp], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/open_ai_session_config_output_tracing.py b/data/src/elevenlabs/types/open_ai_session_config_output_tracing.py new file mode 100644 index 0000000000000000000000000000000000000000..fe9194fc006b727325af80ca8b99ff62a5bb57f1 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_session_config_output_tracing.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .open_ai_tracing_configuration import OpenAiTracingConfiguration + +OpenAiSessionConfigOutputTracing = typing.Union[typing.Literal["auto"], OpenAiTracingConfiguration] diff --git a/data/src/elevenlabs/types/open_ai_tool_choice_function.py b/data/src/elevenlabs/types/open_ai_tool_choice_function.py new file mode 100644 index 0000000000000000000000000000000000000000..a0dc266ea1ea436f46fd1295a5d379b86770a8c1 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_tool_choice_function.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_ai_tool_choice_function_inner import OpenAiToolChoiceFunctionInner + + +class OpenAiToolChoiceFunction(UncheckedBaseModel): + type: typing.Optional[typing.Literal["function"]] = None + function: OpenAiToolChoiceFunctionInner + + 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/data/src/elevenlabs/types/open_ai_tool_choice_function_inner.py b/data/src/elevenlabs/types/open_ai_tool_choice_function_inner.py new file mode 100644 index 0000000000000000000000000000000000000000..07a0609d5c4545002b871132218e4b7ff203bfc1 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_tool_choice_function_inner.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OpenAiToolChoiceFunctionInner(UncheckedBaseModel): + 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/data/src/elevenlabs/types/open_ai_tracing_configuration.py b/data/src/elevenlabs/types/open_ai_tracing_configuration.py new file mode 100644 index 0000000000000000000000000000000000000000..77afa69bb6c54da524f4ec5d297d6f1ecdbb4a99 --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_tracing_configuration.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OpenAiTracingConfiguration(UncheckedBaseModel): + """ + Only ``group_id`` is acted on; ``workflow_name`` and ``metadata`` are kept so the echoed session matches the request. + """ + + group_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Adds conversation to the group (case-insensitive, up to 64 chars). + """ + + workflow_name: typing.Optional[str] = None + metadata: typing.Optional[typing.Dict[str, typing.Any]] = 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/data/src/elevenlabs/types/open_ai_turn_detection.py b/data/src/elevenlabs/types/open_ai_turn_detection.py new file mode 100644 index 0000000000000000000000000000000000000000..7c8f126b546f876fc76fe56a31f370514163854c --- /dev/null +++ b/data/src/elevenlabs/types/open_ai_turn_detection.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .eagerness import Eagerness +from .turn_detection_type import TurnDetectionType + + +class OpenAiTurnDetection(UncheckedBaseModel): + type: typing.Optional[TurnDetectionType] = None + eagerness: typing.Optional[Eagerness] = None + create_response: typing.Optional[bool] = None + interrupt_response: typing.Optional[bool] = None + threshold: typing.Optional[float] = None + prefix_padding_ms: typing.Optional[int] = None + silence_duration_ms: typing.Optional[int] = None + turn_timeout: 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/data/src/elevenlabs/types/open_aimcp_tool.py b/data/src/elevenlabs/types/open_aimcp_tool.py new file mode 100644 index 0000000000000000000000000000000000000000..7bd0bd786616f7fd1c67baf0fe06aab38773d378 --- /dev/null +++ b/data/src/elevenlabs/types/open_aimcp_tool.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .open_aimcp_tool_require_approval import OpenAimcpToolRequireApproval + + +class OpenAimcpTool(UncheckedBaseModel): + server_label: str + server_url: str + authorization: typing.Optional[str] = None + allowed_tools: typing.Optional[typing.List[str]] = None + require_approval: typing.Optional[OpenAimcpToolRequireApproval] = 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/data/src/elevenlabs/types/open_aimcp_tool_require_approval.py b/data/src/elevenlabs/types/open_aimcp_tool_require_approval.py new file mode 100644 index 0000000000000000000000000000000000000000..7063e1f9169e0d7f92fe5d722609be128ddb9e12 --- /dev/null +++ b/data/src/elevenlabs/types/open_aimcp_tool_require_approval.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OpenAimcpToolRequireApproval = typing.Union[typing.Literal["never", "always"], typing.Any] diff --git a/data/src/elevenlabs/types/open_outcome.py b/data/src/elevenlabs/types/open_outcome.py new file mode 100644 index 0000000000000000000000000000000000000000..880f3cb47dbabceef8d113bb79701e0fbb94bc36 --- /dev/null +++ b/data/src/elevenlabs/types/open_outcome.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OpenOutcome(UncheckedBaseModel): + 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/data/src/elevenlabs/types/opener_config.py b/data/src/elevenlabs/types/opener_config.py new file mode 100644 index 0000000000000000000000000000000000000000..9a38350564573ca225428f937f0485482f6c3da9 --- /dev/null +++ b/data/src/elevenlabs/types/opener_config.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .llm import Llm + + +class OpenerConfig(UncheckedBaseModel): + llm: Llm = pydantic.Field() + """ + Model used to speak a fast opener while the main model generates its full reply. Must be a hosted model (not a bring-your-own LLM type). + """ + + 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/data/src/elevenlabs/types/opt_in_sms_reminder_params.py b/data/src/elevenlabs/types/opt_in_sms_reminder_params.py new file mode 100644 index 0000000000000000000000000000000000000000..6008b8098d4c81f8e50f63419c489498d33dc1da --- /dev/null +++ b/data/src/elevenlabs/types/opt_in_sms_reminder_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OptInSmsReminderParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["opt_in_sms_reminder"]] = 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/data/src/elevenlabs/types/opt_out_sms_reminder_params.py b/data/src/elevenlabs/types/opt_out_sms_reminder_params.py new file mode 100644 index 0000000000000000000000000000000000000000..e95dcd59fc43801a0e63e33ddbb2c5627c6b6142 --- /dev/null +++ b/data/src/elevenlabs/types/opt_out_sms_reminder_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OptOutSmsReminderParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["opt_out_sms_reminder"]] = 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/data/src/elevenlabs/types/orb_avatar.py b/data/src/elevenlabs/types/orb_avatar.py new file mode 100644 index 0000000000000000000000000000000000000000..d2d1bdffdc776930f9d5d1b2a33edb2c16213b15 --- /dev/null +++ b/data/src/elevenlabs/types/orb_avatar.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OrbAvatar(UncheckedBaseModel): + color_1: typing.Optional[str] = pydantic.Field(default=None) + """ + The first color of the avatar + """ + + color_2: typing.Optional[str] = pydantic.Field(default=None) + """ + The second color of the avatar + """ + + 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/data/src/elevenlabs/types/orchestrator_tool_mock_behavior_config.py b/data/src/elevenlabs/types/orchestrator_tool_mock_behavior_config.py new file mode 100644 index 0000000000000000000000000000000000000000..794f445ccd8f4acaaf5aa6de81ea8288983ab801 --- /dev/null +++ b/data/src/elevenlabs/types/orchestrator_tool_mock_behavior_config.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mock_no_match_behavior import MockNoMatchBehavior +from .mocking_strategy import MockingStrategy + + +class OrchestratorToolMockBehaviorConfig(UncheckedBaseModel): + """ + Orchestrator-side config: tools are identified by resolved names. + """ + + mocking_strategy: typing.Optional[MockingStrategy] = pydantic.Field(default=None) + """ + Which tools to mock: 'all' mocks every mockable tool, 'selected' mocks only those in mocked_tool_names/mocked_tool_ids, 'none' disables mocking. + """ + + fallback_strategy: typing.Optional[MockNoMatchBehavior] = pydantic.Field(default=None) + """ + Behavior when no mock matches a tool call. + """ + + mocked_tool_names: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Tool names to mock. Only used when mocking_strategy is 'selected'. + """ + + 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/data/src/elevenlabs/types/order_deliverables_response.py b/data/src/elevenlabs/types/order_deliverables_response.py new file mode 100644 index 0000000000000000000000000000000000000000..2011b1aa692e9911d87992d7a507bed2696d8a49 --- /dev/null +++ b/data/src/elevenlabs/types/order_deliverables_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .deliverable_info import DeliverableInfo + + +class OrderDeliverablesResponse(UncheckedBaseModel): + deliverables: typing.List[DeliverableInfo] = pydantic.Field() + """ + The list of delivered files for the order. Empty if the order is not yet completed. + """ + + 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/data/src/elevenlabs/types/order_id.py b/data/src/elevenlabs/types/order_id.py new file mode 100644 index 0000000000000000000000000000000000000000..72b7e34d373afe961074007387028df34cf96d97 --- /dev/null +++ b/data/src/elevenlabs/types/order_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +OrderId = str diff --git a/data/src/elevenlabs/types/order_item_info.py b/data/src/elevenlabs/types/order_item_info.py new file mode 100644 index 0000000000000000000000000000000000000000..ec1eed7eb2870dd654bf9d6fb71008b4d5b0677c --- /dev/null +++ b/data/src/elevenlabs/types/order_item_info.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .item_id import ItemId +from .order_item_request_output import OrderItemRequestOutput +from .quote_info import QuoteInfo + + +class OrderItemInfo(UncheckedBaseModel): + item_id: ItemId = pydantic.Field() + """ + The ID of the order item. + """ + + item: OrderItemRequestOutput = pydantic.Field() + """ + The item configuration details. + """ + + quote: typing.Optional[QuoteInfo] = pydantic.Field(default=None) + """ + The quoted price for this item. + """ + + 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/data/src/elevenlabs/types/order_item_kind.py b/data/src/elevenlabs/types/order_item_kind.py new file mode 100644 index 0000000000000000000000000000000000000000..7d067d7471e4c42eed69636ca88ec892d74e04bd --- /dev/null +++ b/data/src/elevenlabs/types/order_item_kind.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OrderItemKind = typing.Union[typing.Literal["dub", "subtitles", "transcription"], typing.Any] diff --git a/data/src/elevenlabs/types/order_item_request_input.py b/data/src/elevenlabs/types/order_item_request_input.py new file mode 100644 index 0000000000000000000000000000000000000000..2c0f5758d10f5138fd44eb5b8b42c027e770cee2 --- /dev/null +++ b/data/src/elevenlabs/types/order_item_request_input.py @@ -0,0 +1,74 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .cue_options_request import CueOptionsRequest +from .media_id import MediaId + + +class OrderItemRequestInput_Dub(UncheckedBaseModel): + kind: typing.Literal["dub"] = "dub" + media_id: MediaId + source_language: str + destination_languages: typing.List[str] + include_captions: bool + include_source_captions: bool + instructions: typing.Optional[str] = None + captions_sdh: 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 + + +class OrderItemRequestInput_Subtitles(UncheckedBaseModel): + kind: typing.Literal["subtitles"] = "subtitles" + media_ids: typing.List[MediaId] + source_language: str + destination_languages: typing.List[str] + cue_options: typing.Optional[CueOptionsRequest] = None + sdh: typing.Optional[bool] = None + instructions: 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 + + +class OrderItemRequestInput_Transcription(UncheckedBaseModel): + kind: typing.Literal["transcription"] = "transcription" + media_ids: typing.List[MediaId] + source_language: str + verbatim: typing.Optional[bool] = None + instructions: 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 + + +OrderItemRequestInput = typing_extensions.Annotated[ + typing.Union[OrderItemRequestInput_Dub, OrderItemRequestInput_Subtitles, OrderItemRequestInput_Transcription], + UnionMetadata(discriminant="kind"), +] diff --git a/data/src/elevenlabs/types/order_item_request_output.py b/data/src/elevenlabs/types/order_item_request_output.py new file mode 100644 index 0000000000000000000000000000000000000000..ca21e12eb81b1e12e1d8945c848c74e564a9c3f9 --- /dev/null +++ b/data/src/elevenlabs/types/order_item_request_output.py @@ -0,0 +1,74 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .cue_options_request import CueOptionsRequest +from .media_id import MediaId + + +class OrderItemRequestOutput_Dub(UncheckedBaseModel): + kind: typing.Literal["dub"] = "dub" + media_id: MediaId + source_language: str + destination_languages: typing.List[str] + include_captions: bool + include_source_captions: bool + instructions: typing.Optional[str] = None + captions_sdh: 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 + + +class OrderItemRequestOutput_Subtitles(UncheckedBaseModel): + kind: typing.Literal["subtitles"] = "subtitles" + media_ids: typing.List[MediaId] + source_language: str + destination_languages: typing.List[str] + cue_options: typing.Optional[CueOptionsRequest] = None + sdh: typing.Optional[bool] = None + instructions: 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 + + +class OrderItemRequestOutput_Transcription(UncheckedBaseModel): + kind: typing.Literal["transcription"] = "transcription" + media_ids: typing.List[MediaId] + source_language: str + verbatim: typing.Optional[bool] = None + instructions: 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 + + +OrderItemRequestOutput = typing_extensions.Annotated[ + typing.Union[OrderItemRequestOutput_Dub, OrderItemRequestOutput_Subtitles, OrderItemRequestOutput_Transcription], + UnionMetadata(discriminant="kind"), +] diff --git a/data/src/elevenlabs/types/order_media_response.py b/data/src/elevenlabs/types/order_media_response.py new file mode 100644 index 0000000000000000000000000000000000000000..d784a968d9d74eb71499c7661fcbe6d7c3065e24 --- /dev/null +++ b/data/src/elevenlabs/types/order_media_response.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .media_id import MediaId + + +class OrderMediaResponse(UncheckedBaseModel): + media_id: MediaId = pydantic.Field() + """ + The ID of the media file. + """ + + name: str = pydantic.Field() + """ + The original filename of the uploaded media. + """ + + content_type: str = pydantic.Field() + """ + The MIME type of the media file (e.g. 'video/mp4'). + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + The detected or declared language of the media, if available. + """ + + signed_url: str = pydantic.Field() + """ + A time-limited URL to download the media file. + """ + + 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/data/src/elevenlabs/types/order_response.py b/data/src/elevenlabs/types/order_response.py new file mode 100644 index 0000000000000000000000000000000000000000..8b86e34832411f44a64cd5ec6823cd8eb46c1001 --- /dev/null +++ b/data/src/elevenlabs/types/order_response.py @@ -0,0 +1,82 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .order_id import OrderId +from .order_item_info import OrderItemInfo +from .order_state import OrderState + + +class OrderResponse(UncheckedBaseModel): + order_id: OrderId = pydantic.Field() + """ + The ID of the order. + """ + + name: str = pydantic.Field() + """ + The display name of the order. + """ + + state: OrderState = pydantic.Field() + """ + The current state of the order. + """ + + items: typing.List[OrderItemInfo] = pydantic.Field() + """ + The list of items in this order with their quotes. + """ + + total_amount_usd: typing.Optional[float] = pydantic.Field(default=None) + """ + The total price for all items in USD. Excluded from response until quotes are available. + """ + + sandbox: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether this is a sandbox order that auto-progresses without producer intervention. + """ + + created_at: dt.datetime = pydantic.Field() + """ + The timestamp when the order was created. + """ + + submitted_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + The timestamp when the order was submitted, if applicable. + """ + + paid_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + The timestamp when payment was received, if applicable. + """ + + accepted_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + The timestamp when the order was accepted for production, if applicable. + """ + + completed_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + The timestamp when the order was completed, if applicable. + """ + + cancel_reason: typing.Optional[str] = pydantic.Field(default=None) + """ + The reason the order was cancelled, if applicable. + """ + + 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/data/src/elevenlabs/types/order_state.py b/data/src/elevenlabs/types/order_state.py new file mode 100644 index 0000000000000000000000000000000000000000..7ee7be28d719b05fee73b56059a9cb7c1b012589 --- /dev/null +++ b/data/src/elevenlabs/types/order_state.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OrderState = typing.Union[ + typing.Literal[ + "open", "submitted", "paid", "accepted", "rejected", "done", "cancelling", "cancelled", "expired", "merged" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/order_summary.py b/data/src/elevenlabs/types/order_summary.py new file mode 100644 index 0000000000000000000000000000000000000000..663c21107604272689e66415d5fee9bc376d559a --- /dev/null +++ b/data/src/elevenlabs/types/order_summary.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .order_id import OrderId +from .order_state import OrderState + + +class OrderSummary(UncheckedBaseModel): + order_id: OrderId = pydantic.Field() + """ + The ID of the order. + """ + + name: str = pydantic.Field() + """ + The display name of the order. + """ + + state: OrderState = pydantic.Field() + """ + The current state of the order. + """ + + total_amount_usd: typing.Optional[float] = pydantic.Field(default=None) + """ + The total price for all items in USD. Excluded from response until quotes are available. + """ + + sandbox: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether this is a sandbox order that auto-progresses without producer intervention. + """ + + submitted_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + The timestamp when the order was submitted, if applicable. + """ + + updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None) + """ + The timestamp when the order was last modified, if applicable. + """ + + cancel_reason: typing.Optional[str] = pydantic.Field(default=None) + """ + The reason the order was cancelled, if applicable. + """ + + 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/data/src/elevenlabs/types/outbound_call_recipient.py b/data/src/elevenlabs/types/outbound_call_recipient.py new file mode 100644 index 0000000000000000000000000000000000000000..a03e367a4af56e792d23f7ea484db26a71180e83 --- /dev/null +++ b/data/src/elevenlabs/types/outbound_call_recipient.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_initiation_client_data_request_input import ConversationInitiationClientDataRequestInput + + +class OutboundCallRecipient(UncheckedBaseModel): + id: typing.Optional[str] = None + phone_number: typing.Optional[str] = None + whatsapp_user_id: typing.Optional[str] = None + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataRequestInput] = 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/data/src/elevenlabs/types/outbound_call_recipient_response_model.py b/data/src/elevenlabs/types/outbound_call_recipient_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a58d96d1181ba7ad290638705d2d4cc4fae2ca02 --- /dev/null +++ b/data/src/elevenlabs/types/outbound_call_recipient_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .batch_call_recipient_status import BatchCallRecipientStatus +from .conversation_initiation_client_data_internal import ConversationInitiationClientDataInternal + + +class OutboundCallRecipientResponseModel(UncheckedBaseModel): + id: str + phone_number: typing.Optional[str] = None + whatsapp_user_id: typing.Optional[str] = None + status: BatchCallRecipientStatus + created_at_unix: int + updated_at_unix: int + conversation_id: typing.Optional[str] = None + conversation_initiation_client_data: typing.Optional[ConversationInitiationClientDataInternal] = 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/data/src/elevenlabs/types/outbound_sip_trunk_config_request_model.py b/data/src/elevenlabs/types/outbound_sip_trunk_config_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..eba6aab0d48d73a43e3faea312b336df6dece52f --- /dev/null +++ b/data/src/elevenlabs/types/outbound_sip_trunk_config_request_model.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .media_codec import MediaCodec +from .sip_media_encryption_enum import SipMediaEncryptionEnum +from .sip_trunk_credentials_request_model import SipTrunkCredentialsRequestModel +from .sip_trunk_transport_enum import SipTrunkTransportEnum + + +class OutboundSipTrunkConfigRequestModel(UncheckedBaseModel): + address: str = pydantic.Field() + """ + Hostname or IP the SIP INVITE is sent to. + """ + + transport: typing.Optional[SipTrunkTransportEnum] = pydantic.Field(default=None) + """ + Protocol to use for SIP transport (signalling layer). + """ + + media_encryption: typing.Optional[SipMediaEncryptionEnum] = pydantic.Field(default=None) + """ + Whether or not to encrypt media (data layer). + """ + + headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + SIP X-* headers for INVITE request. These headers are sent as-is and may help identify this call. + """ + + attributes_to_headers: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Map of dynamic variable name to header name for attributes_to_headers + """ + + credentials: typing.Optional[SipTrunkCredentialsRequestModel] = pydantic.Field(default=None) + """ + Optional digest authentication credentials (username/password). If not provided, ACL authentication is assumed. + """ + + enabled_codecs: typing.Optional[typing.List[MediaCodec]] = pydantic.Field(default=None) + """ + Media codecs that should be offered in the SDP for outbound calls. If empty, all supported codecs are offered. + """ + + 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/data/src/elevenlabs/types/output_format.py b/data/src/elevenlabs/types/output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..cdcfcdd4a4f92b108f7d1786b071b3a1515142cd --- /dev/null +++ b/data/src/elevenlabs/types/output_format.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OutputFormat = typing.Union[ + typing.Literal[ + "mp3_22050_32", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_44100", + "ulaw_8000", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/paginated_result_agent_merge_proposal_response.py b/data/src/elevenlabs/types/paginated_result_agent_merge_proposal_response.py new file mode 100644 index 0000000000000000000000000000000000000000..2469bce67a29314b66c75df6e0ec3386fa49ed2d --- /dev/null +++ b/data/src/elevenlabs/types/paginated_result_agent_merge_proposal_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_merge_proposal_response import AgentMergeProposalResponse + + +class PaginatedResultAgentMergeProposalResponse(UncheckedBaseModel): + results: typing.List[AgentMergeProposalResponse] + next_cursor: typing.Optional[str] = None + has_more: 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/data/src/elevenlabs/types/paired_languages_response.py b/data/src/elevenlabs/types/paired_languages_response.py new file mode 100644 index 0000000000000000000000000000000000000000..6bf32ef018cd779bada7035858aacdb1ee251e24 --- /dev/null +++ b/data/src/elevenlabs/types/paired_languages_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .language_pair_info import LanguagePairInfo + + +class PairedLanguagesResponse(UncheckedBaseModel): + language_pairs: typing.List[LanguagePairInfo] = pydantic.Field() + """ + The list of available source-to-destination language mappings. + """ + + 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/data/src/elevenlabs/types/partial_transcript_payload.py b/data/src/elevenlabs/types/partial_transcript_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..b84cb9f5819f247d0d1565d1d7bd932238b679b5 --- /dev/null +++ b/data/src/elevenlabs/types/partial_transcript_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PartialTranscriptPayload(UncheckedBaseModel): + """ + Payload for partial transcription results that may change. + """ + + message_type: typing.Literal["partial_transcript"] = pydantic.Field(default="partial_transcript") + """ + The message type identifier. + """ + + text: str = pydantic.Field() + """ + Partial transcription text. + """ + + 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/data/src/elevenlabs/types/patch_workspace_webhook_response_model.py b/data/src/elevenlabs/types/patch_workspace_webhook_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2a293ab9e03095e7b9a8e799bdaab00276e4f735 --- /dev/null +++ b/data/src/elevenlabs/types/patch_workspace_webhook_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PatchWorkspaceWebhookResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the workspace webhook patch request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/pdf_export_options.py b/data/src/elevenlabs/types/pdf_export_options.py new file mode 100644 index 0000000000000000000000000000000000000000..bdebc7dc717c8f0311d2ca5b79997351f8318d4e --- /dev/null +++ b/data/src/elevenlabs/types/pdf_export_options.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PdfExportOptions(UncheckedBaseModel): + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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/data/src/elevenlabs/types/pending_blocks_metadata_model.py b/data/src/elevenlabs/types/pending_blocks_metadata_model.py new file mode 100644 index 0000000000000000000000000000000000000000..456bb04bc70e5fcff15d813e4fe5fd3231b0bf2d --- /dev/null +++ b/data/src/elevenlabs/types/pending_blocks_metadata_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PendingBlocksMetadataModel(UncheckedBaseModel): + target_global_offset_ms: typing.Optional[int] = None + block_ids: typing.List[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/data/src/elevenlabs/types/pending_cancellation_response_model.py b/data/src/elevenlabs/types/pending_cancellation_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f73194f5942541158e54c684ace825330d80ae68 --- /dev/null +++ b/data/src/elevenlabs/types/pending_cancellation_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PendingCancellationResponseModel(UncheckedBaseModel): + kind: typing.Optional[typing.Literal["cancellation"]] = None + timestamp_seconds: int = pydantic.Field() + """ + The timestamp of the cancellation. + """ + + 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/data/src/elevenlabs/types/pending_clip_task.py b/data/src/elevenlabs/types/pending_clip_task.py new file mode 100644 index 0000000000000000000000000000000000000000..1026cd964e66be81146a8e6b72fe17de11d1592e --- /dev/null +++ b/data/src/elevenlabs/types/pending_clip_task.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .pending_clip_task_type import PendingClipTaskType + + +class PendingClipTask(UncheckedBaseModel): + type: PendingClipTaskType + progress: typing.Optional[float] = None + started_at_ms: typing.Optional[int] = None + updated_at_ms: typing.Optional[int] = None + metadata: typing.Optional[typing.Dict[str, typing.Any]] = 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/data/src/elevenlabs/types/pending_clip_task_type.py b/data/src/elevenlabs/types/pending_clip_task_type.py new file mode 100644 index 0000000000000000000000000000000000000000..ccedd5d01640909a8bbbc93f22662002ff254905 --- /dev/null +++ b/data/src/elevenlabs/types/pending_clip_task_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PendingClipTaskType = typing.Union[ + typing.Literal["preprocessing", "speech_import", "dubbing", "video_to_music", "media_generation"], typing.Any +] diff --git a/data/src/elevenlabs/types/pending_external_audios_metadata_model.py b/data/src/elevenlabs/types/pending_external_audios_metadata_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3e119abee86c64e2753026f9c9d4183785ac166f --- /dev/null +++ b/data/src/elevenlabs/types/pending_external_audios_metadata_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PendingExternalAudiosMetadataModel(UncheckedBaseModel): + target_global_offset_ms: typing.Optional[int] = None + external_audio_ids: typing.List[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/data/src/elevenlabs/types/pending_subscription_switch_response_model.py b/data/src/elevenlabs/types/pending_subscription_switch_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a1cbd88d1077020e4a51531a181615a39a308af0 --- /dev/null +++ b/data/src/elevenlabs/types/pending_subscription_switch_response_model.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .billing_period import BillingPeriod +from .pending_subscription_switch_response_model_next_tier import PendingSubscriptionSwitchResponseModelNextTier + + +class PendingSubscriptionSwitchResponseModel(UncheckedBaseModel): + kind: typing.Optional[typing.Literal["change"]] = None + next_tier: PendingSubscriptionSwitchResponseModelNextTier = pydantic.Field() + """ + The tier to change to. + """ + + next_billing_period: BillingPeriod = pydantic.Field() + """ + The billing period to change to. + """ + + timestamp_seconds: int = pydantic.Field() + """ + The timestamp of the change. + """ + + 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/data/src/elevenlabs/types/pending_subscription_switch_response_model_next_tier.py b/data/src/elevenlabs/types/pending_subscription_switch_response_model_next_tier.py new file mode 100644 index 0000000000000000000000000000000000000000..efbd0b05d48126866e2b8ced53f25ec67ad466b2 --- /dev/null +++ b/data/src/elevenlabs/types/pending_subscription_switch_response_model_next_tier.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PendingSubscriptionSwitchResponseModelNextTier = typing.Union[ + typing.Literal[ + "free", + "starter", + "go", + "creator", + "pro", + "growing_business", + "scale_2024_08_10", + "grant_tier_1_2025_07_23", + "grant_tier_2_2025_07_23", + "grant", + "trial", + "enterprise", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/permission_type.py b/data/src/elevenlabs/types/permission_type.py new file mode 100644 index 0000000000000000000000000000000000000000..dd383ce2036a4ff24da77576e187de0be996c34e --- /dev/null +++ b/data/src/elevenlabs/types/permission_type.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PermissionType = typing.Union[ + typing.Literal[ + "text_to_speech", + "speech_to_speech", + "speech_to_text", + "models_read", + "models_write", + "voices_read", + "voices_write", + "voice_collections_read", + "voice_collections_write", + "speech_history_read", + "speech_history_write", + "sound_generation", + "audio_isolation", + "voice_generation", + "dubbing_read", + "dubbing_write", + "pronunciation_dictionaries_read", + "pronunciation_dictionaries_write", + "user_read", + "user_write", + "projects_read", + "projects_write", + "audio_native_read", + "audio_native_write", + "workspace_read", + "workspace_write", + "forced_alignment", + "convai_read", + "convai_write", + "music_generation", + "image_video_generation", + "flows", + "templates", + "add_voice_from_voice_library", + "create_instant_voice_clone", + "create_professional_voice_clone", + "publish_voice_to_voice_library", + "share_voice_externally", + "create_user_api_key", + "workspace_analytics_full_read", + "webhooks_write", + "service_account_write", + "group_members_manage", + "workspace_members_read", + "workspace_members_invite", + "workspace_members_remove", + "terms_of_service_accept", + "audit_log_read", + "conversation_privacy_manage", + "copy_resources_cross_workspace", + "synthid_detector", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/phone_number_agent_info.py b/data/src/elevenlabs/types/phone_number_agent_info.py new file mode 100644 index 0000000000000000000000000000000000000000..5e7238287e621aef3318a7fc09228bf2c48e827c --- /dev/null +++ b/data/src/elevenlabs/types/phone_number_agent_info.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PhoneNumberAgentInfo(UncheckedBaseModel): + agent_id: str = pydantic.Field() + """ + The ID of the agent + """ + + agent_name: str = pydantic.Field() + """ + The name of the agent + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + Environment to use for resolving environment variables on calls to this number. + """ + + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Agent branch to use for calls to this number. + """ + + 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/data/src/elevenlabs/types/phone_number_dynamic_variable_transfer_destination.py b/data/src/elevenlabs/types/phone_number_dynamic_variable_transfer_destination.py new file mode 100644 index 0000000000000000000000000000000000000000..0ad9dfc282010a3523bde3fffb105ee90d6eec0e --- /dev/null +++ b/data/src/elevenlabs/types/phone_number_dynamic_variable_transfer_destination.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PhoneNumberDynamicVariableTransferDestination(UncheckedBaseModel): + phone_number: 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/data/src/elevenlabs/types/phone_number_sort_by.py b/data/src/elevenlabs/types/phone_number_sort_by.py new file mode 100644 index 0000000000000000000000000000000000000000..d3b8e3b0a5a56b9b9ab9e546110104a848008193 --- /dev/null +++ b/data/src/elevenlabs/types/phone_number_sort_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PhoneNumberSortBy = typing.Union[typing.Literal["label", "phone_number"], typing.Any] diff --git a/data/src/elevenlabs/types/phone_number_transfer.py b/data/src/elevenlabs/types/phone_number_transfer.py new file mode 100644 index 0000000000000000000000000000000000000000..0e05acec01b16584de43bfda6f3984ded27a7480 --- /dev/null +++ b/data/src/elevenlabs/types/phone_number_transfer.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .phone_number_transfer_custom_sip_headers_item import PhoneNumberTransferCustomSipHeadersItem +from .phone_number_transfer_post_dial_digits import PhoneNumberTransferPostDialDigits +from .phone_number_transfer_transfer_destination import PhoneNumberTransferTransferDestination +from .transfer_type_enum import TransferTypeEnum +from .uui_transfer_config import UuiTransferConfig + + +class PhoneNumberTransfer(UncheckedBaseModel): + custom_sip_headers: typing.Optional[typing.List[PhoneNumberTransferCustomSipHeadersItem]] = pydantic.Field( + default=None + ) + """ + Custom SIP headers to include when transferring the call. Each header can be either a static value or a dynamic variable reference. + """ + + transfer_destination: PhoneNumberTransferTransferDestination + transfer_type: typing.Optional[TransferTypeEnum] = None + sip_refer_play_dialtone: typing.Optional[bool] = pydantic.Field(default=None) + """ + When True, a ringing tone is played on the original call leg while a SIP REFER transfer completes. The tone is carried over RTP to the SIP peer executing the REFER, so disable this if the receiving system (e.g. an SBC or contact center) should not hear it. When disabled the caller hears silence until the transfer completes. SIP REFER transfers only. + """ + + uui: typing.Optional[UuiTransferConfig] = pydantic.Field(default=None) + """ + User-to-User Information (RFC 7433) to attach to SIP REFER transfers. Carries call context such as CRM identifiers or escalation reason across the transfer boundary. + """ + + post_dial_digits: typing.Optional[PhoneNumberTransferPostDialDigits] = pydantic.Field(default=None) + """ + DTMF digits to send after call connects (e.g., 'ww1234' for extension). Can be either a static value or a dynamic variable reference. Use 'w' for 0.5s pause. Only supported for Twilio transfers. + """ + + phone_number: typing.Optional[str] = None + condition: 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/data/src/elevenlabs/types/phone_number_transfer_custom_sip_headers_item.py b/data/src/elevenlabs/types/phone_number_transfer_custom_sip_headers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..f78bf1514e1f324efab67679eb3868f6bde7a126 --- /dev/null +++ b/data/src/elevenlabs/types/phone_number_transfer_custom_sip_headers_item.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class PhoneNumberTransferCustomSipHeadersItem_Dynamic(UncheckedBaseModel): + type: typing.Literal["dynamic"] = "dynamic" + value: str + key: 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 + + +class PhoneNumberTransferCustomSipHeadersItem_Static(UncheckedBaseModel): + type: typing.Literal["static"] = "static" + key: str + value: 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 + + +PhoneNumberTransferCustomSipHeadersItem = typing_extensions.Annotated[ + typing.Union[PhoneNumberTransferCustomSipHeadersItem_Dynamic, PhoneNumberTransferCustomSipHeadersItem_Static], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/phone_number_transfer_destination.py b/data/src/elevenlabs/types/phone_number_transfer_destination.py new file mode 100644 index 0000000000000000000000000000000000000000..05db276c7bb9400d54a632aa917ed57d30f571ff --- /dev/null +++ b/data/src/elevenlabs/types/phone_number_transfer_destination.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PhoneNumberTransferDestination(UncheckedBaseModel): + phone_number: 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/data/src/elevenlabs/types/phone_number_transfer_post_dial_digits.py b/data/src/elevenlabs/types/phone_number_transfer_post_dial_digits.py new file mode 100644 index 0000000000000000000000000000000000000000..ef29c32495662273b610da2152f53c307c07dabb --- /dev/null +++ b/data/src/elevenlabs/types/phone_number_transfer_post_dial_digits.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class PhoneNumberTransferPostDialDigits_Dynamic(UncheckedBaseModel): + type: typing.Literal["dynamic"] = "dynamic" + value: 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 + + +class PhoneNumberTransferPostDialDigits_Static(UncheckedBaseModel): + type: typing.Literal["static"] = "static" + value: 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 + + +PhoneNumberTransferPostDialDigits = typing_extensions.Annotated[ + typing.Union[PhoneNumberTransferPostDialDigits_Dynamic, PhoneNumberTransferPostDialDigits_Static], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/phone_number_transfer_transfer_destination.py b/data/src/elevenlabs/types/phone_number_transfer_transfer_destination.py new file mode 100644 index 0000000000000000000000000000000000000000..f887d0436e107cbf803305a036f7cbd498b2275b --- /dev/null +++ b/data/src/elevenlabs/types/phone_number_transfer_transfer_destination.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class PhoneNumberTransferTransferDestination_Phone(UncheckedBaseModel): + type: typing.Literal["phone"] = "phone" + phone_number: 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 + + +class PhoneNumberTransferTransferDestination_PhoneDynamicVariable(UncheckedBaseModel): + type: typing.Literal["phone_dynamic_variable"] = "phone_dynamic_variable" + phone_number: 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 + + +class PhoneNumberTransferTransferDestination_SipUri(UncheckedBaseModel): + type: typing.Literal["sip_uri"] = "sip_uri" + sip_uri: 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 + + +class PhoneNumberTransferTransferDestination_SipUriDynamicVariable(UncheckedBaseModel): + type: typing.Literal["sip_uri_dynamic_variable"] = "sip_uri_dynamic_variable" + sip_uri: 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 + + +PhoneNumberTransferTransferDestination = typing_extensions.Annotated[ + typing.Union[ + PhoneNumberTransferTransferDestination_Phone, + PhoneNumberTransferTransferDestination_PhoneDynamicVariable, + PhoneNumberTransferTransferDestination_SipUri, + PhoneNumberTransferTransferDestination_SipUriDynamicVariable, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/ping_payload.py b/data/src/elevenlabs/types/ping_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..e9fb646a217f5eb76e1e78e9cf30d01a633cef36 --- /dev/null +++ b/data/src/elevenlabs/types/ping_payload.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PingPayload(UncheckedBaseModel): + """ + Keep-alive ping sent periodically by ElevenLabs. + """ + + type: typing.Literal["ping"] = pydantic.Field(default="ping") + """ + The message type identifier. + """ + + 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/data/src/elevenlabs/types/platform_category.py b/data/src/elevenlabs/types/platform_category.py new file mode 100644 index 0000000000000000000000000000000000000000..baf5fa724ab72d6af310cdb56c1aeda001eef737 --- /dev/null +++ b/data/src/elevenlabs/types/platform_category.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PlatformCategory = typing.Union[ + typing.Literal[ + "voice", "silence", "burst", "asr", "text_message", "reception", "v3_addon", "v4_addon", "rag_addon", "other" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/platform_category_usage.py b/data/src/elevenlabs/types/platform_category_usage.py new file mode 100644 index 0000000000000000000000000000000000000000..831152edcc29dbf12cb73efa5879a1d9030357e5 --- /dev/null +++ b/data/src/elevenlabs/types/platform_category_usage.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PlatformCategoryUsage(UncheckedBaseModel): + """ + Accumulated charge for a single :class:`PlatformCategory`. + """ + + credits: typing.Optional[int] = None + price: typing.Optional[float] = None + quantity: 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/data/src/elevenlabs/types/platform_limits.py b/data/src/elevenlabs/types/platform_limits.py new file mode 100644 index 0000000000000000000000000000000000000000..f654cf366560547bef8d5bc9e109380e4d75e7da --- /dev/null +++ b/data/src/elevenlabs/types/platform_limits.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .computed_usage_platform_limit import ComputedUsagePlatformLimit +from .stored_usage_platform_limit import StoredUsagePlatformLimit + + +class PlatformLimits(UncheckedBaseModel): + """ + Unified container for all platform limits. + + Can be used by: + - Billing groups (WorkspaceGroupDBModel.platform_limits) + - Child workspaces (SubscriptionDBModel.platform_limits) + - API keys (XiApiKeyMetadataDBModel.platform_limits) + + All fields are required when platform_limits exists. Use limit=None for unlimited. + """ + + credits: typing.Optional[StoredUsagePlatformLimit] = pydantic.Field(default=None) + """ + Credit usage limit (limit=None means unlimited) + """ + + pvc: typing.Optional[ComputedUsagePlatformLimit] = pydantic.Field(default=None) + """ + Professional Voice Clone count limit (limit=None means unlimited) + """ + + concurrency: typing.Optional[ComputedUsagePlatformLimit] = pydantic.Field(default=None) + """ + TTS concurrency limit (limit=None means unlimited) + """ + + dubbing_concurrency: typing.Optional[ComputedUsagePlatformLimit] = pydantic.Field(default=None) + """ + Dubbing concurrency limit (limit=None means unlimited) + """ + + music_concurrency: typing.Optional[ComputedUsagePlatformLimit] = pydantic.Field(default=None) + """ + Music generation concurrency limit (limit=None means unlimited) + """ + + 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/data/src/elevenlabs/types/platform_usage.py b/data/src/elevenlabs/types/platform_usage.py new file mode 100644 index 0000000000000000000000000000000000000000..5843023514c0466b43b31afa43f859be41085e4f --- /dev/null +++ b/data/src/elevenlabs/types/platform_usage.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .platform_category_usage import PlatformCategoryUsage + + +class PlatformUsage(UncheckedBaseModel): + """ + Per-category breakdown of ``platform_charge`` (the analogue of ``llm_usage``). + """ + + category_usage: typing.Optional[typing.Dict[str, PlatformCategoryUsage]] = 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/data/src/elevenlabs/types/play_dtmf_result_error_model.py b/data/src/elevenlabs/types/play_dtmf_result_error_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8340472baa77f63b27376455689abd3be9d417fa --- /dev/null +++ b/data/src/elevenlabs/types/play_dtmf_result_error_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PlayDtmfResultErrorModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["error"]] = None + error: str + details: 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/data/src/elevenlabs/types/play_dtmf_result_success_model.py b/data/src/elevenlabs/types/play_dtmf_result_success_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c26cc6f32e1c82041d1e8388087751f282883d7f --- /dev/null +++ b/data/src/elevenlabs/types/play_dtmf_result_success_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PlayDtmfResultSuccessModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + dtmf_tones: str + reason: 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/data/src/elevenlabs/types/play_dtmf_tool_config.py b/data/src/elevenlabs/types/play_dtmf_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..34e61a13705f9c9cfec2127cb4daf446fce34b27 --- /dev/null +++ b/data/src/elevenlabs/types/play_dtmf_tool_config.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PlayDtmfToolConfig(UncheckedBaseModel): + """ + Allows the agent to play DTMF tones during a phone call. + + This tool can be used to interact with automated phone systems, such as + navigating phone menus, entering extensions, or inputting numeric codes. + """ + + use_out_of_band_dtmf: typing.Optional[bool] = pydantic.Field(default=None) + """ + Send DTMF tones as out-of-band RTP events (RFC 4733) instead of in-band audio. Only effective for SIP trunk imported numbers. + """ + + suppress_turn_after_dtmf: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, the agent will not generate further speech after playing DTMF tones. This prevents the agent's speech from interfering with IVR systems. + """ + + 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/data/src/elevenlabs/types/podcast_bulletin_mode.py b/data/src/elevenlabs/types/podcast_bulletin_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..0679d34370bda90398c60200c1065a4060d9e408 --- /dev/null +++ b/data/src/elevenlabs/types/podcast_bulletin_mode.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .podcast_bulletin_mode_data import PodcastBulletinModeData + + +class PodcastBulletinMode(UncheckedBaseModel): + bulletin: PodcastBulletinModeData = pydantic.Field() + """ + The voice settings for the bulletin. + """ + + 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/data/src/elevenlabs/types/podcast_bulletin_mode_data.py b/data/src/elevenlabs/types/podcast_bulletin_mode_data.py new file mode 100644 index 0000000000000000000000000000000000000000..d2f0d3ebed1a0256f68dc2e5a64bf00cd5522f73 --- /dev/null +++ b/data/src/elevenlabs/types/podcast_bulletin_mode_data.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PodcastBulletinModeData(UncheckedBaseModel): + host_voice_id: str = pydantic.Field() + """ + The ID of the host voice. + """ + + 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/data/src/elevenlabs/types/podcast_conversation_mode.py b/data/src/elevenlabs/types/podcast_conversation_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..2b9d2b1ad54a4abe1e2a42e7e84f5d92005479bc --- /dev/null +++ b/data/src/elevenlabs/types/podcast_conversation_mode.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .podcast_conversation_mode_data import PodcastConversationModeData + + +class PodcastConversationMode(UncheckedBaseModel): + conversation: PodcastConversationModeData = pydantic.Field() + """ + The voice settings for the conversation. + """ + + 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/data/src/elevenlabs/types/podcast_conversation_mode_data.py b/data/src/elevenlabs/types/podcast_conversation_mode_data.py new file mode 100644 index 0000000000000000000000000000000000000000..96d8940a8aa777ebb05c0b608719b33c2fbf4b1c --- /dev/null +++ b/data/src/elevenlabs/types/podcast_conversation_mode_data.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PodcastConversationModeData(UncheckedBaseModel): + host_voice_id: str = pydantic.Field() + """ + The ID of the host voice. + """ + + guest_voice_id: str = pydantic.Field() + """ + The ID of the guest voice. + """ + + 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/data/src/elevenlabs/types/podcast_project_response_model.py b/data/src/elevenlabs/types/podcast_project_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..7f8792dd59e9cb98cda466ada126eab6b49908a2 --- /dev/null +++ b/data/src/elevenlabs/types/podcast_project_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .project_response import ProjectResponse + + +class PodcastProjectResponseModel(UncheckedBaseModel): + project: ProjectResponse = pydantic.Field() + """ + The project associated with the created podcast. + """ + + 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/data/src/elevenlabs/types/podcast_text_source.py b/data/src/elevenlabs/types/podcast_text_source.py new file mode 100644 index 0000000000000000000000000000000000000000..e2df8d91ba9cb46576b53d94fb21439a5a3824c0 --- /dev/null +++ b/data/src/elevenlabs/types/podcast_text_source.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PodcastTextSource(UncheckedBaseModel): + type: typing.Literal["text"] = pydantic.Field(default="text") + """ + The type of source to create. + """ + + text: str = pydantic.Field() + """ + The text to create the podcast from. + """ + + 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/data/src/elevenlabs/types/podcast_url_source.py b/data/src/elevenlabs/types/podcast_url_source.py new file mode 100644 index 0000000000000000000000000000000000000000..f5125692e85fdecdb70d5429dfadbfda8506bea8 --- /dev/null +++ b/data/src/elevenlabs/types/podcast_url_source.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PodcastUrlSource(UncheckedBaseModel): + type: typing.Literal["url"] = pydantic.Field(default="url") + """ + The type of source to create. + """ + + url: str = pydantic.Field() + """ + The URL to create the podcast from. + """ + + 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/data/src/elevenlabs/types/pong_payload.py b/data/src/elevenlabs/types/pong_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..52fe79066df80c74a33cb2d7e31b0512ad16882a --- /dev/null +++ b/data/src/elevenlabs/types/pong_payload.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PongPayload(UncheckedBaseModel): + """ + Reply to a `ping` message. + """ + + type: typing.Literal["pong"] = pydantic.Field(default="pong") + """ + The message type identifier. + """ + + 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/data/src/elevenlabs/types/position_input.py b/data/src/elevenlabs/types/position_input.py new file mode 100644 index 0000000000000000000000000000000000000000..9e9b1994633f5322f59828b30305d6b3bc20fdec --- /dev/null +++ b/data/src/elevenlabs/types/position_input.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PositionInput(UncheckedBaseModel): + x: typing.Optional[float] = None + y: 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/data/src/elevenlabs/types/position_output.py b/data/src/elevenlabs/types/position_output.py new file mode 100644 index 0000000000000000000000000000000000000000..dfa95fec2ce525f383362888c0e5313c0516acc5 --- /dev/null +++ b/data/src/elevenlabs/types/position_output.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PositionOutput(UncheckedBaseModel): + x: float + y: float + + 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/data/src/elevenlabs/types/post_agent_avatar_response_model.py b/data/src/elevenlabs/types/post_agent_avatar_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..59f06c1d1537f0aa103468c5d8dfed4070737089 --- /dev/null +++ b/data/src/elevenlabs/types/post_agent_avatar_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PostAgentAvatarResponseModel(UncheckedBaseModel): + agent_id: str + avatar_url: 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/data/src/elevenlabs/types/post_agent_hold_audio_response_model.py b/data/src/elevenlabs/types/post_agent_hold_audio_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a339b40176ba3131b8aae0973168c0b972891731 --- /dev/null +++ b/data/src/elevenlabs/types/post_agent_hold_audio_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_hold_audio_config import AgentHoldAudioConfig + + +class PostAgentHoldAudioResponseModel(UncheckedBaseModel): + agent_id: str + hold_audio: AgentHoldAudioConfig + + 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/data/src/elevenlabs/types/post_dial_digits_dynamic_variable.py b/data/src/elevenlabs/types/post_dial_digits_dynamic_variable.py new file mode 100644 index 0000000000000000000000000000000000000000..9f29305aba71b31015c8b8f7ed34a42fd76beb41 --- /dev/null +++ b/data/src/elevenlabs/types/post_dial_digits_dynamic_variable.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PostDialDigitsDynamicVariable(UncheckedBaseModel): + value: str = pydantic.Field() + """ + The dynamic variable name to resolve + """ + + 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/data/src/elevenlabs/types/post_dial_digits_static.py b/data/src/elevenlabs/types/post_dial_digits_static.py new file mode 100644 index 0000000000000000000000000000000000000000..aaa329bbc0c5790f9b150ee1b257edb4f912b958 --- /dev/null +++ b/data/src/elevenlabs/types/post_dial_digits_static.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PostDialDigitsStatic(UncheckedBaseModel): + value: str = pydantic.Field() + """ + DTMF digits to send after call connects (e.g., 'ww1234' for extension) + """ + + 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/data/src/elevenlabs/types/post_workspace_secret_response_model.py b/data/src/elevenlabs/types/post_workspace_secret_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e85d673be0b442ccb78f255fc28d12d34c38ff1c --- /dev/null +++ b/data/src/elevenlabs/types/post_workspace_secret_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PostWorkspaceSecretResponseModel(UncheckedBaseModel): + type: typing.Literal["stored"] = "stored" + secret_id: str + 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/data/src/elevenlabs/types/pre_tool_speech_mode.py b/data/src/elevenlabs/types/pre_tool_speech_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..1af93ca83591dab423256ac4c3a638c041b5fc33 --- /dev/null +++ b/data/src/elevenlabs/types/pre_tool_speech_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PreToolSpeechMode = typing.Union[typing.Literal["auto", "force", "off"], typing.Any] diff --git a/data/src/elevenlabs/types/preview_audio_db_model.py b/data/src/elevenlabs/types/preview_audio_db_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d01a7c03e0e62556f5fa6c1be3b5ae937ba34721 --- /dev/null +++ b/data/src/elevenlabs/types/preview_audio_db_model.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PreviewAudioDbModel(UncheckedBaseModel): + voice_id: typing.Optional[str] = None + text: typing.Optional[str] = None + audio_url: str + hls_manifest_url: typing.Optional[str] = None + dash_manifest_url: typing.Optional[str] = None + is_auto_generated: typing.Optional[bool] = None + generated_at_unix: typing.Optional[int] = 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/data/src/elevenlabs/types/price.py b/data/src/elevenlabs/types/price.py new file mode 100644 index 0000000000000000000000000000000000000000..1619fff0152268a3f9752d2447e79dd97cf60287 --- /dev/null +++ b/data/src/elevenlabs/types/price.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .currency import Currency + + +class Price(UncheckedBaseModel): + """ + Currency/amount pair. + """ + + amount: str + currency: Currency + + 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/data/src/elevenlabs/types/privacy_config_input.py b/data/src/elevenlabs/types/privacy_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..64e9b469ed0b17c5269c4c6960de3d205df0924e --- /dev/null +++ b/data/src/elevenlabs/types/privacy_config_input.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_redaction_config import ConversationHistoryRedactionConfig + + +class PrivacyConfigInput(UncheckedBaseModel): + record_voice: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to record the conversation + """ + + retention_days: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of days to retain the conversation. -1 indicates there is no retention limit + """ + + delete_transcript_and_pii: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to delete the transcript and PII + """ + + delete_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to delete the audio + """ + + apply_to_existing_conversations: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to apply the privacy settings to existing conversations + """ + + zero_retention_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable zero retention mode - no PII data is stored + """ + + conversation_history_redaction: typing.Optional[ConversationHistoryRedactionConfig] = pydantic.Field(default=None) + """ + Config for PII redaction in the conversation history + """ + + 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/data/src/elevenlabs/types/privacy_config_output.py b/data/src/elevenlabs/types/privacy_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..e090ba85a3458f14ea783863aaad33a802fe1302 --- /dev/null +++ b/data/src/elevenlabs/types/privacy_config_output.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_redaction_config import ConversationHistoryRedactionConfig + + +class PrivacyConfigOutput(UncheckedBaseModel): + record_voice: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to record the conversation + """ + + retention_days: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of days to retain the conversation. -1 indicates there is no retention limit + """ + + delete_transcript_and_pii: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to delete the transcript and PII + """ + + delete_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to delete the audio + """ + + apply_to_existing_conversations: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to apply the privacy settings to existing conversations + """ + + zero_retention_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable zero retention mode - no PII data is stored + """ + + conversation_history_redaction: typing.Optional[ConversationHistoryRedactionConfig] = pydantic.Field(default=None) + """ + Config for PII redaction in the conversation history + """ + + 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/data/src/elevenlabs/types/private_key_jwt_response.py b/data/src/elevenlabs/types/private_key_jwt_response.py new file mode 100644 index 0000000000000000000000000000000000000000..b283badd18298efd483c35ad32645d96c5b7a5fb --- /dev/null +++ b/data/src/elevenlabs/types/private_key_jwt_response.py @@ -0,0 +1,68 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus +from .private_key_jwt_response_algorithm import PrivateKeyJwtResponseAlgorithm + + +class PrivateKeyJwtResponse(UncheckedBaseModel): + """ + Response model for Private Key JWT auth connections + """ + + name: str + provider: str + algorithm: typing.Optional[PrivateKeyJwtResponseAlgorithm] = pydantic.Field(default=None) + """ + JWT signing algorithm + """ + + key_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Key ID (kid) for JWT header - useful for key rotation + """ + + issuer: str = pydantic.Field() + """ + JWT issuer (iss claim) + """ + + audience: str = pydantic.Field() + """ + JWT audience (aud claim) + """ + + subject: str = pydantic.Field() + """ + JWT subject (sub claim) + """ + + expiration_seconds: typing.Optional[int] = pydantic.Field(default=None) + """ + Token expiration time in seconds + """ + + extra_params: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Additional custom claims to include in the JWT + """ + + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/private_key_jwt_response_algorithm.py b/data/src/elevenlabs/types/private_key_jwt_response_algorithm.py new file mode 100644 index 0000000000000000000000000000000000000000..f3af6af4c1e96bad5ac33dd5ff21562b91a02699 --- /dev/null +++ b/data/src/elevenlabs/types/private_key_jwt_response_algorithm.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PrivateKeyJwtResponseAlgorithm = typing.Union[ + typing.Literal["HS256", "HS384", "HS512", "RS256", "RS384", "RS512"], typing.Any +] diff --git a/data/src/elevenlabs/types/procedure_at_version_response_model.py b/data/src/elevenlabs/types/procedure_at_version_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e809d6e8756031561d6387d0bd2214600ae05d1c --- /dev/null +++ b/data/src/elevenlabs/types/procedure_at_version_response_model.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .procedure_type import ProcedureType + + +class ProcedureAtVersionResponseModel(UncheckedBaseModel): + procedure_id: str = pydantic.Field() + """ + Procedure ID + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Version ID of a version of the procedure. None for a procedure never versioned. + """ + + name: str = pydantic.Field() + """ + Procedure name + """ + + content: str = pydantic.Field() + """ + Procedure content + """ + + type: typing.Optional[ProcedureType] = pydantic.Field(default=None) + """ + Procedure type + """ + + trigger: typing.Optional[str] = pydantic.Field(default=None) + """ + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. + """ + + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Procedure ID of the folder this procedure is placed in. None means root. + """ + + 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/data/src/elevenlabs/types/procedure_draft_ref.py b/data/src/elevenlabs/types/procedure_draft_ref.py new file mode 100644 index 0000000000000000000000000000000000000000..21c6121f397ca80a660b4903af2bbcebc1f241af --- /dev/null +++ b/data/src/elevenlabs/types/procedure_draft_ref.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ProcedureDraftRef(UncheckedBaseModel): + procedure_id: str = pydantic.Field() + """ + Procedure ID + """ + + version_id: typing.Optional[typing.Any] = 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/data/src/elevenlabs/types/procedure_draft_response_model.py b/data/src/elevenlabs/types/procedure_draft_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b0e43e7aad2b05e920160c217d2964d5e6c7d14d --- /dev/null +++ b/data/src/elevenlabs/types/procedure_draft_response_model.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .procedure_type import ProcedureType + + +class ProcedureDraftResponseModel(UncheckedBaseModel): + procedure_id: str = pydantic.Field() + """ + Procedure ID + """ + + name: str = pydantic.Field() + """ + Procedure name + """ + + content: str = pydantic.Field() + """ + Procedure content + """ + + type: typing.Optional[ProcedureType] = pydantic.Field(default=None) + """ + Procedure type + """ + + trigger: typing.Optional[str] = pydantic.Field(default=None) + """ + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. + """ + + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Procedure ID of the folder this procedure is placed in. None means root. + """ + + 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/data/src/elevenlabs/types/procedure_list_item_response_model.py b/data/src/elevenlabs/types/procedure_list_item_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..be578aebf9a51c4fe2ef37ee0ed31fe236fd6558 --- /dev/null +++ b/data/src/elevenlabs/types/procedure_list_item_response_model.py @@ -0,0 +1,74 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .procedure_type import ProcedureType + + +class ProcedureListItemResponseModel(UncheckedBaseModel): + procedure_id: str = pydantic.Field() + """ + Procedure ID + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Version ID of a version of the procedure. None for a procedure never versioned. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + Procedure name + """ + + type: typing.Optional[ProcedureType] = pydantic.Field(default=None) + """ + Procedure type + """ + + trigger: typing.Optional[str] = pydantic.Field(default=None) + """ + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. + """ + + has_draft: bool = pydantic.Field() + """ + True when the procedure has unpublished draft changes on this branch (a newly created or edited procedure not yet published). When true, the name, type, and trigger reflect that draft. + """ + + referenced_tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Tool IDs referenced in the procedure content + """ + + referenced_kb_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Knowledge base IDs referenced in the procedure content + """ + + referenced_procedure_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Procedure IDs referenced in the procedure content + """ + + referenced_dynamic_variables: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Dynamic variable names used in the procedure content + """ + + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Procedure ID of the folder this procedure is placed in. None means root. + """ + + 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/data/src/elevenlabs/types/procedure_ref_response_model.py b/data/src/elevenlabs/types/procedure_ref_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..fc7dc05eb066bec7c9577e0841f8b94ce9b050ed --- /dev/null +++ b/data/src/elevenlabs/types/procedure_ref_response_model.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .procedure_type import ProcedureType + + +class ProcedureRefResponseModel(UncheckedBaseModel): + procedure_id: str = pydantic.Field() + """ + Procedure ID + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Version ID of a version of the procedure. None for a procedure never versioned. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + Procedure name + """ + + type: typing.Optional[ProcedureType] = pydantic.Field(default=None) + """ + Procedure type + """ + + trigger: typing.Optional[str] = pydantic.Field(default=None) + """ + When the agent should use this procedure. Empty string means this is a sub-procedure that should only start when another procedure references it. + """ + + referenced_tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Tool IDs referenced in the procedure content + """ + + referenced_kb_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Knowledge base IDs referenced in the procedure content + """ + + referenced_procedure_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Procedure IDs referenced in the procedure content + """ + + referenced_dynamic_variables: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Dynamic variable names used in the procedure content + """ + + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Procedure ID of the folder this procedure is placed in. None means root. + """ + + 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/data/src/elevenlabs/types/procedure_type.py b/data/src/elevenlabs/types/procedure_type.py new file mode 100644 index 0000000000000000000000000000000000000000..106d34e2e81724d1388038e938ed1241365d509c --- /dev/null +++ b/data/src/elevenlabs/types/procedure_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProcedureType = typing.Union[typing.Literal["free_form", "deterministic", "folder"], typing.Any] diff --git a/data/src/elevenlabs/types/procedure_validation_error.py b/data/src/elevenlabs/types/procedure_validation_error.py new file mode 100644 index 0000000000000000000000000000000000000000..ede92630135265f720baaea812798365df2476c5 --- /dev/null +++ b/data/src/elevenlabs/types/procedure_validation_error.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ProcedureValidationError(UncheckedBaseModel): + path: str = pydantic.Field() + """ + JSON path to the error, e.g. 'trigger', 'steps[0].instruction' + """ + + message: str = pydantic.Field() + """ + Human-readable error message + """ + + 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/data/src/elevenlabs/types/procedure_version_ref.py b/data/src/elevenlabs/types/procedure_version_ref.py new file mode 100644 index 0000000000000000000000000000000000000000..f26e90bd3dcf293ddbd0582e960dabd89179a556 --- /dev/null +++ b/data/src/elevenlabs/types/procedure_version_ref.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ProcedureVersionRef(UncheckedBaseModel): + procedure_id: str = pydantic.Field() + """ + Procedure ID + """ + + version_id: str = pydantic.Field() + """ + Version ID of the procedure version. + """ + + 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/data/src/elevenlabs/types/project_creation_meta_response_model.py b/data/src/elevenlabs/types/project_creation_meta_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c4183436190a8075adce62de9dab771e95b88744 --- /dev/null +++ b/data/src/elevenlabs/types/project_creation_meta_response_model.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .project_creation_meta_response_model_status import ProjectCreationMetaResponseModelStatus +from .project_creation_meta_type import ProjectCreationMetaType + + +class ProjectCreationMetaResponseModel(UncheckedBaseModel): + creation_progress: float = pydantic.Field() + """ + The progress of the project creation. + """ + + status: ProjectCreationMetaResponseModelStatus = pydantic.Field() + """ + The status of the project creation action. + """ + + type: ProjectCreationMetaType = pydantic.Field() + """ + The type of the project creation action. + """ + + 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/data/src/elevenlabs/types/project_creation_meta_response_model_status.py b/data/src/elevenlabs/types/project_creation_meta_response_model_status.py new file mode 100644 index 0000000000000000000000000000000000000000..8a0ce516fa864943f2636caaf7858b96bb28fc88 --- /dev/null +++ b/data/src/elevenlabs/types/project_creation_meta_response_model_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectCreationMetaResponseModelStatus = typing.Union[ + typing.Literal["draft", "pending", "creating", "finished", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/types/project_creation_meta_type.py b/data/src/elevenlabs/types/project_creation_meta_type.py new file mode 100644 index 0000000000000000000000000000000000000000..1bfb6b32827bc8d037577d2e40390aa3cf9034bc --- /dev/null +++ b/data/src/elevenlabs/types/project_creation_meta_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectCreationMetaType = typing.Union[ + typing.Literal["blank", "generate_podcast", "auto_assign_voices", "dub_video", "import_speech"], typing.Any +] diff --git a/data/src/elevenlabs/types/project_extended_response.py b/data/src/elevenlabs/types/project_extended_response.py new file mode 100644 index 0000000000000000000000000000000000000000..0c2e833b7acf1f17455c483b539e2e6cb118128a --- /dev/null +++ b/data/src/elevenlabs/types/project_extended_response.py @@ -0,0 +1,273 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .caption_style_model import CaptionStyleModel +from .chapter_response import ChapterResponse +from .direct_publishing_read_response_model import DirectPublishingReadResponseModel +from .project_creation_meta_response_model import ProjectCreationMetaResponseModel +from .project_extended_response_access_level import ProjectExtendedResponseAccessLevel +from .project_extended_response_apply_text_normalization import ProjectExtendedResponseApplyTextNormalization +from .project_extended_response_aspect_ratio import ProjectExtendedResponseAspectRatio +from .project_extended_response_assets_item import ProjectExtendedResponseAssetsItem +from .project_extended_response_fiction import ProjectExtendedResponseFiction +from .project_extended_response_source_type import ProjectExtendedResponseSourceType +from .project_extended_response_target_audience import ProjectExtendedResponseTargetAudience +from .project_state import ProjectState +from .project_voice_response_model import ProjectVoiceResponseModel +from .pronunciation_dictionary_locator_response_model import PronunciationDictionaryLocatorResponseModel +from .pronunciation_dictionary_version_response_model import PronunciationDictionaryVersionResponseModel +from .quality_preset_type import QualityPresetType +from .studio_agent_settings_model import StudioAgentSettingsModel +from .voice import Voice + + +class ProjectExtendedResponse(UncheckedBaseModel): + project_id: str = pydantic.Field() + """ + The ID of the project. + """ + + name: str = pydantic.Field() + """ + The name of the project. + """ + + create_date_unix: int = pydantic.Field() + """ + The creation date of the project. + """ + + created_by_user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The user ID who created the project. + """ + + default_title_voice_ref_id: str = pydantic.Field() + """ + The default title project voice reference ID. + """ + + default_paragraph_voice_ref_id: str = pydantic.Field() + """ + The default paragraph project voice reference ID. + """ + + default_model_id: str = pydantic.Field() + """ + The default model ID. + """ + + last_conversion_date_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The last conversion date of the project. + """ + + can_be_downloaded: bool = pydantic.Field() + """ + Whether the project can be downloaded. + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + The title of the project. + """ + + author: typing.Optional[str] = pydantic.Field(default=None) + """ + The author of the project. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the project. + """ + + genres: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of genres of the project. + """ + + cover_image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The cover image URL of the project. + """ + + target_audience: typing.Optional[ProjectExtendedResponseTargetAudience] = pydantic.Field(default=None) + """ + The target audience of the project. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Two-letter language code (ISO 639-1) of the language of the project. + """ + + content_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The content type of the project, e.g. 'Novel' or 'Short Story' + """ + + original_publication_date: typing.Optional[str] = pydantic.Field(default=None) + """ + The original publication date of the project. + """ + + mature_content: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the project contains mature content. + """ + + isbn_number: typing.Optional[str] = pydantic.Field(default=None) + """ + The ISBN number of the project. + """ + + volume_normalization: bool = pydantic.Field() + """ + Whether the project uses volume normalization. + """ + + state: ProjectState = pydantic.Field() + """ + The state of the project. + """ + + access_level: ProjectExtendedResponseAccessLevel = pydantic.Field() + """ + The access level of the project. + """ + + fiction: typing.Optional[ProjectExtendedResponseFiction] = pydantic.Field(default=None) + """ + Whether the project is fiction. + """ + + quality_check_on: bool = pydantic.Field() + """ + Whether quality check is enabled for this project. + """ + + quality_check_on_when_bulk_convert: bool = pydantic.Field() + """ + Whether quality check is enabled on the project when bulk converting. + """ + + creation_meta: typing.Optional[ProjectCreationMetaResponseModel] = pydantic.Field(default=None) + """ + The creation meta of the project. + """ + + source_type: typing.Optional[ProjectExtendedResponseSourceType] = pydantic.Field(default=None) + """ + The source type of the project. + """ + + chapters_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether chapters are enabled for the project. + """ + + captions_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether captions are enabled for the project. + """ + + caption_style: typing.Optional[CaptionStyleModel] = pydantic.Field(default=None) + """ + Global styling to be applied to all captions + """ + + caption_style_template_overrides: typing.Optional[typing.Dict[str, typing.Optional[CaptionStyleModel]]] = ( + pydantic.Field(default=None) + ) + """ + Styling changes that have been made to the provided templates + """ + + public_share_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The public share ID of the project. + """ + + aspect_ratio: typing.Optional[ProjectExtendedResponseAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the project. + """ + + agent_settings: typing.Optional[StudioAgentSettingsModel] = pydantic.Field(default=None) + """ + Agent-related settings for the project + """ + + quality_preset: QualityPresetType = pydantic.Field() + """ + The quality preset level of the project. + """ + + chapters: typing.List[ChapterResponse] = pydantic.Field() + """ + List of chapters of the project and their metadata. + """ + + pronunciation_dictionary_versions: typing.List[PronunciationDictionaryVersionResponseModel] = pydantic.Field() + """ + List of pronunciation dictionary versions of the project and their metadata. + """ + + pronunciation_dictionary_locators: typing.List[PronunciationDictionaryLocatorResponseModel] = pydantic.Field() + """ + List of pronunciation dictionary locators. + """ + + apply_text_normalization: ProjectExtendedResponseApplyTextNormalization = pydantic.Field() + """ + Whether text normalization is applied to the project. + """ + + experimental: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Experimental features for the project. + """ + + assets: typing.List[ProjectExtendedResponseAssetsItem] = pydantic.Field() + """ + List of uploaded assets e.g. videos, audios. + """ + + voices: typing.List[ProjectVoiceResponseModel] = pydantic.Field() + """ + List of configured project voices. + """ + + base_voices: typing.Optional[typing.List[Voice]] = pydantic.Field(default=None) + """ + List of voices used by the project. + """ + + publishing_read: typing.Optional[DirectPublishingReadResponseModel] = pydantic.Field(default=None) + """ + The ElevenReader data if the book was published. + """ + + default_title_voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The default title voice ID. + """ + + default_paragraph_voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The default paragraph voice ID. + """ + + 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/data/src/elevenlabs/types/project_extended_response_access_level.py b/data/src/elevenlabs/types/project_extended_response_access_level.py new file mode 100644 index 0000000000000000000000000000000000000000..334e698862fb57884308aa45babd46938a0541a0 --- /dev/null +++ b/data/src/elevenlabs/types/project_extended_response_access_level.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectExtendedResponseAccessLevel = typing.Union[typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any] diff --git a/data/src/elevenlabs/types/project_extended_response_apply_text_normalization.py b/data/src/elevenlabs/types/project_extended_response_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..aa1ffba2b062eb94db97b6a4bd2fdc90a1526e4d --- /dev/null +++ b/data/src/elevenlabs/types/project_extended_response_apply_text_normalization.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectExtendedResponseApplyTextNormalization = typing.Union[ + typing.Literal["auto", "on", "off", "apply_english"], typing.Any +] diff --git a/data/src/elevenlabs/types/project_extended_response_aspect_ratio.py b/data/src/elevenlabs/types/project_extended_response_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..4e61359a4ab21bee5b53d3c426fbe9bf30a5bcda --- /dev/null +++ b/data/src/elevenlabs/types/project_extended_response_aspect_ratio.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectExtendedResponseAspectRatio = typing.Union[typing.Literal["16:9", "9:16", "4:5", "1:1"], typing.Any] diff --git a/data/src/elevenlabs/types/project_extended_response_assets_item.py b/data/src/elevenlabs/types/project_extended_response_assets_item.py new file mode 100644 index 0000000000000000000000000000000000000000..3797dca100df135a37ddbbc0717238e466a4e9fa --- /dev/null +++ b/data/src/elevenlabs/types/project_extended_response_assets_item.py @@ -0,0 +1,165 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .asset_transcription import AssetTranscription +from .audio_analysis import AudioAnalysis +from .canvas_placement import CanvasPlacement +from .clip_animation import ClipAnimation +from .generation_source_context import GenerationSourceContext +from .image_analysis import ImageAnalysis +from .pending_blocks_metadata_model import PendingBlocksMetadataModel +from .pending_clip_task import PendingClipTask +from .pending_external_audios_metadata_model import PendingExternalAudiosMetadataModel +from .project_external_audio_response_model_source_context import ProjectExternalAudioResponseModelSourceContext +from .project_video_thumbnail_sheet_response_model import ProjectVideoThumbnailSheetResponseModel +from .video_analysis import VideoAnalysis + + +class ProjectExtendedResponseAssetsItem_Video(UncheckedBaseModel): + type: typing.Literal["video"] = "video" + video_id: str + filename: str + signed_url: typing.Optional[str] = None + signed_preview_url: typing.Optional[str] = None + offset_ms: int + duration_ms: int + volume_gain_db: float + muted: bool + fade_in_ms: typing.Optional[int] = None + fade_out_ms: typing.Optional[int] = None + width: int + height: int + codec: str + order: str + created_at_ms: int + updated_at_ms: int + error: typing.Optional[str] = None + thumbnail_interval_seconds: float + thumbnail_size: typing.List[int] + thumbnail_sheets: typing.List[ProjectVideoThumbnailSheetResponseModel] + start_time_ms: int + end_time_ms: typing.Optional[int] = None + asset_preview_signed_url: typing.Optional[str] = None + source_video_id: typing.Optional[str] = None + source_asset_id: typing.Optional[str] = None + source_platform_asset_id: typing.Optional[str] = None + pending_blocks_metadata: typing.Optional[PendingBlocksMetadataModel] = None + pending_external_audios_metadata: typing.Optional[PendingExternalAudiosMetadataModel] = None + speech_imported: typing.Optional[bool] = None + pending_task: typing.Optional[PendingClipTask] = None + audio_track_ready: typing.Optional[bool] = None + export_format_ready: typing.Optional[bool] = None + current_snapshot_id: typing.Optional[str] = None + source_context: typing.Optional[GenerationSourceContext] = None + analysis: typing.Optional[VideoAnalysis] = None + transcription: typing.Optional[AssetTranscription] = None + canvas_placement: typing.Optional[CanvasPlacement] = None + animation: typing.Optional[ClipAnimation] = None + playback_speed: typing.Optional[float] = None + opacity: typing.Optional[float] = None + track_id: typing.Optional[str] = None + preview_job_progress: typing.Optional[float] = None + import_speech_progress: 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 + + +class ProjectExtendedResponseAssetsItem_Audio(UncheckedBaseModel): + type: typing.Literal["audio"] = "audio" + external_audio_id: str + filename: str + signed_url: typing.Optional[str] = None + offset_ms: int + duration_ms: int + start_time_ms: int + end_time_ms: typing.Optional[int] = None + order: str + track_id: str + created_at_ms: int + updated_at_ms: int + volume_gain_db: typing.Optional[float] = None + muted: typing.Optional[bool] = None + fade_in_ms: typing.Optional[int] = None + fade_out_ms: typing.Optional[int] = None + source_external_audio_id: typing.Optional[str] = None + source_asset_id: typing.Optional[str] = None + source_platform_asset_id: typing.Optional[str] = None + pending_blocks_metadata: typing.Optional[PendingBlocksMetadataModel] = None + pending_external_audios_metadata: typing.Optional[PendingExternalAudiosMetadataModel] = None + speech_imported: typing.Optional[bool] = None + pending_task: typing.Optional[PendingClipTask] = None + error: typing.Optional[str] = None + current_snapshot_id: typing.Optional[str] = None + source_context: typing.Optional[ProjectExternalAudioResponseModelSourceContext] = None + analysis: typing.Optional[AudioAnalysis] = None + transcription: typing.Optional[AssetTranscription] = None + import_speech_progress: 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 + + +class ProjectExtendedResponseAssetsItem_Image(UncheckedBaseModel): + type: typing.Literal["image"] = "image" + image_id: str + filename: str + signed_url: typing.Optional[str] = None + thumbnail_signed_url: typing.Optional[str] = None + source: typing.Optional[typing.Literal["upload"]] = None + file_size_bytes: int + width: int + height: int + track_id: typing.Optional[str] = None + offset_ms: int + duration_ms: int + order: str + canvas_placement: CanvasPlacement + animation: typing.Optional[ClipAnimation] = None + opacity: typing.Optional[float] = None + created_at_ms: int + updated_at_ms: int + current_snapshot_id: typing.Optional[str] = None + source_asset_id: typing.Optional[str] = None + source_platform_asset_id: typing.Optional[str] = None + error: typing.Optional[str] = None + pending_task: typing.Optional[PendingClipTask] = None + analysis: typing.Optional[ImageAnalysis] = 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 + + +ProjectExtendedResponseAssetsItem = typing_extensions.Annotated[ + typing.Union[ + ProjectExtendedResponseAssetsItem_Video, + ProjectExtendedResponseAssetsItem_Audio, + ProjectExtendedResponseAssetsItem_Image, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/project_extended_response_fiction.py b/data/src/elevenlabs/types/project_extended_response_fiction.py new file mode 100644 index 0000000000000000000000000000000000000000..78c674e5982fb9b9a21ed9e48f2b1900e428ce37 --- /dev/null +++ b/data/src/elevenlabs/types/project_extended_response_fiction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectExtendedResponseFiction = typing.Union[typing.Literal["fiction", "non-fiction"], typing.Any] diff --git a/data/src/elevenlabs/types/project_extended_response_source_type.py b/data/src/elevenlabs/types/project_extended_response_source_type.py new file mode 100644 index 0000000000000000000000000000000000000000..549d08e99745d0ee7bbbba374df0a7797af69fd9 --- /dev/null +++ b/data/src/elevenlabs/types/project_extended_response_source_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectExtendedResponseSourceType = typing.Union[ + typing.Literal["blank", "book", "article", "genfm", "video", "screenplay"], typing.Any +] diff --git a/data/src/elevenlabs/types/project_extended_response_target_audience.py b/data/src/elevenlabs/types/project_extended_response_target_audience.py new file mode 100644 index 0000000000000000000000000000000000000000..12361774e7c7b0e5de86650639b3156f742cb9d4 --- /dev/null +++ b/data/src/elevenlabs/types/project_extended_response_target_audience.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectExtendedResponseTargetAudience = typing.Union[ + typing.Literal["children", "young adult", "adult", "all ages"], typing.Any +] diff --git a/data/src/elevenlabs/types/project_external_audio_response_model.py b/data/src/elevenlabs/types/project_external_audio_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..b7fff0e3da8ac7fd5d62184bbe6f4368673a6caf --- /dev/null +++ b/data/src/elevenlabs/types/project_external_audio_response_model.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .asset_transcription import AssetTranscription +from .audio_analysis import AudioAnalysis +from .pending_blocks_metadata_model import PendingBlocksMetadataModel +from .pending_clip_task import PendingClipTask +from .pending_external_audios_metadata_model import PendingExternalAudiosMetadataModel +from .project_external_audio_response_model_source_context import ProjectExternalAudioResponseModelSourceContext + + +class ProjectExternalAudioResponseModel(UncheckedBaseModel): + external_audio_id: str + filename: str + signed_url: typing.Optional[str] = None + offset_ms: int + duration_ms: int + start_time_ms: int + end_time_ms: typing.Optional[int] = None + order: str + track_id: str + created_at_ms: int + updated_at_ms: int + volume_gain_db: typing.Optional[float] = None + muted: typing.Optional[bool] = None + fade_in_ms: typing.Optional[int] = None + fade_out_ms: typing.Optional[int] = None + source_external_audio_id: typing.Optional[str] = None + source_asset_id: typing.Optional[str] = None + source_platform_asset_id: typing.Optional[str] = None + pending_blocks_metadata: typing.Optional[PendingBlocksMetadataModel] = None + pending_external_audios_metadata: typing.Optional[PendingExternalAudiosMetadataModel] = None + speech_imported: typing.Optional[bool] = None + pending_task: typing.Optional[PendingClipTask] = None + error: typing.Optional[str] = None + current_snapshot_id: typing.Optional[str] = None + source_context: typing.Optional[ProjectExternalAudioResponseModelSourceContext] = None + analysis: typing.Optional[AudioAnalysis] = None + transcription: typing.Optional[AssetTranscription] = None + import_speech_progress: 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/data/src/elevenlabs/types/project_external_audio_response_model_source_context.py b/data/src/elevenlabs/types/project_external_audio_response_model_source_context.py new file mode 100644 index 0000000000000000000000000000000000000000..f12bd941f44601e755d2ec5dad9b0ad18610b739 --- /dev/null +++ b/data/src/elevenlabs/types/project_external_audio_response_model_source_context.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class ProjectExternalAudioResponseModelSourceContext_MusicExploreSong(UncheckedBaseModel): + source_type: typing.Literal["music_explore_song"] = "music_explore_song" + music_explore_song_id: str + title: typing.Optional[str] = None + description: typing.Optional[str] = None + bpm: typing.Optional[int] = None + vocals: typing.Optional[str] = None + lyrics: 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 + + +class ProjectExternalAudioResponseModelSourceContext_Sfx(UncheckedBaseModel): + source_type: typing.Literal["sfx"] = "sfx" + sound_generation_history_item_id: typing.Optional[str] = None + text: typing.Optional[str] = None + generation_config: typing.Optional[typing.Dict[str, typing.Any]] = 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 + + +class ProjectExternalAudioResponseModelSourceContext_Song(UncheckedBaseModel): + source_type: typing.Literal["song"] = "song" + song_id: str + chat_id: typing.Optional[str] = None + title: typing.Optional[str] = None + description: typing.Optional[str] = None + genres: typing.Optional[typing.List[str]] = None + languages: typing.Optional[typing.List[str]] = None + is_explicit: typing.Optional[bool] = None + bpm: typing.Optional[int] = None + generation_settings: typing.Optional[typing.Dict[str, typing.Any]] = 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 + + +ProjectExternalAudioResponseModelSourceContext = typing_extensions.Annotated[ + typing.Union[ + ProjectExternalAudioResponseModelSourceContext_MusicExploreSong, + ProjectExternalAudioResponseModelSourceContext_Sfx, + ProjectExternalAudioResponseModelSourceContext_Song, + ], + UnionMetadata(discriminant="source_type"), +] diff --git a/data/src/elevenlabs/types/project_image_response_model.py b/data/src/elevenlabs/types/project_image_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..feff4059b4036434f88aedbbf9b4b03d710cf015 --- /dev/null +++ b/data/src/elevenlabs/types/project_image_response_model.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .canvas_placement import CanvasPlacement +from .clip_animation import ClipAnimation +from .image_analysis import ImageAnalysis +from .pending_clip_task import PendingClipTask + + +class ProjectImageResponseModel(UncheckedBaseModel): + image_id: str + filename: str + signed_url: typing.Optional[str] = None + thumbnail_signed_url: typing.Optional[str] = None + source: typing.Optional[typing.Literal["upload"]] = None + file_size_bytes: int + width: int + height: int + track_id: typing.Optional[str] = None + offset_ms: int + duration_ms: int + order: str + canvas_placement: CanvasPlacement + animation: typing.Optional[ClipAnimation] = None + opacity: typing.Optional[float] = None + created_at_ms: int + updated_at_ms: int + current_snapshot_id: typing.Optional[str] = None + source_asset_id: typing.Optional[str] = None + source_platform_asset_id: typing.Optional[str] = None + error: typing.Optional[str] = None + pending_task: typing.Optional[PendingClipTask] = None + analysis: typing.Optional[ImageAnalysis] = 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/data/src/elevenlabs/types/project_muted_tracks_response_model.py b/data/src/elevenlabs/types/project_muted_tracks_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2df4e14d3e4e6dbd2f04e71b705b7db521180fb2 --- /dev/null +++ b/data/src/elevenlabs/types/project_muted_tracks_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ProjectMutedTracksResponseModel(UncheckedBaseModel): + chapter_ids: typing.List[str] = pydantic.Field() + """ + List of chapter IDs that have muted tracks. + """ + + 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/data/src/elevenlabs/types/project_response.py b/data/src/elevenlabs/types/project_response.py new file mode 100644 index 0000000000000000000000000000000000000000..55a05c9f0a17837e0f0ca8be44d3474cc399ed4b --- /dev/null +++ b/data/src/elevenlabs/types/project_response.py @@ -0,0 +1,214 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .caption_style_model import CaptionStyleModel +from .project_creation_meta_response_model import ProjectCreationMetaResponseModel +from .project_response_access_level import ProjectResponseAccessLevel +from .project_response_aspect_ratio import ProjectResponseAspectRatio +from .project_response_fiction import ProjectResponseFiction +from .project_response_source_type import ProjectResponseSourceType +from .project_response_target_audience import ProjectResponseTargetAudience +from .project_state import ProjectState +from .studio_agent_settings_model import StudioAgentSettingsModel + + +class ProjectResponse(UncheckedBaseModel): + project_id: str = pydantic.Field() + """ + The ID of the project. + """ + + name: str = pydantic.Field() + """ + The name of the project. + """ + + create_date_unix: int = pydantic.Field() + """ + The creation date of the project. + """ + + created_by_user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The user ID who created the project. + """ + + default_title_voice_ref_id: str = pydantic.Field() + """ + The default title project voice reference ID. + """ + + default_paragraph_voice_ref_id: str = pydantic.Field() + """ + The default paragraph project voice reference ID. + """ + + default_model_id: str = pydantic.Field() + """ + The default model ID. + """ + + last_conversion_date_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The last conversion date of the project. + """ + + can_be_downloaded: bool = pydantic.Field() + """ + Whether the project can be downloaded. + """ + + title: typing.Optional[str] = pydantic.Field(default=None) + """ + The title of the project. + """ + + author: typing.Optional[str] = pydantic.Field(default=None) + """ + The author of the project. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the project. + """ + + genres: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of genres of the project. + """ + + cover_image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The cover image URL of the project. + """ + + target_audience: typing.Optional[ProjectResponseTargetAudience] = pydantic.Field(default=None) + """ + The target audience of the project. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + Two-letter language code (ISO 639-1) of the language of the project. + """ + + content_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The content type of the project, e.g. 'Novel' or 'Short Story' + """ + + original_publication_date: typing.Optional[str] = pydantic.Field(default=None) + """ + The original publication date of the project. + """ + + mature_content: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the project contains mature content. + """ + + isbn_number: typing.Optional[str] = pydantic.Field(default=None) + """ + The ISBN number of the project. + """ + + volume_normalization: bool = pydantic.Field() + """ + Whether the project uses volume normalization. + """ + + state: ProjectState = pydantic.Field() + """ + The state of the project. + """ + + access_level: ProjectResponseAccessLevel = pydantic.Field() + """ + The access level of the project. + """ + + fiction: typing.Optional[ProjectResponseFiction] = pydantic.Field(default=None) + """ + Whether the project is fiction. + """ + + quality_check_on: bool = pydantic.Field() + """ + Whether quality check is enabled for this project. + """ + + quality_check_on_when_bulk_convert: bool = pydantic.Field() + """ + Whether quality check is enabled on the project when bulk converting. + """ + + creation_meta: typing.Optional[ProjectCreationMetaResponseModel] = pydantic.Field(default=None) + """ + The creation meta of the project. + """ + + source_type: typing.Optional[ProjectResponseSourceType] = pydantic.Field(default=None) + """ + The source type of the project. + """ + + chapters_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether chapters are enabled for the project. + """ + + captions_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether captions are enabled for the project. + """ + + caption_style: typing.Optional[CaptionStyleModel] = pydantic.Field(default=None) + """ + Global styling to be applied to all captions + """ + + caption_style_template_overrides: typing.Optional[typing.Dict[str, typing.Optional[CaptionStyleModel]]] = ( + pydantic.Field(default=None) + ) + """ + Styling changes that have been made to the provided templates + """ + + public_share_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The public share ID of the project. + """ + + aspect_ratio: typing.Optional[ProjectResponseAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the project. + """ + + agent_settings: typing.Optional[StudioAgentSettingsModel] = pydantic.Field(default=None) + """ + Agent-related settings for the project + """ + + default_title_voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The default title voice ID. + """ + + default_paragraph_voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The default paragraph voice ID. + """ + + 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/data/src/elevenlabs/types/project_response_access_level.py b/data/src/elevenlabs/types/project_response_access_level.py new file mode 100644 index 0000000000000000000000000000000000000000..ca9d79139258d5395875cbfffd13c43477eb0144 --- /dev/null +++ b/data/src/elevenlabs/types/project_response_access_level.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectResponseAccessLevel = typing.Union[typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any] diff --git a/data/src/elevenlabs/types/project_response_aspect_ratio.py b/data/src/elevenlabs/types/project_response_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..f948bfec9ba89cf1b54fd05ea0c3fe9d96e97a02 --- /dev/null +++ b/data/src/elevenlabs/types/project_response_aspect_ratio.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectResponseAspectRatio = typing.Union[typing.Literal["16:9", "9:16", "4:5", "1:1"], typing.Any] diff --git a/data/src/elevenlabs/types/project_response_fiction.py b/data/src/elevenlabs/types/project_response_fiction.py new file mode 100644 index 0000000000000000000000000000000000000000..e5c3913d2faa5988bf19edf9b25b363b62488b28 --- /dev/null +++ b/data/src/elevenlabs/types/project_response_fiction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectResponseFiction = typing.Union[typing.Literal["fiction", "non-fiction"], typing.Any] diff --git a/data/src/elevenlabs/types/project_response_source_type.py b/data/src/elevenlabs/types/project_response_source_type.py new file mode 100644 index 0000000000000000000000000000000000000000..b9aac2b8d4b73635106e33ae529c054b7a8cf086 --- /dev/null +++ b/data/src/elevenlabs/types/project_response_source_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectResponseSourceType = typing.Union[ + typing.Literal["blank", "book", "article", "genfm", "video", "screenplay"], typing.Any +] diff --git a/data/src/elevenlabs/types/project_response_target_audience.py b/data/src/elevenlabs/types/project_response_target_audience.py new file mode 100644 index 0000000000000000000000000000000000000000..443b379cb4b1dbac83943c4b0dfe00eac12ac4bd --- /dev/null +++ b/data/src/elevenlabs/types/project_response_target_audience.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectResponseTargetAudience = typing.Union[typing.Literal["children", "young adult", "adult", "all ages"], typing.Any] diff --git a/data/src/elevenlabs/types/project_snapshot_extended_response_model.py b/data/src/elevenlabs/types/project_snapshot_extended_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1b9e48445bd3fb3bb176ae022b537b968b1b31d3 --- /dev/null +++ b/data/src/elevenlabs/types/project_snapshot_extended_response_model.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .character_alignment_model import CharacterAlignmentModel + + +class ProjectSnapshotExtendedResponseModel(UncheckedBaseModel): + project_snapshot_id: str = pydantic.Field() + """ + The ID of the project snapshot. + """ + + project_id: str = pydantic.Field() + """ + The ID of the project. + """ + + created_at_unix: int = pydantic.Field() + """ + The creation date of the project snapshot. + """ + + name: str = pydantic.Field() + """ + The name of the project snapshot. + """ + + audio_upload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + (Deprecated) + """ + + zip_upload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + (Deprecated) + """ + + character_alignments: typing.List[CharacterAlignmentModel] + audio_duration_secs: float = pydantic.Field() + """ + The total duration of the audio in seconds. + """ + + 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/data/src/elevenlabs/types/project_snapshot_response.py b/data/src/elevenlabs/types/project_snapshot_response.py new file mode 100644 index 0000000000000000000000000000000000000000..0602a1f90ec5e40e36786ab4bd5d5b331d20c297 --- /dev/null +++ b/data/src/elevenlabs/types/project_snapshot_response.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ProjectSnapshotResponse(UncheckedBaseModel): + project_snapshot_id: str = pydantic.Field() + """ + The ID of the project snapshot. + """ + + project_id: str = pydantic.Field() + """ + The ID of the project. + """ + + created_at_unix: int = pydantic.Field() + """ + The creation date of the project snapshot. + """ + + name: str = pydantic.Field() + """ + The name of the project snapshot. + """ + + audio_upload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + (Deprecated) + """ + + zip_upload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + (Deprecated) + """ + + 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/data/src/elevenlabs/types/project_snapshots_response.py b/data/src/elevenlabs/types/project_snapshots_response.py new file mode 100644 index 0000000000000000000000000000000000000000..71f59baba1bcc1ebbd46443e714871acd27a5dd4 --- /dev/null +++ b/data/src/elevenlabs/types/project_snapshots_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .project_snapshot_response import ProjectSnapshotResponse + + +class ProjectSnapshotsResponse(UncheckedBaseModel): + snapshots: typing.List[ProjectSnapshotResponse] = pydantic.Field() + """ + List of project snapshots. + """ + + 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/data/src/elevenlabs/types/project_state.py b/data/src/elevenlabs/types/project_state.py new file mode 100644 index 0000000000000000000000000000000000000000..d96580c0902aae4a38ac12750190a525ce930e34 --- /dev/null +++ b/data/src/elevenlabs/types/project_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ProjectState = typing.Union[typing.Literal["creating", "default", "converting", "in_queue"], typing.Any] diff --git a/data/src/elevenlabs/types/project_video_response_model.py b/data/src/elevenlabs/types/project_video_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..154f8533b1a5c42e88111933e445d590a465d2bb --- /dev/null +++ b/data/src/elevenlabs/types/project_video_response_model.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .asset_transcription import AssetTranscription +from .canvas_placement import CanvasPlacement +from .clip_animation import ClipAnimation +from .generation_source_context import GenerationSourceContext +from .pending_blocks_metadata_model import PendingBlocksMetadataModel +from .pending_clip_task import PendingClipTask +from .pending_external_audios_metadata_model import PendingExternalAudiosMetadataModel +from .project_video_thumbnail_sheet_response_model import ProjectVideoThumbnailSheetResponseModel +from .video_analysis import VideoAnalysis + + +class ProjectVideoResponseModel(UncheckedBaseModel): + video_id: str + filename: str + signed_url: typing.Optional[str] = None + signed_preview_url: typing.Optional[str] = None + offset_ms: int + duration_ms: int + volume_gain_db: float + muted: bool + fade_in_ms: typing.Optional[int] = None + fade_out_ms: typing.Optional[int] = None + width: int + height: int + codec: str + order: str + created_at_ms: int + updated_at_ms: int + error: typing.Optional[str] = None + thumbnail_interval_seconds: float + thumbnail_size: typing.List[int] + thumbnail_sheets: typing.List[ProjectVideoThumbnailSheetResponseModel] + start_time_ms: int + end_time_ms: typing.Optional[int] = None + asset_preview_signed_url: typing.Optional[str] = None + source_video_id: typing.Optional[str] = None + source_asset_id: typing.Optional[str] = None + source_platform_asset_id: typing.Optional[str] = None + pending_blocks_metadata: typing.Optional[PendingBlocksMetadataModel] = None + pending_external_audios_metadata: typing.Optional[PendingExternalAudiosMetadataModel] = None + speech_imported: typing.Optional[bool] = None + pending_task: typing.Optional[PendingClipTask] = None + audio_track_ready: typing.Optional[bool] = None + export_format_ready: typing.Optional[bool] = None + current_snapshot_id: typing.Optional[str] = None + source_context: typing.Optional[GenerationSourceContext] = None + analysis: typing.Optional[VideoAnalysis] = None + transcription: typing.Optional[AssetTranscription] = None + canvas_placement: typing.Optional[CanvasPlacement] = None + animation: typing.Optional[ClipAnimation] = None + playback_speed: typing.Optional[float] = None + opacity: typing.Optional[float] = None + track_id: typing.Optional[str] = None + preview_job_progress: typing.Optional[float] = None + import_speech_progress: 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/data/src/elevenlabs/types/project_video_thumbnail_sheet_response_model.py b/data/src/elevenlabs/types/project_video_thumbnail_sheet_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..63238cdcd1a09532489892d93aa47cd1a6ed4845 --- /dev/null +++ b/data/src/elevenlabs/types/project_video_thumbnail_sheet_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ProjectVideoThumbnailSheetResponseModel(UncheckedBaseModel): + start_thumbnail_index: int + thumbnail_count: int + signed_cloud_url: 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/data/src/elevenlabs/types/project_voice_response_model.py b/data/src/elevenlabs/types/project_voice_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2316d4faa92c87cc19aa46e26d8247ed5a9b71ea --- /dev/null +++ b/data/src/elevenlabs/types/project_voice_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ProjectVoiceResponseModel(UncheckedBaseModel): + project_voice_ref_id: str + voice_id: str + alias: str + stability: float + similarity_boost: float + style: float + is_pinned: bool + use_speaker_boost: bool + volume_gain: float + speed: float + + 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/data/src/elevenlabs/types/prompt_agent.py b/data/src/elevenlabs/types/prompt_agent.py new file mode 100644 index 0000000000000000000000000000000000000000..85b35a957b549c8b9a6f9e3191690c5d16f7d600 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PromptAgent = typing.Any diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_input.py b/data/src/elevenlabs/types/prompt_agent_api_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..c080204df187da9b581d879934134b700d4cc520 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_input.py @@ -0,0 +1,136 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .built_in_tools_input import BuiltInToolsInput +from .custom_llm import CustomLlm +from .knowledge_base_locator import KnowledgeBaseLocator +from .llm import Llm +from .llm_reasoning_effort import LlmReasoningEffort +from .prompt_agent_api_model_input_backup_llm_config import PromptAgentApiModelInputBackupLlmConfig +from .prompt_agent_api_model_input_tools_item import PromptAgentApiModelInputToolsItem +from .rag_config_input import RagConfigInput + + +class PromptAgentApiModelInput(UncheckedBaseModel): + prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + The LLM to query with the prompt and the chat history. If using data residency, the LLM must be supported in the data residency environment + """ + + reasoning_effort: typing.Optional[LlmReasoningEffort] = pydantic.Field(default=None) + """ + Reasoning effort of the model. Only available for some models. + """ + + thinking_budget: typing.Optional[int] = pydantic.Field(default=None) + """ + Max number of tokens used for thinking. Use 0 to turn off if supported by the model. + """ + + enable_reasoning_summary: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable model reasoning summaries. When disabled, we do not request summaries from provider if possible for faster TTFB. Not ZRM compatible. + """ + + temperature: typing.Optional[float] = pydantic.Field(default=None) + """ + The temperature for the LLM. Defaults to 0. Set to null to omit the parameter from the LLM request entirely (useful for custom LLMs that reject the temperature field). + """ + + max_tokens: typing.Optional[int] = pydantic.Field(default=None) + """ + If greater than 0, maximum number of tokens the LLM can predict + """ + + tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of IDs of tools used by the agent + """ + + tool_ids_strict: typing.Optional[bool] = pydantic.Field(default=None) + """ + Only applies as a conversation override, allowed whenever tool_ids may be overridden. When true, the overridden tool_ids is the full list of tools allowed in the conversation, including tools on workflow nodes. Ignored when set on the agent. + """ + + built_in_tools: typing.Optional[BuiltInToolsInput] = pydantic.Field(default=None) + """ + Built-in system tools to be used by the agent + """ + + enable_parallel_tool_calls: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable parallel tool calling. When enabled, the agent can execute multiple tools in parallel within a single turn. Not supported by all models. + """ + + mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of MCP server ids to be used by the agent + """ + + native_mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of Native MCP server ids to be used by the agent + """ + + knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) + """ + A list of knowledge bases to be used by the agent + """ + + custom_llm: typing.Optional[CustomLlm] = pydantic.Field(default=None) + """ + Definition for a custom LLM if LLM field is set to 'CUSTOM_LLM' + """ + + ignore_default_personality: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to remove the default personality lines from the system prompt + """ + + rag: typing.Optional[RagConfigInput] = pydantic.Field(default=None) + """ + Configuration for RAG + """ + + timezone: typing.Optional[str] = pydantic.Field(default=None) + """ + Timezone for displaying current time in system prompt. If set, the current time will be included in the system prompt using this timezone. Must be a valid timezone name (e.g., 'America/New_York', 'Europe/London', 'UTC'). Recommended for accurate time-aware responses; without this, the agent has no knowledge of the current date/time unless you provide it via dynamic variables or tools, which can lead to incorrect or hallucinated time references. + """ + + backup_llm_config: typing.Optional[PromptAgentApiModelInputBackupLlmConfig] = pydantic.Field(default=None) + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + cascade_timeout_seconds: typing.Optional[float] = pydantic.Field(default=None) + """ + Time in seconds before cascading to backup LLM. Must be between 2 and 15 seconds. + """ + + tools: typing.Optional[typing.List[PromptAgentApiModelInputToolsItem]] = pydantic.Field(default=None) + """ + A list of tools that the agent can use over the course of the conversation, use tool_ids instead + """ + + 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 + + +update_forward_refs(PromptAgentApiModelInput) diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_input_backup_llm_config.py b/data/src/elevenlabs/types/prompt_agent_api_model_input_backup_llm_config.py new file mode 100644 index 0000000000000000000000000000000000000000..d9c0625cb11dae66540ee4fdf3136eb7c7cf3b6a --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_input_backup_llm_config.py @@ -0,0 +1,73 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .llm import Llm + + +class PromptAgentApiModelInputBackupLlmConfig_Default(UncheckedBaseModel): + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + preference: typing.Literal["default"] = "default" + + 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 + + +class PromptAgentApiModelInputBackupLlmConfig_Disabled(UncheckedBaseModel): + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + preference: typing.Literal["disabled"] = "disabled" + + 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 + + +class PromptAgentApiModelInputBackupLlmConfig_Override(UncheckedBaseModel): + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + preference: typing.Literal["override"] = "override" + order: typing.List[Llm] + + 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 + + +PromptAgentApiModelInputBackupLlmConfig = typing_extensions.Annotated[ + typing.Union[ + PromptAgentApiModelInputBackupLlmConfig_Default, + PromptAgentApiModelInputBackupLlmConfig_Disabled, + PromptAgentApiModelInputBackupLlmConfig_Override, + ], + UnionMetadata(discriminant="preference"), +] diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_input_tools_item.py b/data/src/elevenlabs/types/prompt_agent_api_model_input_tools_item.py new file mode 100644 index 0000000000000000000000000000000000000000..6776eee58a1b666b9ba23fcd449fa3908f6613c6 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_input_tools_item.py @@ -0,0 +1,201 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .api_integration_webhook_overrides import ApiIntegrationWebhookOverrides +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .system_tool_config_input_params import SystemToolConfigInputParams +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .webhook_tool_api_schema_config_input import WebhookToolApiSchemaConfigInput + + +class PromptAgentApiModelInputToolsItem_ApiIntegrationWebhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = None + tool_version: typing.Optional[str] = None + api_integration_id: str + api_integration_connection_id: str + api_schema_overrides: typing.Optional[ApiIntegrationWebhookOverrides] = 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 + + +class PromptAgentApiModelInputToolsItem_Client(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["client"] = "client" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyInput"] = None + expects_response: typing.Optional[bool] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = 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 + + +class PromptAgentApiModelInputToolsItem_Mcp(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["mcp"] = "mcp" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class PromptAgentApiModelInputToolsItem_Smb(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["smb"] = "smb" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class PromptAgentApiModelInputToolsItem_System(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["system"] = "system" + name: str + description: typing.Optional[str] = None + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + params: SystemToolConfigInputParams + + 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 + + +class PromptAgentApiModelInputToolsItem_Webhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["webhook"] = "webhook" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = None + api_schema: WebhookToolApiSchemaConfigInput + follow_redirects: typing.Optional[bool] = None + follow_redirects_allowed_domains: typing.Optional[typing.List[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 + + +PromptAgentApiModelInputToolsItem = typing_extensions.Annotated[ + typing.Union[ + PromptAgentApiModelInputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelInputToolsItem_Client, + PromptAgentApiModelInputToolsItem_Mcp, + PromptAgentApiModelInputToolsItem_Smb, + PromptAgentApiModelInputToolsItem_System, + PromptAgentApiModelInputToolsItem_Webhook, + ], + UnionMetadata(discriminant="type"), +] +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, I001 +from .array_json_schema_property_input_items import ArrayJsonSchemaPropertyInputItems # noqa: E402, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, I001 +from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + PromptAgentApiModelInputToolsItem_Client, + ArrayJsonSchemaPropertyInput=ArrayJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInputItems=ArrayJsonSchemaPropertyInputItems, + ObjectJsonSchemaPropertyInput=ObjectJsonSchemaPropertyInput, + ObjectJsonSchemaPropertyInputPropertiesValue=ObjectJsonSchemaPropertyInputPropertiesValue, +) +update_forward_refs(PromptAgentApiModelInputToolsItem_Webhook) diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_output.py b/data/src/elevenlabs/types/prompt_agent_api_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..8578ae5b47dc36788833e0c3d2c24df0e4b7a8e8 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_output.py @@ -0,0 +1,136 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .built_in_tools_output import BuiltInToolsOutput +from .custom_llm import CustomLlm +from .knowledge_base_locator import KnowledgeBaseLocator +from .llm import Llm +from .llm_reasoning_effort import LlmReasoningEffort +from .prompt_agent_api_model_output_backup_llm_config import PromptAgentApiModelOutputBackupLlmConfig +from .prompt_agent_api_model_output_tools_item import PromptAgentApiModelOutputToolsItem +from .rag_config_output import RagConfigOutput + + +class PromptAgentApiModelOutput(UncheckedBaseModel): + prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + The LLM to query with the prompt and the chat history. If using data residency, the LLM must be supported in the data residency environment + """ + + reasoning_effort: typing.Optional[LlmReasoningEffort] = pydantic.Field(default=None) + """ + Reasoning effort of the model. Only available for some models. + """ + + thinking_budget: typing.Optional[int] = pydantic.Field(default=None) + """ + Max number of tokens used for thinking. Use 0 to turn off if supported by the model. + """ + + enable_reasoning_summary: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable model reasoning summaries. When disabled, we do not request summaries from provider if possible for faster TTFB. Not ZRM compatible. + """ + + temperature: typing.Optional[float] = pydantic.Field(default=None) + """ + The temperature for the LLM. Defaults to 0. Set to null to omit the parameter from the LLM request entirely (useful for custom LLMs that reject the temperature field). + """ + + max_tokens: typing.Optional[int] = pydantic.Field(default=None) + """ + If greater than 0, maximum number of tokens the LLM can predict + """ + + tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of IDs of tools used by the agent + """ + + tool_ids_strict: typing.Optional[bool] = pydantic.Field(default=None) + """ + Only applies as a conversation override, allowed whenever tool_ids may be overridden. When true, the overridden tool_ids is the full list of tools allowed in the conversation, including tools on workflow nodes. Ignored when set on the agent. + """ + + built_in_tools: typing.Optional[BuiltInToolsOutput] = pydantic.Field(default=None) + """ + Built-in system tools to be used by the agent + """ + + enable_parallel_tool_calls: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable parallel tool calling. When enabled, the agent can execute multiple tools in parallel within a single turn. Not supported by all models. + """ + + mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of MCP server ids to be used by the agent + """ + + native_mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of Native MCP server ids to be used by the agent + """ + + knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) + """ + A list of knowledge bases to be used by the agent + """ + + custom_llm: typing.Optional[CustomLlm] = pydantic.Field(default=None) + """ + Definition for a custom LLM if LLM field is set to 'CUSTOM_LLM' + """ + + ignore_default_personality: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to remove the default personality lines from the system prompt + """ + + rag: typing.Optional[RagConfigOutput] = pydantic.Field(default=None) + """ + Configuration for RAG + """ + + timezone: typing.Optional[str] = pydantic.Field(default=None) + """ + Timezone for displaying current time in system prompt. If set, the current time will be included in the system prompt using this timezone. Must be a valid timezone name (e.g., 'America/New_York', 'Europe/London', 'UTC'). Recommended for accurate time-aware responses; without this, the agent has no knowledge of the current date/time unless you provide it via dynamic variables or tools, which can lead to incorrect or hallucinated time references. + """ + + backup_llm_config: typing.Optional[PromptAgentApiModelOutputBackupLlmConfig] = pydantic.Field(default=None) + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + cascade_timeout_seconds: typing.Optional[float] = pydantic.Field(default=None) + """ + Time in seconds before cascading to backup LLM. Must be between 2 and 15 seconds. + """ + + tools: typing.Optional[typing.List[PromptAgentApiModelOutputToolsItem]] = pydantic.Field(default=None) + """ + A list of tools that the agent can use over the course of the conversation, use tool_ids instead + """ + + 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 + + +update_forward_refs(PromptAgentApiModelOutput) diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_output_backup_llm_config.py b/data/src/elevenlabs/types/prompt_agent_api_model_output_backup_llm_config.py new file mode 100644 index 0000000000000000000000000000000000000000..082788a17b0e69f21e38f311b01811a810b3261d --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_output_backup_llm_config.py @@ -0,0 +1,73 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .llm import Llm + + +class PromptAgentApiModelOutputBackupLlmConfig_Default(UncheckedBaseModel): + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + preference: typing.Literal["default"] = "default" + + 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 + + +class PromptAgentApiModelOutputBackupLlmConfig_Disabled(UncheckedBaseModel): + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + preference: typing.Literal["disabled"] = "disabled" + + 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 + + +class PromptAgentApiModelOutputBackupLlmConfig_Override(UncheckedBaseModel): + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + preference: typing.Literal["override"] = "override" + order: typing.List[Llm] + + 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 + + +PromptAgentApiModelOutputBackupLlmConfig = typing_extensions.Annotated[ + typing.Union[ + PromptAgentApiModelOutputBackupLlmConfig_Default, + PromptAgentApiModelOutputBackupLlmConfig_Disabled, + PromptAgentApiModelOutputBackupLlmConfig_Override, + ], + UnionMetadata(discriminant="preference"), +] diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_output_tools_item.py b/data/src/elevenlabs/types/prompt_agent_api_model_output_tools_item.py new file mode 100644 index 0000000000000000000000000000000000000000..c91cf8f9a52d7a8ae90c38c243b809cef4bd19ab --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_output_tools_item.py @@ -0,0 +1,201 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .api_integration_webhook_overrides import ApiIntegrationWebhookOverrides +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .system_tool_config_output_params import SystemToolConfigOutputParams +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .webhook_tool_api_schema_config_output import WebhookToolApiSchemaConfigOutput + + +class PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + name: str + description: str + response_timeout_secs: int + disable_interruptions: bool + interruption_mode: ToolInterruptionMode + force_pre_tool_speech: bool + pre_tool_speech: PreToolSpeechMode + assignments: typing.List[DynamicVariableAssignment] + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: ToolCallSoundBehavior + tool_error_handling_mode: ToolErrorHandlingMode + dynamic_variables: DynamicVariablesConfig + execution_mode: ToolExecutionMode + tool_version: str + api_integration_id: str + api_integration_connection_id: str + api_schema_overrides: typing.Optional[ApiIntegrationWebhookOverrides] = 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 + + +class PromptAgentApiModelOutputToolsItem_Client(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["client"] = "client" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyOutput"] = None + expects_response: typing.Optional[bool] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = 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 + + +class PromptAgentApiModelOutputToolsItem_Mcp(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["mcp"] = "mcp" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class PromptAgentApiModelOutputToolsItem_Smb(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["smb"] = "smb" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class PromptAgentApiModelOutputToolsItem_System(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["system"] = "system" + name: str + description: typing.Optional[str] = None + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + params: SystemToolConfigOutputParams + + 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 + + +class PromptAgentApiModelOutputToolsItem_Webhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["webhook"] = "webhook" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = None + api_schema: WebhookToolApiSchemaConfigOutput + follow_redirects: typing.Optional[bool] = None + follow_redirects_allowed_domains: typing.Optional[typing.List[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 + + +PromptAgentApiModelOutputToolsItem = typing_extensions.Annotated[ + typing.Union[ + PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelOutputToolsItem_Client, + PromptAgentApiModelOutputToolsItem_Mcp, + PromptAgentApiModelOutputToolsItem_Smb, + PromptAgentApiModelOutputToolsItem_System, + PromptAgentApiModelOutputToolsItem_Webhook, + ], + UnionMetadata(discriminant="type"), +] +from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, I001 +from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems # noqa: E402, I001 +from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, I001 +from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + PromptAgentApiModelOutputToolsItem_Client, + ArrayJsonSchemaPropertyOutput=ArrayJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems, + ObjectJsonSchemaPropertyOutput=ObjectJsonSchemaPropertyOutput, + ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue, +) +update_forward_refs(PromptAgentApiModelOutputToolsItem_Webhook) diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_override_config.py b/data/src/elevenlabs/types/prompt_agent_api_model_override_config.py new file mode 100644 index 0000000000000000000000000000000000000000..0117bfd2e5bc87fd82a99624354c0fb6e4d7f560 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_override_config.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PromptAgentApiModelOverrideConfig(UncheckedBaseModel): + prompt: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the prompt field. + """ + + llm: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the llm field. + """ + + tool_ids: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the tool_ids field. + """ + + tool_ids_strict: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the tool_ids_strict field. + """ + + native_mcp_server_ids: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the native_mcp_server_ids field. + """ + + knowledge_base: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the knowledge_base field. + """ + + 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/data/src/elevenlabs/types/prompt_agent_api_model_override_input.py b/data/src/elevenlabs/types/prompt_agent_api_model_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..0bb72dcac2eba936330f243b7fc3e1718b114265 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_override_input.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_locator import KnowledgeBaseLocator +from .llm import Llm + + +class PromptAgentApiModelOverrideInput(UncheckedBaseModel): + prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + The LLM to query with the prompt and the chat history. If using data residency, the LLM must be supported in the data residency environment + """ + + tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of IDs of tools used by the agent + """ + + tool_ids_strict: typing.Optional[bool] = pydantic.Field(default=None) + """ + Only applies as a conversation override, allowed whenever tool_ids may be overridden. When true, the overridden tool_ids is the full list of tools allowed in the conversation, including tools on workflow nodes. Ignored when set on the agent. + """ + + native_mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of Native MCP server ids to be used by the agent + """ + + knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) + """ + A list of knowledge bases to be used by the agent + """ + + 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/data/src/elevenlabs/types/prompt_agent_api_model_override_output.py b/data/src/elevenlabs/types/prompt_agent_api_model_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..e749749bbfcd0a2f9a1c2da0100a3fdde04273e5 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_override_output.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .knowledge_base_locator import KnowledgeBaseLocator +from .llm import Llm + + +class PromptAgentApiModelOverrideOutput(UncheckedBaseModel): + prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + The LLM to query with the prompt and the chat history. If using data residency, the LLM must be supported in the data residency environment + """ + + tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of IDs of tools used by the agent + """ + + tool_ids_strict: typing.Optional[bool] = pydantic.Field(default=None) + """ + Only applies as a conversation override, allowed whenever tool_ids may be overridden. When true, the overridden tool_ids is the full list of tools allowed in the conversation, including tools on workflow nodes. Ignored when set on the agent. + """ + + native_mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of Native MCP server ids to be used by the agent + """ + + knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) + """ + A list of knowledge bases to be used by the agent + """ + + 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/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input.py b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..25fa1f7e5f2ed8f5e94ba95e03984eb4e0110fc0 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input.py @@ -0,0 +1,142 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .built_in_tools_workflow_override_input import BuiltInToolsWorkflowOverrideInput +from .custom_llm import CustomLlm +from .knowledge_base_locator import KnowledgeBaseLocator +from .llm import Llm +from .llm_reasoning_effort import LlmReasoningEffort +from .prompt_agent_api_model_workflow_override_input_backup_llm_config import ( + PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig, +) +from .prompt_agent_api_model_workflow_override_input_tools_item import PromptAgentApiModelWorkflowOverrideInputToolsItem +from .rag_config_workflow_override_input import RagConfigWorkflowOverrideInput + + +class PromptAgentApiModelWorkflowOverrideInput(UncheckedBaseModel): + prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + The LLM to query with the prompt and the chat history. If using data residency, the LLM must be supported in the data residency environment + """ + + reasoning_effort: typing.Optional[LlmReasoningEffort] = pydantic.Field(default=None) + """ + Reasoning effort of the model. Only available for some models. + """ + + thinking_budget: typing.Optional[int] = pydantic.Field(default=None) + """ + Max number of tokens used for thinking. Use 0 to turn off if supported by the model. + """ + + enable_reasoning_summary: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable model reasoning summaries. When disabled, we do not request summaries from provider if possible for faster TTFB. Not ZRM compatible. + """ + + temperature: typing.Optional[float] = pydantic.Field(default=None) + """ + The temperature for the LLM. Defaults to 0. Set to null to omit the parameter from the LLM request entirely (useful for custom LLMs that reject the temperature field). + """ + + max_tokens: typing.Optional[int] = pydantic.Field(default=None) + """ + If greater than 0, maximum number of tokens the LLM can predict + """ + + tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of IDs of tools used by the agent + """ + + tool_ids_strict: typing.Optional[bool] = pydantic.Field(default=None) + """ + Only applies as a conversation override, allowed whenever tool_ids may be overridden. When true, the overridden tool_ids is the full list of tools allowed in the conversation, including tools on workflow nodes. Ignored when set on the agent. + """ + + built_in_tools: typing.Optional[BuiltInToolsWorkflowOverrideInput] = pydantic.Field(default=None) + """ + Built-in system tools to be used by the agent + """ + + enable_parallel_tool_calls: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable parallel tool calling. When enabled, the agent can execute multiple tools in parallel within a single turn. Not supported by all models. + """ + + mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of MCP server ids to be used by the agent + """ + + native_mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of Native MCP server ids to be used by the agent + """ + + knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) + """ + A list of knowledge bases to be used by the agent + """ + + custom_llm: typing.Optional[CustomLlm] = pydantic.Field(default=None) + """ + Definition for a custom LLM if LLM field is set to 'CUSTOM_LLM' + """ + + ignore_default_personality: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to remove the default personality lines from the system prompt + """ + + rag: typing.Optional[RagConfigWorkflowOverrideInput] = pydantic.Field(default=None) + """ + Configuration for RAG + """ + + timezone: typing.Optional[str] = pydantic.Field(default=None) + """ + Timezone for displaying current time in system prompt. If set, the current time will be included in the system prompt using this timezone. Must be a valid timezone name (e.g., 'America/New_York', 'Europe/London', 'UTC'). Recommended for accurate time-aware responses; without this, the agent has no knowledge of the current date/time unless you provide it via dynamic variables or tools, which can lead to incorrect or hallucinated time references. + """ + + backup_llm_config: typing.Optional[PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig] = pydantic.Field( + default=None + ) + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + cascade_timeout_seconds: typing.Optional[float] = pydantic.Field(default=None) + """ + Time in seconds before cascading to backup LLM. Must be between 2 and 15 seconds. + """ + + tools: typing.Optional[typing.List[PromptAgentApiModelWorkflowOverrideInputToolsItem]] = pydantic.Field( + default=None + ) + """ + A list of tools that the agent can use over the course of the conversation, use tool_ids instead + """ + + 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 + + +update_forward_refs(PromptAgentApiModelWorkflowOverrideInput) diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input_backup_llm_config.py b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input_backup_llm_config.py new file mode 100644 index 0000000000000000000000000000000000000000..fb58951041478c1d79f5c5a14f32bd5ead2a392d --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input_backup_llm_config.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .backup_llm_default import BackupLlmDefault +from .backup_llm_disabled import BackupLlmDisabled +from .backup_llm_override import BackupLlmOverride + +PromptAgentApiModelWorkflowOverrideInputBackupLlmConfig = typing.Union[ + BackupLlmDefault, BackupLlmDisabled, BackupLlmOverride +] diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input_tools_item.py b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input_tools_item.py new file mode 100644 index 0000000000000000000000000000000000000000..c2227cb6fa766706749f98357d18a6beac57e532 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_input_tools_item.py @@ -0,0 +1,201 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .api_integration_webhook_overrides import ApiIntegrationWebhookOverrides +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .system_tool_config_input_params import SystemToolConfigInputParams +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .webhook_tool_api_schema_config_input import WebhookToolApiSchemaConfigInput + + +class PromptAgentApiModelWorkflowOverrideInputToolsItem_ApiIntegrationWebhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = None + tool_version: typing.Optional[str] = None + api_integration_id: str + api_integration_connection_id: str + api_schema_overrides: typing.Optional[ApiIntegrationWebhookOverrides] = 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 + + +class PromptAgentApiModelWorkflowOverrideInputToolsItem_Client(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["client"] = "client" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyInput"] = None + expects_response: typing.Optional[bool] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = 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 + + +class PromptAgentApiModelWorkflowOverrideInputToolsItem_Mcp(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["mcp"] = "mcp" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class PromptAgentApiModelWorkflowOverrideInputToolsItem_Smb(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["smb"] = "smb" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class PromptAgentApiModelWorkflowOverrideInputToolsItem_System(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["system"] = "system" + name: str + description: typing.Optional[str] = None + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + params: SystemToolConfigInputParams + + 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 + + +class PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["webhook"] = "webhook" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = None + api_schema: WebhookToolApiSchemaConfigInput + follow_redirects: typing.Optional[bool] = None + follow_redirects_allowed_domains: typing.Optional[typing.List[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 + + +PromptAgentApiModelWorkflowOverrideInputToolsItem = typing_extensions.Annotated[ + typing.Union[ + PromptAgentApiModelWorkflowOverrideInputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Client, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Mcp, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Smb, + PromptAgentApiModelWorkflowOverrideInputToolsItem_System, + PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook, + ], + UnionMetadata(discriminant="type"), +] +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, I001 +from .array_json_schema_property_input_items import ArrayJsonSchemaPropertyInputItems # noqa: E402, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, I001 +from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + PromptAgentApiModelWorkflowOverrideInputToolsItem_Client, + ArrayJsonSchemaPropertyInput=ArrayJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInputItems=ArrayJsonSchemaPropertyInputItems, + ObjectJsonSchemaPropertyInput=ObjectJsonSchemaPropertyInput, + ObjectJsonSchemaPropertyInputPropertiesValue=ObjectJsonSchemaPropertyInputPropertiesValue, +) +update_forward_refs(PromptAgentApiModelWorkflowOverrideInputToolsItem_Webhook) diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output.py b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..689d99cc66ea733b31335ab9fef737a3a08d821c --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output.py @@ -0,0 +1,144 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .built_in_tools_workflow_override_output import BuiltInToolsWorkflowOverrideOutput +from .custom_llm import CustomLlm +from .knowledge_base_locator import KnowledgeBaseLocator +from .llm import Llm +from .llm_reasoning_effort import LlmReasoningEffort +from .prompt_agent_api_model_workflow_override_output_backup_llm_config import ( + PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig, +) +from .prompt_agent_api_model_workflow_override_output_tools_item import ( + PromptAgentApiModelWorkflowOverrideOutputToolsItem, +) +from .rag_config_workflow_override_output import RagConfigWorkflowOverrideOutput + + +class PromptAgentApiModelWorkflowOverrideOutput(UncheckedBaseModel): + prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + The prompt for the agent + """ + + llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + The LLM to query with the prompt and the chat history. If using data residency, the LLM must be supported in the data residency environment + """ + + reasoning_effort: typing.Optional[LlmReasoningEffort] = pydantic.Field(default=None) + """ + Reasoning effort of the model. Only available for some models. + """ + + thinking_budget: typing.Optional[int] = pydantic.Field(default=None) + """ + Max number of tokens used for thinking. Use 0 to turn off if supported by the model. + """ + + enable_reasoning_summary: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable model reasoning summaries. When disabled, we do not request summaries from provider if possible for faster TTFB. Not ZRM compatible. + """ + + temperature: typing.Optional[float] = pydantic.Field(default=None) + """ + The temperature for the LLM. Defaults to 0. Set to null to omit the parameter from the LLM request entirely (useful for custom LLMs that reject the temperature field). + """ + + max_tokens: typing.Optional[int] = pydantic.Field(default=None) + """ + If greater than 0, maximum number of tokens the LLM can predict + """ + + tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of IDs of tools used by the agent + """ + + tool_ids_strict: typing.Optional[bool] = pydantic.Field(default=None) + """ + Only applies as a conversation override, allowed whenever tool_ids may be overridden. When true, the overridden tool_ids is the full list of tools allowed in the conversation, including tools on workflow nodes. Ignored when set on the agent. + """ + + built_in_tools: typing.Optional[BuiltInToolsWorkflowOverrideOutput] = pydantic.Field(default=None) + """ + Built-in system tools to be used by the agent + """ + + enable_parallel_tool_calls: typing.Optional[bool] = pydantic.Field(default=None) + """ + Enable parallel tool calling. When enabled, the agent can execute multiple tools in parallel within a single turn. Not supported by all models. + """ + + mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of MCP server ids to be used by the agent + """ + + native_mcp_server_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of Native MCP server ids to be used by the agent + """ + + knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) + """ + A list of knowledge bases to be used by the agent + """ + + custom_llm: typing.Optional[CustomLlm] = pydantic.Field(default=None) + """ + Definition for a custom LLM if LLM field is set to 'CUSTOM_LLM' + """ + + ignore_default_personality: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to remove the default personality lines from the system prompt + """ + + rag: typing.Optional[RagConfigWorkflowOverrideOutput] = pydantic.Field(default=None) + """ + Configuration for RAG + """ + + timezone: typing.Optional[str] = pydantic.Field(default=None) + """ + Timezone for displaying current time in system prompt. If set, the current time will be included in the system prompt using this timezone. Must be a valid timezone name (e.g., 'America/New_York', 'Europe/London', 'UTC'). Recommended for accurate time-aware responses; without this, the agent has no knowledge of the current date/time unless you provide it via dynamic variables or tools, which can lead to incorrect or hallucinated time references. + """ + + backup_llm_config: typing.Optional[PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig] = pydantic.Field( + default=None + ) + """ + Configuration for backup LLM cascading. Can be disabled, use system defaults, or specify custom order. + """ + + cascade_timeout_seconds: typing.Optional[float] = pydantic.Field(default=None) + """ + Time in seconds before cascading to backup LLM. Must be between 2 and 15 seconds. + """ + + tools: typing.Optional[typing.List[PromptAgentApiModelWorkflowOverrideOutputToolsItem]] = pydantic.Field( + default=None + ) + """ + A list of tools that the agent can use over the course of the conversation, use tool_ids instead + """ + + 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 + + +update_forward_refs(PromptAgentApiModelWorkflowOverrideOutput) diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output_backup_llm_config.py b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output_backup_llm_config.py new file mode 100644 index 0000000000000000000000000000000000000000..441e1d4f3174318aa53cba05f5eb396eaa42def6 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output_backup_llm_config.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .backup_llm_default import BackupLlmDefault +from .backup_llm_disabled import BackupLlmDisabled +from .backup_llm_override import BackupLlmOverride + +PromptAgentApiModelWorkflowOverrideOutputBackupLlmConfig = typing.Union[ + BackupLlmDefault, BackupLlmDisabled, BackupLlmOverride +] diff --git a/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output_tools_item.py b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output_tools_item.py new file mode 100644 index 0000000000000000000000000000000000000000..ac962a69ac8c3a292590fdf42ca088b026705f7b --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_api_model_workflow_override_output_tools_item.py @@ -0,0 +1,201 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .api_integration_webhook_overrides import ApiIntegrationWebhookOverrides +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .system_tool_config_output_params import SystemToolConfigOutputParams +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .webhook_tool_api_schema_config_output import WebhookToolApiSchemaConfigOutput + + +class PromptAgentApiModelWorkflowOverrideOutputToolsItem_ApiIntegrationWebhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + name: str + description: str + response_timeout_secs: int + disable_interruptions: bool + interruption_mode: ToolInterruptionMode + force_pre_tool_speech: bool + pre_tool_speech: PreToolSpeechMode + assignments: typing.List[DynamicVariableAssignment] + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: ToolCallSoundBehavior + tool_error_handling_mode: ToolErrorHandlingMode + dynamic_variables: DynamicVariablesConfig + execution_mode: ToolExecutionMode + tool_version: str + api_integration_id: str + api_integration_connection_id: str + api_schema_overrides: typing.Optional[ApiIntegrationWebhookOverrides] = 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 + + +class PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["client"] = "client" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyOutput"] = None + expects_response: typing.Optional[bool] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = 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 + + +class PromptAgentApiModelWorkflowOverrideOutputToolsItem_Mcp(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["mcp"] = "mcp" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class PromptAgentApiModelWorkflowOverrideOutputToolsItem_Smb(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["smb"] = "smb" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class PromptAgentApiModelWorkflowOverrideOutputToolsItem_System(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["system"] = "system" + name: str + description: typing.Optional[str] = None + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + params: SystemToolConfigOutputParams + + 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 + + +class PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["webhook"] = "webhook" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = None + api_schema: WebhookToolApiSchemaConfigOutput + follow_redirects: typing.Optional[bool] = None + follow_redirects_allowed_domains: typing.Optional[typing.List[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 + + +PromptAgentApiModelWorkflowOverrideOutputToolsItem = typing_extensions.Annotated[ + typing.Union[ + PromptAgentApiModelWorkflowOverrideOutputToolsItem_ApiIntegrationWebhook, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Mcp, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Smb, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_System, + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook, + ], + UnionMetadata(discriminant="type"), +] +from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, I001 +from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems # noqa: E402, I001 +from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, I001 +from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + PromptAgentApiModelWorkflowOverrideOutputToolsItem_Client, + ArrayJsonSchemaPropertyOutput=ArrayJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems, + ObjectJsonSchemaPropertyOutput=ObjectJsonSchemaPropertyOutput, + ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue, +) +update_forward_refs(PromptAgentApiModelWorkflowOverrideOutputToolsItem_Webhook) diff --git a/data/src/elevenlabs/types/prompt_agent_db_model.py b/data/src/elevenlabs/types/prompt_agent_db_model.py new file mode 100644 index 0000000000000000000000000000000000000000..00fdabdf1c1ab55680a34dffe7647934420580fa --- /dev/null +++ b/data/src/elevenlabs/types/prompt_agent_db_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PromptAgentDbModel(UncheckedBaseModel): + tools: typing.Optional[typing.Any] = 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/data/src/elevenlabs/types/prompt_evaluation_criteria.py b/data/src/elevenlabs/types/prompt_evaluation_criteria.py new file mode 100644 index 0000000000000000000000000000000000000000..b96fcf3195f13ca8af63d78881fdf99bf836ecf2 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_evaluation_criteria.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .analysis_scope import AnalysisScope +from .criteria_scoring_mode import CriteriaScoringMode +from .llm import Llm + + +class PromptEvaluationCriteria(UncheckedBaseModel): + """ + An evaluation using the transcript and a prompt for a yes/no achieved answer + """ + + id: str = pydantic.Field() + """ + The unique identifier for the evaluation criteria + """ + + name: str + type: typing.Optional[typing.Literal["prompt"]] = pydantic.Field(default=None) + """ + The type of evaluation criteria + """ + + conversation_goal_prompt: str = pydantic.Field() + """ + The prompt that the agent should use to evaluate the conversation + """ + + use_knowledge_base: typing.Optional[bool] = pydantic.Field(default=None) + """ + When evaluating the prompt, should the agent's knowledge base be used. + """ + + scope: typing.Optional[AnalysisScope] = pydantic.Field(default=None) + """ + The scope of transcript context used when evaluating this criterion. 'conversation' uses the full transcript; 'agent' uses only the portion where the defining agent was active. + """ + + llm: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model to use for this evaluation criteria. If not set, uses agent's analysis_llm default. + """ + + scoring_mode: typing.Optional[CriteriaScoringMode] = pydantic.Field(default=None) + """ + How this criterion is scored. 'binary' resolves to success/failure/unknown. 'numeric_uniform' returns a number on the [0, max_score] scale which is normalized into the aggregate conversation success percentage. + """ + + max_score: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum value of the numeric score scale (minimum is always 0). Only used when scoring_mode is 'numeric_uniform'. + """ + + score_instructions: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional free-text instructions describing how to assign values on the numeric scale. Only used when scoring_mode is 'numeric_uniform'. + """ + + 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/data/src/elevenlabs/types/prompt_injection_guardrail.py b/data/src/elevenlabs/types/prompt_injection_guardrail.py new file mode 100644 index 0000000000000000000000000000000000000000..b479ac50779b444c5f970e7545bb98ab77026871 --- /dev/null +++ b/data/src/elevenlabs/types/prompt_injection_guardrail.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PromptInjectionGuardrail(UncheckedBaseModel): + is_enabled: 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/data/src/elevenlabs/types/pronunciation_dictionary_alias_rule_request_model.py b/data/src/elevenlabs/types/pronunciation_dictionary_alias_rule_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3dd6953683ee72b5be739375f653421a0c9521cb --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_alias_rule_request_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PronunciationDictionaryAliasRuleRequestModel(UncheckedBaseModel): + string_to_replace: str = pydantic.Field() + """ + The string to replace. Must be a non-empty string. + """ + + case_sensitive: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the rule should match case-sensitively. + """ + + word_boundaries: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the rule should only match at word boundaries. + """ + + alias: str = pydantic.Field() + """ + The alias for the string to be replaced. + """ + + 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/data/src/elevenlabs/types/pronunciation_dictionary_alias_rule_response_model.py b/data/src/elevenlabs/types/pronunciation_dictionary_alias_rule_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..87322407fa425462001aa77833354cf4076fe832 --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_alias_rule_response_model.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PronunciationDictionaryAliasRuleResponseModel(UncheckedBaseModel): + string_to_replace: str + case_sensitive: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the rule matches case-sensitively. + """ + + word_boundaries: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the rule only matches at word boundaries. + """ + + alias: 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/data/src/elevenlabs/types/pronunciation_dictionary_locator.py b/data/src/elevenlabs/types/pronunciation_dictionary_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..8a9eae85ecb53d6f5af844d194f45790a4caf425 --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_locator.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PronunciationDictionaryLocator(UncheckedBaseModel): + """ + Identifies a specific pronunciation dictionary to use + """ + + pronunciation_dictionary_id: str = pydantic.Field() + """ + The unique identifier of the pronunciation dictionary + """ + + version_id: str = pydantic.Field() + """ + The version identifier of the pronunciation dictionary + """ + + 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/data/src/elevenlabs/types/pronunciation_dictionary_locator_response_model.py b/data/src/elevenlabs/types/pronunciation_dictionary_locator_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f02fd90523dbae6a3b64c48e0fb58df20dea4d1b --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_locator_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PronunciationDictionaryLocatorResponseModel(UncheckedBaseModel): + pronunciation_dictionary_id: str + version_id: 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/data/src/elevenlabs/types/pronunciation_dictionary_phoneme_rule_request_model.py b/data/src/elevenlabs/types/pronunciation_dictionary_phoneme_rule_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2beb4433da05472e0c24e0b8449d29f109d5520f --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_phoneme_rule_request_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PronunciationDictionaryPhonemeRuleRequestModel(UncheckedBaseModel): + string_to_replace: str = pydantic.Field() + """ + The string to replace. Must be a non-empty string. + """ + + case_sensitive: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the rule should match case-sensitively. + """ + + word_boundaries: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the rule should only match at word boundaries. + """ + + phoneme: str = pydantic.Field() + """ + The phoneme rule. + """ + + alphabet: str = pydantic.Field() + """ + The alphabet to use with the phoneme rule. + """ + + 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/data/src/elevenlabs/types/pronunciation_dictionary_phoneme_rule_response_model.py b/data/src/elevenlabs/types/pronunciation_dictionary_phoneme_rule_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..eac7c79d9cc78ae4a094d718f6b9d73b54ffd527 --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_phoneme_rule_response_model.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PronunciationDictionaryPhonemeRuleResponseModel(UncheckedBaseModel): + string_to_replace: str + case_sensitive: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the rule matches case-sensitively. + """ + + word_boundaries: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the rule only matches at word boundaries. + """ + + phoneme: str + alphabet: 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/data/src/elevenlabs/types/pronunciation_dictionary_rules_response_model.py b/data/src/elevenlabs/types/pronunciation_dictionary_rules_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d133155033b04384fab5ea9436a12d5969c18ecc --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_rules_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PronunciationDictionaryRulesResponseModel(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The ID of the pronunciation dictionary. + """ + + version_id: str = pydantic.Field() + """ + The version ID of the pronunciation dictionary. + """ + + version_rules_num: int = pydantic.Field() + """ + The number of rules in the version of the pronunciation dictionary. + """ + + 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/data/src/elevenlabs/types/pronunciation_dictionary_version_locator.py b/data/src/elevenlabs/types/pronunciation_dictionary_version_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..ad6a32d8b603393598c2d3ce006dbf5e118a9db5 --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_version_locator.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PronunciationDictionaryVersionLocator(UncheckedBaseModel): + pronunciation_dictionary_id: str = pydantic.Field() + """ + The ID of the pronunciation dictionary. + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the version of the pronunciation dictionary. If not provided, the latest version will be used. + """ + + 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/data/src/elevenlabs/types/pronunciation_dictionary_version_response_model.py b/data/src/elevenlabs/types/pronunciation_dictionary_version_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..33e3031879ab97eb0380b14ed1232f52e6a518a9 --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_version_response_model.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .pronunciation_dictionary_version_response_model_permission_on_resource import ( + PronunciationDictionaryVersionResponseModelPermissionOnResource, +) + + +class PronunciationDictionaryVersionResponseModel(UncheckedBaseModel): + version_id: str + version_rules_num: int + pronunciation_dictionary_id: str + dictionary_name: str + version_name: str + permission_on_resource: typing.Optional[PronunciationDictionaryVersionResponseModelPermissionOnResource] = None + created_by: str + creation_time_unix: int + archived_time_unix: typing.Optional[int] = 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/data/src/elevenlabs/types/pronunciation_dictionary_version_response_model_permission_on_resource.py b/data/src/elevenlabs/types/pronunciation_dictionary_version_response_model_permission_on_resource.py new file mode 100644 index 0000000000000000000000000000000000000000..d474b428813386ca1dc81f51507fd0cbdc52b1f9 --- /dev/null +++ b/data/src/elevenlabs/types/pronunciation_dictionary_version_response_model_permission_on_resource.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +PronunciationDictionaryVersionResponseModelPermissionOnResource = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/pydantic_pronunciation_dictionary_version_locator.py b/data/src/elevenlabs/types/pydantic_pronunciation_dictionary_version_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..b060210e4eb4fecb5dbb116ccd4b92bcc03a0cf0 --- /dev/null +++ b/data/src/elevenlabs/types/pydantic_pronunciation_dictionary_version_locator.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class PydanticPronunciationDictionaryVersionLocator(UncheckedBaseModel): + """ + A locator for other documents to be able to reference a specific dictionary and it's version. + This is a pydantic version of PronunciationDictionaryVersionLocatorDBModel. + Required to ensure compat with the rest of the agent data models. + """ + + pronunciation_dictionary_id: str = pydantic.Field() + """ + The ID of the pronunciation dictionary + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the version of the pronunciation dictionary + """ + + 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/data/src/elevenlabs/types/quality_preset_type.py b/data/src/elevenlabs/types/quality_preset_type.py new file mode 100644 index 0000000000000000000000000000000000000000..4aae31c36de6e501d2f0b6d5f2a7199800ad8f0e --- /dev/null +++ b/data/src/elevenlabs/types/quality_preset_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +QualityPresetType = typing.Union[typing.Literal["standard", "high", "ultra", "ultra_lossless"], typing.Any] diff --git a/data/src/elevenlabs/types/query_params_json_schema_input.py b/data/src/elevenlabs/types/query_params_json_schema_input.py new file mode 100644 index 0000000000000000000000000000000000000000..1dac71ac2491d577a480fa6b99f48f8de426b098 --- /dev/null +++ b/data/src/elevenlabs/types/query_params_json_schema_input.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .literal_json_schema_property import LiteralJsonSchemaProperty + + +class QueryParamsJsonSchemaInput(UncheckedBaseModel): + properties: typing.Dict[str, LiteralJsonSchemaProperty] + required: typing.Optional[typing.List[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/data/src/elevenlabs/types/query_params_json_schema_output.py b/data/src/elevenlabs/types/query_params_json_schema_output.py new file mode 100644 index 0000000000000000000000000000000000000000..99a56ad7bb169cca62041878feab64b4ad09e6c6 --- /dev/null +++ b/data/src/elevenlabs/types/query_params_json_schema_output.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .literal_json_schema_property import LiteralJsonSchemaProperty + + +class QueryParamsJsonSchemaOutput(UncheckedBaseModel): + properties: typing.Dict[str, LiteralJsonSchemaProperty] + required: typing.Optional[typing.List[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/data/src/elevenlabs/types/quote_info.py b/data/src/elevenlabs/types/quote_info.py new file mode 100644 index 0000000000000000000000000000000000000000..62ffe3ce759a785aa9e911f0dfd4b5e2c97d8272 --- /dev/null +++ b/data/src/elevenlabs/types/quote_info.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class QuoteInfo(UncheckedBaseModel): + amount_usd: float = pydantic.Field() + """ + The quoted price for this item in USD. Use the order's total_amount_usd for the combined order total. + """ + + 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/data/src/elevenlabs/types/rag_chunk_metadata.py b/data/src/elevenlabs/types/rag_chunk_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..e6345190d8b5f1b550a2a1e4a6864023b714b945 --- /dev/null +++ b/data/src/elevenlabs/types/rag_chunk_metadata.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RagChunkMetadata(UncheckedBaseModel): + document_id: str + chunk_id: str + vector_distance: float + + 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/data/src/elevenlabs/types/rag_config_input.py b/data/src/elevenlabs/types/rag_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..7891de979a3b7b9aa80d9ea1b74b43046cd664aa --- /dev/null +++ b/data/src/elevenlabs/types/rag_config_input.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .embedding_model_enum import EmbeddingModelEnum +from .knowledge_base_tool_info import KnowledgeBaseToolInfo + + +class RagConfigInput(UncheckedBaseModel): + enabled: typing.Optional[bool] = None + embedding_model: typing.Optional[EmbeddingModelEnum] = None + max_vector_distance: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum vector distance of retrieved chunks. + """ + + max_documents_length: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum total length of document chunks retrieved from RAG. + """ + + max_retrieved_rag_chunks_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of RAG document chunks to initially retrieve from the vector store. These are then further filtered by vector distance and total length. + """ + + num_candidates: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of candidates evaluated in ANN vector search. Higher number means better results, but higher latency. Minimum recommended value is 100. If disabled, the default value is used. + """ + + query_rewrite_prompt_override: typing.Optional[str] = pydantic.Field(default=None) + """ + Custom prompt for rewriting user queries before RAG retrieval. The conversation history will be automatically appended at the end. If not set, the default prompt will be used. + """ + + knowledge_base_tool_info: typing.Optional[KnowledgeBaseToolInfo] = pydantic.Field(default=None) + """ + When set, the agent uses the knowledge_base tool instead of the legacy knowledge_base_rag tool. None means the agent is not opted in. + """ + + 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/data/src/elevenlabs/types/rag_config_output.py b/data/src/elevenlabs/types/rag_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..a67681caa2c841ec59936385b764b30b9eb0b054 --- /dev/null +++ b/data/src/elevenlabs/types/rag_config_output.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .embedding_model_enum import EmbeddingModelEnum +from .knowledge_base_tool_info import KnowledgeBaseToolInfo + + +class RagConfigOutput(UncheckedBaseModel): + enabled: typing.Optional[bool] = None + embedding_model: typing.Optional[EmbeddingModelEnum] = None + max_vector_distance: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum vector distance of retrieved chunks. + """ + + max_documents_length: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum total length of document chunks retrieved from RAG. + """ + + max_retrieved_rag_chunks_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of RAG document chunks to initially retrieve from the vector store. These are then further filtered by vector distance and total length. + """ + + num_candidates: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of candidates evaluated in ANN vector search. Higher number means better results, but higher latency. Minimum recommended value is 100. If disabled, the default value is used. + """ + + query_rewrite_prompt_override: typing.Optional[str] = pydantic.Field(default=None) + """ + Custom prompt for rewriting user queries before RAG retrieval. The conversation history will be automatically appended at the end. If not set, the default prompt will be used. + """ + + knowledge_base_tool_info: typing.Optional[KnowledgeBaseToolInfo] = pydantic.Field(default=None) + """ + When set, the agent uses the knowledge_base tool instead of the legacy knowledge_base_rag tool. None means the agent is not opted in. + """ + + 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/data/src/elevenlabs/types/rag_config_workflow_override_input.py b/data/src/elevenlabs/types/rag_config_workflow_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..09ac30e458f44a8f38368555769fc377646f2f06 --- /dev/null +++ b/data/src/elevenlabs/types/rag_config_workflow_override_input.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .embedding_model_enum import EmbeddingModelEnum +from .knowledge_base_tool_info import KnowledgeBaseToolInfo + + +class RagConfigWorkflowOverrideInput(UncheckedBaseModel): + enabled: typing.Optional[bool] = None + embedding_model: typing.Optional[EmbeddingModelEnum] = None + max_vector_distance: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum vector distance of retrieved chunks. + """ + + max_documents_length: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum total length of document chunks retrieved from RAG. + """ + + max_retrieved_rag_chunks_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of RAG document chunks to initially retrieve from the vector store. These are then further filtered by vector distance and total length. + """ + + num_candidates: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of candidates evaluated in ANN vector search. Higher number means better results, but higher latency. Minimum recommended value is 100. If disabled, the default value is used. + """ + + query_rewrite_prompt_override: typing.Optional[str] = pydantic.Field(default=None) + """ + Custom prompt for rewriting user queries before RAG retrieval. The conversation history will be automatically appended at the end. If not set, the default prompt will be used. + """ + + knowledge_base_tool_info: typing.Optional[KnowledgeBaseToolInfo] = pydantic.Field(default=None) + """ + When set, the agent uses the knowledge_base tool instead of the legacy knowledge_base_rag tool. None means the agent is not opted in. + """ + + 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/data/src/elevenlabs/types/rag_config_workflow_override_output.py b/data/src/elevenlabs/types/rag_config_workflow_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..117fc23b2342b3df20e6bd24d6909a17673d875b --- /dev/null +++ b/data/src/elevenlabs/types/rag_config_workflow_override_output.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .embedding_model_enum import EmbeddingModelEnum +from .knowledge_base_tool_info import KnowledgeBaseToolInfo + + +class RagConfigWorkflowOverrideOutput(UncheckedBaseModel): + enabled: typing.Optional[bool] = None + embedding_model: typing.Optional[EmbeddingModelEnum] = None + max_vector_distance: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum vector distance of retrieved chunks. + """ + + max_documents_length: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum total length of document chunks retrieved from RAG. + """ + + max_retrieved_rag_chunks_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of RAG document chunks to initially retrieve from the vector store. These are then further filtered by vector distance and total length. + """ + + num_candidates: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of candidates evaluated in ANN vector search. Higher number means better results, but higher latency. Minimum recommended value is 100. If disabled, the default value is used. + """ + + query_rewrite_prompt_override: typing.Optional[str] = pydantic.Field(default=None) + """ + Custom prompt for rewriting user queries before RAG retrieval. The conversation history will be automatically appended at the end. If not set, the default prompt will be used. + """ + + knowledge_base_tool_info: typing.Optional[KnowledgeBaseToolInfo] = pydantic.Field(default=None) + """ + When set, the agent uses the knowledge_base tool instead of the legacy knowledge_base_rag tool. None means the agent is not opted in. + """ + + 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/data/src/elevenlabs/types/rag_document_index_response_model.py b/data/src/elevenlabs/types/rag_document_index_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f8e03fb56e324113f85d4bd520d6fc6dbcf3678d --- /dev/null +++ b/data/src/elevenlabs/types/rag_document_index_response_model.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .embedding_model_enum import EmbeddingModelEnum +from .rag_document_index_usage import RagDocumentIndexUsage +from .rag_index_status import RagIndexStatus + + +class RagDocumentIndexResponseModel(UncheckedBaseModel): + id: str + model: EmbeddingModelEnum + status: RagIndexStatus + progress_percentage: float + document_model_index_usage: RagDocumentIndexUsage + + 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/data/src/elevenlabs/types/rag_document_index_usage.py b/data/src/elevenlabs/types/rag_document_index_usage.py new file mode 100644 index 0000000000000000000000000000000000000000..f2c129355b65990326e9c2930635c5b33f77ad4f --- /dev/null +++ b/data/src/elevenlabs/types/rag_document_index_usage.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RagDocumentIndexUsage(UncheckedBaseModel): + used_bytes: int + + 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/data/src/elevenlabs/types/rag_document_indexes_response_model.py b/data/src/elevenlabs/types/rag_document_indexes_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5a078909b3b812b8c43f964ab186cc4aa61ca6d8 --- /dev/null +++ b/data/src/elevenlabs/types/rag_document_indexes_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .rag_document_index_response_model import RagDocumentIndexResponseModel + + +class RagDocumentIndexesResponseModel(UncheckedBaseModel): + indexes: typing.List[RagDocumentIndexResponseModel] + + 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/data/src/elevenlabs/types/rag_index_batch_successful_response_model.py b/data/src/elevenlabs/types/rag_index_batch_successful_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a4cae16b763cb6fe6c511e0a3716317d9ea429fb --- /dev/null +++ b/data/src/elevenlabs/types/rag_index_batch_successful_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .rag_document_index_response_model import RagDocumentIndexResponseModel + + +class RagIndexBatchSuccessfulResponseModel(UncheckedBaseModel): + data: RagDocumentIndexResponseModel + + 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/data/src/elevenlabs/types/rag_index_overview_embedding_model_response_model.py b/data/src/elevenlabs/types/rag_index_overview_embedding_model_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..064dcbdfa743e291a9c97ebdd9f01f428608fbfc --- /dev/null +++ b/data/src/elevenlabs/types/rag_index_overview_embedding_model_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .embedding_model_enum import EmbeddingModelEnum + + +class RagIndexOverviewEmbeddingModelResponseModel(UncheckedBaseModel): + model: EmbeddingModelEnum + used_bytes: int + + 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/data/src/elevenlabs/types/rag_index_overview_response_model.py b/data/src/elevenlabs/types/rag_index_overview_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9ff788b00c36ecb39078219224e8cb378a788641 --- /dev/null +++ b/data/src/elevenlabs/types/rag_index_overview_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .rag_index_overview_embedding_model_response_model import RagIndexOverviewEmbeddingModelResponseModel + + +class RagIndexOverviewResponseModel(UncheckedBaseModel): + total_used_bytes: int + total_max_bytes: int + models: typing.List[RagIndexOverviewEmbeddingModelResponseModel] + + 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/data/src/elevenlabs/types/rag_index_status.py b/data/src/elevenlabs/types/rag_index_status.py new file mode 100644 index 0000000000000000000000000000000000000000..fe85829a665e1a3009ce072f8ef6da81f96e4e95 --- /dev/null +++ b/data/src/elevenlabs/types/rag_index_status.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +RagIndexStatus = typing.Union[ + typing.Literal[ + "new", + "created", + "processing", + "failed", + "succeeded", + "rag_limit_exceeded", + "document_too_small", + "cannot_index_folder", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/rag_retrieval_info.py b/data/src/elevenlabs/types/rag_retrieval_info.py new file mode 100644 index 0000000000000000000000000000000000000000..ec1cdbd22a8c19491499f621b7f85064fccf32ed --- /dev/null +++ b/data/src/elevenlabs/types/rag_retrieval_info.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .embedding_model_enum import EmbeddingModelEnum +from .rag_chunk_metadata import RagChunkMetadata + + +class RagRetrievalInfo(UncheckedBaseModel): + chunks: typing.List[RagChunkMetadata] + embedding_model: EmbeddingModelEnum + retrieval_query: str + rag_latency_secs: float + used_chunk_ids: typing.Optional[typing.List[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/data/src/elevenlabs/types/read_legal_terms.py b/data/src/elevenlabs/types/read_legal_terms.py new file mode 100644 index 0000000000000000000000000000000000000000..7727f35625e815bad0899f72dc0c690872b4f1c3 --- /dev/null +++ b/data/src/elevenlabs/types/read_legal_terms.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ReadLegalTerms(UncheckedBaseModel): + terms: typing.Optional[str] = None + start_date: typing.Optional[str] = None + end_date: 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/data/src/elevenlabs/types/read_metadata_chapter_db_model.py b/data/src/elevenlabs/types/read_metadata_chapter_db_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1b453e8f02b8d6d5dedeec9895700985ab36f981 --- /dev/null +++ b/data/src/elevenlabs/types/read_metadata_chapter_db_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ReadMetadataChapterDbModel(UncheckedBaseModel): + chapter_name: str + word_count: int + char_count: int + starting_char_offset: int + has_parsed_html: typing.Optional[bool] = None + has_summary: typing.Optional[bool] = None + duration_seconds: typing.Optional[float] = None + file_number: typing.Optional[str] = None + is_fallback_name: typing.Optional[bool] = None + chapter_id: 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/data/src/elevenlabs/types/reader_resource_response_model.py b/data/src/elevenlabs/types/reader_resource_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5f09128ed5efcc5611a9bdc63bc557e7edabdbcf --- /dev/null +++ b/data/src/elevenlabs/types/reader_resource_response_model.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .reader_resource_response_model_resource_type import ReaderResourceResponseModelResourceType + + +class ReaderResourceResponseModel(UncheckedBaseModel): + resource_type: ReaderResourceResponseModelResourceType = pydantic.Field() + """ + The type of resource. + """ + + resource_id: str = pydantic.Field() + """ + The ID of the resource. + """ + + 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/data/src/elevenlabs/types/reader_resource_response_model_resource_type.py b/data/src/elevenlabs/types/reader_resource_response_model_resource_type.py new file mode 100644 index 0000000000000000000000000000000000000000..937d9174099207f50bf316e5db453c29e19064b8 --- /dev/null +++ b/data/src/elevenlabs/types/reader_resource_response_model_resource_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ReaderResourceResponseModelResourceType = typing.Union[typing.Literal["read", "collection"], typing.Any] diff --git a/data/src/elevenlabs/types/realtime_model.py b/data/src/elevenlabs/types/realtime_model.py new file mode 100644 index 0000000000000000000000000000000000000000..75cbe14237d6c277e770ae407c61271819c6fcc0 --- /dev/null +++ b/data/src/elevenlabs/types/realtime_model.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +RealtimeModel = typing.Union[typing.Literal["eleven_realtime_v1_mini", "eleven_realtime_v1_max"], typing.Any] diff --git a/data/src/elevenlabs/types/realtime_voice_settings.py b/data/src/elevenlabs/types/realtime_voice_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..f34a82dce696d05b337b006256dc15728446a4a7 --- /dev/null +++ b/data/src/elevenlabs/types/realtime_voice_settings.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RealtimeVoiceSettings(UncheckedBaseModel): + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + Defines the stability for voice settings. + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + Defines the similarity boost for voice settings. + """ + + style: typing.Optional[float] = pydantic.Field(default=None) + """ + Defines the style for voice settings. This parameter is available on V2+ models. + """ + + use_speaker_boost: typing.Optional[bool] = pydantic.Field(default=None) + """ + Defines the use speaker boost for voice settings. This parameter is available on V2+ models. + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + Controls the speed of the generated speech. Values range from 0.7 to 1.2, with 1.0 being the default speed. + """ + + 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/data/src/elevenlabs/types/recording_response.py b/data/src/elevenlabs/types/recording_response.py new file mode 100644 index 0000000000000000000000000000000000000000..60bc23716d3a101992eabf67503c932baa267bc9 --- /dev/null +++ b/data/src/elevenlabs/types/recording_response.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RecordingResponse(UncheckedBaseModel): + recording_id: str = pydantic.Field() + """ + The ID of the recording. + """ + + mime_type: str = pydantic.Field() + """ + The MIME type of the recording. + """ + + size_bytes: int = pydantic.Field() + """ + The size of the recording in bytes. + """ + + upload_date_unix: int = pydantic.Field() + """ + The date of the recording in Unix time. + """ + + transcription: str = pydantic.Field() + """ + The transcription of the recording. + """ + + 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/data/src/elevenlabs/types/reference_video.py b/data/src/elevenlabs/types/reference_video.py new file mode 100644 index 0000000000000000000000000000000000000000..39fa5a59e2f0b8cf8f38a081fecb25c47f6e48ab --- /dev/null +++ b/data/src/elevenlabs/types/reference_video.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .studio_clip_locator import StudioClipLocator + + +class ReferenceVideo(UncheckedBaseModel): + generation_id: typing.Optional[str] = None + content_asset_id: typing.Optional[str] = None + template_node_id: typing.Optional[str] = None + studio_clip: typing.Optional[StudioClipLocator] = 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/data/src/elevenlabs/types/referenced_tool_common_model.py b/data/src/elevenlabs/types/referenced_tool_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4a1cc261c1cc781711e743303dec4409bd4766b3 --- /dev/null +++ b/data/src/elevenlabs/types/referenced_tool_common_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .referenced_tool_common_model_type import ReferencedToolCommonModelType + + +class ReferencedToolCommonModel(UncheckedBaseModel): + """ + Reference to a tool for unit test evaluation. + """ + + id: str = pydantic.Field() + """ + The ID of the tool + """ + + type: ReferencedToolCommonModelType = pydantic.Field() + """ + The type of the tool + """ + + 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/data/src/elevenlabs/types/referenced_tool_common_model_type.py b/data/src/elevenlabs/types/referenced_tool_common_model_type.py new file mode 100644 index 0000000000000000000000000000000000000000..2d4b33df6a1c8b2470e9d217a624a000acd9b8df --- /dev/null +++ b/data/src/elevenlabs/types/referenced_tool_common_model_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ReferencedToolCommonModelType = typing.Union[ + typing.Literal["system", "webhook", "client", "workflow", "api_integration_webhook", "mcp", "code"], typing.Any +] diff --git a/data/src/elevenlabs/types/refresh_token_auth_response.py b/data/src/elevenlabs/types/refresh_token_auth_response.py new file mode 100644 index 0000000000000000000000000000000000000000..82fa891e9782680bac49e25564ad123f043593e1 --- /dev/null +++ b/data/src/elevenlabs/types/refresh_token_auth_response.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class RefreshTokenAuthResponse(UncheckedBaseModel): + """ + Response model for OAuth2 refresh-token-grant auth connections + """ + + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/regex_parameter_evaluation_strategy.py b/data/src/elevenlabs/types/regex_parameter_evaluation_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..da0cf374273e75e681123c2567242fa0d36685a5 --- /dev/null +++ b/data/src/elevenlabs/types/regex_parameter_evaluation_strategy.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RegexParameterEvaluationStrategy(UncheckedBaseModel): + pattern: str = pydantic.Field() + """ + A regex pattern to match the agent's response against. + """ + + 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/data/src/elevenlabs/types/region_config_request.py b/data/src/elevenlabs/types/region_config_request.py new file mode 100644 index 0000000000000000000000000000000000000000..d26f8539c5db0883537f6bab4c125d0c605a7bf7 --- /dev/null +++ b/data/src/elevenlabs/types/region_config_request.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .twilio_edge_location import TwilioEdgeLocation +from .twilio_region_id import TwilioRegionId + + +class RegionConfigRequest(UncheckedBaseModel): + region_id: TwilioRegionId = pydantic.Field() + """ + Region ID + """ + + token: str = pydantic.Field() + """ + Auth Token for this region + """ + + edge_location: TwilioEdgeLocation = pydantic.Field() + """ + Edge location for this region + """ + + 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/data/src/elevenlabs/types/regional_processing_surcharge_info.py b/data/src/elevenlabs/types/regional_processing_surcharge_info.py new file mode 100644 index 0000000000000000000000000000000000000000..fa2bce7f757add5500d2655be88285c64aa67c25 --- /dev/null +++ b/data/src/elevenlabs/types/regional_processing_surcharge_info.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RegionalProcessingSurchargeInfo(UncheckedBaseModel): + multiplier: float = pydantic.Field() + """ + The surcharge multiplier applied to this model's pricing (e.g. 1.1 for a 10% surcharge). + """ + + 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/data/src/elevenlabs/types/register_for_group_session_params.py b/data/src/elevenlabs/types/register_for_group_session_params.py new file mode 100644 index 0000000000000000000000000000000000000000..7a4ab0611cf47e7403ac8f0bf81f03490ea5986a --- /dev/null +++ b/data/src/elevenlabs/types/register_for_group_session_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RegisterForGroupSessionParams(UncheckedBaseModel): + """ + Register a client for a scheduled group session. + """ + + smb_tool_type: typing.Optional[typing.Literal["register_for_group_session"]] = 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/data/src/elevenlabs/types/register_media_response.py b/data/src/elevenlabs/types/register_media_response.py new file mode 100644 index 0000000000000000000000000000000000000000..312fc1408f448472358907f33c20faeb7eaa5d9c --- /dev/null +++ b/data/src/elevenlabs/types/register_media_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .media_id import MediaId + + +class RegisterMediaResponse(UncheckedBaseModel): + media_id: MediaId = pydantic.Field() + """ + The ID of the uploaded media file. + """ + + 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/data/src/elevenlabs/types/remove_member_from_group_request.py b/data/src/elevenlabs/types/remove_member_from_group_request.py new file mode 100644 index 0000000000000000000000000000000000000000..bbc1fd8c7df9eea6c0415bb55bb415f456cef051 --- /dev/null +++ b/data/src/elevenlabs/types/remove_member_from_group_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +RemoveMemberFromGroupRequest = typing.Any diff --git a/data/src/elevenlabs/types/remove_order_item_response.py b/data/src/elevenlabs/types/remove_order_item_response.py new file mode 100644 index 0000000000000000000000000000000000000000..f3a2c1749d775c2a943fd3c2c44224f91dae7927 --- /dev/null +++ b/data/src/elevenlabs/types/remove_order_item_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RemoveOrderItemResponse(UncheckedBaseModel): + success: bool = pydantic.Field() + """ + Whether the item was successfully removed. + """ + + 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/data/src/elevenlabs/types/remove_voice_from_user_voice_collection_response_model.py b/data/src/elevenlabs/types/remove_voice_from_user_voice_collection_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..98a944a30c70acca5db0a97a4ffcebec85ebdb31 --- /dev/null +++ b/data/src/elevenlabs/types/remove_voice_from_user_voice_collection_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RemoveVoiceFromUserVoiceCollectionResponseModel(UncheckedBaseModel): + collection_id: str = pydantic.Field() + """ + The ID of the voice collection. + """ + + voice_id: str = pydantic.Field() + """ + The ID of the voice that was removed. + """ + + 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/data/src/elevenlabs/types/render.py b/data/src/elevenlabs/types/render.py new file mode 100644 index 0000000000000000000000000000000000000000..056db8fa04cedc45b91766d67e98dd56013fc71f --- /dev/null +++ b/data/src/elevenlabs/types/render.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_media_reference import DubbingMediaReference +from .render_status import RenderStatus +from .render_type import RenderType + + +class Render(UncheckedBaseModel): + id: str + version: int + language: typing.Optional[str] = None + type: typing.Optional[RenderType] = None + media_ref: typing.Optional[DubbingMediaReference] = None + status: RenderStatus + + 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/data/src/elevenlabs/types/render_status.py b/data/src/elevenlabs/types/render_status.py new file mode 100644 index 0000000000000000000000000000000000000000..2f65782fc67592cb2deec37349545bb2d212043b --- /dev/null +++ b/data/src/elevenlabs/types/render_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +RenderStatus = typing.Union[typing.Literal["complete", "processing", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/render_type.py b/data/src/elevenlabs/types/render_type.py new file mode 100644 index 0000000000000000000000000000000000000000..ccc2ffd5248934470e7cd5b383556b0c6ea8770b --- /dev/null +++ b/data/src/elevenlabs/types/render_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +RenderType = typing.Union[ + typing.Literal["mp4", "aac", "mp3", "wav", "aaf", "tracks_zip", "clips_zip", "zip"], typing.Any +] diff --git a/data/src/elevenlabs/types/replicate_voice_to_isolated_environment_response_model.py b/data/src/elevenlabs/types/replicate_voice_to_isolated_environment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..68a246d4e941594644a1fe8ccf96848cf4b01e0e --- /dev/null +++ b/data/src/elevenlabs/types/replicate_voice_to_isolated_environment_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ReplicateVoiceToIsolatedEnvironmentResponseModel(UncheckedBaseModel): + voice_id: str = pydantic.Field() + """ + Voice ID of the replicated voice in the target residency. + """ + + 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/data/src/elevenlabs/types/report_knowledge_gap_params.py b/data/src/elevenlabs/types/report_knowledge_gap_params.py new file mode 100644 index 0000000000000000000000000000000000000000..67d3602d8f40c995a6afa61bc81febd3efcbff15 --- /dev/null +++ b/data/src/elevenlabs/types/report_knowledge_gap_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ReportKnowledgeGapParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["report_knowledge_gap"]] = 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/data/src/elevenlabs/types/request_pvc_manual_verification_response_model.py b/data/src/elevenlabs/types/request_pvc_manual_verification_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..22c31c37e95e5c3e678226996149ecaded77b2c0 --- /dev/null +++ b/data/src/elevenlabs/types/request_pvc_manual_verification_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RequestPvcManualVerificationResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the request PVC manual verification request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/required_constraint.py b/data/src/elevenlabs/types/required_constraint.py new file mode 100644 index 0000000000000000000000000000000000000000..55239d6c4acf98623fe6aa5543bf6b0b799f920b --- /dev/null +++ b/data/src/elevenlabs/types/required_constraint.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RequiredConstraint(UncheckedBaseModel): + """ + A set of fields that must all be present to satisfy this constraint. + """ + + required: typing.List[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/data/src/elevenlabs/types/required_constraints.py b/data/src/elevenlabs/types/required_constraints.py new file mode 100644 index 0000000000000000000000000000000000000000..dd064801743e5aeabb3bb57bdf35f9a6238f8b1a --- /dev/null +++ b/data/src/elevenlabs/types/required_constraints.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .required_constraint import RequiredConstraint + + +class RequiredConstraints(UncheckedBaseModel): + """ + Wrapper for anyOf/allOf composition constraints scoped to required fields. + """ + + any_of: typing.Optional[typing.List[RequiredConstraint]] = None + all_of: typing.Optional[typing.List[RequiredConstraint]] = 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/data/src/elevenlabs/types/resource_access_info.py b/data/src/elevenlabs/types/resource_access_info.py new file mode 100644 index 0000000000000000000000000000000000000000..533f46b1cbf392424a4cf35e3c1a96987791ca71 --- /dev/null +++ b/data/src/elevenlabs/types/resource_access_info.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .resource_access_info_access_source import ResourceAccessInfoAccessSource +from .resource_access_info_anonymous_access_level_override import ResourceAccessInfoAnonymousAccessLevelOverride +from .resource_access_info_role import ResourceAccessInfoRole + + +class ResourceAccessInfo(UncheckedBaseModel): + is_creator: bool = pydantic.Field() + """ + Whether the user making the request is the creator of the agent + """ + + creator_name: str = pydantic.Field() + """ + Name of the agent's creator + """ + + creator_email: str = pydantic.Field() + """ + Email of the agent's creator + """ + + role: ResourceAccessInfoRole = pydantic.Field() + """ + The role of the user making the request + """ + + anonymous_access_level_override: typing.Optional[ResourceAccessInfoAnonymousAccessLevelOverride] = pydantic.Field( + default=None + ) + """ + The access level for anonymous users. If None, the resource is not shared publicly. + """ + + access_source: typing.Optional[ResourceAccessInfoAccessSource] = pydantic.Field(default=None) + """ + Why the requesting user has access to this resource. 'creator' = caller is the owner. 'explicit' = caller (or one of their workspace groups) is listed in role_to_group_ids beyond the workspace-wide everyone group. 'workspace_default' = the workspace-wide everyone group is listed in role_to_group_ids (every non-anon workspace member, including admins, sees this resource). 'workspace_admin' = caller is a workspace admin and the admin seat is the *only* path to access; reserved for docs nobody else can see. Lets the UI disclose why an admin-bypass viewer sees a doc that wasn't explicitly shared with them. + """ + + 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/data/src/elevenlabs/types/resource_access_info_access_source.py b/data/src/elevenlabs/types/resource_access_info_access_source.py new file mode 100644 index 0000000000000000000000000000000000000000..d7c9866d3713a7b6dc35c235ff99212ccc683322 --- /dev/null +++ b/data/src/elevenlabs/types/resource_access_info_access_source.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ResourceAccessInfoAccessSource = typing.Union[ + typing.Literal["creator", "explicit", "workspace_admin", "workspace_default"], typing.Any +] diff --git a/data/src/elevenlabs/types/resource_access_info_anonymous_access_level_override.py b/data/src/elevenlabs/types/resource_access_info_anonymous_access_level_override.py new file mode 100644 index 0000000000000000000000000000000000000000..0198d8f9d1c30660c325bfe56428298d707a4b7a --- /dev/null +++ b/data/src/elevenlabs/types/resource_access_info_anonymous_access_level_override.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ResourceAccessInfoAnonymousAccessLevelOverride = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/resource_access_info_role.py b/data/src/elevenlabs/types/resource_access_info_role.py new file mode 100644 index 0000000000000000000000000000000000000000..51714cb520bddbfd5eb9de136a807527c1668e79 --- /dev/null +++ b/data/src/elevenlabs/types/resource_access_info_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ResourceAccessInfoRole = typing.Union[typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any] diff --git a/data/src/elevenlabs/types/resource_metadata_response_model.py b/data/src/elevenlabs/types/resource_metadata_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6f80b0daf8adad076ec2037ef7d5903fea2c2e1c --- /dev/null +++ b/data/src/elevenlabs/types/resource_metadata_response_model.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .resource_metadata_response_model_anonymous_access_level_override import ( + ResourceMetadataResponseModelAnonymousAccessLevelOverride, +) +from .share_option_response_model import ShareOptionResponseModel +from .workspace_resource_type import WorkspaceResourceType + + +class ResourceMetadataResponseModel(UncheckedBaseModel): + resource_id: str = pydantic.Field() + """ + The ID of the resource. + """ + + resource_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the resource, if available. + """ + + resource_type: WorkspaceResourceType = pydantic.Field() + """ + The type of the resource. + """ + + creator_user_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the user who created the resource. + """ + + anonymous_access_level_override: typing.Optional[ResourceMetadataResponseModelAnonymousAccessLevelOverride] = ( + pydantic.Field(default=None) + ) + """ + The access level for anonymous users. If None, the resource is not shared publicly. + """ + + role_to_group_ids: typing.Dict[str, typing.List[str]] = pydantic.Field() + """ + A mapping of grant slots to group IDs. Keys are the preset access roles plus workspace custom-role ids ('role_...'). When the resource is shared with a user, the group id is the user's id. + """ + + share_options: typing.List[ShareOptionResponseModel] = pydantic.Field() + """ + List of options for sharing the resource further in the workspace. These are users who don't have access to the resource yet. + """ + + 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/data/src/elevenlabs/types/resource_metadata_response_model_anonymous_access_level_override.py b/data/src/elevenlabs/types/resource_metadata_response_model_anonymous_access_level_override.py new file mode 100644 index 0000000000000000000000000000000000000000..75a9672cfe1bc72ef67bdb1f1e1256b9e03378cf --- /dev/null +++ b/data/src/elevenlabs/types/resource_metadata_response_model_anonymous_access_level_override.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ResourceMetadataResponseModelAnonymousAccessLevelOverride = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/response_conversation_error_type.py b/data/src/elevenlabs/types/response_conversation_error_type.py new file mode 100644 index 0000000000000000000000000000000000000000..3c09a4fde4697b1e55368fd0cd3b51a431c5f18d --- /dev/null +++ b/data/src/elevenlabs/types/response_conversation_error_type.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ResponseConversationErrorType = typing.Union[ + typing.Literal[ + "system_error", + "call_initialization_error", + "line_busy", + "no_answer", + "call_rejected", + "blocked_by_user", + "agent_configuration_error", + "invalid_client_request", + "permission_error", + "entitlement_exceeded", + "client_disconnected", + "llm_error", + "speech_error", + "tool_error", + "integration_error", + "guardrail_triggered", + "safety_violation", + "max_duration_exceeded", + "post_processing_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/response_filter.py b/data/src/elevenlabs/types/response_filter.py new file mode 100644 index 0000000000000000000000000000000000000000..e1368e3c2f448067eecef1df55a8c025e82ef3ee --- /dev/null +++ b/data/src/elevenlabs/types/response_filter.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .response_filter_mode import ResponseFilterMode + + +class ResponseFilter(UncheckedBaseModel): + """ + Configuration for filtering tool responses before they are visible to the agent. + """ + + mode: typing.Optional[ResponseFilterMode] = pydantic.Field(default=None) + """ + Controls how tool responses are filtered. 'all' returns entire response, 'allow' returns only specified paths, 'hide_all' hides the entire response. + """ + + filters: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Dot notation paths to include when mode is 'allow' (e.g., ['ticket.id', 'ticket.status']). + """ + + content_type: typing.Optional[typing.Literal["application/json"]] = pydantic.Field(default=None) + """ + Content type for response filtering. Only 'application/json' responses are filtered. + """ + + 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/data/src/elevenlabs/types/response_filter_mode.py b/data/src/elevenlabs/types/response_filter_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..e00b6ffbd8181e16a4716e459f6e815eae073d2f --- /dev/null +++ b/data/src/elevenlabs/types/response_filter_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ResponseFilterMode = typing.Union[typing.Literal["all", "allow", "hide_all"], typing.Any] diff --git a/data/src/elevenlabs/types/response_unit_test_model.py b/data/src/elevenlabs/types/response_unit_test_model.py new file mode 100644 index 0000000000000000000000000000000000000000..67e4d524bde84e1f40148553f374050b4f9198bd --- /dev/null +++ b/data/src/elevenlabs/types/response_unit_test_model.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_failure_response_example import AgentFailureResponseExample +from .agent_successful_response_example import AgentSuccessfulResponseExample +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from .conversation_initiation_source import ConversationInitiationSource +from .test_from_conversation_metadata_output import TestFromConversationMetadataOutput + + +class ResponseUnitTestModel(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + success_condition: typing.Optional[str] = pydantic.Field(default=None) + """ + A prompt that evaluates whether the agent's response is successful. Should return True or False. + """ + + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = pydantic.Field(default=None) + """ + Non-empty list of example responses that should be considered successful + """ + + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = pydantic.Field(default=None) + """ + Non-empty list of example responses that should be considered failures + """ + + 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 + + +update_forward_refs(ResponseUnitTestModel) diff --git a/data/src/elevenlabs/types/restore_calendar_event_params.py b/data/src/elevenlabs/types/restore_calendar_event_params.py new file mode 100644 index 0000000000000000000000000000000000000000..62dddf632925ff5a96912b3f35c2b5572f08bdab --- /dev/null +++ b/data/src/elevenlabs/types/restore_calendar_event_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RestoreCalendarEventParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["restore_calendar_event"]] = 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/data/src/elevenlabs/types/retry_trigger_action.py b/data/src/elevenlabs/types/retry_trigger_action.py new file mode 100644 index 0000000000000000000000000000000000000000..aad48805f54417992e3e8a9ae037a944ad78c8c0 --- /dev/null +++ b/data/src/elevenlabs/types/retry_trigger_action.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class RetryTriggerAction(UncheckedBaseModel): + feedback: typing.Optional[str] = pydantic.Field(default=None) + """ + Custom feedback to inject into the agent when retrying after guardrail trigger. + """ + + 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/data/src/elevenlabs/types/review_response_model.py b/data/src/elevenlabs/types/review_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..86dfb9e236099ca351efd4c5ea9ade2ac9b100d2 --- /dev/null +++ b/data/src/elevenlabs/types/review_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .review_response_model_reject_reasons_item import ReviewResponseModelRejectReasonsItem +from .review_response_model_review_status import ReviewResponseModelReviewStatus + + +class ReviewResponseModel(UncheckedBaseModel): + review_status: ReviewResponseModelReviewStatus + reviewed_at_unix: int + reviewed_by: typing.Optional[str] = None + reject_reasons: typing.Optional[typing.List[ReviewResponseModelRejectReasonsItem]] = None + scores_breakdown: typing.Optional[typing.Dict[str, typing.Optional[int]]] = None + rejected_details: typing.Optional[str] = None + explanation: 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/data/src/elevenlabs/types/review_response_model_reject_reasons_item.py b/data/src/elevenlabs/types/review_response_model_reject_reasons_item.py new file mode 100644 index 0000000000000000000000000000000000000000..8951ab0c4b20e3561cc9b360895883c39a498f40 --- /dev/null +++ b/data/src/elevenlabs/types/review_response_model_reject_reasons_item.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ReviewResponseModelRejectReasonsItem = typing.Union[ + typing.Literal[ + "lacks_structure", + "doesnt_open", + "not_literary_work", + "language_not_supported", + "too_short", + "duplicate", + "promotional", + "formatting_issues", + "low_quality", + "metadata_incomplete", + "metadata_inaccurate", + "typos", + "review_error", + "spam", + "legal_violation", + "content_policy", + "public_domain", + "other", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/review_response_model_review_status.py b/data/src/elevenlabs/types/review_response_model_review_status.py new file mode 100644 index 0000000000000000000000000000000000000000..de07405b7157825f40dae006d5526fcd9e216d92 --- /dev/null +++ b/data/src/elevenlabs/types/review_response_model_review_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ReviewResponseModelReviewStatus = typing.Union[typing.Literal["approved", "edits_required", "rejected"], typing.Any] diff --git a/data/src/elevenlabs/types/review_status.py b/data/src/elevenlabs/types/review_status.py new file mode 100644 index 0000000000000000000000000000000000000000..a4c65cb9611fd1891d7d38d0a06765f672f7e5b8 --- /dev/null +++ b/data/src/elevenlabs/types/review_status.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ReviewStatus = typing.Union[ + typing.Literal["not_requested", "pending", "declined", "declined_resubmittable", "allowed", "allowed_with_changes"], + typing.Any, +] diff --git a/data/src/elevenlabs/types/safety_common_model_input.py b/data/src/elevenlabs/types/safety_common_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..44bc666909da9ef96a6c925e76c1a073bd34bc9a --- /dev/null +++ b/data/src/elevenlabs/types/safety_common_model_input.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .safety_evaluation import SafetyEvaluation + + +class SafetyCommonModelInput(UncheckedBaseModel): + """ + Safety object that has the information of safety evaluations based on used voice. + """ + + ivc: typing.Optional[SafetyEvaluation] = None + non_ivc: typing.Optional[SafetyEvaluation] = 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/data/src/elevenlabs/types/safety_common_model_output.py b/data/src/elevenlabs/types/safety_common_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..8462ae84fe47991e3336135f4ad3b01de273056c --- /dev/null +++ b/data/src/elevenlabs/types/safety_common_model_output.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .safety_evaluation import SafetyEvaluation + + +class SafetyCommonModelOutput(UncheckedBaseModel): + """ + Safety object that has the information of safety evaluations based on used voice. + """ + + ivc: typing.Optional[SafetyEvaluation] = None + non_ivc: typing.Optional[SafetyEvaluation] = 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/data/src/elevenlabs/types/safety_evaluation.py b/data/src/elevenlabs/types/safety_evaluation.py new file mode 100644 index 0000000000000000000000000000000000000000..563988ac840c606120b2d291dcccc6d0b379bb77 --- /dev/null +++ b/data/src/elevenlabs/types/safety_evaluation.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .safety_rule import SafetyRule + + +class SafetyEvaluation(UncheckedBaseModel): + """ + Safety evaluation of the agent. Prompt and first message is taken into account. + The unsafe reason is provided from the evaluation + """ + + is_unsafe: typing.Optional[bool] = None + llm_reason: typing.Optional[str] = None + safety_prompt_version: typing.Optional[int] = None + matched_rule_id: typing.Optional[typing.List[SafetyRule]] = 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/data/src/elevenlabs/types/safety_response_model.py b/data/src/elevenlabs/types/safety_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8422f28bd1a092037d606af36422e06d570e7ec6 --- /dev/null +++ b/data/src/elevenlabs/types/safety_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SafetyResponseModel(UncheckedBaseModel): + is_blocked_ivc: typing.Optional[bool] = None + is_blocked_non_ivc: typing.Optional[bool] = None + ignore_safety_evaluation: 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/data/src/elevenlabs/types/safety_rule.py b/data/src/elevenlabs/types/safety_rule.py new file mode 100644 index 0000000000000000000000000000000000000000..982a09454ae5919a72d6276557c94469c3623f4e --- /dev/null +++ b/data/src/elevenlabs/types/safety_rule.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SafetyRule = typing.Union[ + typing.Literal[ + "sexual_minors", + "forget_moderation", + "extremism", + "scam_fraud", + "political", + "self_harm", + "illegal_distribution_medical", + "sexual_adults", + "unknown", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/sample_config_db_model.py b/data/src/elevenlabs/types/sample_config_db_model.py new file mode 100644 index 0000000000000000000000000000000000000000..50b5c15616b4d23213f39126d2a22d2ad71025db --- /dev/null +++ b/data/src/elevenlabs/types/sample_config_db_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .sample_config_db_model_parent_type import SampleConfigDbModelParentType + + +class SampleConfigDbModel(UncheckedBaseModel): + is_sample: typing.Optional[bool] = None + parent_id: typing.Optional[str] = None + parent_type: typing.Optional[SampleConfigDbModelParentType] = None + chapter_ids: typing.Optional[typing.List[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/data/src/elevenlabs/types/sample_config_db_model_parent_type.py b/data/src/elevenlabs/types/sample_config_db_model_parent_type.py new file mode 100644 index 0000000000000000000000000000000000000000..d5445e5f39fa10c33a0dd45713d4c831e6b9cbd0 --- /dev/null +++ b/data/src/elevenlabs/types/sample_config_db_model_parent_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SampleConfigDbModelParentType = typing.Union[typing.Literal["read", "collection"], typing.Any] diff --git a/data/src/elevenlabs/types/save_voice_preview_request.py b/data/src/elevenlabs/types/save_voice_preview_request.py new file mode 100644 index 0000000000000000000000000000000000000000..0603e2afa1921189a14c531b49504554b95f2748 --- /dev/null +++ b/data/src/elevenlabs/types/save_voice_preview_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SaveVoicePreviewRequest = typing.Any diff --git a/data/src/elevenlabs/types/say_node_literal_message_input.py b/data/src/elevenlabs/types/say_node_literal_message_input.py new file mode 100644 index 0000000000000000000000000000000000000000..a2baed4d953a6e0033ca090a7dad087b2f6992d0 --- /dev/null +++ b/data/src/elevenlabs/types/say_node_literal_message_input.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .translated_string import TranslatedString + + +class SayNodeLiteralMessageInput(UncheckedBaseModel): + text: str = pydantic.Field() + """ + Exact text spoken by the agent. Supports `{{variable_name}}` dynamic variable placeholders. + """ + + text_translations: typing.Optional[typing.Dict[str, TranslatedString]] = pydantic.Field(default=None) + """ + Translations of `text`, keyed by language code. When the conversation language has an entry, its value is spoken instead of `text`. + """ + + 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/data/src/elevenlabs/types/say_node_literal_message_output.py b/data/src/elevenlabs/types/say_node_literal_message_output.py new file mode 100644 index 0000000000000000000000000000000000000000..18d1ca9275d7849794bb60d94406ca36d9ff90ec --- /dev/null +++ b/data/src/elevenlabs/types/say_node_literal_message_output.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .translated_string import TranslatedString + + +class SayNodeLiteralMessageOutput(UncheckedBaseModel): + text: str = pydantic.Field() + """ + Exact text spoken by the agent. Supports `{{variable_name}}` dynamic variable placeholders. + """ + + text_translations: typing.Dict[str, TranslatedString] = pydantic.Field() + """ + Translations of `text`, keyed by language code. When the conversation language has an entry, its value is spoken instead of `text`. + """ + + 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/data/src/elevenlabs/types/say_node_prompt_message_input.py b/data/src/elevenlabs/types/say_node_prompt_message_input.py new file mode 100644 index 0000000000000000000000000000000000000000..4695f87fa451e6a09ffb65930ae501070ae7f40b --- /dev/null +++ b/data/src/elevenlabs/types/say_node_prompt_message_input.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SayNodePromptMessageInput(UncheckedBaseModel): + prompt: str = pydantic.Field() + """ + Description of the message the LLM should generate. It is appended to the agent's system prompt while this node is active. + """ + + 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/data/src/elevenlabs/types/say_node_prompt_message_output.py b/data/src/elevenlabs/types/say_node_prompt_message_output.py new file mode 100644 index 0000000000000000000000000000000000000000..f5af09eb8d365d1a1e97d3ba6fb075a825d77cbd --- /dev/null +++ b/data/src/elevenlabs/types/say_node_prompt_message_output.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SayNodePromptMessageOutput(UncheckedBaseModel): + prompt: str = pydantic.Field() + """ + Description of the message the LLM should generate. It is appended to the agent's system prompt while this node is active. + """ + + 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/data/src/elevenlabs/types/schedule_group_session_params.py b/data/src/elevenlabs/types/schedule_group_session_params.py new file mode 100644 index 0000000000000000000000000000000000000000..161247f5e385d5690d3ee289de19ee900450a199 --- /dev/null +++ b/data/src/elevenlabs/types/schedule_group_session_params.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScheduleGroupSessionParams(UncheckedBaseModel): + """ + Schedule a single instance of a group service. + + The session's duration is derived from the parent service so the assistant + only has to pin start time, the (optional) instructor / room, and the + location. Participants register separately via + ``register_for_group_session``. + """ + + smb_tool_type: typing.Optional[typing.Literal["schedule_group_session"]] = 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/data/src/elevenlabs/types/scim_group_response_model.py b/data/src/elevenlabs/types/scim_group_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8831b9e456f02d357981af62a5e8ce330de6a271 --- /dev/null +++ b/data/src/elevenlabs/types/scim_group_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .seat_type import SeatType + + +class ScimGroupResponseModel(UncheckedBaseModel): + scim_external_id: typing.Optional[str] = None + display_name: str + created_at_unix: typing.Optional[int] = None + updated_at_unix: typing.Optional[int] = None + seat_type: typing.Optional[SeatType] = 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/data/src/elevenlabs/types/scoped_analysis_result.py b/data/src/elevenlabs/types/scoped_analysis_result.py new file mode 100644 index 0000000000000000000000000000000000000000..975ecb9b92024090d62ac26fbad85b7ed7021266 --- /dev/null +++ b/data/src/elevenlabs/types/scoped_analysis_result.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .analysis_scope import AnalysisScope +from .conversation_history_evaluation_criteria_result_common_model import ( + ConversationHistoryEvaluationCriteriaResultCommonModel, +) +from .data_collection_result_common_model import DataCollectionResultCommonModel +from .evaluation_success_result import EvaluationSuccessResult + + +class ScopedAnalysisResult(UncheckedBaseModel): + scope: AnalysisScope = pydantic.Field() + """ + The scope of the analysis. 'conversation' uses the full transcript; 'agent' uses only the portion where the defining agent was active. + """ + + source_agent_id: str + source_branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Branch of the agent for this scoped block; disambiguates repeated agent_id. + """ + + evaluation_criteria_results: typing.Optional[ + typing.Dict[str, ConversationHistoryEvaluationCriteriaResultCommonModel] + ] = None + data_collection_results: typing.Optional[typing.Dict[str, DataCollectionResultCommonModel]] = None + successful: EvaluationSuccessResult + success_score: 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/data/src/elevenlabs/types/scribe_auth_error_payload.py b/data/src/elevenlabs/types/scribe_auth_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..8bf9cef3d81b0e891660a83de3534885765d5322 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_auth_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeAuthErrorPayload(UncheckedBaseModel): + """ + Payload for authentication errors. + """ + + message_type: typing.Literal["auth_error"] = pydantic.Field(default="auth_error") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Authentication error details. + """ + + 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/data/src/elevenlabs/types/scribe_chunk_size_exceeded_error_payload.py b/data/src/elevenlabs/types/scribe_chunk_size_exceeded_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..17be7c988bd22bec74914f196179590e4c4443c8 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_chunk_size_exceeded_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeChunkSizeExceededErrorPayload(UncheckedBaseModel): + """ + Payload for chunk size exceeded errors. + """ + + message_type: typing.Literal["chunk_size_exceeded"] = pydantic.Field(default="chunk_size_exceeded") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Chunk size exceeded error details. + """ + + 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/data/src/elevenlabs/types/scribe_error_payload.py b/data/src/elevenlabs/types/scribe_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..7f039aa455d33e905c3d8d97519837bab45416a7 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeErrorPayload(UncheckedBaseModel): + """ + Payload for error events during transcription. + """ + + message_type: typing.Literal["error"] = pydantic.Field(default="error") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Error message describing what went wrong. + """ + + 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/data/src/elevenlabs/types/scribe_input_error_payload.py b/data/src/elevenlabs/types/scribe_input_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..55edacd0d26305b814b149a96f9278ea1b3175fb --- /dev/null +++ b/data/src/elevenlabs/types/scribe_input_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeInputErrorPayload(UncheckedBaseModel): + """ + Payload for input errors. + """ + + message_type: typing.Literal["input_error"] = pydantic.Field(default="input_error") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Input error details. + """ + + 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/data/src/elevenlabs/types/scribe_insufficient_audio_activity_error_payload.py b/data/src/elevenlabs/types/scribe_insufficient_audio_activity_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..f822ead09122011d512092ad7130712e8a28e1b3 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_insufficient_audio_activity_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeInsufficientAudioActivityErrorPayload(UncheckedBaseModel): + """ + Payload for insufficient audio activity errors. + """ + + message_type: typing.Literal["insufficient_audio_activity"] = pydantic.Field(default="insufficient_audio_activity") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Insufficient audio activity error details. + """ + + 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/data/src/elevenlabs/types/scribe_invalid_request_error.py b/data/src/elevenlabs/types/scribe_invalid_request_error.py new file mode 100644 index 0000000000000000000000000000000000000000..a5f0a4ad773a58c17390d31a56b60f917f120cb2 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_invalid_request_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeInvalidRequestError(UncheckedBaseModel): + message_type: typing.Literal["invalid_request"] = "invalid_request" + error: 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/data/src/elevenlabs/types/scribe_queue_overflow_error_payload.py b/data/src/elevenlabs/types/scribe_queue_overflow_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..e3a5f7602bb1e5f754af5c7a88ddb07d920c3fb5 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_queue_overflow_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeQueueOverflowErrorPayload(UncheckedBaseModel): + """ + Payload for queue overflow errors. + """ + + message_type: typing.Literal["queue_overflow"] = pydantic.Field(default="queue_overflow") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Queue overflow error details. + """ + + 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/data/src/elevenlabs/types/scribe_quota_exceeded_error_payload.py b/data/src/elevenlabs/types/scribe_quota_exceeded_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..6ba7c20944aa7bbda60e12901170add5b8f26bd2 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_quota_exceeded_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeQuotaExceededErrorPayload(UncheckedBaseModel): + """ + Payload for quota exceeded errors. + """ + + message_type: typing.Literal["quota_exceeded"] = pydantic.Field(default="quota_exceeded") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Quota exceeded error details. + """ + + 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/data/src/elevenlabs/types/scribe_rate_limited_error_payload.py b/data/src/elevenlabs/types/scribe_rate_limited_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..414572af861a53c66aa2afe7ad1c02dd77ed3570 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_rate_limited_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeRateLimitedErrorPayload(UncheckedBaseModel): + """ + Payload for rate limited errors. + """ + + message_type: typing.Literal["rate_limited"] = pydantic.Field(default="rate_limited") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Rate limited error details. + """ + + 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/data/src/elevenlabs/types/scribe_resource_exhausted_error_payload.py b/data/src/elevenlabs/types/scribe_resource_exhausted_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..a00fd648b0f39ed904d6bc31d04a89267782114d --- /dev/null +++ b/data/src/elevenlabs/types/scribe_resource_exhausted_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeResourceExhaustedErrorPayload(UncheckedBaseModel): + """ + Payload for resource exhausted errors. + """ + + message_type: typing.Literal["resource_exhausted"] = pydantic.Field(default="resource_exhausted") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Resource exhausted error details. + """ + + 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/data/src/elevenlabs/types/scribe_session_time_limit_exceeded_error_payload.py b/data/src/elevenlabs/types/scribe_session_time_limit_exceeded_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..8df0a9e12fff474c93f86e9366fddc544ab88aba --- /dev/null +++ b/data/src/elevenlabs/types/scribe_session_time_limit_exceeded_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeSessionTimeLimitExceededErrorPayload(UncheckedBaseModel): + """ + Payload for session time limit exceeded errors. + """ + + message_type: typing.Literal["session_time_limit_exceeded"] = pydantic.Field(default="session_time_limit_exceeded") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Session time limit exceeded error details. + """ + + 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/data/src/elevenlabs/types/scribe_throttled_error_payload.py b/data/src/elevenlabs/types/scribe_throttled_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..15f67f5d159f61d80d33dc2d89d8b048a8445b3b --- /dev/null +++ b/data/src/elevenlabs/types/scribe_throttled_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeThrottledErrorPayload(UncheckedBaseModel): + """ + Payload for throttled errors. + """ + + message_type: typing.Literal["commit_throttled"] = pydantic.Field(default="commit_throttled") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Throttled error details. + """ + + 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/data/src/elevenlabs/types/scribe_transcriber_error_payload.py b/data/src/elevenlabs/types/scribe_transcriber_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..283f1deacaac33f2bb0a227748ef3345d79690f4 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_transcriber_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeTranscriberErrorPayload(UncheckedBaseModel): + """ + Payload for transcriber errors. + """ + + message_type: typing.Literal["transcriber_error"] = pydantic.Field(default="transcriber_error") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Transcriber error details. + """ + + 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/data/src/elevenlabs/types/scribe_unaccepted_terms_error_payload.py b/data/src/elevenlabs/types/scribe_unaccepted_terms_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..c17e90c7fa422f46ff1c5c75bb29ab72c60ef152 --- /dev/null +++ b/data/src/elevenlabs/types/scribe_unaccepted_terms_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeUnacceptedTermsErrorPayload(UncheckedBaseModel): + """ + Payload for unaccepted terms errors. + """ + + message_type: typing.Literal["unaccepted_terms"] = pydantic.Field(default="unaccepted_terms") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Unaccepted terms error details. + """ + + 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/data/src/elevenlabs/types/scribe_warning.py b/data/src/elevenlabs/types/scribe_warning.py new file mode 100644 index 0000000000000000000000000000000000000000..f7a384fda10af3bd774e56ab33515f639b60f32b --- /dev/null +++ b/data/src/elevenlabs/types/scribe_warning.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ScribeWarning(UncheckedBaseModel): + message_type: typing.Optional[typing.Literal["warning"]] = None + warning: 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/data/src/elevenlabs/types/search_clients_params.py b/data/src/elevenlabs/types/search_clients_params.py new file mode 100644 index 0000000000000000000000000000000000000000..fd329079415c8baab28a2e4a5a67448d5052bb9e --- /dev/null +++ b/data/src/elevenlabs/types/search_clients_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SearchClientsParams(UncheckedBaseModel): + """ + Search for clients by name, phone number, or email. + """ + + smb_tool_type: typing.Optional[typing.Literal["search_clients"]] = 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/data/src/elevenlabs/types/search_highlight_segment.py b/data/src/elevenlabs/types/search_highlight_segment.py new file mode 100644 index 0000000000000000000000000000000000000000..d057405637526f80e4a276383ca348bdca30a0d9 --- /dev/null +++ b/data/src/elevenlabs/types/search_highlight_segment.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SearchHighlightSegment(UncheckedBaseModel): + value: str + is_hit: bool + + 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/data/src/elevenlabs/types/search_strategy.py b/data/src/elevenlabs/types/search_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..4c881b66085eb22d6f223afaae18f07865f97471 --- /dev/null +++ b/data/src/elevenlabs/types/search_strategy.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SearchStrategy = typing.Union[typing.Literal["cat", "keyword", "semantic", "ls"], typing.Any] diff --git a/data/src/elevenlabs/types/seat_type.py b/data/src/elevenlabs/types/seat_type.py new file mode 100644 index 0000000000000000000000000000000000000000..997d650568a96d49e0e8468e622cd3e3bde7e812 --- /dev/null +++ b/data/src/elevenlabs/types/seat_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SeatType = typing.Union[typing.Literal["workspace_admin", "workspace_member", "workspace_lite_member"], typing.Any] diff --git a/data/src/elevenlabs/types/secret_dependency_resource_type.py b/data/src/elevenlabs/types/secret_dependency_resource_type.py new file mode 100644 index 0000000000000000000000000000000000000000..770038c5e589382b214c6b75f233729419c6733e --- /dev/null +++ b/data/src/elevenlabs/types/secret_dependency_resource_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SecretDependencyResourceType = typing.Union[typing.Literal["tools", "agents", "phone_numbers"], typing.Any] diff --git a/data/src/elevenlabs/types/secret_dependency_type.py b/data/src/elevenlabs/types/secret_dependency_type.py new file mode 100644 index 0000000000000000000000000000000000000000..1a2f9f490131b6be132497339fd0bede58feeca2 --- /dev/null +++ b/data/src/elevenlabs/types/secret_dependency_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SecretDependencyType = typing.Literal["conversation_initiation_webhook"] diff --git a/data/src/elevenlabs/types/section_source.py b/data/src/elevenlabs/types/section_source.py new file mode 100644 index 0000000000000000000000000000000000000000..c91a391c57a81f38b734b3e90b69c3fecdc3d6a6 --- /dev/null +++ b/data/src/elevenlabs/types/section_source.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .time_range import TimeRange + + +class SectionSource(UncheckedBaseModel): + song_id: str = pydantic.Field() + """ + The ID of the song to source the section from. You can find the song ID in the response headers when you generate a song. + """ + + range: TimeRange = pydantic.Field() + """ + The range to extract from the source song. + """ + + negative_ranges: typing.Optional[typing.List[TimeRange]] = pydantic.Field(default=None) + """ + The ranges to exclude from the 'range'. + """ + + 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/data/src/elevenlabs/types/segment_create_response.py b/data/src/elevenlabs/types/segment_create_response.py new file mode 100644 index 0000000000000000000000000000000000000000..15fadd4e409be8738826540644b1b2b32dc3b01f --- /dev/null +++ b/data/src/elevenlabs/types/segment_create_response.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentCreateResponse(UncheckedBaseModel): + version: int + new_segment: 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/data/src/elevenlabs/types/segment_delete_response.py b/data/src/elevenlabs/types/segment_delete_response.py new file mode 100644 index 0000000000000000000000000000000000000000..aa2693c28808dd622c103600b3095771bba32440 --- /dev/null +++ b/data/src/elevenlabs/types/segment_delete_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentDeleteResponse(UncheckedBaseModel): + version: int + + 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/data/src/elevenlabs/types/segment_dub_response.py b/data/src/elevenlabs/types/segment_dub_response.py new file mode 100644 index 0000000000000000000000000000000000000000..50139b9c18b07ed79db2f07f7e1167b75ff68768 --- /dev/null +++ b/data/src/elevenlabs/types/segment_dub_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentDubResponse(UncheckedBaseModel): + version: int + + 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/data/src/elevenlabs/types/segment_migration_response.py b/data/src/elevenlabs/types/segment_migration_response.py new file mode 100644 index 0000000000000000000000000000000000000000..8a2c11580794133c9404a4958221bad297f3e745 --- /dev/null +++ b/data/src/elevenlabs/types/segment_migration_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentMigrationResponse(UncheckedBaseModel): + version: int + + 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/data/src/elevenlabs/types/segment_subtitle_frame.py b/data/src/elevenlabs/types/segment_subtitle_frame.py new file mode 100644 index 0000000000000000000000000000000000000000..39182b5c486a499c997e4e2f0b397ce33cc68483 --- /dev/null +++ b/data/src/elevenlabs/types/segment_subtitle_frame.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentSubtitleFrame(UncheckedBaseModel): + start_time: float + end_time: float + lines: typing.List[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/data/src/elevenlabs/types/segment_transcription_response.py b/data/src/elevenlabs/types/segment_transcription_response.py new file mode 100644 index 0000000000000000000000000000000000000000..46b69d1df3d9ccf6a0275945444afdf70bfc3fd8 --- /dev/null +++ b/data/src/elevenlabs/types/segment_transcription_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentTranscriptionResponse(UncheckedBaseModel): + version: int + + 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/data/src/elevenlabs/types/segment_translation_response.py b/data/src/elevenlabs/types/segment_translation_response.py new file mode 100644 index 0000000000000000000000000000000000000000..2e0fa9eb57b0eca4725f1d1419deec5f5dd123f0 --- /dev/null +++ b/data/src/elevenlabs/types/segment_translation_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentTranslationResponse(UncheckedBaseModel): + version: int + + 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/data/src/elevenlabs/types/segment_update_response.py b/data/src/elevenlabs/types/segment_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..41789c94834abfc794f9f6417e44a98801ae3331 --- /dev/null +++ b/data/src/elevenlabs/types/segment_update_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentUpdateResponse(UncheckedBaseModel): + version: int + + 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/data/src/elevenlabs/types/segmented_json_export_options.py b/data/src/elevenlabs/types/segmented_json_export_options.py new file mode 100644 index 0000000000000000000000000000000000000000..da084539dc34f9f75a1b7fae19b21e521cf3beda --- /dev/null +++ b/data/src/elevenlabs/types/segmented_json_export_options.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SegmentedJsonExportOptions(UncheckedBaseModel): + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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/data/src/elevenlabs/types/send_custom_email_params.py b/data/src/elevenlabs/types/send_custom_email_params.py new file mode 100644 index 0000000000000000000000000000000000000000..e8e5f4bc9e2af625b9ab86ea135f317941fc9583 --- /dev/null +++ b/data/src/elevenlabs/types/send_custom_email_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SendCustomEmailParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["send_custom_email"]] = 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/data/src/elevenlabs/types/send_text.py b/data/src/elevenlabs/types/send_text.py new file mode 100644 index 0000000000000000000000000000000000000000..6ff0234e45061f23fb311ec3f0af000d79a4b788 --- /dev/null +++ b/data/src/elevenlabs/types/send_text.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .generation_config import GenerationConfig +from .realtime_voice_settings import RealtimeVoiceSettings + + +class SendText(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text to be sent to the API for audio generation. Should always end with a single space string. + """ + + try_trigger_generation: typing.Optional[bool] = pydantic.Field(default=None) + """ + This is an advanced setting that most users shouldn't need to use. It relates to our generation schedule. + + Use this to attempt to immediately trigger the generation of audio, overriding the `chunk_length_schedule`. + Unlike flush, `try_trigger_generation` will only generate audio if our + buffer contains more than a minimum + threshold of characters, this is to ensure a higher quality response from our model. + + Note that overriding the chunk schedule to generate small amounts of + text may result in lower quality audio, therefore, only use this parameter if you + really need text to be processed immediately. We generally recommend keeping the default value of + `false` and adjusting the `chunk_length_schedule` in the `generation_config` instead. + """ + + voice_settings: typing.Optional[RealtimeVoiceSettings] = pydantic.Field(default=None) + """ + The voice settings field can be provided in the first `InitializeConnection` message and then must either be not provided or not changed. + """ + + generator_config: typing.Optional[GenerationConfig] = pydantic.Field(default=None) + """ + The generator config field can be provided in the first `InitializeConnection` message and then must either be not provided or not changed. + """ + + flush: typing.Optional[bool] = pydantic.Field(default=None) + """ + Flush forces the generation of audio. Set this value to true when you have finished sending text, but want to keep the websocket connection open. + + This is useful when you want to ensure that the last chunk of audio is generated even when the length of text sent is smaller than the value set in chunk_length_schedule (e.g. 120 or 50). + """ + + 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/data/src/elevenlabs/types/send_text_multi.py b/data/src/elevenlabs/types/send_text_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..8d76838d662982af48f19ca25c5578b998e73176 --- /dev/null +++ b/data/src/elevenlabs/types/send_text_multi.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SendTextMulti(UncheckedBaseModel): + """ + Payload to send text for synthesis to an existing context. + """ + + text: str = pydantic.Field() + """ + Text to synthesize. Should end with a single space. + """ + + context_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The target context_id for this text. + """ + + flush: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, flushes the audio buffer for the specified context. If false, the text will be appended to the buffer to be generated. + """ + + 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/data/src/elevenlabs/types/sentiment_aggregate.py b/data/src/elevenlabs/types/sentiment_aggregate.py new file mode 100644 index 0000000000000000000000000000000000000000..e56c4c036e7180174e329afe45966c9b9d3a593d --- /dev/null +++ b/data/src/elevenlabs/types/sentiment_aggregate.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SentimentAggregate(UncheckedBaseModel): + scored_conversation_count: int + positive_count: int + neutral_count: int + negative_count: int + average_sentiment_score: typing.Optional[float] = None + average_frustration_score: typing.Optional[float] = None + recent_scored_conversation_count: int + recent_positive_count: int + recent_neutral_count: int + recent_negative_count: int + recent_average_sentiment_score: typing.Optional[float] = None + recent_average_frustration_score: 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/data/src/elevenlabs/types/sentiment_analysis_settings.py b/data/src/elevenlabs/types/sentiment_analysis_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..709616de32c5074654876ae88d60c4c1a4593b0b --- /dev/null +++ b/data/src/elevenlabs/types/sentiment_analysis_settings.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SentimentAnalysisSettings(UncheckedBaseModel): + 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/data/src/elevenlabs/types/session_started_payload.py b/data/src/elevenlabs/types/session_started_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..10bbe465f451f25d9171e08eafb6c70646a08917 --- /dev/null +++ b/data/src/elevenlabs/types/session_started_payload.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .session_started_payload_config import SessionStartedPayloadConfig + + +class SessionStartedPayload(UncheckedBaseModel): + """ + Payload sent when the transcription session is successfully started. + """ + + message_type: typing.Literal["session_started"] = pydantic.Field(default="session_started") + """ + The message type identifier. + """ + + session_id: str = pydantic.Field() + """ + Unique identifier for the session. + """ + + config: SessionStartedPayloadConfig = pydantic.Field() + """ + Configuration for the transcription session. + """ + + 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/data/src/elevenlabs/types/session_started_payload_config.py b/data/src/elevenlabs/types/session_started_payload_config.py new file mode 100644 index 0000000000000000000000000000000000000000..38524cb8dfe5d1e5c6a0097891dfc52d6fbdf024 --- /dev/null +++ b/data/src/elevenlabs/types/session_started_payload_config.py @@ -0,0 +1,90 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .audio_format_enum import AudioFormatEnum +from .session_started_payload_config_commit_strategy import SessionStartedPayloadConfigCommitStrategy + + +class SessionStartedPayloadConfig(UncheckedBaseModel): + """ + Configuration for the transcription session. + """ + + sample_rate: typing.Optional[int] = pydantic.Field(default=None) + """ + Sample rate of the audio in Hz. + """ + + audio_format: typing.Optional[AudioFormatEnum] = None + language_code: typing.Optional[str] = pydantic.Field(default=None) + """ + Language code in ISO 639-1 or ISO 639-3 format. + """ + + commit_strategy: typing.Optional[SessionStartedPayloadConfigCommitStrategy] = pydantic.Field(default=None) + """ + Strategy for committing transcriptions. + """ + + vad_silence_threshold_secs: typing.Optional[float] = pydantic.Field(default=None) + """ + Silence threshold in seconds. + """ + + vad_threshold: typing.Optional[float] = pydantic.Field(default=None) + """ + Threshold for voice activity detection. + """ + + min_speech_duration_ms: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum speech duration in milliseconds. + """ + + min_silence_duration_ms: typing.Optional[int] = pydantic.Field(default=None) + """ + Minimum silence duration in milliseconds. + """ + + model_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the model to use for transcription. + """ + + enable_logging: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enable_logging is set to false zero retention mode will be used for the request. This will mean history features are unavailable for this request. Zero retention mode may only be used by enterprise customers. + """ + + include_timestamps: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the session will include word-level timestamps in the committed transcript. + """ + + include_language_detection: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the session will include language detection in the committed transcript. + """ + + keyterms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of keyterms the model is biased towards. + """ + + no_verbatim: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether filler words and disfluencies are removed from the transcript. + """ + + 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/data/src/elevenlabs/types/session_started_payload_config_commit_strategy.py b/data/src/elevenlabs/types/session_started_payload_config_commit_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..d7ad9b8f14fcc813601105e071123133622ea56b --- /dev/null +++ b/data/src/elevenlabs/types/session_started_payload_config_commit_strategy.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SessionStartedPayloadConfigCommitStrategy = typing.Union[typing.Literal["manual", "vad"], typing.Any] diff --git a/data/src/elevenlabs/types/set_booking_slug_params.py b/data/src/elevenlabs/types/set_booking_slug_params.py new file mode 100644 index 0000000000000000000000000000000000000000..ad91b8f58100c0278b1646122064a52a0f275245 --- /dev/null +++ b/data/src/elevenlabs/types/set_booking_slug_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SetBookingSlugParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["set_booking_slug"]] = 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/data/src/elevenlabs/types/severity_id.py b/data/src/elevenlabs/types/severity_id.py new file mode 100644 index 0000000000000000000000000000000000000000..c3a8cd0ec5de4ffb2d1d4558f8ee2a6143cde1a8 --- /dev/null +++ b/data/src/elevenlabs/types/severity_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +SeverityId = int diff --git a/data/src/elevenlabs/types/sfx_model_id.py b/data/src/elevenlabs/types/sfx_model_id.py new file mode 100644 index 0000000000000000000000000000000000000000..16b514700a49ba3ded01a787389976e6a3c07fe5 --- /dev/null +++ b/data/src/elevenlabs/types/sfx_model_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SfxModelId = typing.Literal["eleven_text_to_sound_v2"] diff --git a/data/src/elevenlabs/types/sfx_source_context.py b/data/src/elevenlabs/types/sfx_source_context.py new file mode 100644 index 0000000000000000000000000000000000000000..2173ff1c4e94ccdc097197e85de049b6748e403b --- /dev/null +++ b/data/src/elevenlabs/types/sfx_source_context.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SfxSourceContext(UncheckedBaseModel): + """ + Context for sound effect clips. + """ + + sound_generation_history_item_id: typing.Optional[str] = None + text: typing.Optional[str] = None + generation_config: typing.Optional[typing.Dict[str, typing.Any]] = 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/data/src/elevenlabs/types/share_option_response_model.py b/data/src/elevenlabs/types/share_option_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8ec0d6e120ceb10a342e973b0eacf81582a5e2a6 --- /dev/null +++ b/data/src/elevenlabs/types/share_option_response_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .share_option_response_model_type import ShareOptionResponseModelType + + +class ShareOptionResponseModel(UncheckedBaseModel): + name: str = pydantic.Field() + """ + The name of the principal. + """ + + id: str = pydantic.Field() + """ + The ID of the principal. + """ + + type: ShareOptionResponseModelType = pydantic.Field() + """ + The type of the principal: user, group, or service account (under 'key'). + """ + + 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/data/src/elevenlabs/types/share_option_response_model_type.py b/data/src/elevenlabs/types/share_option_response_model_type.py new file mode 100644 index 0000000000000000000000000000000000000000..e968d8b14c17b084a895a3752c25fde4bcb5c0dc --- /dev/null +++ b/data/src/elevenlabs/types/share_option_response_model_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ShareOptionResponseModelType = typing.Union[typing.Literal["user", "group", "key"], typing.Any] diff --git a/data/src/elevenlabs/types/similar_voice.py b/data/src/elevenlabs/types/similar_voice.py new file mode 100644 index 0000000000000000000000000000000000000000..d11726720afbe55df3654ff29e0222a2d01b7152 --- /dev/null +++ b/data/src/elevenlabs/types/similar_voice.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .voice_category import VoiceCategory + + +class SimilarVoice(UncheckedBaseModel): + voice_id: str + name: str + category: VoiceCategory + description: typing.Optional[str] = None + preview_url: 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/data/src/elevenlabs/types/similar_voices_for_speaker_response.py b/data/src/elevenlabs/types/similar_voices_for_speaker_response.py new file mode 100644 index 0000000000000000000000000000000000000000..388969a088a6c0b9b1468e9bb044f05008cd2195 --- /dev/null +++ b/data/src/elevenlabs/types/similar_voices_for_speaker_response.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .similar_voice import SimilarVoice + + +class SimilarVoicesForSpeakerResponse(UncheckedBaseModel): + voices: typing.List[SimilarVoice] + + 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/data/src/elevenlabs/types/simulation_library_settings.py b/data/src/elevenlabs/types/simulation_library_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..e5997f39fca6dc993110efc9d80c503af9830153 --- /dev/null +++ b/data/src/elevenlabs/types/simulation_library_settings.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SimulationLibrarySettings(UncheckedBaseModel): + 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/data/src/elevenlabs/types/simulation_test_model.py b/data/src/elevenlabs/types/simulation_test_model.py new file mode 100644 index 0000000000000000000000000000000000000000..501f6da013740bed7e9f59013b5a18237c1f9fc8 --- /dev/null +++ b/data/src/elevenlabs/types/simulation_test_model.py @@ -0,0 +1,97 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from .conversation_initiation_source import ConversationInitiationSource +from .llm import Llm +from .simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from .test_from_conversation_metadata_output import TestFromConversationMetadataOutput +from .tool_response_mock_config_output import ToolResponseMockConfigOutput + + +class SimulationTestModel(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + success_condition: typing.Optional[str] = pydantic.Field(default=None) + """ + Deprecated legacy single success criterion. Use success_conditions instead. At least one of success_condition or success_conditions is required. + """ + + success_conditions: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of prompts that evaluate whether the simulation was successful. If provided, all criteria are evaluated and merged into a final result. Capped at the maximum number of evaluation criteria. + """ + + simulation_scenario: typing.Optional[str] = pydantic.Field(default=None) + """ + Description of the simulation scenario and user persona for simulation tests. + """ + + simulation_max_turns: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of conversation turns for simulation tests. + """ + + simulation_environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to use when running this simulation test. If not provided, defaults to 'production'. + """ + + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = pydantic.Field(default=None) + """ + Configuration for which tools to mock and fallback behavior. + """ + + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigOutput]]] = pydantic.Field( + default=None + ) + """ + Test-specific response mocks, keyed by tool ID. Applied ahead of the tool's shared mocks and only within this test. Only take effect for tools that are mocked (see tool_mock_config). + """ + + evaluation_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model to use for evaluating simulation results. + """ + + simulated_user_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model for the simulated user. + """ + + 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 + + +update_forward_refs(SimulationTestModel) diff --git a/data/src/elevenlabs/types/simulation_tool_mock_behavior_config.py b/data/src/elevenlabs/types/simulation_tool_mock_behavior_config.py new file mode 100644 index 0000000000000000000000000000000000000000..7d680e3a2bf41b4a124c39a1604f0590d9a6f160 --- /dev/null +++ b/data/src/elevenlabs/types/simulation_tool_mock_behavior_config.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .mock_no_match_behavior import MockNoMatchBehavior +from .mocking_strategy import MockingStrategy + + +class SimulationToolMockBehaviorConfig(UncheckedBaseModel): + """ + Simulation/preview-side config: tools are identified by IDs, resolved to names at runtime. + """ + + mocking_strategy: typing.Optional[MockingStrategy] = pydantic.Field(default=None) + """ + Which tools to mock: 'all' mocks every mockable tool, 'selected' mocks only those in mocked_tool_names/mocked_tool_ids, 'none' disables mocking. + """ + + fallback_strategy: typing.Optional[MockNoMatchBehavior] = pydantic.Field(default=None) + """ + Behavior when no mock matches a tool call. + """ + + mocked_tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Tool IDs to mock. Resolved to tool names before being passed to the orchestrator. + """ + + 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/data/src/elevenlabs/types/single_languages_response.py b/data/src/elevenlabs/types/single_languages_response.py new file mode 100644 index 0000000000000000000000000000000000000000..5087c22ca3f6b11b7d736ce7a4f1cf4bfb490b5d --- /dev/null +++ b/data/src/elevenlabs/types/single_languages_response.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .language_info import LanguageInfo + + +class SingleLanguagesResponse(UncheckedBaseModel): + languages: typing.List[LanguageInfo] = pydantic.Field() + """ + The list of available languages. + """ + + 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/data/src/elevenlabs/types/single_test_run_request_model.py b/data/src/elevenlabs/types/single_test_run_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e8a0adb0ac7766214de1df5b76602b11e90e182f --- /dev/null +++ b/data/src/elevenlabs/types/single_test_run_request_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SingleTestRunRequestModel(UncheckedBaseModel): + test_id: str = pydantic.Field() + """ + ID of the test to run + """ + + workflow_node_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the workflow node to run the test on. If not provided, the test will be run on the agent's default workflow node. + """ + + root_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + ID of the root folder to run the test on. If not provided, the test will be run on the agent's default folder. + """ + + root_folder_name: typing.Optional[str] = pydantic.Field(default=None) + """ + Name of the root folder to run the test on. If not provided, the test will be run on the agent's default folder. + """ + + 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/data/src/elevenlabs/types/single_use_token_response_model.py b/data/src/elevenlabs/types/single_use_token_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1510d7540ae888a3d46dfbefca2661396c24877f --- /dev/null +++ b/data/src/elevenlabs/types/single_use_token_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SingleUseTokenResponseModel(UncheckedBaseModel): + token: str = pydantic.Field() + """ + A time bound single use token that expires after 15 minutes. Will be consumed on use. + """ + + 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/data/src/elevenlabs/types/single_use_token_type.py b/data/src/elevenlabs/types/single_use_token_type.py new file mode 100644 index 0000000000000000000000000000000000000000..7546834292fa67693ad2f763f1b85a713769c1a9 --- /dev/null +++ b/data/src/elevenlabs/types/single_use_token_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SingleUseTokenType = typing.Union[typing.Literal["realtime_scribe", "batch_scribe", "tts_websocket"], typing.Any] diff --git a/data/src/elevenlabs/types/sip_log_message.py b/data/src/elevenlabs/types/sip_log_message.py new file mode 100644 index 0000000000000000000000000000000000000000..0094322bcfdd8d07c6a08ac70e0cd4a25921bff0 --- /dev/null +++ b/data/src/elevenlabs/types/sip_log_message.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .sip_log_message_direction import SipLogMessageDirection + + +class SipLogMessage(UncheckedBaseModel): + call_id: str + phone_numbers: typing.List[str] + local_address: str + remote_address: str + transport: str + raw_message: str + error_message: str + direction: SipLogMessageDirection + created_at_unix_micro: int + + 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/data/src/elevenlabs/types/sip_log_message_direction.py b/data/src/elevenlabs/types/sip_log_message_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..f246ce8fcef94d6b1562e229ec994339709a7478 --- /dev/null +++ b/data/src/elevenlabs/types/sip_log_message_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SipLogMessageDirection = typing.Union[typing.Literal["in", "out"], typing.Any] diff --git a/data/src/elevenlabs/types/sip_media_encryption_enum.py b/data/src/elevenlabs/types/sip_media_encryption_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..e5b2691b3b8c7ea27465c6851890f0968837d53d --- /dev/null +++ b/data/src/elevenlabs/types/sip_media_encryption_enum.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SipMediaEncryptionEnum = typing.Union[typing.Literal["disabled", "allowed", "required"], typing.Any] diff --git a/data/src/elevenlabs/types/sip_trunk_credentials_request_model.py b/data/src/elevenlabs/types/sip_trunk_credentials_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8ca53525840befb7b1b82600fac947ddcd5933ae --- /dev/null +++ b/data/src/elevenlabs/types/sip_trunk_credentials_request_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SipTrunkCredentialsRequestModel(UncheckedBaseModel): + username: str = pydantic.Field() + """ + SIP trunk username + """ + + password: typing.Optional[str] = pydantic.Field(default=None) + """ + SIP trunk password - if not specified, then remain unchanged + """ + + 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/data/src/elevenlabs/types/sip_trunk_outbound_call_response.py b/data/src/elevenlabs/types/sip_trunk_outbound_call_response.py new file mode 100644 index 0000000000000000000000000000000000000000..915413b27a7b3d72b084ef9c35e107dd66903762 --- /dev/null +++ b/data/src/elevenlabs/types/sip_trunk_outbound_call_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SipTrunkOutboundCallResponse(UncheckedBaseModel): + success: bool + message: str + conversation_id: typing.Optional[str] = None + sip_call_id: 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/data/src/elevenlabs/types/sip_trunk_transport_enum.py b/data/src/elevenlabs/types/sip_trunk_transport_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..02f4ff1577c14ebf26895951ae87ac5200854f8a --- /dev/null +++ b/data/src/elevenlabs/types/sip_trunk_transport_enum.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SipTrunkTransportEnum = typing.Union[typing.Literal["auto", "udp", "tcp", "tls"], typing.Any] diff --git a/data/src/elevenlabs/types/sip_uri_dynamic_variable_transfer_destination.py b/data/src/elevenlabs/types/sip_uri_dynamic_variable_transfer_destination.py new file mode 100644 index 0000000000000000000000000000000000000000..f94cb914b5f272f9cbbf85fc52f814a05480cbc7 --- /dev/null +++ b/data/src/elevenlabs/types/sip_uri_dynamic_variable_transfer_destination.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SipUriDynamicVariableTransferDestination(UncheckedBaseModel): + sip_uri: 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/data/src/elevenlabs/types/sip_uri_transfer_destination.py b/data/src/elevenlabs/types/sip_uri_transfer_destination.py new file mode 100644 index 0000000000000000000000000000000000000000..5dae82b0c831a892ac6e0aee7aedab280fde718b --- /dev/null +++ b/data/src/elevenlabs/types/sip_uri_transfer_destination.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SipUriTransferDestination(UncheckedBaseModel): + sip_uri: 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/data/src/elevenlabs/types/skip_turn_tool_config.py b/data/src/elevenlabs/types/skip_turn_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..3521e5830dca93a0d9711bb565801c7bde402e40 --- /dev/null +++ b/data/src/elevenlabs/types/skip_turn_tool_config.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SkipTurnToolConfig(UncheckedBaseModel): + """ + Allows the agent to explicitly skip its turn. + + This tool should be invoked by the LLM when the user indicates they would like + to think or take a short pause before continuing the conversation—e.g. when + they say: "Give me a second", "Let me think", or "One moment please". After + calling this tool, the assistant should not speak until the user speaks + again, or if wait_timeout_secs is set, until that wait elapses and the + agent generates a check-in. + """ + + wait_timeout_secs: typing.Optional[float] = pydantic.Field(default=None) + """ + Seconds to wait after skip_turn before the agent generates a contextual check-in. The "End conversation after silence" timer is paused during the wait. -1 disables the wait: after skip_turn the agent stays silent until the caller speaks, and that timer keeps running. Applies to voice conversations only. + """ + + 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/data/src/elevenlabs/types/skip_turn_tool_response_model.py b/data/src/elevenlabs/types/skip_turn_tool_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d8416ffb8ae367ae3af6f349f5f506d44287dfff --- /dev/null +++ b/data/src/elevenlabs/types/skip_turn_tool_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SkipTurnToolResponseModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + reason: 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/data/src/elevenlabs/types/slack_bot_auth_response.py b/data/src/elevenlabs/types/slack_bot_auth_response.py new file mode 100644 index 0000000000000000000000000000000000000000..1db5af2bdb5c199234fa021c0bfe560ef22da99e --- /dev/null +++ b/data/src/elevenlabs/types/slack_bot_auth_response.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class SlackBotAuthResponse(UncheckedBaseModel): + """ + Response model for the internal Slack BYO bot auth connection. + """ + + name: str + provider: typing.Optional[typing.Literal["Slack"]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/smb_agent_type.py b/data/src/elevenlabs/types/smb_agent_type.py new file mode 100644 index 0000000000000000000000000000000000000000..56526052c0ef20cedaf3635732cf32136490d18f --- /dev/null +++ b/data/src/elevenlabs/types/smb_agent_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SmbAgentType = typing.Union[typing.Literal["customer_facing", "assistant"], typing.Any] diff --git a/data/src/elevenlabs/types/smb_client_access_config.py b/data/src/elevenlabs/types/smb_client_access_config.py new file mode 100644 index 0000000000000000000000000000000000000000..b33eed43791e990395d78644a93b5d610a7dc7fd --- /dev/null +++ b/data/src/elevenlabs/types/smb_client_access_config.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SmbClientAccessConfig(UncheckedBaseModel): + enable_secure_mode: typing.Optional[bool] = None + identity_verification_enabled: typing.Optional[bool] = None + identity_verification_email_enabled: typing.Optional[bool] = None + identity_verification_sms_enabled: 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/data/src/elevenlabs/types/sms_conversation_info.py b/data/src/elevenlabs/types/sms_conversation_info.py new file mode 100644 index 0000000000000000000000000000000000000000..258bab7f0591fb7a89632326dd2f22f37dd04ffe --- /dev/null +++ b/data/src/elevenlabs/types/sms_conversation_info.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .sms_conversation_info_direction import SmsConversationInfoDirection + + +class SmsConversationInfo(UncheckedBaseModel): + direction: SmsConversationInfoDirection + phone_number_id: typing.Optional[str] = None + sms_user_phone_number: str + agent_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/data/src/elevenlabs/types/sms_conversation_info_direction.py b/data/src/elevenlabs/types/sms_conversation_info_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..ea6b8b6d8ca381ff8c98ec5d035046752fb9f417 --- /dev/null +++ b/data/src/elevenlabs/types/sms_conversation_info_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SmsConversationInfoDirection = typing.Union[typing.Literal["inbound", "outbound"], typing.Any] diff --git a/data/src/elevenlabs/types/soft_timeout_config.py b/data/src/elevenlabs/types/soft_timeout_config.py new file mode 100644 index 0000000000000000000000000000000000000000..795848e7fd9fb0dcdd5b4aa119d9b4f1f513600c --- /dev/null +++ b/data/src/elevenlabs/types/soft_timeout_config.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SoftTimeoutConfig(UncheckedBaseModel): + """ + Configuration for soft timeout functionality during LLM response generation. + """ + + timeout_seconds: typing.Optional[float] = pydantic.Field(default=None) + """ + Time in seconds before showing the predefined message while waiting for LLM response. Set to -1 to disable. + """ + + message: typing.Optional[str] = pydantic.Field(default=None) + """ + Message to show when the first soft timeout is reached while waiting for LLM response. Supports dynamic variables (e.g., {{system__time}}, {{custom_variable}}). + """ + + additional_soft_timeout_messages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Extra static filler messages for subsequent soft timeouts in the same LLM generation. The first timeout uses `message`. If fewer messages are configured than `max_soft_timeouts_per_generation`, the last configured message is repeated; otherwise a built-in filler is used. + """ + + use_llm_generated_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled, the soft timeout message will be generated dynamically instead of using the static message. + """ + + randomize_fillers: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled, shuffle the order of static soft timeout messages once at the start of each turn. Only applies when use_llm_generated_message is false. + """ + + max_soft_timeouts_per_generation: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum filler messages while waiting for a single LLM response. Fires every timeout_seconds until the LLM streams content or this limit is reached. + """ + + llm_generated_message_prompt_override: typing.Optional[str] = pydantic.Field(default=None) + """ + Custom prompt for generating the soft timeout filler message when use_llm_generated_message is enabled. Recent conversation context is provided as a separate user message. If not set, the default prompt will be used. Supports dynamic variables (e.g., {{system__time}}, {{custom_variable}}). + """ + + disable_until_first_user_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + When true, soft timeout fillers are suppressed until the conversation has at least one real user message. Prevents fillers during the agent's opening turn (e.g. workflow generate-immediately / tool calls before the user speaks). + """ + + 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/data/src/elevenlabs/types/soft_timeout_config_override.py b/data/src/elevenlabs/types/soft_timeout_config_override.py new file mode 100644 index 0000000000000000000000000000000000000000..43ec2b66e1a8124c0b3e5a51b949589a12447b46 --- /dev/null +++ b/data/src/elevenlabs/types/soft_timeout_config_override.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SoftTimeoutConfigOverride(UncheckedBaseModel): + message: typing.Optional[str] = pydantic.Field(default=None) + """ + Message to show when the first soft timeout is reached while waiting for LLM response. Supports dynamic variables (e.g., {{system__time}}, {{custom_variable}}). + """ + + additional_soft_timeout_messages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Extra static filler messages for subsequent soft timeouts in the same LLM generation. The first timeout uses `message`. If fewer messages are configured than `max_soft_timeouts_per_generation`, the last configured message is repeated; otherwise a built-in filler is used. + """ + + 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/data/src/elevenlabs/types/soft_timeout_config_override_config.py b/data/src/elevenlabs/types/soft_timeout_config_override_config.py new file mode 100644 index 0000000000000000000000000000000000000000..65baf8af269887a0637e7062e31fa8dee9301c3d --- /dev/null +++ b/data/src/elevenlabs/types/soft_timeout_config_override_config.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SoftTimeoutConfigOverrideConfig(UncheckedBaseModel): + message: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the message field. + """ + + additional_soft_timeout_messages: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the additional_soft_timeout_messages field. + """ + + 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/data/src/elevenlabs/types/soft_timeout_config_workflow_override.py b/data/src/elevenlabs/types/soft_timeout_config_workflow_override.py new file mode 100644 index 0000000000000000000000000000000000000000..058a7a405815b15c38e300aac3f08b3382cf2d5c --- /dev/null +++ b/data/src/elevenlabs/types/soft_timeout_config_workflow_override.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SoftTimeoutConfigWorkflowOverride(UncheckedBaseModel): + timeout_seconds: typing.Optional[float] = pydantic.Field(default=None) + """ + Time in seconds before showing the predefined message while waiting for LLM response. Set to -1 to disable. + """ + + message: typing.Optional[str] = pydantic.Field(default=None) + """ + Message to show when the first soft timeout is reached while waiting for LLM response. Supports dynamic variables (e.g., {{system__time}}, {{custom_variable}}). + """ + + additional_soft_timeout_messages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Extra static filler messages for subsequent soft timeouts in the same LLM generation. The first timeout uses `message`. If fewer messages are configured than `max_soft_timeouts_per_generation`, the last configured message is repeated; otherwise a built-in filler is used. + """ + + use_llm_generated_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled, the soft timeout message will be generated dynamically instead of using the static message. + """ + + randomize_fillers: typing.Optional[bool] = pydantic.Field(default=None) + """ + If enabled, shuffle the order of static soft timeout messages once at the start of each turn. Only applies when use_llm_generated_message is false. + """ + + max_soft_timeouts_per_generation: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum filler messages while waiting for a single LLM response. Fires every timeout_seconds until the LLM streams content or this limit is reached. + """ + + llm_generated_message_prompt_override: typing.Optional[str] = pydantic.Field(default=None) + """ + Custom prompt for generating the soft timeout filler message when use_llm_generated_message is enabled. Recent conversation context is provided as a separate user message. If not set, the default prompt will be used. Supports dynamic variables (e.g., {{system__time}}, {{custom_variable}}). + """ + + disable_until_first_user_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + When true, soft timeout fillers are suppressed until the conversation has at least one real user message. Prevents fillers during the agent's opening turn (e.g. workflow generate-immediately / tool calls before the user speaks). + """ + + 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/data/src/elevenlabs/types/song_metadata.py b/data/src/elevenlabs/types/song_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..a1fee8ae2bad2b313667e5229130ea2c65cec84c --- /dev/null +++ b/data/src/elevenlabs/types/song_metadata.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SongMetadata(UncheckedBaseModel): + title: typing.Optional[str] = pydantic.Field(default=None) + """ + The title of the song + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the song + """ + + genres: typing.List[str] = pydantic.Field() + """ + The genres of the song + """ + + languages: typing.List[str] = pydantic.Field() + """ + The languages of the song + """ + + is_explicit: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the song is explicit + """ + + 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/data/src/elevenlabs/types/song_section.py b/data/src/elevenlabs/types/song_section.py new file mode 100644 index 0000000000000000000000000000000000000000..d6fcbfed3a683b3046f641151fc4161a3b5d3be1 --- /dev/null +++ b/data/src/elevenlabs/types/song_section.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .section_source import SectionSource + + +class SongSection(UncheckedBaseModel): + section_name: str = pydantic.Field() + """ + The name of the section. Must be between 1 and 100 characters. + """ + + positive_local_styles: typing.List[str] = pydantic.Field() + """ + The styles and musical directions that should be present in this section. Use English language for best result. + """ + + negative_local_styles: typing.List[str] = pydantic.Field() + """ + The styles and musical directions that should not be present in this section. Use English language for best result. + """ + + duration_ms: int = pydantic.Field() + """ + The duration of the section in milliseconds. Must be between 3000ms and 120000ms. + """ + + lines: typing.List[str] = pydantic.Field() + """ + The lyrics of the section. Max 30 lines per section and max 200 characters per line. + """ + + source_from: typing.Optional[SectionSource] = pydantic.Field(default=None) + """ + Optional source to extract the section from. Used for inpainting. + """ + + 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/data/src/elevenlabs/types/song_source_context.py b/data/src/elevenlabs/types/song_source_context.py new file mode 100644 index 0000000000000000000000000000000000000000..f651f0898893a5cdf96223c07978e05056f70089 --- /dev/null +++ b/data/src/elevenlabs/types/song_source_context.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SongSourceContext(UncheckedBaseModel): + song_id: str + chat_id: typing.Optional[str] = None + title: typing.Optional[str] = None + description: typing.Optional[str] = None + genres: typing.Optional[typing.List[str]] = None + languages: typing.Optional[typing.List[str]] = None + is_explicit: typing.Optional[bool] = None + bpm: typing.Optional[int] = None + generation_settings: typing.Optional[typing.Dict[str, typing.Any]] = 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/data/src/elevenlabs/types/sort_direction.py b/data/src/elevenlabs/types/sort_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..4832af00d907f99e27ffbb690eaf80c8210a55bb --- /dev/null +++ b/data/src/elevenlabs/types/sort_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SortDirection = typing.Union[typing.Literal["asc", "desc"], typing.Any] diff --git a/data/src/elevenlabs/types/speaker_audio_response_model.py b/data/src/elevenlabs/types/speaker_audio_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..aeedb82456d4d46a21c1b97631b08e4c36c1d167 --- /dev/null +++ b/data/src/elevenlabs/types/speaker_audio_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SpeakerAudioResponseModel(UncheckedBaseModel): + audio_base_64: str = pydantic.Field() + """ + The base64 encoded audio. + """ + + media_type: str = pydantic.Field() + """ + The media type of the audio. + """ + + duration_secs: float = pydantic.Field() + """ + The duration of the audio in seconds. + """ + + 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/data/src/elevenlabs/types/speaker_created_response.py b/data/src/elevenlabs/types/speaker_created_response.py new file mode 100644 index 0000000000000000000000000000000000000000..8ca3b9647b9633b32db74b7f8eb4928d4cb75760 --- /dev/null +++ b/data/src/elevenlabs/types/speaker_created_response.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SpeakerCreatedResponse(UncheckedBaseModel): + version: int + speaker_id: 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/data/src/elevenlabs/types/speaker_response_model.py b/data/src/elevenlabs/types/speaker_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..da352050b40097a49ed938b55b4f6783ca318833 --- /dev/null +++ b/data/src/elevenlabs/types/speaker_response_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .utterance_response_model import UtteranceResponseModel + + +class SpeakerResponseModel(UncheckedBaseModel): + speaker_id: str = pydantic.Field() + """ + The ID of the speaker. + """ + + duration_secs: float = pydantic.Field() + """ + The duration of the speaker segment in seconds. + """ + + utterances: typing.Optional[typing.List[UtteranceResponseModel]] = pydantic.Field(default=None) + """ + The utterances of the speaker. + """ + + 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/data/src/elevenlabs/types/speaker_segment.py b/data/src/elevenlabs/types/speaker_segment.py new file mode 100644 index 0000000000000000000000000000000000000000..6d683d8ba861cd78d9624a53e590f615c847a1f5 --- /dev/null +++ b/data/src/elevenlabs/types/speaker_segment.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbed_segment import DubbedSegment +from .segment_subtitle_frame import SegmentSubtitleFrame + + +class SpeakerSegment(UncheckedBaseModel): + id: str + start_time: float + end_time: float + text: str + subtitles: typing.List[SegmentSubtitleFrame] + dubs: typing.Dict[str, DubbedSegment] + + 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/data/src/elevenlabs/types/speaker_separation_response_model.py b/data/src/elevenlabs/types/speaker_separation_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..66f85b1353fa6b754d1384bb60ffd24e8b076ed4 --- /dev/null +++ b/data/src/elevenlabs/types/speaker_separation_response_model.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .speaker_response_model import SpeakerResponseModel +from .speaker_separation_response_model_status import SpeakerSeparationResponseModelStatus + + +class SpeakerSeparationResponseModel(UncheckedBaseModel): + voice_id: str = pydantic.Field() + """ + The ID of the voice. + """ + + sample_id: str = pydantic.Field() + """ + The ID of the sample. + """ + + status: SpeakerSeparationResponseModelStatus = pydantic.Field() + """ + The status of the speaker separation. + """ + + speakers: typing.Optional[typing.Dict[str, typing.Optional[SpeakerResponseModel]]] = pydantic.Field(default=None) + """ + The speakers of the sample. + """ + + selected_speaker_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The IDs of the selected speakers. + """ + + 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/data/src/elevenlabs/types/speaker_separation_response_model_status.py b/data/src/elevenlabs/types/speaker_separation_response_model_status.py new file mode 100644 index 0000000000000000000000000000000000000000..c54e918542febbabb61997b0ca5726bd59eb9a1b --- /dev/null +++ b/data/src/elevenlabs/types/speaker_separation_response_model_status.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeakerSeparationResponseModelStatus = typing.Union[ + typing.Literal["not_started", "pending", "completed", "failed"], typing.Any +] diff --git a/data/src/elevenlabs/types/speaker_track.py b/data/src/elevenlabs/types/speaker_track.py new file mode 100644 index 0000000000000000000000000000000000000000..9463d97e3ef7f3a1e40ad430ede07debd4cf1766 --- /dev/null +++ b/data/src/elevenlabs/types/speaker_track.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dubbing_media_reference import DubbingMediaReference + + +class SpeakerTrack(UncheckedBaseModel): + id: str + media_ref: DubbingMediaReference + speaker_name: str + voices: typing.Dict[str, str] + segments: typing.List[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/data/src/elevenlabs/types/speaker_updated_response.py b/data/src/elevenlabs/types/speaker_updated_response.py new file mode 100644 index 0000000000000000000000000000000000000000..fa8423f229b0c10c555ecad4b37621098875a72c --- /dev/null +++ b/data/src/elevenlabs/types/speaker_updated_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SpeakerUpdatedResponse(UncheckedBaseModel): + version: int + + 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/data/src/elevenlabs/types/speech_engine_config.py b/data/src/elevenlabs/types/speech_engine_config.py new file mode 100644 index 0000000000000000000000000000000000000000..3ed5a0bf38bd3052c6ebdb475e844980c0ba459a --- /dev/null +++ b/data/src/elevenlabs/types/speech_engine_config.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .speech_engine_config_request_headers_value import SpeechEngineConfigRequestHeadersValue + + +class SpeechEngineConfig(UncheckedBaseModel): + ws_url: str = pydantic.Field() + """ + The WebSocket URL for the transcript server + """ + + request_headers: typing.Optional[typing.Dict[str, SpeechEngineConfigRequestHeadersValue]] = pydantic.Field( + default=None + ) + """ + Headers to include in the WebSocket connection request + """ + + 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/data/src/elevenlabs/types/speech_engine_config_request_headers_value.py b/data/src/elevenlabs/types/speech_engine_config_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..483ba0ed605923934b11aaf4bfafbe4098b3b75d --- /dev/null +++ b/data/src/elevenlabs/types/speech_engine_config_request_headers_value.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable +from .conv_ai_secret_locator import ConvAiSecretLocator + +SpeechEngineConfigRequestHeadersValue = typing.Union[str, ConvAiSecretLocator, ConvAiDynamicVariable] diff --git a/data/src/elevenlabs/types/speech_engine_conversation_initiation_client_data_config.py b/data/src/elevenlabs/types/speech_engine_conversation_initiation_client_data_config.py new file mode 100644 index 0000000000000000000000000000000000000000..a536a4f65f6a9fe14982b8af25780335507ccf13 --- /dev/null +++ b/data/src/elevenlabs/types/speech_engine_conversation_initiation_client_data_config.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SpeechEngineConversationInitiationClientDataConfig(UncheckedBaseModel): + first_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the first message can be overridden by the client + """ + + 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/data/src/elevenlabs/types/speech_engine_response.py b/data/src/elevenlabs/types/speech_engine_response.py new file mode 100644 index 0000000000000000000000000000000000000000..7771c92221188ba970ac28428472927a237e0361 --- /dev/null +++ b/data/src/elevenlabs/types/speech_engine_response.py @@ -0,0 +1,109 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_call_limits import AgentCallLimits +from .agent_metadata_db_model import AgentMetadataDbModel +from .asr_conversational_config import AsrConversationalConfig +from .base_turn_config import BaseTurnConfig +from .conversation_config_output import ConversationConfigOutput +from .privacy_config_output import PrivacyConfigOutput +from .resource_access_info import ResourceAccessInfo +from .speech_engine_config import SpeechEngineConfig +from .speech_engine_conversation_initiation_client_data_config import SpeechEngineConversationInitiationClientDataConfig +from .tts_conversational_config_output import TtsConversationalConfigOutput +from .vad_config import VadConfig + + +class SpeechEngineResponse(UncheckedBaseModel): + speech_engine_id: str = pydantic.Field() + """ + The speech engine resource ID + """ + + name: str = pydantic.Field() + """ + Human-readable name for the speech engine + """ + + speech_engine: SpeechEngineConfig = pydantic.Field() + """ + WebSocket connection settings for the upstream transcript server + """ + + asr: AsrConversationalConfig = pydantic.Field() + """ + Automatic speech recognition configuration + """ + + tts: TtsConversationalConfigOutput = pydantic.Field() + """ + Text-to-speech output configuration + """ + + turn: BaseTurnConfig = pydantic.Field() + """ + Turn detection configuration + """ + + vad: VadConfig = pydantic.Field() + """ + Configuration for voice activity detection + """ + + conversation: ConversationConfigOutput = pydantic.Field() + """ + Conversation-level settings including client events and duration limits + """ + + privacy: PrivacyConfigOutput = pydantic.Field() + """ + Privacy settings controlling recording, retention, and PII handling + """ + + call_limits: AgentCallLimits = pydantic.Field() + """ + Concurrency and daily conversation limits for this speech engine + """ + + language: str = pydantic.Field() + """ + ISO language code used by the speech engine (e.g. 'en') + """ + + cascade_timeout_seconds: float = pydantic.Field() + """ + Time in seconds to wait for the upstream speech engine endpoint to respond before the attempt is abandoned and retried. Must be between 2 and 15 seconds. + """ + + tags: typing.List[str] = pydantic.Field() + """ + Arbitrary tags for categorization and filtering + """ + + overrides: SpeechEngineConversationInitiationClientDataConfig = pydantic.Field() + """ + Override settings the client may set during conversation initiation + """ + + metadata: AgentMetadataDbModel = pydantic.Field() + """ + Creation and update timestamps with source information + """ + + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information of the speech engine for the user + """ + + 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/data/src/elevenlabs/types/speech_engine_summary_response.py b/data/src/elevenlabs/types/speech_engine_summary_response.py new file mode 100644 index 0000000000000000000000000000000000000000..1a7be24b0177211760415ac051fb51699be0e281 --- /dev/null +++ b/data/src/elevenlabs/types/speech_engine_summary_response.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .resource_access_info import ResourceAccessInfo + + +class SpeechEngineSummaryResponse(UncheckedBaseModel): + speech_engine_id: str = pydantic.Field() + """ + The speech engine resource ID + """ + + name: str = pydantic.Field() + """ + Human-readable name for the speech engine + """ + + voice_id: str = pydantic.Field() + """ + Voice ID assigned to this speech engine + """ + + created_at_unix_secs: int = pydantic.Field() + """ + Creation time in Unix seconds + """ + + updated_at_unix_secs: int = pydantic.Field() + """ + Last update time in Unix seconds + """ + + tags: typing.List[str] = pydantic.Field() + """ + Arbitrary tags for categorization and filtering + """ + + access_info: ResourceAccessInfo = pydantic.Field() + """ + The access information of the speech engine for the user + """ + + 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/data/src/elevenlabs/types/speech_history_item_response.py b/data/src/elevenlabs/types/speech_history_item_response.py new file mode 100644 index 0000000000000000000000000000000000000000..f8004065eac089156b97c898da19e15f3d492c7a --- /dev/null +++ b/data/src/elevenlabs/types/speech_history_item_response.py @@ -0,0 +1,108 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dialogue_input_response_model import DialogueInputResponseModel +from .history_alignments_response_model import HistoryAlignmentsResponseModel +from .speech_history_item_response_source import SpeechHistoryItemResponseSource +from .speech_history_item_response_voice_category import SpeechHistoryItemResponseVoiceCategory + + +class SpeechHistoryItemResponse(UncheckedBaseModel): + history_item_id: str = pydantic.Field() + """ + The ID of the history item. + """ + + request_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the request. + """ + + voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the voice used. + """ + + model_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the model. + """ + + voice_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the voice. + """ + + voice_category: typing.Optional[SpeechHistoryItemResponseVoiceCategory] = pydantic.Field(default=None) + """ + The category of the voice. Either 'premade', 'cloned', 'generated' or 'professional'. + """ + + text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text used to generate the audio item. + """ + + date_unix: int = pydantic.Field() + """ + Unix timestamp of when the item was created. + """ + + character_count_change_from: int = pydantic.Field() + """ + The character count change from. + """ + + character_count_change_to: int = pydantic.Field() + """ + The character count change to. + """ + + content_type: str = pydantic.Field() + """ + The content type of the generated item. + """ + + state: typing.Any + settings: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + The settings of the history item. + """ + + share_link_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the share link. + """ + + source: typing.Optional[SpeechHistoryItemResponseSource] = pydantic.Field(default=None) + """ + The source of the history item. Either TTS (text to speech), STS (speech to text), AN (audio native), Projects, Dubbing, PlayAPI, PD (pronunciation dictionary) or ConvAI (Agents Platform). + """ + + alignments: typing.Optional[HistoryAlignmentsResponseModel] = pydantic.Field(default=None) + """ + The alignments of the history item. + """ + + dialogue: typing.Optional[typing.List[DialogueInputResponseModel]] = pydantic.Field(default=None) + """ + The dialogue (voice and text pairs) used to generate the audio item. If this is set then the top level `text` and `voice_id` fields will be empty. + """ + + output_format: typing.Optional[str] = pydantic.Field(default=None) + """ + The output format the audio was originally generated in. + """ + + 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/data/src/elevenlabs/types/speech_history_item_response_source.py b/data/src/elevenlabs/types/speech_history_item_response_source.py new file mode 100644 index 0000000000000000000000000000000000000000..4e756b4e13638181795ead5215343a3fa2619116 --- /dev/null +++ b/data/src/elevenlabs/types/speech_history_item_response_source.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechHistoryItemResponseSource = typing.Union[ + typing.Literal[ + "TTS", + "STS", + "Projects", + "PD", + "AN", + "Dubbing", + "PlayAPI", + "ConvAI", + "VoiceGeneration", + "InVPC", + "Flows", + "VoicePreview", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/speech_history_item_response_voice_category.py b/data/src/elevenlabs/types/speech_history_item_response_voice_category.py new file mode 100644 index 0000000000000000000000000000000000000000..854f0d28ae8e3cc887b89a116efdc0f3987cc34e --- /dev/null +++ b/data/src/elevenlabs/types/speech_history_item_response_voice_category.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechHistoryItemResponseVoiceCategory = typing.Union[ + typing.Literal["premade", "cloned", "generated", "professional"], typing.Any +] diff --git a/data/src/elevenlabs/types/speech_to_text_character_response_model.py b/data/src/elevenlabs/types/speech_to_text_character_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..41ae5f6c5d197bc37cd63bb8da90c8955887216d --- /dev/null +++ b/data/src/elevenlabs/types/speech_to_text_character_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SpeechToTextCharacterResponseModel(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The character that was transcribed. + """ + + start: typing.Optional[float] = pydantic.Field(default=None) + """ + The start time of the character in seconds. + """ + + end: typing.Optional[float] = pydantic.Field(default=None) + """ + The end time of the character in seconds. + """ + + 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/data/src/elevenlabs/types/speech_to_text_chunk_response_model.py b/data/src/elevenlabs/types/speech_to_text_chunk_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..39e2be3e33cbc1d68f2ccf4aaa282b47fd45f4f2 --- /dev/null +++ b/data/src/elevenlabs/types/speech_to_text_chunk_response_model.py @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .additional_format_response_model import AdditionalFormatResponseModel +from .detected_entity import DetectedEntity +from .speech_to_text_chunk_response_model_edited_transcript import SpeechToTextChunkResponseModelEditedTranscript +from .speech_to_text_word_response_model import SpeechToTextWordResponseModel + + +class SpeechToTextChunkResponseModel(UncheckedBaseModel): + """ + Chunk-level detail of the transcription with timing information. + """ + + language_code: str = pydantic.Field() + """ + The detected language code (e.g. 'eng' for English). + """ + + language_probability: float = pydantic.Field() + """ + The confidence score of the language detection (0 to 1). + """ + + text: str = pydantic.Field() + """ + The raw text of the transcription. + """ + + words: typing.List[SpeechToTextWordResponseModel] = pydantic.Field() + """ + List of words with their timing information. + """ + + channel_index: typing.Optional[int] = pydantic.Field(default=None) + """ + The channel index this transcript belongs to (for multichannel audio). + """ + + additional_formats: typing.Optional[typing.List[typing.Optional[AdditionalFormatResponseModel]]] = pydantic.Field( + default=None + ) + """ + Requested additional formats of the transcript. + """ + + transcription_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The transcription ID of the response. + """ + + entities: typing.Optional[typing.List[DetectedEntity]] = pydantic.Field(default=None) + """ + List of detected entities with their text, type, and character positions in the transcript. + """ + + audio_duration_secs: typing.Optional[float] = pydantic.Field(default=None) + """ + The duration of the audio that was transcribed in seconds. + """ + + edited_transcript: typing.Optional[SpeechToTextChunkResponseModelEditedTranscript] = pydantic.Field(default=None) + """ + Result of the optional transcript edit: the edited text, or an error if it could not be produced. Absent when no edit was requested. On success, both `text` and `edited_text` hold the edited transcript; compare them with the top-level `text` to see what changed. + """ + + 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/data/src/elevenlabs/types/speech_to_text_chunk_response_model_edited_transcript.py b/data/src/elevenlabs/types/speech_to_text_chunk_response_model_edited_transcript.py new file mode 100644 index 0000000000000000000000000000000000000000..8a42645fd2e2ee6633e7fb988ac53a43adaef055 --- /dev/null +++ b/data/src/elevenlabs/types/speech_to_text_chunk_response_model_edited_transcript.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class SpeechToTextChunkResponseModelEditedTranscript_Error(UncheckedBaseModel): + kind: typing.Literal["error"] = "error" + error_type: typing.Literal["edit_failed"] = "edit_failed" + message: 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 + + +class SpeechToTextChunkResponseModelEditedTranscript_Transcript(UncheckedBaseModel): + kind: typing.Literal["transcript"] = "transcript" + message_type: typing.Optional[str] = None + text: str + edited_text: 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 + + +SpeechToTextChunkResponseModelEditedTranscript = typing_extensions.Annotated[ + typing.Union[ + SpeechToTextChunkResponseModelEditedTranscript_Error, SpeechToTextChunkResponseModelEditedTranscript_Transcript + ], + UnionMetadata(discriminant="kind"), +] diff --git a/data/src/elevenlabs/types/speech_to_text_webhook_response_model.py b/data/src/elevenlabs/types/speech_to_text_webhook_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f6803f7514a0989ec654536cafceffc9c0f0ef79 --- /dev/null +++ b/data/src/elevenlabs/types/speech_to_text_webhook_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SpeechToTextWebhookResponseModel(UncheckedBaseModel): + message: str = pydantic.Field() + """ + The message of the webhook response. + """ + + request_id: str = pydantic.Field() + """ + The request ID of the webhook response. + """ + + transcription_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The transcription ID of the webhook response. + """ + + 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/data/src/elevenlabs/types/speech_to_text_word_response_model.py b/data/src/elevenlabs/types/speech_to_text_word_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4a0edca6d25925c7e78bab165b8892d25cd030e7 --- /dev/null +++ b/data/src/elevenlabs/types/speech_to_text_word_response_model.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .speech_to_text_character_response_model import SpeechToTextCharacterResponseModel +from .speech_to_text_word_response_model_type import SpeechToTextWordResponseModelType + + +class SpeechToTextWordResponseModel(UncheckedBaseModel): + """ + Word-level detail of the transcription with timing information. + """ + + text: str = pydantic.Field() + """ + The word or sound that was transcribed. + """ + + start: typing.Optional[float] = pydantic.Field(default=None) + """ + The start time of the word or sound in seconds. + """ + + end: typing.Optional[float] = pydantic.Field(default=None) + """ + The end time of the word or sound in seconds. + """ + + type: SpeechToTextWordResponseModelType = pydantic.Field() + """ + The type of the word or sound. 'audio_event' is used for non-word sounds like laughter or footsteps. + """ + + speaker_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Unique identifier for the speaker of this word. + """ + + logprob: float = pydantic.Field() + """ + The log of the probability with which this word was predicted. Logprobs are in range [-infinity, 0], higher logprobs indicate a higher confidence the model has in its predictions. + """ + + characters: typing.Optional[typing.List[SpeechToTextCharacterResponseModel]] = pydantic.Field(default=None) + """ + The characters that make up the word and their timing information. + """ + + channel_index: typing.Optional[int] = pydantic.Field(default=None) + """ + The channel this word was spoken on (for multichannel audio). Null for single-channel transcriptions. + """ + + 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/data/src/elevenlabs/types/speech_to_text_word_response_model_type.py b/data/src/elevenlabs/types/speech_to_text_word_response_model_type.py new file mode 100644 index 0000000000000000000000000000000000000000..a080c3b2982fec685ba2ce4b13d4fed0080ed435 --- /dev/null +++ b/data/src/elevenlabs/types/speech_to_text_word_response_model_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpeechToTextWordResponseModelType = typing.Union[typing.Literal["word", "spacing", "audio_event"], typing.Any] diff --git a/data/src/elevenlabs/types/spelling_patience.py b/data/src/elevenlabs/types/spelling_patience.py new file mode 100644 index 0000000000000000000000000000000000000000..8b6f5298823e63097dbc355a00bba2ee292c2f8f --- /dev/null +++ b/data/src/elevenlabs/types/spelling_patience.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SpellingPatience = typing.Union[typing.Literal["auto", "off"], typing.Any] diff --git a/data/src/elevenlabs/types/srt_export_options.py b/data/src/elevenlabs/types/srt_export_options.py new file mode 100644 index 0000000000000000000000000000000000000000..a74dd1772808e872d76fd82d0564cfe33b4eae2f --- /dev/null +++ b/data/src/elevenlabs/types/srt_export_options.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SrtExportOptions(UncheckedBaseModel): + max_characters_per_line: typing.Optional[int] = None + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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/data/src/elevenlabs/types/start_procedure_tool_config.py b/data/src/elevenlabs/types/start_procedure_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..4e46b49bbe4ae74c95eddfa51bca1f0aaa844655 --- /dev/null +++ b/data/src/elevenlabs/types/start_procedure_tool_config.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .start_procedure_tool_config_procedures_value import StartProcedureToolConfigProceduresValue + + +class StartProcedureToolConfig(UncheckedBaseModel): + procedures: typing.Optional[typing.Dict[str, StartProcedureToolConfigProceduresValue]] = 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/data/src/elevenlabs/types/start_procedure_tool_config_procedures_value.py b/data/src/elevenlabs/types/start_procedure_tool_config_procedures_value.py new file mode 100644 index 0000000000000000000000000000000000000000..db109ff52eccf83224708b769c798258890ed0b9 --- /dev/null +++ b/data/src/elevenlabs/types/start_procedure_tool_config_procedures_value.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .procedure_draft_ref import ProcedureDraftRef +from .procedure_version_ref import ProcedureVersionRef + +StartProcedureToolConfigProceduresValue = typing.Union[ProcedureVersionRef, ProcedureDraftRef] diff --git a/data/src/elevenlabs/types/start_procedure_tool_error_status.py b/data/src/elevenlabs/types/start_procedure_tool_error_status.py new file mode 100644 index 0000000000000000000000000000000000000000..bc2146daa5bf719a83a33a240239ed561ac7c205 --- /dev/null +++ b/data/src/elevenlabs/types/start_procedure_tool_error_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +StartProcedureToolErrorStatus = typing.Union[typing.Literal["not_found", "invalid_name", "already_active"], typing.Any] diff --git a/data/src/elevenlabs/types/start_procedure_tool_result_error_model.py b/data/src/elevenlabs/types/start_procedure_tool_result_error_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4529f472b0278893ca1fbb920248e50e05ce990e --- /dev/null +++ b/data/src/elevenlabs/types/start_procedure_tool_result_error_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .start_procedure_tool_error_status import StartProcedureToolErrorStatus + + +class StartProcedureToolResultErrorModel(UncheckedBaseModel): + status: StartProcedureToolErrorStatus + procedure_id: typing.Optional[str] = None + message: 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/data/src/elevenlabs/types/start_procedure_tool_result_success_model.py b/data/src/elevenlabs/types/start_procedure_tool_result_success_model.py new file mode 100644 index 0000000000000000000000000000000000000000..03d03b4adde7c34c9953ce71e9121322c979cc7e --- /dev/null +++ b/data/src/elevenlabs/types/start_procedure_tool_result_success_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StartProcedureToolResultSuccessModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + procedure_id: str + procedure_name: str + procedure_entry_workflow_node: typing.Optional[str] = None + procedure_return_workflow_node: typing.Optional[str] = None + message: 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/data/src/elevenlabs/types/start_pvc_voice_training_response_model.py b/data/src/elevenlabs/types/start_pvc_voice_training_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2645bf37a51508c5209254d9261ee6896540491f --- /dev/null +++ b/data/src/elevenlabs/types/start_pvc_voice_training_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StartPvcVoiceTrainingResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the start PVC voice training request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/start_speaker_separation_response_model.py b/data/src/elevenlabs/types/start_speaker_separation_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..089791b737da213e3c6ab5cc6575c539a0659c0d --- /dev/null +++ b/data/src/elevenlabs/types/start_speaker_separation_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StartSpeakerSeparationResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the start speaker seperation request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/static_asset_reference.py b/data/src/elevenlabs/types/static_asset_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..3c9c25205ccee16d7f3174affb5cfb041ba535ee --- /dev/null +++ b/data/src/elevenlabs/types/static_asset_reference.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StaticAssetReference(UncheckedBaseModel): + """ + An asset uploaded via the assets API. + """ + + asset_id: str = pydantic.Field() + """ + The ID of an asset uploaded via the assets API (`POST /v1/assets`), as returned in that response's `asset_id`. + """ + + 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/data/src/elevenlabs/types/status_id.py b/data/src/elevenlabs/types/status_id.py new file mode 100644 index 0000000000000000000000000000000000000000..f060a45c7a352b0ce9c21cb35fe092dfc400f2f1 --- /dev/null +++ b/data/src/elevenlabs/types/status_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +StatusId = int diff --git a/data/src/elevenlabs/types/stored_usage_platform_limit.py b/data/src/elevenlabs/types/stored_usage_platform_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..c52dd3cc7476cea68f84fa367b02a12056457dd2 --- /dev/null +++ b/data/src/elevenlabs/types/stored_usage_platform_limit.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StoredUsagePlatformLimit(UncheckedBaseModel): + """ + Platform limit with usage stored in Firestore. Example: credit usage tracked in Firestore. + """ + + limit: typing.Optional[int] = None + usage: typing.Optional[int] = pydantic.Field(default=None) + """ + Current usage + """ + + 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/data/src/elevenlabs/types/streaming_audio_chunk_with_timestamps_and_voice_segments_response_model.py b/data/src/elevenlabs/types/streaming_audio_chunk_with_timestamps_and_voice_segments_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1d412ccf75771a350a6a5ea87ba2e7f9cbb5512e --- /dev/null +++ b/data/src/elevenlabs/types/streaming_audio_chunk_with_timestamps_and_voice_segments_response_model.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .character_alignment_response_model import CharacterAlignmentResponseModel +from .voice_segment import VoiceSegment + + +class StreamingAudioChunkWithTimestampsAndVoiceSegmentsResponseModel(UncheckedBaseModel): + audio_base_64: typing_extensions.Annotated[ + str, + FieldMetadata(alias="audio_base64"), + pydantic.Field(alias="audio_base64", description="Base64 encoded audio data"), + ] + alignment: typing.Optional[CharacterAlignmentResponseModel] = pydantic.Field(default=None) + """ + Timestamp information for each character in the original text + """ + + normalized_alignment: typing.Optional[CharacterAlignmentResponseModel] = pydantic.Field(default=None) + """ + Timestamp information for each character in the normalized text + """ + + voice_segments: typing.List[VoiceSegment] = pydantic.Field() + """ + Voice segments for the audio + """ + + 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/data/src/elevenlabs/types/streaming_audio_chunk_with_timestamps_response.py b/data/src/elevenlabs/types/streaming_audio_chunk_with_timestamps_response.py new file mode 100644 index 0000000000000000000000000000000000000000..6ef1a6e772275e2421ea132cb5e029f370620196 --- /dev/null +++ b/data/src/elevenlabs/types/streaming_audio_chunk_with_timestamps_response.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .character_alignment_response_model import CharacterAlignmentResponseModel + + +class StreamingAudioChunkWithTimestampsResponse(UncheckedBaseModel): + audio_base_64: typing_extensions.Annotated[ + str, + FieldMetadata(alias="audio_base64"), + pydantic.Field(alias="audio_base64", description="Base64 encoded audio data"), + ] + alignment: typing.Optional[CharacterAlignmentResponseModel] = pydantic.Field(default=None) + """ + Timestamp information for each character in the original text + """ + + normalized_alignment: typing.Optional[CharacterAlignmentResponseModel] = pydantic.Field(default=None) + """ + Timestamp information for each character in the normalized text + """ + + 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/data/src/elevenlabs/types/string_schema.py b/data/src/elevenlabs/types/string_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..98259524f1c3ae34b2a2bcd88c1eb7c78a06f85f --- /dev/null +++ b/data/src/elevenlabs/types/string_schema.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StringSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: typing.Optional[str] = None + enum: typing.Optional[typing.List[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/data/src/elevenlabs/types/studio_agent_settings_model.py b/data/src/elevenlabs/types/studio_agent_settings_model.py new file mode 100644 index 0000000000000000000000000000000000000000..67a3bb88048a3af0480b67d52c619ce3dd7f5a56 --- /dev/null +++ b/data/src/elevenlabs/types/studio_agent_settings_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .studio_agent_tool_settings_model import StudioAgentToolSettingsModel + + +class StudioAgentSettingsModel(UncheckedBaseModel): + tool_settings: typing.Optional[typing.Dict[str, StudioAgentToolSettingsModel]] = 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/data/src/elevenlabs/types/studio_agent_tool_settings_model.py b/data/src/elevenlabs/types/studio_agent_tool_settings_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e8de56fa913b658f5397921af0eab80ae2de8cb9 --- /dev/null +++ b/data/src/elevenlabs/types/studio_agent_tool_settings_model.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StudioAgentToolSettingsModel(UncheckedBaseModel): + skip_confirmation: 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/data/src/elevenlabs/types/studio_clip_locator.py b/data/src/elevenlabs/types/studio_clip_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..66140a480721d38081a71aee83aeeb7fffd22d83 --- /dev/null +++ b/data/src/elevenlabs/types/studio_clip_locator.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .studio_clip_locator_clip_type import StudioClipLocatorClipType + + +class StudioClipLocator(UncheckedBaseModel): + """ + Coordinates of a clip inside a Studio project: the payload of a studio_clip reference. + """ + + project_id: str + chapter_id: str + clip_type: StudioClipLocatorClipType + clip_id: str + block_id: typing.Optional[str] = None + preview_url: 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/data/src/elevenlabs/types/studio_clip_locator_clip_type.py b/data/src/elevenlabs/types/studio_clip_locator_clip_type.py new file mode 100644 index 0000000000000000000000000000000000000000..3dd1fb7117067637d6285a22c811acd6ccfda719 --- /dev/null +++ b/data/src/elevenlabs/types/studio_clip_locator_clip_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +StudioClipLocatorClipType = typing.Union[typing.Literal["video", "image", "external_audio", "tts_node"], typing.Any] diff --git a/data/src/elevenlabs/types/studio_text_style_outline_model.py b/data/src/elevenlabs/types/studio_text_style_outline_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9022b0ba89f7e2f518c08f934ae0cde3a05e717d --- /dev/null +++ b/data/src/elevenlabs/types/studio_text_style_outline_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StudioTextStyleOutlineModel(UncheckedBaseModel): + enabled: bool + color: str + opacity: float + width: float + + 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/data/src/elevenlabs/types/studio_text_style_shadow_model.py b/data/src/elevenlabs/types/studio_text_style_shadow_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e47f62c3fcabe6a470668ae359c55c4eaa3f2e8e --- /dev/null +++ b/data/src/elevenlabs/types/studio_text_style_shadow_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class StudioTextStyleShadowModel(UncheckedBaseModel): + enabled: bool + color: str + opacity: float + blur: float + offset_x: float + offset_y: float + + 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/data/src/elevenlabs/types/submit_business_info_params.py b/data/src/elevenlabs/types/submit_business_info_params.py new file mode 100644 index 0000000000000000000000000000000000000000..397901a324c85b6a8efc3372b2cd41468bd8e8b0 --- /dev/null +++ b/data/src/elevenlabs/types/submit_business_info_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SubmitBusinessInfoParams(UncheckedBaseModel): + """ + Finalize the onboarding interview: create a text knowledge source and mark done. + """ + + smb_tool_type: typing.Optional[typing.Literal["submit_business_info"]] = 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/data/src/elevenlabs/types/submit_order_response.py b/data/src/elevenlabs/types/submit_order_response.py new file mode 100644 index 0000000000000000000000000000000000000000..ca8c3a9f4a79517168abd4c59a796a52823a7b38 --- /dev/null +++ b/data/src/elevenlabs/types/submit_order_response.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .order_id import OrderId +from .order_state import OrderState + + +class SubmitOrderResponse(UncheckedBaseModel): + order_id: OrderId = pydantic.Field() + """ + The ID of the submitted order. + """ + + state: OrderState = pydantic.Field() + """ + The current state of the order after submission. + """ + + submitted_at: dt.datetime = pydantic.Field() + """ + The timestamp when the order was submitted. + """ + + 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/data/src/elevenlabs/types/subscription.py b/data/src/elevenlabs/types/subscription.py new file mode 100644 index 0000000000000000000000000000000000000000..df7874b68129ba3b7ad8d25163a64bd2cb255498 --- /dev/null +++ b/data/src/elevenlabs/types/subscription.py @@ -0,0 +1,176 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .billing_period import BillingPeriod +from .character_refresh_period import CharacterRefreshPeriod +from .currency import Currency +from .invoice_response import InvoiceResponse +from .price import Price +from .subscription_max_credit_limit_extension import SubscriptionMaxCreditLimitExtension +from .subscription_pending_change import SubscriptionPendingChange +from .subscription_status_type import SubscriptionStatusType + + +class Subscription(UncheckedBaseModel): + tier: str = pydantic.Field() + """ + The tier of the user's subscription. + """ + + character_count: int = pydantic.Field() + """ + The number of characters used by the user. + """ + + character_limit: int = pydantic.Field() + """ + The maximum number of characters allowed in the current billing period. + """ + + max_character_limit_extension: typing.Optional[int] = pydantic.Field(default=None) + """ + Deprecated: use `max_credit_limit_extension`. Maximum number of characters that the character limit can be exceeded by. Managed by the workspace admin. + """ + + max_credit_limit_extension: SubscriptionMaxCreditLimitExtension = pydantic.Field() + """ + Maximum number of credits that the credit limit can be exceeded by. Managed by the workspace admin. `"unlimited"` means no cap, `0` means usage-based billing is disabled. + """ + + can_extend_character_limit: bool = pydantic.Field() + """ + Whether the workspace is entitled to enter overages (usage-based billing). + """ + + allowed_to_extend_character_limit: bool = pydantic.Field() + """ + Deprecated: use `max_credit_limit_extension != 0`. Whether the user is allowed to extend their character limit. + """ + + next_character_count_reset_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The Unix timestamp of the next character count reset. + """ + + voice_slots_used: int = pydantic.Field() + """ + The number of voice slots used by the user. + """ + + professional_voice_slots_used: int = pydantic.Field() + """ + The number of professional voice slots used. For consolidated billing this is the group-wide count across all workspaces in the group; see professional_voice_slots_used_in_workspace for the current workspace only. + """ + + professional_voice_slots_used_in_workspace: int = pydantic.Field() + """ + The number of professional voice slots used in the current workspace. For consolidated billing, professional_voice_slots_used counts across all workspaces in the group, while this counts only the current workspace. + """ + + voice_limit: int = pydantic.Field() + """ + The maximum number of voice slots allowed for the user. + """ + + max_voice_add_edits: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum number of voice add/edits allowed for the user. + """ + + voice_add_edit_counter: int = pydantic.Field() + """ + The number of voice add/edits used by the user. + """ + + professional_voice_limit: int = pydantic.Field() + """ + The maximum number of professional voices allowed for the user. + """ + + can_extend_voice_limit: bool = pydantic.Field() + """ + Whether the user can extend their voice limit. + """ + + can_use_instant_voice_cloning: bool = pydantic.Field() + """ + Whether the user can use instant voice cloning. + """ + + can_use_professional_voice_cloning: bool = pydantic.Field() + """ + Whether the user can use professional voice cloning. + """ + + currency: typing.Optional[Currency] = pydantic.Field(default=None) + """ + The currency of the user's subscription. + """ + + current_overage: Price = pydantic.Field() + """ + The current usage-based overage cost. + """ + + status: SubscriptionStatusType = pydantic.Field() + """ + The status of the user's subscription. + """ + + billing_period: typing.Optional[BillingPeriod] = pydantic.Field(default=None) + """ + The billing period of the user's subscription. + """ + + character_refresh_period: typing.Optional[CharacterRefreshPeriod] = pydantic.Field(default=None) + """ + The character refresh period of the user's subscription. + """ + + next_invoice: typing.Optional[InvoiceResponse] = pydantic.Field(default=None) + """ + The next invoice for the user. + """ + + open_invoices: typing.List[InvoiceResponse] = pydantic.Field() + """ + The open invoices for the user. + """ + + has_open_invoices: bool = pydantic.Field() + """ + Whether the user has open invoices. + """ + + pending_change: typing.Optional[SubscriptionPendingChange] = pydantic.Field(default=None) + """ + The pending change for the user. + """ + + has_used_starter_coupon_on_account: typing.Optional[bool] = pydantic.Field(default=None) + """ + True if any workspace owned by this user's auth account has redeemed the starter first-month discount coupon. + """ + + has_used_creator_coupon_on_account: typing.Optional[bool] = pydantic.Field(default=None) + """ + True if any workspace owned by this user's auth account has redeemed the creator first-month discount coupon. + """ + + is_eligible_for_starter_promo: typing.Optional[bool] = pydantic.Field(default=None) + """ + True if this user's auth account qualifies for the Starter first-month promo, using the same check as checkout. The starter_discount feature flag still decides whether the promo is offered. + """ + + 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/data/src/elevenlabs/types/subscription_extras_response_model.py b/data/src/elevenlabs/types/subscription_extras_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5022fdf9f64dfaaef4ddd789eaaf40fd3c831c89 --- /dev/null +++ b/data/src/elevenlabs/types/subscription_extras_response_model.py @@ -0,0 +1,95 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .moderation_status_response_model import ModerationStatusResponseModel +from .subscription_usage_response_model import SubscriptionUsageResponseModel + + +class SubscriptionExtrasResponseModel(UncheckedBaseModel): + concurrency: int = pydantic.Field() + """ + The concurrency of the user. + """ + + convai_concurrency: int = pydantic.Field() + """ + The Convai concurrency of the user. + """ + + enterprise_music_concurrency: typing.Optional[int] = pydantic.Field(default=None) + """ + The Music concurrency of the user on enterprise plan. + """ + + music_finetunes_total_limit: typing.Optional[int] = pydantic.Field(default=None) + """ + Custom total finetunes limit for the user. + """ + + music_finetunes_monthly_limit: typing.Optional[int] = pydantic.Field(default=None) + """ + Custom monthly finetunes limit for the user. + """ + + music_finetunes_concurrency_limit: typing.Optional[int] = pydantic.Field(default=None) + """ + Custom finetunes concurrency limit for the user. + """ + + convai_chars_per_minute: typing.Optional[int] = pydantic.Field(default=None) + """ + The Convai characters per minute of the user. This field is deprecated and will always return None. + """ + + convai_asr_chars_per_minute: typing.Optional[int] = pydantic.Field(default=None) + """ + The Convai ASR characters per minute of the user. This field is deprecated and will always return None. + """ + + force_logging_disabled: bool = pydantic.Field() + """ + Whether the user's logging is disabled. + """ + + can_request_manual_pro_voice_verification: bool = pydantic.Field() + """ + Whether the user can request manual pro voice verification. + """ + + can_bypass_voice_captcha: bool = pydantic.Field() + """ + Whether the user can bypass the voice captcha. + """ + + moderation: ModerationStatusResponseModel = pydantic.Field() + """ + The moderation status of the user. + """ + + unused_characters_rolled_over_from_previous_period: typing.Optional[int] = pydantic.Field(default=None) + """ + The unused characters rolled over from the previous period. + """ + + overused_characters_rolled_over_from_previous_period: typing.Optional[int] = pydantic.Field(default=None) + """ + The overused characters rolled over from the previous period. + """ + + usage: typing.Optional[SubscriptionUsageResponseModel] = pydantic.Field(default=None) + """ + Data on how the subscription is being used. + """ + + 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/data/src/elevenlabs/types/subscription_max_credit_limit_extension.py b/data/src/elevenlabs/types/subscription_max_credit_limit_extension.py new file mode 100644 index 0000000000000000000000000000000000000000..7f650a51d8122ad73f5360384aad7c77dd8606a6 --- /dev/null +++ b/data/src/elevenlabs/types/subscription_max_credit_limit_extension.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionMaxCreditLimitExtension = typing.Union[int, typing.Literal["unlimited"]] diff --git a/data/src/elevenlabs/types/subscription_pending_change.py b/data/src/elevenlabs/types/subscription_pending_change.py new file mode 100644 index 0000000000000000000000000000000000000000..eae2043b0d9e91418f800d27f080885ffd3bb5d1 --- /dev/null +++ b/data/src/elevenlabs/types/subscription_pending_change.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .pending_cancellation_response_model import PendingCancellationResponseModel +from .pending_subscription_switch_response_model import PendingSubscriptionSwitchResponseModel + +SubscriptionPendingChange = typing.Union[PendingSubscriptionSwitchResponseModel, PendingCancellationResponseModel] diff --git a/data/src/elevenlabs/types/subscription_response.py b/data/src/elevenlabs/types/subscription_response.py new file mode 100644 index 0000000000000000000000000000000000000000..cbd2bb6fbfc4eac32cbc12600886ce7ec789f053 --- /dev/null +++ b/data/src/elevenlabs/types/subscription_response.py @@ -0,0 +1,139 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .billing_period import BillingPeriod +from .character_refresh_period import CharacterRefreshPeriod +from .currency import Currency +from .price import Price +from .subscription_response_max_credit_limit_extension import SubscriptionResponseMaxCreditLimitExtension +from .subscription_status_type import SubscriptionStatusType + + +class SubscriptionResponse(UncheckedBaseModel): + tier: str = pydantic.Field() + """ + The tier of the user's subscription. + """ + + character_count: int = pydantic.Field() + """ + The number of characters used by the user. + """ + + character_limit: int = pydantic.Field() + """ + The maximum number of characters allowed in the current billing period. + """ + + max_character_limit_extension: typing.Optional[int] = pydantic.Field(default=None) + """ + Deprecated: use `max_credit_limit_extension`. Maximum number of characters that the character limit can be exceeded by. Managed by the workspace admin. + """ + + max_credit_limit_extension: SubscriptionResponseMaxCreditLimitExtension = pydantic.Field() + """ + Maximum number of credits that the credit limit can be exceeded by. Managed by the workspace admin. `"unlimited"` means no cap, `0` means usage-based billing is disabled. + """ + + can_extend_character_limit: bool = pydantic.Field() + """ + Whether the workspace is entitled to enter overages (usage-based billing). + """ + + allowed_to_extend_character_limit: bool = pydantic.Field() + """ + Deprecated: use `max_credit_limit_extension != 0`. Whether the user is allowed to extend their character limit. + """ + + next_character_count_reset_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The Unix timestamp of the next character count reset. + """ + + voice_slots_used: int = pydantic.Field() + """ + The number of voice slots used by the user. + """ + + professional_voice_slots_used: int = pydantic.Field() + """ + The number of professional voice slots used. For consolidated billing this is the group-wide count across all workspaces in the group; see professional_voice_slots_used_in_workspace for the current workspace only. + """ + + professional_voice_slots_used_in_workspace: int = pydantic.Field() + """ + The number of professional voice slots used in the current workspace. For consolidated billing, professional_voice_slots_used counts across all workspaces in the group, while this counts only the current workspace. + """ + + voice_limit: int = pydantic.Field() + """ + The maximum number of voice slots allowed for the user. + """ + + max_voice_add_edits: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum number of voice add/edits allowed for the user. + """ + + voice_add_edit_counter: int = pydantic.Field() + """ + The number of voice add/edits used by the user. + """ + + professional_voice_limit: int = pydantic.Field() + """ + The maximum number of professional voices allowed for the user. + """ + + can_extend_voice_limit: bool = pydantic.Field() + """ + Whether the user can extend their voice limit. + """ + + can_use_instant_voice_cloning: bool = pydantic.Field() + """ + Whether the user can use instant voice cloning. + """ + + can_use_professional_voice_cloning: bool = pydantic.Field() + """ + Whether the user can use professional voice cloning. + """ + + currency: typing.Optional[Currency] = pydantic.Field(default=None) + """ + The currency of the user's subscription. + """ + + current_overage: Price = pydantic.Field() + """ + The current usage-based overage cost. + """ + + status: SubscriptionStatusType = pydantic.Field() + """ + The status of the user's subscription. + """ + + billing_period: typing.Optional[BillingPeriod] = pydantic.Field(default=None) + """ + The billing period of the user's subscription. + """ + + character_refresh_period: typing.Optional[CharacterRefreshPeriod] = pydantic.Field(default=None) + """ + The character refresh period of the user's subscription. + """ + + 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/data/src/elevenlabs/types/subscription_response_max_credit_limit_extension.py b/data/src/elevenlabs/types/subscription_response_max_credit_limit_extension.py new file mode 100644 index 0000000000000000000000000000000000000000..1c64410d8462165a51f9c23771b1da6e7fe2abc7 --- /dev/null +++ b/data/src/elevenlabs/types/subscription_response_max_credit_limit_extension.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionResponseMaxCreditLimitExtension = typing.Union[int, typing.Literal["unlimited"]] diff --git a/data/src/elevenlabs/types/subscription_status_type.py b/data/src/elevenlabs/types/subscription_status_type.py new file mode 100644 index 0000000000000000000000000000000000000000..a2d2478f75bd9958a98803242e7c47607bcba894 --- /dev/null +++ b/data/src/elevenlabs/types/subscription_status_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SubscriptionStatusType = typing.Union[ + typing.Literal["trialing", "active", "incomplete", "past_due", "free", "free_disabled"], typing.Any +] diff --git a/data/src/elevenlabs/types/subscription_usage_response_model.py b/data/src/elevenlabs/types/subscription_usage_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c2af5d3e5282b0e9b127662b7af4c8efc8f8c9fb --- /dev/null +++ b/data/src/elevenlabs/types/subscription_usage_response_model.py @@ -0,0 +1,68 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SubscriptionUsageResponseModel(UncheckedBaseModel): + rollover_credits_quota: int = pydantic.Field() + """ + The rollover credits quota. + """ + + subscription_cycle_credits_quota: int = pydantic.Field() + """ + The subscription cycle credits quota. + """ + + manually_gifted_credits_quota: int = pydantic.Field() + """ + The manually gifted credits quota. + """ + + payg_credits_quota: typing.Optional[int] = pydantic.Field(default=None) + """ + The payg credits quota. + """ + + rollover_credits_used: int = pydantic.Field() + """ + The rollover credits used. + """ + + subscription_cycle_credits_used: int = pydantic.Field() + """ + The subscription cycle credits used. + """ + + manually_gifted_credits_used: int = pydantic.Field() + """ + The manually gifted credits used. + """ + + payg_credits_used: typing.Optional[int] = pydantic.Field(default=None) + """ + The payg credits used. + """ + + paid_usage_based_credits_used: int = pydantic.Field() + """ + The paid usage based credits used. + """ + + actual_reported_credits: int = pydantic.Field() + """ + The actual reported credits. + """ + + 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/data/src/elevenlabs/types/subtitle_order_item_request.py b/data/src/elevenlabs/types/subtitle_order_item_request.py new file mode 100644 index 0000000000000000000000000000000000000000..3c2f6eb3307aa1ea6bb6e3070d975d444d33d4a3 --- /dev/null +++ b/data/src/elevenlabs/types/subtitle_order_item_request.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .cue_options_request import CueOptionsRequest +from .media_id import MediaId + + +class SubtitleOrderItemRequest(UncheckedBaseModel): + media_ids: typing.List[MediaId] = pydantic.Field() + """ + The IDs of the uploaded media files to generate subtitles for. + """ + + source_language: str = pydantic.Field() + """ + The language code of the source media (e.g. 'en', 'es'). + """ + + destination_languages: typing.List[str] = pydantic.Field() + """ + List of target language codes. Subtitles will be generated for each media file in each destination language. + """ + + cue_options: typing.Optional[CueOptionsRequest] = pydantic.Field(default=None) + """ + Formatting options for subtitle cues such as duration, line count, and character limits. + """ + + sdh: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether subtitles should use SDH format, which includes descriptions for deaf and hard-of-hearing viewers. + """ + + instructions: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional free-text instructions for the subtitling team. + """ + + 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/data/src/elevenlabs/types/suggested_audio_tag.py b/data/src/elevenlabs/types/suggested_audio_tag.py new file mode 100644 index 0000000000000000000000000000000000000000..e20d18529c6099c514046704bf143e7be47a9f8b --- /dev/null +++ b/data/src/elevenlabs/types/suggested_audio_tag.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SuggestedAudioTag(UncheckedBaseModel): + tag: str = pydantic.Field() + """ + Audio tag to use (for best performance, 1-2 words, e.g., 'happy', 'excited') + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional description of when to use this tag + """ + + 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/data/src/elevenlabs/types/supported_voice.py b/data/src/elevenlabs/types/supported_voice.py new file mode 100644 index 0000000000000000000000000000000000000000..a10cbbc04d83b985808007d1d91e858e853d0d19 --- /dev/null +++ b/data/src/elevenlabs/types/supported_voice.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .tts_model_family import TtsModelFamily +from .tts_optimize_streaming_latency import TtsOptimizeStreamingLatency + + +class SupportedVoice(UncheckedBaseModel): + label: str + voice_id: str + description: typing.Optional[str] = None + language: typing.Optional[str] = None + model_family: typing.Optional[TtsModelFamily] = None + optimize_streaming_latency: typing.Optional[TtsOptimizeStreamingLatency] = None + stability: typing.Optional[float] = None + speed: typing.Optional[float] = None + similarity_boost: 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/data/src/elevenlabs/types/system_data_collection_id.py b/data/src/elevenlabs/types/system_data_collection_id.py new file mode 100644 index 0000000000000000000000000000000000000000..f8759f8b50e101f52522c910b65829dacaa73720 --- /dev/null +++ b/data/src/elevenlabs/types/system_data_collection_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SystemDataCollectionId = typing.Literal["__system_data_collection_topic"] diff --git a/data/src/elevenlabs/types/system_evaluation_criteria.py b/data/src/elevenlabs/types/system_evaluation_criteria.py new file mode 100644 index 0000000000000000000000000000000000000000..1750fa9aa2ae2f2ff88d6767f2924f2c336b1b7b --- /dev/null +++ b/data/src/elevenlabs/types/system_evaluation_criteria.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class SystemEvaluationCriteria(UncheckedBaseModel): + user_sentiment_score: float + user_frustration_score: float + + 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/data/src/elevenlabs/types/system_evaluation_id.py b/data/src/elevenlabs/types/system_evaluation_id.py new file mode 100644 index 0000000000000000000000000000000000000000..f8a178b3c6d8813c175be4f13a67be16650171d6 --- /dev/null +++ b/data/src/elevenlabs/types/system_evaluation_id.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +SystemEvaluationId = typing.Union[ + typing.Literal["__system_eval_criteria_sentiment", "__system_eval_criteria_frustration"], typing.Any +] diff --git a/data/src/elevenlabs/types/system_tool_config_input.py b/data/src/elevenlabs/types/system_tool_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..7042d039b596d30b83012d3eb274a891a71f5387 --- /dev/null +++ b/data/src/elevenlabs/types/system_tool_config_input.py @@ -0,0 +1,87 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_assignment import DynamicVariableAssignment +from .pre_tool_speech_mode import PreToolSpeechMode +from .system_tool_config_input_params import SystemToolConfigInputParams +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_interruption_mode import ToolInterruptionMode + + +class SystemToolConfigInput(UncheckedBaseModel): + """ + A system tool is a tool that is used to call a system method in the server + """ + + type: typing.Optional[typing.Literal["system"]] = pydantic.Field(default=None) + """ + The type of tool + """ + + name: str + description: typing.Optional[str] = pydantic.Field(default=None) + """ + Description of when the tool should be used and what it does. Leave empty to use the default description that's optimized for the specific tool type. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for the tool call to complete. + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while this tool is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, the agent will speak before the tool call. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution. If not specified, no tool call sound will be played. + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play. 'auto' only plays when there's pre-tool speech, 'always' plays for every tool call. + """ + + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = pydantic.Field(default=None) + """ + Controls how tool errors are processed before being shared with the agent. 'auto' determines handling based on tool type (summarized for native integrations, hide for others), 'summarized' sends an LLM-generated summary, 'passthrough' sends the raw error, 'hide' does not share the error with the agent. + """ + + params: SystemToolConfigInputParams + + 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/data/src/elevenlabs/types/system_tool_config_input_params.py b/data/src/elevenlabs/types/system_tool_config_input_params.py new file mode 100644 index 0000000000000000000000000000000000000000..4d1ea61c81bff2ad82dd5aa67554b5a92fec6130 --- /dev/null +++ b/data/src/elevenlabs/types/system_tool_config_input_params.py @@ -0,0 +1,187 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .agent_transfer_input import AgentTransferInput +from .end_procedure_tool_config_procedures_value import EndProcedureToolConfigProceduresValue +from .phone_number_transfer import PhoneNumberTransfer +from .search_strategy import SearchStrategy +from .start_procedure_tool_config_procedures_value import StartProcedureToolConfigProceduresValue + + +class SystemToolConfigInputParams_EndCall(UncheckedBaseModel): + system_tool_type: typing.Literal["end_call"] = "end_call" + + 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 + + +class SystemToolConfigInputParams_EndProcedure(UncheckedBaseModel): + system_tool_type: typing.Literal["end_procedure"] = "end_procedure" + procedures: typing.Optional[typing.Dict[str, EndProcedureToolConfigProceduresValue]] = 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 + + +class SystemToolConfigInputParams_KnowledgeBase(UncheckedBaseModel): + system_tool_type: typing.Literal["knowledge_base"] = "knowledge_base" + enabled_strategies: typing.Optional[typing.List[SearchStrategy]] = 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 + + +class SystemToolConfigInputParams_KnowledgeBaseRag(UncheckedBaseModel): + system_tool_type: typing.Literal["knowledge_base_rag"] = "knowledge_base_rag" + + 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 + + +class SystemToolConfigInputParams_LanguageDetection(UncheckedBaseModel): + system_tool_type: typing.Literal["language_detection"] = "language_detection" + only_at_conversation_start: 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 + + +class SystemToolConfigInputParams_PlayKeypadTouchTone(UncheckedBaseModel): + system_tool_type: typing.Literal["play_keypad_touch_tone"] = "play_keypad_touch_tone" + use_out_of_band_dtmf: typing.Optional[bool] = None + suppress_turn_after_dtmf: 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 + + +class SystemToolConfigInputParams_SkipTurn(UncheckedBaseModel): + system_tool_type: typing.Literal["skip_turn"] = "skip_turn" + wait_timeout_secs: 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 + + +class SystemToolConfigInputParams_StartProcedure(UncheckedBaseModel): + system_tool_type: typing.Literal["start_procedure"] = "start_procedure" + procedures: typing.Optional[typing.Dict[str, StartProcedureToolConfigProceduresValue]] = 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 + + +class SystemToolConfigInputParams_TransferToAgent(UncheckedBaseModel): + system_tool_type: typing.Literal["transfer_to_agent"] = "transfer_to_agent" + transfers: typing.List[AgentTransferInput] + + 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 + + +class SystemToolConfigInputParams_TransferToNumber(UncheckedBaseModel): + system_tool_type: typing.Literal["transfer_to_number"] = "transfer_to_number" + transfers: typing.List[PhoneNumberTransfer] + enable_client_message: 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 + + +class SystemToolConfigInputParams_VoicemailDetection(UncheckedBaseModel): + system_tool_type: typing.Literal["voicemail_detection"] = "voicemail_detection" + voicemail_message: 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 + + +SystemToolConfigInputParams = typing_extensions.Annotated[ + typing.Union[ + SystemToolConfigInputParams_EndCall, + SystemToolConfigInputParams_EndProcedure, + SystemToolConfigInputParams_KnowledgeBase, + SystemToolConfigInputParams_KnowledgeBaseRag, + SystemToolConfigInputParams_LanguageDetection, + SystemToolConfigInputParams_PlayKeypadTouchTone, + SystemToolConfigInputParams_SkipTurn, + SystemToolConfigInputParams_StartProcedure, + SystemToolConfigInputParams_TransferToAgent, + SystemToolConfigInputParams_TransferToNumber, + SystemToolConfigInputParams_VoicemailDetection, + ], + UnionMetadata(discriminant="system_tool_type"), +] diff --git a/data/src/elevenlabs/types/system_tool_config_output.py b/data/src/elevenlabs/types/system_tool_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..2e2c52a4b62831afdff5ba763336a2f835ffb232 --- /dev/null +++ b/data/src/elevenlabs/types/system_tool_config_output.py @@ -0,0 +1,87 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_assignment import DynamicVariableAssignment +from .pre_tool_speech_mode import PreToolSpeechMode +from .system_tool_config_output_params import SystemToolConfigOutputParams +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_interruption_mode import ToolInterruptionMode + + +class SystemToolConfigOutput(UncheckedBaseModel): + """ + A system tool is a tool that is used to call a system method in the server + """ + + type: typing.Optional[typing.Literal["system"]] = pydantic.Field(default=None) + """ + The type of tool + """ + + name: str + description: typing.Optional[str] = pydantic.Field(default=None) + """ + Description of when the tool should be used and what it does. Leave empty to use the default description that's optimized for the specific tool type. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for the tool call to complete. + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while this tool is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, the agent will speak before the tool call. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution. If not specified, no tool call sound will be played. + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play. 'auto' only plays when there's pre-tool speech, 'always' plays for every tool call. + """ + + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = pydantic.Field(default=None) + """ + Controls how tool errors are processed before being shared with the agent. 'auto' determines handling based on tool type (summarized for native integrations, hide for others), 'summarized' sends an LLM-generated summary, 'passthrough' sends the raw error, 'hide' does not share the error with the agent. + """ + + params: SystemToolConfigOutputParams + + 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/data/src/elevenlabs/types/system_tool_config_output_params.py b/data/src/elevenlabs/types/system_tool_config_output_params.py new file mode 100644 index 0000000000000000000000000000000000000000..f1d135dcb6276c15c86e15febecb87e9f322076d --- /dev/null +++ b/data/src/elevenlabs/types/system_tool_config_output_params.py @@ -0,0 +1,187 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .agent_transfer_output import AgentTransferOutput +from .end_procedure_tool_config_procedures_value import EndProcedureToolConfigProceduresValue +from .phone_number_transfer import PhoneNumberTransfer +from .search_strategy import SearchStrategy +from .start_procedure_tool_config_procedures_value import StartProcedureToolConfigProceduresValue + + +class SystemToolConfigOutputParams_EndCall(UncheckedBaseModel): + system_tool_type: typing.Literal["end_call"] = "end_call" + + 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 + + +class SystemToolConfigOutputParams_EndProcedure(UncheckedBaseModel): + system_tool_type: typing.Literal["end_procedure"] = "end_procedure" + procedures: typing.Optional[typing.Dict[str, EndProcedureToolConfigProceduresValue]] = 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 + + +class SystemToolConfigOutputParams_KnowledgeBase(UncheckedBaseModel): + system_tool_type: typing.Literal["knowledge_base"] = "knowledge_base" + enabled_strategies: typing.Optional[typing.List[SearchStrategy]] = 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 + + +class SystemToolConfigOutputParams_KnowledgeBaseRag(UncheckedBaseModel): + system_tool_type: typing.Literal["knowledge_base_rag"] = "knowledge_base_rag" + + 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 + + +class SystemToolConfigOutputParams_LanguageDetection(UncheckedBaseModel): + system_tool_type: typing.Literal["language_detection"] = "language_detection" + only_at_conversation_start: 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 + + +class SystemToolConfigOutputParams_PlayKeypadTouchTone(UncheckedBaseModel): + system_tool_type: typing.Literal["play_keypad_touch_tone"] = "play_keypad_touch_tone" + use_out_of_band_dtmf: typing.Optional[bool] = None + suppress_turn_after_dtmf: 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 + + +class SystemToolConfigOutputParams_SkipTurn(UncheckedBaseModel): + system_tool_type: typing.Literal["skip_turn"] = "skip_turn" + wait_timeout_secs: 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 + + +class SystemToolConfigOutputParams_StartProcedure(UncheckedBaseModel): + system_tool_type: typing.Literal["start_procedure"] = "start_procedure" + procedures: typing.Optional[typing.Dict[str, StartProcedureToolConfigProceduresValue]] = 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 + + +class SystemToolConfigOutputParams_TransferToAgent(UncheckedBaseModel): + system_tool_type: typing.Literal["transfer_to_agent"] = "transfer_to_agent" + transfers: typing.List[AgentTransferOutput] + + 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 + + +class SystemToolConfigOutputParams_TransferToNumber(UncheckedBaseModel): + system_tool_type: typing.Literal["transfer_to_number"] = "transfer_to_number" + transfers: typing.List[PhoneNumberTransfer] + enable_client_message: 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 + + +class SystemToolConfigOutputParams_VoicemailDetection(UncheckedBaseModel): + system_tool_type: typing.Literal["voicemail_detection"] = "voicemail_detection" + voicemail_message: 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 + + +SystemToolConfigOutputParams = typing_extensions.Annotated[ + typing.Union[ + SystemToolConfigOutputParams_EndCall, + SystemToolConfigOutputParams_EndProcedure, + SystemToolConfigOutputParams_KnowledgeBase, + SystemToolConfigOutputParams_KnowledgeBaseRag, + SystemToolConfigOutputParams_LanguageDetection, + SystemToolConfigOutputParams_PlayKeypadTouchTone, + SystemToolConfigOutputParams_SkipTurn, + SystemToolConfigOutputParams_StartProcedure, + SystemToolConfigOutputParams_TransferToAgent, + SystemToolConfigOutputParams_TransferToNumber, + SystemToolConfigOutputParams_VoicemailDetection, + ], + UnionMetadata(discriminant="system_tool_type"), +] diff --git a/data/src/elevenlabs/types/telephony_call_config_input.py b/data/src/elevenlabs/types/telephony_call_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..d1bc00a4322e6ca7942812a1f7bdcd5a5af917d4 --- /dev/null +++ b/data/src/elevenlabs/types/telephony_call_config_input.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .twilio_machine_detection_config import TwilioMachineDetectionConfig + + +class TelephonyCallConfigInput(UncheckedBaseModel): + ringing_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + How long to ring the recipient before giving up, in seconds. Note that this will also be limited by the provider's own constraints. + """ + + twilio_call_recording_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to record the call using Twilio call recording. Ignored for non-Twilio providers. Recordings are stored in your Twilio account. + """ + + twilio_machine_detection: typing.Optional[TwilioMachineDetectionConfig] = pydantic.Field(default=None) + """ + Configuration for Twilio's carrier-level answering machine detection (AMD). Omit or set to null to disable it. Ignored for non-Twilio providers and for inbound calls. The resulting verdict is delivered as its own `answering_machine_detection` webhook event, which requires that event to be enabled on the workspace or agent webhook settings; it is not part of the conversation or the post-call webhook. Detection runs asynchronously so it never delays the start of the conversation, and the verdict can arrive at any point during the call -- with `detect_message_end`, even after it has ended. Twilio bills separately for AMD. + """ + + 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/data/src/elevenlabs/types/telephony_call_config_output.py b/data/src/elevenlabs/types/telephony_call_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..6de2a901abf1f2f1281bc08965268049cd24482f --- /dev/null +++ b/data/src/elevenlabs/types/telephony_call_config_output.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .twilio_machine_detection_config import TwilioMachineDetectionConfig + + +class TelephonyCallConfigOutput(UncheckedBaseModel): + ringing_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + How long to ring the recipient before giving up, in seconds. Note that this will also be limited by the provider's own constraints. + """ + + twilio_call_recording_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to record the call using Twilio call recording. Ignored for non-Twilio providers. Recordings are stored in your Twilio account. + """ + + twilio_machine_detection: typing.Optional[TwilioMachineDetectionConfig] = pydantic.Field(default=None) + """ + Configuration for Twilio's carrier-level answering machine detection (AMD). Omit or set to null to disable it. Ignored for non-Twilio providers and for inbound calls. The resulting verdict is delivered as its own `answering_machine_detection` webhook event, which requires that event to be enabled on the workspace or agent webhook settings; it is not part of the conversation or the post-call webhook. Detection runs asynchronously so it never delays the start of the conversation, and the verdict can arrive at any point during the call -- with `detect_message_end`, even after it has ended. Twilio bills separately for AMD. + """ + + 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/data/src/elevenlabs/types/telephony_direction.py b/data/src/elevenlabs/types/telephony_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..a91104aef003ff3c27d208e44266ac2fa647ebcd --- /dev/null +++ b/data/src/elevenlabs/types/telephony_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TelephonyDirection = typing.Union[typing.Literal["inbound", "outbound"], typing.Any] diff --git a/data/src/elevenlabs/types/telephony_provider.py b/data/src/elevenlabs/types/telephony_provider.py new file mode 100644 index 0000000000000000000000000000000000000000..dc8378903c24a443a6cee46a3ac71fb318ca48d1 --- /dev/null +++ b/data/src/elevenlabs/types/telephony_provider.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TelephonyProvider = typing.Union[typing.Literal["twilio", "sip_trunk", "exotel"], typing.Any] diff --git a/data/src/elevenlabs/types/template_array_output.py b/data/src/elevenlabs/types/template_array_output.py new file mode 100644 index 0000000000000000000000000000000000000000..f14f57cea739635fbf49eb7c5bd5c71f24a53d16 --- /dev/null +++ b/data/src/elevenlabs/types/template_array_output.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_array_output_failure_reason import TemplateArrayOutputFailureReason +from .template_run_status import TemplateRunStatus + + +class TemplateArrayOutput(UncheckedBaseModel): + """ + An `array` output, delivered as `content` once completed: one output per + element, each an output in its own right with its own `status`. A list can + be arbitrarily long, so `content` is its first page; when `has_more` is + true, `next_cursor` leads to the rest. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateArrayOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content: typing.Optional[typing.List["TemplateOutput"]] = pydantic.Field(default=None) + """ + The first elements of the list, in order, each following the shape of the schema's `items`. Present only when `status` is `completed`. When `has_more` is true this is not the whole list. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Pass as `cursor` to a later endpoint to fetch the elements after `content`. `null` when `content` holds the whole list, or before the output completes. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client. + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the list has elements beyond `content`. + """ + + 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 + + +from .template_object_output import TemplateObjectOutput # noqa: E402, I001 +from .template_output import TemplateOutput # noqa: E402, I001 + +update_forward_refs(TemplateArrayOutput, TemplateObjectOutput=TemplateObjectOutput, TemplateOutput=TemplateOutput) diff --git a/data/src/elevenlabs/types/template_array_output_failure_reason.py b/data/src/elevenlabs/types/template_array_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..84735ae9f37c4cbc5fc9d277cb22b1ca9b87edff --- /dev/null +++ b/data/src/elevenlabs/types/template_array_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateArrayOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/template_audio_output.py b/data/src/elevenlabs/types/template_audio_output.py new file mode 100644 index 0000000000000000000000000000000000000000..9e63ef90f398579c8b4cb10bb6effd79aac4e266 --- /dev/null +++ b/data/src/elevenlabs/types/template_audio_output.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_audio_output_failure_reason import TemplateAudioOutputFailureReason +from .template_run_status import TemplateRunStatus + + +class TemplateAudioOutput(UncheckedBaseModel): + """ + An `audio` output, downloaded from `content_url` once completed. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateAudioOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content_url: typing.Optional[str] = pydantic.Field(default=None) + """ + A signed URL to download the generated media from. Present only when `status` is `completed`. It expires about an hour after this response is returned; fetch the run again for a fresh URL. + """ + + content_mime_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The MIME type of the generated media. Present only when `status` is `completed`. + """ + + 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/data/src/elevenlabs/types/template_audio_output_failure_reason.py b/data/src/elevenlabs/types/template_audio_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..fea527ca14efba454b44b12405f359c7d425e314 --- /dev/null +++ b/data/src/elevenlabs/types/template_audio_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateAudioOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/template_boolean_output.py b/data/src/elevenlabs/types/template_boolean_output.py new file mode 100644 index 0000000000000000000000000000000000000000..6d2c31b67dfe55e758b349ca5706b4662f789591 --- /dev/null +++ b/data/src/elevenlabs/types/template_boolean_output.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_boolean_output_failure_reason import TemplateBooleanOutputFailureReason +from .template_run_status import TemplateRunStatus + + +class TemplateBooleanOutput(UncheckedBaseModel): + """ + A `boolean` output, delivered as `content` once completed. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateBooleanOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content: typing.Optional[bool] = pydantic.Field(default=None) + """ + The generated boolean. Present only when `status` is `completed`. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client. + """ + + 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/data/src/elevenlabs/types/template_boolean_output_failure_reason.py b/data/src/elevenlabs/types/template_boolean_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..2bb71e76745a694fdae43f54c275034c76501d4c --- /dev/null +++ b/data/src/elevenlabs/types/template_boolean_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateBooleanOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/template_image_output.py b/data/src/elevenlabs/types/template_image_output.py new file mode 100644 index 0000000000000000000000000000000000000000..9fcf58ff459aa8891de1b16ff5c6ae1755edcd24 --- /dev/null +++ b/data/src/elevenlabs/types/template_image_output.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_image_output_failure_reason import TemplateImageOutputFailureReason +from .template_run_status import TemplateRunStatus + + +class TemplateImageOutput(UncheckedBaseModel): + """ + An `image` output, downloaded from `content_url` once completed. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateImageOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content_url: typing.Optional[str] = pydantic.Field(default=None) + """ + A signed URL to download the generated media from. Present only when `status` is `completed`. It expires about an hour after this response is returned; fetch the run again for a fresh URL. + """ + + content_mime_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The MIME type of the generated media. Present only when `status` is `completed`. + """ + + 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/data/src/elevenlabs/types/template_image_output_failure_reason.py b/data/src/elevenlabs/types/template_image_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..6751954c58e03d49ee7125235f8735c9b25521d5 --- /dev/null +++ b/data/src/elevenlabs/types/template_image_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateImageOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/template_input_reference.py b/data/src/elevenlabs/types/template_input_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..b5992ec1ed3d5329f20ca4d505bd22392d71f445 --- /dev/null +++ b/data/src/elevenlabs/types/template_input_reference.py @@ -0,0 +1,82 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .inline_base_64_reference_mime_type import InlineBase64ReferenceMimeType + + +class TemplateInputReference_Asset(UncheckedBaseModel): + type: typing.Literal["asset"] = "asset" + asset_id: 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 + + +class TemplateInputReference_Generation(UncheckedBaseModel): + type: typing.Literal["generation"] = "generation" + generation_id: 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 + + +class TemplateInputReference_InlineBase64(UncheckedBaseModel): + type: typing.Literal["inline_base64"] = "inline_base64" + content_base_64: typing_extensions.Annotated[ + str, FieldMetadata(alias="content_base64"), pydantic.Field(alias="content_base64") + ] + mime_type: InlineBase64ReferenceMimeType + + 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 + + +class TemplateInputReference_Voice(UncheckedBaseModel): + type: typing.Literal["voice"] = "voice" + voice_id: 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 + + +TemplateInputReference = typing_extensions.Annotated[ + typing.Union[ + TemplateInputReference_Asset, + TemplateInputReference_Generation, + TemplateInputReference_InlineBase64, + TemplateInputReference_Voice, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/template_integer_output.py b/data/src/elevenlabs/types/template_integer_output.py new file mode 100644 index 0000000000000000000000000000000000000000..4c319ff5ad3f22245a6856c602dca098e5ddd35b --- /dev/null +++ b/data/src/elevenlabs/types/template_integer_output.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_integer_output_failure_reason import TemplateIntegerOutputFailureReason +from .template_run_status import TemplateRunStatus + + +class TemplateIntegerOutput(UncheckedBaseModel): + """ + An `integer` output, delivered as `content` once completed. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateIntegerOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content: typing.Optional[int] = pydantic.Field(default=None) + """ + The generated integer. Present only when `status` is `completed`. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client. + """ + + 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/data/src/elevenlabs/types/template_integer_output_failure_reason.py b/data/src/elevenlabs/types/template_integer_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..4c1616a273e26d13a6611448581bc23e6b2c55da --- /dev/null +++ b/data/src/elevenlabs/types/template_integer_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateIntegerOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/template_list_response.py b/data/src/elevenlabs/types/template_list_response.py new file mode 100644 index 0000000000000000000000000000000000000000..3e8b93263c7fe433928c3f84687204ac0cc11a31 --- /dev/null +++ b/data/src/elevenlabs/types/template_list_response.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_summary import TemplateSummary + + +class TemplateListResponse(UncheckedBaseModel): + """ + One page of the templates the caller can run, most recently updated first. + """ + + templates: typing.List[TemplateSummary] = pydantic.Field() + """ + The templates on this page, most recently updated first. A page can hold fewer than `page_size` templates, or none at all, because templates you cannot run are filtered out after the page is read — keep paging while `has_more` is true. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Pass as `cursor` to fetch the next page. `null` when there is no further page. + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether more templates exist beyond this page. + """ + + 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 + + +update_forward_refs(TemplateListResponse) diff --git a/data/src/elevenlabs/types/template_number_output.py b/data/src/elevenlabs/types/template_number_output.py new file mode 100644 index 0000000000000000000000000000000000000000..f265e6473a402bffedc5f8da8cf47a6610301be2 --- /dev/null +++ b/data/src/elevenlabs/types/template_number_output.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_number_output_failure_reason import TemplateNumberOutputFailureReason +from .template_run_status import TemplateRunStatus + + +class TemplateNumberOutput(UncheckedBaseModel): + """ + A `number` output, delivered as `content` once completed. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateNumberOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content: typing.Optional[float] = pydantic.Field(default=None) + """ + The generated number. Present only when `status` is `completed`. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client. + """ + + 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/data/src/elevenlabs/types/template_number_output_failure_reason.py b/data/src/elevenlabs/types/template_number_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..b8c019d01537780a3442fccd29d5b1c932ba7b6e --- /dev/null +++ b/data/src/elevenlabs/types/template_number_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateNumberOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/template_object_output.py b/data/src/elevenlabs/types/template_object_output.py new file mode 100644 index 0000000000000000000000000000000000000000..fb2ed82310a3cf8098ecef6987c8598a63334f61 --- /dev/null +++ b/data/src/elevenlabs/types/template_object_output.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_object_output_failure_reason import TemplateObjectOutputFailureReason +from .template_run_status import TemplateRunStatus + + +class TemplateObjectOutput(UncheckedBaseModel): + """ + An `object` output, delivered as `content` once completed: one output per + field of the schema's `properties`, each an output in its own right with + its own `status`. There are no dynamic fields. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateObjectOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content: typing.Optional[typing.Dict[str, typing.Optional["TemplateOutput"]]] = pydantic.Field(default=None) + """ + One output per field, keyed by field name, each following the shape of that field's schema. Present only when `status` is `completed`. Reserved: no template produces this kind of output yet; it is published so that templates which do can be run with the same client. + """ + + 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 + + +from .template_array_output import TemplateArrayOutput # noqa: E402, I001 +from .template_output import TemplateOutput # noqa: E402, I001 + +update_forward_refs(TemplateObjectOutput, TemplateArrayOutput=TemplateArrayOutput, TemplateOutput=TemplateOutput) diff --git a/data/src/elevenlabs/types/template_object_output_failure_reason.py b/data/src/elevenlabs/types/template_object_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..c8f8442c0765733fad1eac1e416a66865549152b --- /dev/null +++ b/data/src/elevenlabs/types/template_object_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateObjectOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/template_output.py b/data/src/elevenlabs/types/template_output.py new file mode 100644 index 0000000000000000000000000000000000000000..85ebe5941cc0ee3c89806a5cbde12959894764ca --- /dev/null +++ b/data/src/elevenlabs/types/template_output.py @@ -0,0 +1,253 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .template_array_output_failure_reason import TemplateArrayOutputFailureReason +from .template_audio_output_failure_reason import TemplateAudioOutputFailureReason +from .template_boolean_output_failure_reason import TemplateBooleanOutputFailureReason +from .template_image_output_failure_reason import TemplateImageOutputFailureReason +from .template_integer_output_failure_reason import TemplateIntegerOutputFailureReason +from .template_number_output_failure_reason import TemplateNumberOutputFailureReason +from .template_object_output_failure_reason import TemplateObjectOutputFailureReason +from .template_run_status import TemplateRunStatus +from .template_string_output_failure_reason import TemplateStringOutputFailureReason +from .template_video_output_failure_reason import TemplateVideoOutputFailureReason + + +class TemplateOutput_Array(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["array"] = "array" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateArrayOutputFailureReason] = None + error_message: typing.Optional[str] = None + content: typing.Optional[typing.List["TemplateOutput"]] = None + next_cursor: typing.Optional[str] = None + has_more: 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 + + +class TemplateOutput_Audio(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["audio"] = "audio" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateAudioOutputFailureReason] = None + error_message: typing.Optional[str] = None + content_url: typing.Optional[str] = None + content_mime_type: 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 + + +class TemplateOutput_Boolean(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["boolean"] = "boolean" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateBooleanOutputFailureReason] = None + error_message: typing.Optional[str] = None + content: 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 + + +class TemplateOutput_Image(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["image"] = "image" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateImageOutputFailureReason] = None + error_message: typing.Optional[str] = None + content_url: typing.Optional[str] = None + content_mime_type: 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 + + +class TemplateOutput_Integer(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["integer"] = "integer" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateIntegerOutputFailureReason] = None + error_message: typing.Optional[str] = None + content: typing.Optional[int] = 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 + + +class TemplateOutput_Number(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["number"] = "number" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateNumberOutputFailureReason] = None + error_message: typing.Optional[str] = None + content: 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 + + +class TemplateOutput_Object(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["object"] = "object" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateObjectOutputFailureReason] = None + error_message: typing.Optional[str] = None + content: typing.Optional[typing.Dict[str, typing.Optional["TemplateOutput"]]] = 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 + + +class TemplateOutput_String(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["string"] = "string" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateStringOutputFailureReason] = None + error_message: typing.Optional[str] = None + content: 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 + + +class TemplateOutput_Video(UncheckedBaseModel): + """ + One output of a template run, discriminated on `type`: the `type` of the + port's `content_schema`. Check `status` for where it is in its lifecycle. + """ + + type: typing.Literal["video"] = "video" + id: str + status: TemplateRunStatus + failure_reason: typing.Optional[TemplateVideoOutputFailureReason] = None + error_message: typing.Optional[str] = None + content_url: typing.Optional[str] = None + content_mime_type: 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 + + +TemplateOutput = typing_extensions.Annotated[ + typing.Union[ + TemplateOutput_Array, + TemplateOutput_Audio, + TemplateOutput_Boolean, + TemplateOutput_Image, + TemplateOutput_Integer, + TemplateOutput_Number, + TemplateOutput_Object, + TemplateOutput_String, + TemplateOutput_Video, + ], + UnionMetadata(discriminant="type"), +] +from .template_object_output import TemplateObjectOutput # noqa: E402, I001 +from .template_array_output import TemplateArrayOutput # noqa: E402, I001 + +update_forward_refs(TemplateOutput_Array, TemplateObjectOutput=TemplateObjectOutput, TemplateOutput=TemplateOutput) +update_forward_refs(TemplateOutput_Object, TemplateArrayOutput=TemplateArrayOutput, TemplateOutput=TemplateOutput) diff --git a/data/src/elevenlabs/types/template_port.py b/data/src/elevenlabs/types/template_port.py new file mode 100644 index 0000000000000000000000000000000000000000..81a60f6c734201b75c82cf03be88ffe3184c8563 --- /dev/null +++ b/data/src/elevenlabs/types/template_port.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TemplatePort(UncheckedBaseModel): + """ + One input or output port of a published template version. + """ + + id: str = pydantic.Field() + """ + The port id. Input ids are the keys of the `inputs` map on `POST /v1/flows/templates/{template_id}/runs`; output ids are the keys of the `outputs` map on the run response. + """ + + content_schema: "ContentSchema" = pydantic.Field() + """ + What this port accepts or produces, as a `ContentSchema`. Its `title` is the port's display name and its `description` is the help text the template author wrote. For an input, its `type` decides what value is accepted: `string` takes a bare string or a `generation` reference, `voice` takes a `voice` reference, and `image`/`video`/`audio` take an `asset`, `generation` or `inline_base64` reference. `number`, `integer` and `boolean` take a JSON value of that type. An `array` input takes a JSON array with one value per element, each admissible for its `items`. `object` inputs cannot be bound through this API yet. A `string` schema may carry an `enum` of the only values accepted. For an output, its `type` decides which `TemplateOutput` shape the run response holds under the port id. + """ + + 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 + + +from .array_schema import ArraySchema # noqa: E402, I001 +from .content_schema import ContentSchema # noqa: E402, I001 +from .object_schema import ObjectSchema # noqa: E402, I001 + +update_forward_refs(TemplatePort, ArraySchema=ArraySchema, ContentSchema=ContentSchema, ObjectSchema=ObjectSchema) diff --git a/data/src/elevenlabs/types/template_run_input.py b/data/src/elevenlabs/types/template_run_input.py new file mode 100644 index 0000000000000000000000000000000000000000..3942562b2bdfa370731ab4b49185e4eab94808f9 --- /dev/null +++ b/data/src/elevenlabs/types/template_run_input.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .template_input_reference import TemplateInputReference + +TemplateRunInput = typing.Union[str, bool, int, float, TemplateInputReference, typing.List["TemplateRunInput"]] diff --git a/data/src/elevenlabs/types/template_run_list_response.py b/data/src/elevenlabs/types/template_run_list_response.py new file mode 100644 index 0000000000000000000000000000000000000000..87af0c212e5c912430d7c062cdb11c9571edfeb7 --- /dev/null +++ b/data/src/elevenlabs/types/template_run_list_response.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_run_response import TemplateRunResponse + + +class TemplateRunListResponse(UncheckedBaseModel): + """ + One page of the caller's public-API template runs, newest first. + """ + + runs: typing.List[TemplateRunResponse] = pydantic.Field() + """ + The runs on this page, newest first. Each item has the same shape as `GET /v1/flows/templates/{template_id}/runs/{run_id}`. + """ + + next_cursor: typing.Optional[str] = pydantic.Field(default=None) + """ + Pass as `cursor` to fetch the next page. `null` when there is no further page. + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether more runs exist beyond this page. + """ + + 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 + + +update_forward_refs(TemplateRunListResponse) diff --git a/data/src/elevenlabs/types/template_run_response.py b/data/src/elevenlabs/types/template_run_response.py new file mode 100644 index 0000000000000000000000000000000000000000..16158bc7f6095da5568850ee80c7013458c9008d --- /dev/null +++ b/data/src/elevenlabs/types/template_run_response.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_run_status import TemplateRunStatus + + +class TemplateRunResponse(UncheckedBaseModel): + """ + A template run and its outputs. Every output exists from the moment the + run is created and reports its own `status`; the run's `status` rolls them + up, and the run is finished once it is `completed` or `failed`. + """ + + id: str = pydantic.Field() + """ + The unique identifier of the run. + """ + + template_id: str = pydantic.Field() + """ + The template this run executed, so a webhook consumer running several templates can tell their runs apart without keeping a run-to-template map. + """ + + version_id: str = pydantic.Field() + """ + The template version this run executed. Resolved when the run is created, so a run started with `latest` records the concrete version it ran. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The run's status, rolled up from its outputs: `pending` until an output starts, `generating` while any output is unfinished, `completed` once every output has completed, and `failed` once every output has finished and at least one failed. `completed` and `failed` are terminal: the `flows_template_run` webhook fires once the run reaches either. + """ + + outputs: typing.Dict[str, "TemplateOutput"] = pydantic.Field() + """ + The run's outputs, keyed by output port id. Each is a `TemplateOutput` discriminated on `type`, the `type` of its port's `content_schema`. + """ + + 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 + + +from .template_array_output import TemplateArrayOutput # noqa: E402, I001 +from .template_object_output import TemplateObjectOutput # noqa: E402, I001 +from .template_output import TemplateOutput # noqa: E402, I001 + +update_forward_refs( + TemplateRunResponse, + TemplateArrayOutput=TemplateArrayOutput, + TemplateObjectOutput=TemplateObjectOutput, + TemplateOutput=TemplateOutput, +) diff --git a/data/src/elevenlabs/types/template_run_status.py b/data/src/elevenlabs/types/template_run_status.py new file mode 100644 index 0000000000000000000000000000000000000000..b09ce96c928e6b1b63bc4d7064324eaab5b55e2c --- /dev/null +++ b/data/src/elevenlabs/types/template_run_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateRunStatus = typing.Union[typing.Literal["pending", "generating", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/template_string_output.py b/data/src/elevenlabs/types/template_string_output.py new file mode 100644 index 0000000000000000000000000000000000000000..662b1232f75cb1fc54e2b60f0f8c671f79ac51d4 --- /dev/null +++ b/data/src/elevenlabs/types/template_string_output.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_run_status import TemplateRunStatus +from .template_string_output_failure_reason import TemplateStringOutputFailureReason + + +class TemplateStringOutput(UncheckedBaseModel): + """ + A `string` output, delivered as `content` once completed. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateStringOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content: typing.Optional[str] = pydantic.Field(default=None) + """ + The generated text. Present only when `status` is `completed`. + """ + + 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/data/src/elevenlabs/types/template_string_output_failure_reason.py b/data/src/elevenlabs/types/template_string_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..f7b419b76a5a9c71ac019b5e187a2505160ca9ac --- /dev/null +++ b/data/src/elevenlabs/types/template_string_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateStringOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/template_summary.py b/data/src/elevenlabs/types/template_summary.py new file mode 100644 index 0000000000000000000000000000000000000000..001af320cd7dead4b0605c4383c0196df0d91a04 --- /dev/null +++ b/data/src/elevenlabs/types/template_summary.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_version import TemplateVersion + + +class TemplateSummary(UncheckedBaseModel): + """ + A template the caller can run, and its runnable versions. + """ + + id: str = pydantic.Field() + """ + Pass as `template_id` on `POST /v1/flows/templates/{template_id}/runs`. + """ + + name: str = pydantic.Field() + """ + The template's name. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The template's description, if it has one. + """ + + versions: typing.List[TemplateVersion] = pydantic.Field() + """ + The published versions this caller can run, newest first. A version whose graph uses a model that is not available to you through the API is left out, as is one whose stored snapshot is gone; either way the list can be empty while the template still has versions the ElevenLabs app can run. + """ + + has_more_versions: bool = pydantic.Field() + """ + Whether this template has further published versions beyond the `versions_per_template` returned here. Fetch `GET /v1/flows/templates/{template_id}` with a larger `versions_per_template` to see more of them. + """ + + 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 + + +update_forward_refs(TemplateSummary) diff --git a/data/src/elevenlabs/types/template_version.py b/data/src/elevenlabs/types/template_version.py new file mode 100644 index 0000000000000000000000000000000000000000..cb3210f6f5c9b99a09e904eec2bf4353370e6203 --- /dev/null +++ b/data/src/elevenlabs/types/template_version.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_port import TemplatePort + + +class TemplateVersion(UncheckedBaseModel): + """ + A published snapshot of a template, and the ports it runs with. + """ + + version_id: str = pydantic.Field() + """ + Pass as `version_id` on `POST /v1/flows/templates/{template_id}/runs` to pin a run to this snapshot. + """ + + published_at_unix: int = pydantic.Field() + """ + When this version was published, as a Unix timestamp in seconds. + """ + + is_latest: bool = pydantic.Field() + """ + Whether this is the version a run gets when `version_id` is omitted or set to `latest`. + """ + + inputs: typing.List[TemplatePort] = pydantic.Field() + """ + The inputs this version accepts, in canvas order. Every input is required on a run. + """ + + outputs: typing.List[TemplatePort] = pydantic.Field() + """ + The outputs this version produces, in canvas order. + """ + + 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 + + +update_forward_refs(TemplateVersion) diff --git a/data/src/elevenlabs/types/template_video_output.py b/data/src/elevenlabs/types/template_video_output.py new file mode 100644 index 0000000000000000000000000000000000000000..7f62fddd34536ea03fd1035ed0c7111dcae702f5 --- /dev/null +++ b/data/src/elevenlabs/types/template_video_output.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .template_run_status import TemplateRunStatus +from .template_video_output_failure_reason import TemplateVideoOutputFailureReason + + +class TemplateVideoOutput(UncheckedBaseModel): + """ + A `video` output, downloaded from `content_url` once completed. + """ + + id: str = pydantic.Field() + """ + The id of the generation behind this output. Pass it as a `generation` reference to use the output as an input elsewhere. + """ + + status: TemplateRunStatus = pydantic.Field() + """ + The lifecycle status of the output. It ends at `completed`, when the output's content fields are set, or `failed`, when `failure_reason` and `error_message` are set. + """ + + failure_reason: typing.Optional[TemplateVideoOutputFailureReason] = pydantic.Field(default=None) + """ + The category of failure. Present only when `status` is `failed`. + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + A human-readable description of the failure. Present only when `status` is `failed`. Failed generations are not charged. + """ + + content_url: typing.Optional[str] = pydantic.Field(default=None) + """ + A signed URL to download the generated media from. Present only when `status` is `completed`. It expires about an hour after this response is returned; fetch the run again for a fresh URL. + """ + + content_mime_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The MIME type of the generated media. Present only when `status` is `completed`. + """ + + 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/data/src/elevenlabs/types/template_video_output_failure_reason.py b/data/src/elevenlabs/types/template_video_output_failure_reason.py new file mode 100644 index 0000000000000000000000000000000000000000..c6535af2b438f984ba0a628ff4ceb23f95cbe4f9 --- /dev/null +++ b/data/src/elevenlabs/types/template_video_output_failure_reason.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TemplateVideoOutputFailureReason = typing.Union[ + typing.Literal[ + "timeout", + "model_error", + "moderated", + "invalid_parameters", + "dependency_failed", + "charging_failed", + "internal_error", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/test_condition_rationale_common_model.py b/data/src/elevenlabs/types/test_condition_rationale_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d26e58b3ebeedbf8eac257cb02874f8041b20446 --- /dev/null +++ b/data/src/elevenlabs/types/test_condition_rationale_common_model.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TestConditionRationaleCommonModel(UncheckedBaseModel): + """ + Structured rationale for test condition results containing individual failure/success reasons. + """ + + messages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of individual parameter evaluation messages or reasons + """ + + summary: typing.Optional[str] = pydantic.Field(default=None) + """ + High-level summary of the evaluation result + """ + + 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/data/src/elevenlabs/types/test_condition_result_common_model.py b/data/src/elevenlabs/types/test_condition_result_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..24175a440426ad4b2af15f0f319b97d0ef90028f --- /dev/null +++ b/data/src/elevenlabs/types/test_condition_result_common_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .evaluation_success_result import EvaluationSuccessResult +from .test_condition_rationale_common_model import TestConditionRationaleCommonModel + + +class TestConditionResultCommonModel(UncheckedBaseModel): + result: EvaluationSuccessResult + rationale: typing.Optional[TestConditionRationaleCommonModel] = 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/data/src/elevenlabs/types/test_from_conversation_metadata_input.py b/data/src/elevenlabs/types/test_from_conversation_metadata_input.py new file mode 100644 index 0000000000000000000000000000000000000000..91e3d1a5419010da8662fbd73ce9efdcb823fc65 --- /dev/null +++ b/data/src/elevenlabs/types/test_from_conversation_metadata_input.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput + + +class TestFromConversationMetadataInput(UncheckedBaseModel): + conversation_id: str + agent_id: str + branch_id: typing.Optional[str] = None + workflow_node_id: typing.Optional[str] = None + original_agent_reply: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = 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 + + +update_forward_refs(TestFromConversationMetadataInput) diff --git a/data/src/elevenlabs/types/test_from_conversation_metadata_output.py b/data/src/elevenlabs/types/test_from_conversation_metadata_output.py new file mode 100644 index 0000000000000000000000000000000000000000..3435d8a8d72a8eb57e3598fa1437e3dceacb8654 --- /dev/null +++ b/data/src/elevenlabs/types/test_from_conversation_metadata_output.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput + + +class TestFromConversationMetadataOutput(UncheckedBaseModel): + conversation_id: str + agent_id: str + branch_id: typing.Optional[str] = None + workflow_node_id: typing.Optional[str] = None + original_agent_reply: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = 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 + + +update_forward_refs(TestFromConversationMetadataOutput) diff --git a/data/src/elevenlabs/types/test_invocation_summary_response_model.py b/data/src/elevenlabs/types/test_invocation_summary_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6a153fb2e452c21be3b3c9c1c6ee24733d0362a9 --- /dev/null +++ b/data/src/elevenlabs/types/test_invocation_summary_response_model.py @@ -0,0 +1,109 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .resource_access_info import ResourceAccessInfo + + +class TestInvocationSummaryResponseModel(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The ID of the test invocation + """ + + agent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the agent this test invocation belongs to + """ + + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the branch this test invocation was run on + """ + + version_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the agent version this test invocation ran against. For draft or config-override runs this is the version those uncommitted changes were applied on top of. None only for runs recorded before this field existed. + """ + + ran_against_draft: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the run included uncommitted changes (a saved draft or an ad-hoc config override) layered on top of version_id. + """ + + runs_diverged_from_version: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the test runs in this invocation did not all execute against the same version, which happens when a subset of runs was resubmitted after the original run. When true, version_id describes the most recent resubmit rather than every run. + """ + + created_at_unix_secs: int = pydantic.Field() + """ + Creation time of the test invocation in unix seconds + """ + + test_run_count: int = pydantic.Field() + """ + Number of test runs in this invocation + """ + + passed_count: int = pydantic.Field() + """ + Number of test runs that passed + """ + + failed_count: int = pydantic.Field() + """ + Number of test runs that failed + """ + + pending_count: int = pydantic.Field() + """ + Number of test runs that are pending + """ + + cancelled_count: int = pydantic.Field() + """ + Number of test runs that were cancelled + """ + + title: str = pydantic.Field() + """ + Title of the test invocation - the folder name for folder runs, otherwise the single test name or count of tests + """ + + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information of the test invocation + """ + + repeat_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of times each test was repeated in this invocation + """ + + cancelled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether this test invocation was cancelled + """ + + credits_used: typing.Optional[int] = pydantic.Field(default=None) + """ + Total credits billed across test runs in this invocation. None when no run has cost data. + """ + + total_price: typing.Optional[float] = pydantic.Field(default=None) + """ + Total USD price across test runs in this invocation. None when no run has price data. + """ + + 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/data/src/elevenlabs/types/test_run_metadata.py b/data/src/elevenlabs/types/test_run_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..0e294ddf99b77bab78cfd30fb6c95cf3b8579c59 --- /dev/null +++ b/data/src/elevenlabs/types/test_run_metadata.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .test_run_metadata_test_type import TestRunMetadataTestType + + +class TestRunMetadata(UncheckedBaseModel): + workspace_id: str + test_name: str + ran_by_user_email: str + test_type: typing.Optional[TestRunMetadataTestType] = 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/data/src/elevenlabs/types/test_run_metadata_test_type.py b/data/src/elevenlabs/types/test_run_metadata_test_type.py new file mode 100644 index 0000000000000000000000000000000000000000..755c87134f73c0abdcfc72d7f43eebc8d47339b4 --- /dev/null +++ b/data/src/elevenlabs/types/test_run_metadata_test_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TestRunMetadataTestType = typing.Union[typing.Literal["llm", "tool_call", "simulation"], typing.Any] diff --git a/data/src/elevenlabs/types/test_run_result_bucket.py b/data/src/elevenlabs/types/test_run_result_bucket.py new file mode 100644 index 0000000000000000000000000000000000000000..acf3c624b089cbcbcf94d06bef317c706e108c4a --- /dev/null +++ b/data/src/elevenlabs/types/test_run_result_bucket.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .test_run_status import TestRunStatus + + +class TestRunResultBucket(UncheckedBaseModel): + test_run_ids: typing.List[str] + title: str = pydantic.Field() + """ + Short one-line title for this bucket + """ + + reason: str = pydantic.Field() + """ + Short summary of why the test runs in this bucket passed or failed + """ + + status: TestRunStatus + + 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/data/src/elevenlabs/types/test_run_result_summary.py b/data/src/elevenlabs/types/test_run_result_summary.py new file mode 100644 index 0000000000000000000000000000000000000000..e15cde4a195d3e6cec3cec7cb4ca854f08194f25 --- /dev/null +++ b/data/src/elevenlabs/types/test_run_result_summary.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .test_run_result_bucket import TestRunResultBucket + + +class TestRunResultSummary(UncheckedBaseModel): + test_id: str + test_name: str + workflow_node_id: typing.Optional[str] = None + buckets: typing.List[TestRunResultBucket] + + 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/data/src/elevenlabs/types/test_run_status.py b/data/src/elevenlabs/types/test_run_status.py new file mode 100644 index 0000000000000000000000000000000000000000..335420604a65c2e02994182a95e94cf9e52623fc --- /dev/null +++ b/data/src/elevenlabs/types/test_run_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TestRunStatus = typing.Union[typing.Literal["pending", "passed", "failed", "cancelled"], typing.Any] diff --git a/data/src/elevenlabs/types/test_sharing_mode.py b/data/src/elevenlabs/types/test_sharing_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..674c091418aa4b9842059b237e2fd8a101cb6d18 --- /dev/null +++ b/data/src/elevenlabs/types/test_sharing_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TestSharingMode = typing.Union[typing.Literal["all", "shared_with_me"], typing.Any] diff --git a/data/src/elevenlabs/types/test_tool_result_model.py b/data/src/elevenlabs/types/test_tool_result_model.py new file mode 100644 index 0000000000000000000000000000000000000000..294149892ade15546c8d1da47fe804a020efecf8 --- /dev/null +++ b/data/src/elevenlabs/types/test_tool_result_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TestToolResultModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = None + to_agent: typing.Optional[str] = None + to_node: 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/data/src/elevenlabs/types/test_type.py b/data/src/elevenlabs/types/test_type.py new file mode 100644 index 0000000000000000000000000000000000000000..973a0f5f1fef4cfce98b5f476755bc2f01decb0d --- /dev/null +++ b/data/src/elevenlabs/types/test_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TestType = typing.Union[typing.Literal["llm", "tool", "simulation", "folder"], typing.Any] diff --git a/data/src/elevenlabs/types/tests_feature_usage_common_model.py b/data/src/elevenlabs/types/tests_feature_usage_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..aabb91ae4f828ff1006ed432a1ed5703fb77260e --- /dev/null +++ b/data/src/elevenlabs/types/tests_feature_usage_common_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TestsFeatureUsageCommonModel(UncheckedBaseModel): + enabled: typing.Optional[bool] = None + tests_ran_after_last_modification: typing.Optional[bool] = None + tests_ran_in_last_7_days: 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/data/src/elevenlabs/types/text_normalisation_type.py b/data/src/elevenlabs/types/text_normalisation_type.py new file mode 100644 index 0000000000000000000000000000000000000000..ce8160a4b6fd4fd63592603618f8fd6458f39eea --- /dev/null +++ b/data/src/elevenlabs/types/text_normalisation_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextNormalisationType = typing.Union[typing.Literal["system_prompt", "elevenlabs"], typing.Any] diff --git a/data/src/elevenlabs/types/text_to_dialogue_websocket_apply_text_normalization_enum.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_apply_text_normalization_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..6a686ed60a404e720b6cc82e18ddd850e4498d74 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_apply_text_normalization_enum.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueWebsocketApplyTextNormalizationEnum = typing.Union[typing.Literal["on", "off"], typing.Any] diff --git a/data/src/elevenlabs/types/text_to_dialogue_websocket_audio_chunk.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_audio_chunk.py new file mode 100644 index 0000000000000000000000000000000000000000..ad5d793739b1d27b1bb7f0b36d845f69d32dd366 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_audio_chunk.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dialogue_text_alignment import DialogueTextAlignment + + +class TextToDialogueWebsocketAudioChunk(UncheckedBaseModel): + """ + Server chunk containing encoded audio and optional alignment metadata. + """ + + audio: typing.Optional[str] = pydantic.Field(default=None) + """ + Base64-encoded audio bytes for the selected `output_format`. + """ + + alignment: typing.Optional[DialogueTextAlignment] = pydantic.Field(default=None) + """ + Present when `sync_alignment` query parameter is `true` and the model returned timing data for the chunk. + """ + + normalized_alignment: typing.Optional[DialogueTextAlignment] = pydantic.Field(default=None) + """ + Reserved for future use; currently unused by the server. + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_audio_chunk_multi.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_audio_chunk_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..577ec9b35ce6d63ce9344e2e346b3b08eb288700 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_audio_chunk_multi.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .dialogue_text_alignment import DialogueTextAlignment + + +class TextToDialogueWebsocketAudioChunkMulti(UncheckedBaseModel): + """ + Server chunk containing encoded audio for a specific context and optional alignment metadata. + """ + + audio: typing.Optional[str] = pydantic.Field(default=None) + """ + Base64-encoded audio bytes for the selected `output_format`. + """ + + alignment: typing.Optional[DialogueTextAlignment] = pydantic.Field(default=None) + """ + Present when `sync_alignment` query parameter is `true` and the model returned timing data for the chunk. + """ + + normalized_alignment: typing.Optional[DialogueTextAlignment] = pydantic.Field(default=None) + """ + Reserved for future use; currently unused by the server. + """ + + context_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The context this audio chunk belongs to. + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_client_message.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_client_message.py new file mode 100644 index 0000000000000000000000000000000000000000..e6283c5678ba168fce8d695a06deab4a3a168180 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_client_message.py @@ -0,0 +1,84 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .pronunciation_dictionary_locator import PronunciationDictionaryLocator +from .text_to_dialogue_websocket_voice_input import TextToDialogueWebsocketVoiceInput +from .text_to_dialogue_websocket_voice_settings import TextToDialogueWebsocketVoiceSettings + + +class TextToDialogueWebsocketClientMessage(UncheckedBaseModel): + """ + All fields are optional unless noted for the **first** message. + + **First message requirements** + - `voices`: non-empty array of voice IDs (maximum 10 for `eleven_v3`; exactly 1 for `eleven_v3_conversational`). + - Credentials if not supplied via `xi-api-key` / `Authorization` headers or `single_use_token` query parameter. + + **Subsequent messages** + - Do not resend `voices`, `pronunciation_dictionary_locators`, or credential fields. + """ + + inputs: typing.Optional[typing.List[TextToDialogueWebsocketVoiceInput]] = pydantic.Field(default=None) + """ + Dialogue lines to append for synthesis. + """ + + flush: typing.Optional[bool] = pydantic.Field(default=None) + """ + Force generation of buffered text without closing the connection. + """ + + close_socket: typing.Optional[bool] = pydantic.Field(default=None) + """ + Flush buffers, emit remaining audio, send `is_final`, and close the WebSocket. + """ + + keep_alive: typing.Optional[bool] = pydantic.Field(default=None) + """ + Resets the 20s inactivity timer; performs no synthesis. + """ + + xi_api_key: typing.Optional[str] = pydantic.Field(default=None) + """ + API key for the first message if not provided via the `xi-api-key` header. + """ + + authorization: typing.Optional[str] = pydantic.Field(default=None) + """ + Bearer token for the first message if not provided via the `Authorization` header. + """ + + single_use_token: typing.Optional[str] = pydantic.Field(default=None) + """ + Single-use token for the first message if not provided via the `single_use_token` query parameter. + """ + + voices: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Voice IDs to load for the session (first message only, required on first message). + """ + + voice_settings: typing.Optional[TextToDialogueWebsocketVoiceSettings] = pydantic.Field(default=None) + """ + Optional voice settings (first message only). + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryLocator]] = pydantic.Field( + default=None + ) + """ + Optional pronunciation dictionaries (first message only). + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_client_message_multi.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_client_message_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..55c8665a8a7ccfea10c1c85333321854d53b703f --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_client_message_multi.py @@ -0,0 +1,97 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .pronunciation_dictionary_locator import PronunciationDictionaryLocator +from .text_to_dialogue_websocket_voice_input import TextToDialogueWebsocketVoiceInput +from .text_to_dialogue_websocket_voice_settings import TextToDialogueWebsocketVoiceSettings + + +class TextToDialogueWebsocketClientMessageMulti(UncheckedBaseModel): + """ + All fields are optional unless noted for a context's **first** message. + + **Every message** + - `context_id` is required, except on a message containing only `close_socket`. + + **First message for a context** + - `voices`: non-empty array of voice IDs (maximum 10 per context for `eleven_v3`; exactly 1 for `eleven_v3_conversational`). + - Credentials if not supplied via `xi-api-key` / `Authorization` headers or `single_use_token` query parameter (accepted on the first message of the connection only). + + **Subsequent messages for a context** + - Do not resend `voices`, `voice_settings`, `pronunciation_dictionary_locators`, or credential fields. + """ + + context_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Identifier for an independent dialogue stream within the socket. The first message with a new `context_id` creates that context. Required on every message except one containing only `close_socket`. + """ + + inputs: typing.Optional[typing.List[TextToDialogueWebsocketVoiceInput]] = pydantic.Field(default=None) + """ + Dialogue lines to append to this context for synthesis. Each `voice_id` must be registered for this context. + """ + + flush: typing.Optional[bool] = pydantic.Field(default=None) + """ + Force generation of this context's buffered text without closing it. + """ + + close_context: typing.Optional[bool] = pydantic.Field(default=None) + """ + Flush this context's remaining audio, emit its `is_final` message, and close it. Other contexts stay open. + """ + + close_socket: typing.Optional[bool] = pydantic.Field(default=None) + """ + Flush all contexts, emit their remaining audio and `is_final` messages, and close the WebSocket. + """ + + keep_alive: typing.Optional[bool] = pydantic.Field(default=None) + """ + Resets this context's 20s inactivity timer; performs no synthesis. + """ + + xi_api_key: typing.Optional[str] = pydantic.Field(default=None) + """ + API key for the first message of the connection if not provided via the `xi-api-key` header. + """ + + authorization: typing.Optional[str] = pydantic.Field(default=None) + """ + Bearer token for the first message of the connection if not provided via the `Authorization` header. + """ + + single_use_token: typing.Optional[str] = pydantic.Field(default=None) + """ + Single-use token for the first message of the connection if not provided via the `single_use_token` query parameter. + """ + + voices: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Voice IDs to load for this context (first message for the context only, required on that message). + """ + + voice_settings: typing.Optional[TextToDialogueWebsocketVoiceSettings] = pydantic.Field(default=None) + """ + Optional voice settings for this context (first message for the context only). + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryLocator]] = pydantic.Field( + default=None + ) + """ + Optional pronunciation dictionaries for this context (first message for the context only). + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_error.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_error.py new file mode 100644 index 0000000000000000000000000000000000000000..8aaeca85a06fb606770b4ec61eeac14d19ca1479 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_error.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TextToDialogueWebsocketError(UncheckedBaseModel): + message: str = pydantic.Field() + """ + Human-readable error description. + """ + + error: str = pydantic.Field() + """ + Machine-readable error identifier (for example `authentication_required`). + """ + + code: int = pydantic.Field() + """ + WebSocket close code that will follow this payload. + """ + + param: typing.Optional[str] = pydantic.Field(default=None) + """ + Field name related to the error, when applicable. + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_final.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_final.py new file mode 100644 index 0000000000000000000000000000000000000000..e1a6796eee3c8e3b0c2f6c48bd9a1864ae7d5375 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_final.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TextToDialogueWebsocketFinal(UncheckedBaseModel): + is_final: typing.Literal[True] = pydantic.Field(default=True) + """ + Marks the end of the closing flush sequence. + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_final_audio_for_turn.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_final_audio_for_turn.py new file mode 100644 index 0000000000000000000000000000000000000000..dbc0de012c9ec03b69bbdd2052c7b6bbf1836aad --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_final_audio_for_turn.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TextToDialogueWebsocketFinalAudioForTurn(UncheckedBaseModel): + is_final_audio_for_turn: typing.Optional[bool] = pydantic.Field(default=None) + """ + Indicates that the final audio for a given turn has been sent. + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_final_audio_for_turn_multi.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_final_audio_for_turn_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..27e8f08e0667b2bb667381ab58579695d5c3232a --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_final_audio_for_turn_multi.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TextToDialogueWebsocketFinalAudioForTurnMulti(UncheckedBaseModel): + is_final_audio_for_turn: typing.Optional[bool] = pydantic.Field(default=None) + """ + Indicates that the final audio for a given turn of this context has been sent. + """ + + context_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The context whose turn has finished. + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_final_multi.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_final_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..9f33c09f7fbedc45dabd629bfc68f423e0f8fc51 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_final_multi.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TextToDialogueWebsocketFinalMulti(UncheckedBaseModel): + is_final: typing.Literal[True] = pydantic.Field(default=True) + """ + Marks the end of this context's closing flush sequence. + """ + + context_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The context that has been finalized. + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_output_format_enum.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_output_format_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..adf81b09327fcf64ccc33da4b357aac4a48e7691 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_output_format_enum.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueWebsocketOutputFormatEnum = typing.Union[ + typing.Literal[ + "mp3_22050_32", + "mp3_24000_48", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_32000", + "pcm_44100", + "pcm_48000", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/text_to_dialogue_websocket_voice_input.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_voice_input.py new file mode 100644 index 0000000000000000000000000000000000000000..9c4a11e3c81af4467474964437da3a6b31ccdc46 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_voice_input.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TextToDialogueWebsocketVoiceInput(UncheckedBaseModel): + text: str = pydantic.Field() + """ + Text appended for this voice. Buffered with prior text until the server triggers generation. + """ + + voice_id: str = pydantic.Field() + """ + Must be one of the IDs from the initial `voices` array. + """ + + new_turn: typing.Optional[bool] = pydantic.Field(default=None) + """ + When `true`, the server finalizes the current pending segment (as if the speaker finished their turn) before applying this input. + """ + + 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/data/src/elevenlabs/types/text_to_dialogue_websocket_voice_settings.py b/data/src/elevenlabs/types/text_to_dialogue_websocket_voice_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..f9ab496f5dac844c16521fbb540c4d31d3ba897c --- /dev/null +++ b/data/src/elevenlabs/types/text_to_dialogue_websocket_voice_settings.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TextToDialogueWebsocketVoiceSettings(UncheckedBaseModel): + """ + Voice settings for dialogue generation. Only `stability` is supported for `eleven_v3` dialogue models. + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + Determines how stable the voice is and the randomness between each generation. Lower values introduce broader emotional range for the voice. Higher values can result in a monotonous voice with limited emotion. + """ + + 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/data/src/elevenlabs/types/text_to_speech_apply_text_normalization_enum.py b/data/src/elevenlabs/types/text_to_speech_apply_text_normalization_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..19cabebf8e216813dc3e034b4ea966d884a97bb3 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_speech_apply_text_normalization_enum.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechApplyTextNormalizationEnum = typing.Union[typing.Literal["auto", "on", "off"], typing.Any] diff --git a/data/src/elevenlabs/types/text_to_speech_generation_request.py b/data/src/elevenlabs/types/text_to_speech_generation_request.py new file mode 100644 index 0000000000000000000000000000000000000000..51896eb412bc136061ef67ab0deac480f400828e --- /dev/null +++ b/data/src/elevenlabs/types/text_to_speech_generation_request.py @@ -0,0 +1,87 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .eleven_flash_v_25_request_output_format import ElevenFlashV25RequestOutputFormat +from .eleven_flash_v_25_voice_settings import ElevenFlashV25VoiceSettings +from .eleven_multilingual_v_2_request_output_format import ElevenMultilingualV2RequestOutputFormat +from .eleven_v_3_request_output_format import ElevenV3RequestOutputFormat +from .eleven_v_3_voice_settings import ElevenV3VoiceSettings +from .pronunciation_dictionary_version_locator import PronunciationDictionaryVersionLocator +from .tts_voice_settings import TtsVoiceSettings +from .webhook_target import WebhookTarget + + +class TextToSpeechGenerationRequest_ElevenFlashV25(UncheckedBaseModel): + model_id: typing.Literal["eleven_flash_v2_5"] = "eleven_flash_v2_5" + webhook: typing.Optional[WebhookTarget] = None + text: str + voice: str + output_format: typing.Optional[ElevenFlashV25RequestOutputFormat] = None + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryVersionLocator]] = None + language_code: typing.Optional[str] = None + voice_settings: typing.Optional[ElevenFlashV25VoiceSettings] = 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 + + +class TextToSpeechGenerationRequest_ElevenMultilingualV2(UncheckedBaseModel): + model_id: typing.Literal["eleven_multilingual_v2"] = "eleven_multilingual_v2" + webhook: typing.Optional[WebhookTarget] = None + text: str + voice: str + output_format: typing.Optional[ElevenMultilingualV2RequestOutputFormat] = None + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryVersionLocator]] = None + voice_settings: typing.Optional[TtsVoiceSettings] = 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 + + +class TextToSpeechGenerationRequest_ElevenV3(UncheckedBaseModel): + model_id: typing.Literal["eleven_v3"] = "eleven_v3" + webhook: typing.Optional[WebhookTarget] = None + text: str + voice: str + output_format: typing.Optional[ElevenV3RequestOutputFormat] = None + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryVersionLocator]] = None + language_code: typing.Optional[str] = None + voice_settings: typing.Optional[ElevenV3VoiceSettings] = 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 + + +TextToSpeechGenerationRequest = typing_extensions.Annotated[ + typing.Union[ + TextToSpeechGenerationRequest_ElevenFlashV25, + TextToSpeechGenerationRequest_ElevenMultilingualV2, + TextToSpeechGenerationRequest_ElevenV3, + ], + UnionMetadata(discriminant="model_id"), +] diff --git a/data/src/elevenlabs/types/text_to_speech_output_format_enum.py b/data/src/elevenlabs/types/text_to_speech_output_format_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..192e40fda65d18c27023bca6f7cf392c84a68518 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_speech_output_format_enum.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechOutputFormatEnum = typing.Union[ + typing.Literal[ + "mp3_22050_32", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_8000", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_44100", + "ulaw_8000", + "alaw_8000", + "opus_48000_32", + "opus_48000_64", + "opus_48000_96", + "opus_48000_128", + "opus_48000_192", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/text_to_speech_request.py b/data/src/elevenlabs/types/text_to_speech_request.py new file mode 100644 index 0000000000000000000000000000000000000000..823ca827e19b288d9602795b9157e554d457a377 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_speech_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechRequest = typing.Any diff --git a/data/src/elevenlabs/types/text_to_speech_stream_request.py b/data/src/elevenlabs/types/text_to_speech_stream_request.py new file mode 100644 index 0000000000000000000000000000000000000000..f3ba47824a479f0e968393e40c8ee5366f0c51d4 --- /dev/null +++ b/data/src/elevenlabs/types/text_to_speech_stream_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechStreamRequest = typing.Any diff --git a/data/src/elevenlabs/types/text_to_speech_stream_with_timestamps_request.py b/data/src/elevenlabs/types/text_to_speech_stream_with_timestamps_request.py new file mode 100644 index 0000000000000000000000000000000000000000..43f0513938885e5737b3698a0bd027d6c16e169a --- /dev/null +++ b/data/src/elevenlabs/types/text_to_speech_stream_with_timestamps_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechStreamWithTimestampsRequest = typing.Any diff --git a/data/src/elevenlabs/types/text_to_speech_with_timestamps_request.py b/data/src/elevenlabs/types/text_to_speech_with_timestamps_request.py new file mode 100644 index 0000000000000000000000000000000000000000..3119e8b05ce0cd7f31ed3ed117f7f8c27aab495d --- /dev/null +++ b/data/src/elevenlabs/types/text_to_speech_with_timestamps_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToSpeechWithTimestampsRequest = typing.Any diff --git a/data/src/elevenlabs/types/threshold_guardrail.py b/data/src/elevenlabs/types/threshold_guardrail.py new file mode 100644 index 0000000000000000000000000000000000000000..b7233286ea96c5e9edfbc3b50c8c3bbb0885f513 --- /dev/null +++ b/data/src/elevenlabs/types/threshold_guardrail.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ThresholdGuardrail(UncheckedBaseModel): + is_enabled: typing.Optional[bool] = None + threshold: 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/data/src/elevenlabs/types/ticket_comment_response_model.py b/data/src/elevenlabs/types/ticket_comment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2a24f06380b08959a1064254348abaf28c728b01 --- /dev/null +++ b/data/src/elevenlabs/types/ticket_comment_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TicketCommentResponseModel(UncheckedBaseModel): + comment: str + created_at_unix_secs: int + owner_user_id: 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/data/src/elevenlabs/types/ticket_merge_proposal_link_response_model.py b/data/src/elevenlabs/types/ticket_merge_proposal_link_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..889bbb1797f5e2be4562700ccf2d0804813dce94 --- /dev/null +++ b/data/src/elevenlabs/types/ticket_merge_proposal_link_response_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TicketMergeProposalLinkResponseModel(UncheckedBaseModel): + merge_proposal_id: str + linked_by_user_id: typing.Optional[str] = None + linked_at_unix_secs: int + + 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/data/src/elevenlabs/types/ticket_priority_change_response_model.py b/data/src/elevenlabs/types/ticket_priority_change_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c4b1f453e80438ff44d36b284b742e6402a51487 --- /dev/null +++ b/data/src/elevenlabs/types/ticket_priority_change_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_conversation_ticket_priority import AgentConversationTicketPriority + + +class TicketPriorityChangeResponseModel(UncheckedBaseModel): + priority: typing.Optional[AgentConversationTicketPriority] = None + changed_by_user_id: str + changed_at_unix_secs: int + + 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/data/src/elevenlabs/types/ticket_search_match_field.py b/data/src/elevenlabs/types/ticket_search_match_field.py new file mode 100644 index 0000000000000000000000000000000000000000..28524bec24d83e355b0e441c093b93f1bb121991 --- /dev/null +++ b/data/src/elevenlabs/types/ticket_search_match_field.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TicketSearchMatchField = typing.Union[typing.Literal["title", "description", "comment", "turn_comment"], typing.Any] diff --git a/data/src/elevenlabs/types/ticket_search_match_response_model.py b/data/src/elevenlabs/types/ticket_search_match_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1abeccac2868fc95ab4b70ee416d3cde038c5c58 --- /dev/null +++ b/data/src/elevenlabs/types/ticket_search_match_response_model.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .ticket_search_match_field import TicketSearchMatchField + + +class TicketSearchMatchResponseModel(UncheckedBaseModel): + field: TicketSearchMatchField = pydantic.Field() + """ + Which of the ticket's texts matched. + """ + + snippet: str = pydantic.Field() + """ + Whitespace-collapsed excerpt around the match, with an ellipsis where it was cut. + """ + + highlight_start: int = pydantic.Field() + """ + Offset of the match in `snippet`. + """ + + highlight_end: int = pydantic.Field() + """ + Exclusive end offset of the match in `snippet`. + """ + + turn_index: typing.Optional[int] = pydantic.Field(default=None) + """ + The commented turn, set when `field` is 'turn_comment'. + """ + + 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/data/src/elevenlabs/types/ticket_status_change_response_model.py b/data/src/elevenlabs/types/ticket_status_change_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..be006926d34411ed96d047a93af08d0fa19ea688 --- /dev/null +++ b/data/src/elevenlabs/types/ticket_status_change_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_conversation_ticket_status import AgentConversationTicketStatus + + +class TicketStatusChangeResponseModel(UncheckedBaseModel): + status: AgentConversationTicketStatus + changed_by_user_id: typing.Optional[str] = None + changed_at_unix_secs: int + + 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/data/src/elevenlabs/types/time_range.py b/data/src/elevenlabs/types/time_range.py new file mode 100644 index 0000000000000000000000000000000000000000..a86f3746988ad8a1426f8144dd5f6144374436e8 --- /dev/null +++ b/data/src/elevenlabs/types/time_range.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TimeRange(UncheckedBaseModel): + start_ms: int + end_ms: int + + 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/data/src/elevenlabs/types/to_dialogue_settings_response_model.py b/data/src/elevenlabs/types/to_dialogue_settings_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4635dd853f3ee8866ea72e075e5a5f4b0dc2c160 --- /dev/null +++ b/data/src/elevenlabs/types/to_dialogue_settings_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ToDialogueSettingsResponseModel(UncheckedBaseModel): + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + Determines how stable the voice is and the randomness between each generation. Lower values introduce broader emotional range for the voice. Higher values can result in a monotonous voice with limited emotion. + """ + + similarity: typing.Optional[float] = pydantic.Field(default=None) + """ + Determines how strongly the model is guided while generating. Higher values make the model adhere more closely to the voice, at the cost of variation. Not supported by every model. + """ + + 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/data/src/elevenlabs/types/token_response_model.py b/data/src/elevenlabs/types/token_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..fc681b1ff9d7c47f90527025cfd1009d6bacfcb8 --- /dev/null +++ b/data/src/elevenlabs/types/token_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TokenResponseModel(UncheckedBaseModel): + token: str + conversation_id: 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/data/src/elevenlabs/types/tool.py b/data/src/elevenlabs/types/tool.py new file mode 100644 index 0000000000000000000000000000000000000000..724d603e1765d63023862e7b1236cb57c23852ef --- /dev/null +++ b/data/src/elevenlabs/types/tool.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .icon import Icon +from .tool_annotations import ToolAnnotations +from .tool_execution import ToolExecution + + +class Tool(UncheckedBaseModel): + """ + Definition for a tool the client can call. + """ + + name: str + title: typing.Optional[str] = None + description: typing.Optional[str] = None + input_schema: typing_extensions.Annotated[ + typing.Dict[str, typing.Any], FieldMetadata(alias="inputSchema"), pydantic.Field(alias="inputSchema") + ] + execution: typing.Optional[ToolExecution] = None + output_schema: typing_extensions.Annotated[ + typing.Optional[typing.Dict[str, typing.Any]], + FieldMetadata(alias="outputSchema"), + pydantic.Field(alias="outputSchema"), + ] = None + icons: typing.Optional[typing.List[Icon]] = None + annotations: typing.Optional[ToolAnnotations] = None + meta: typing_extensions.Annotated[ + typing.Optional[typing.Dict[str, typing.Any]], FieldMetadata(alias="_meta"), pydantic.Field(alias="_meta") + ] = 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/data/src/elevenlabs/types/tool_annotations.py b/data/src/elevenlabs/types/tool_annotations.py new file mode 100644 index 0000000000000000000000000000000000000000..fb56342dca2f5fc889fbe199adc5149ca0ba5d49 --- /dev/null +++ b/data/src/elevenlabs/types/tool_annotations.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ToolAnnotations(UncheckedBaseModel): + """ + Additional properties describing a Tool to clients. + + NOTE: all properties in ToolAnnotations are **hints**. + They are not guaranteed to provide a faithful description of + tool behavior (including descriptive properties like `title`). + + Clients should never make tool use decisions based on ToolAnnotations + received from untrusted servers. + """ + + title: typing.Optional[str] = None + read_only_hint: typing_extensions.Annotated[ + typing.Optional[bool], FieldMetadata(alias="readOnlyHint"), pydantic.Field(alias="readOnlyHint") + ] = None + destructive_hint: typing_extensions.Annotated[ + typing.Optional[bool], FieldMetadata(alias="destructiveHint"), pydantic.Field(alias="destructiveHint") + ] = None + idempotent_hint: typing_extensions.Annotated[ + typing.Optional[bool], FieldMetadata(alias="idempotentHint"), pydantic.Field(alias="idempotentHint") + ] = None + open_world_hint: typing_extensions.Annotated[ + typing.Optional[bool], FieldMetadata(alias="openWorldHint"), pydantic.Field(alias="openWorldHint") + ] = 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/data/src/elevenlabs/types/tool_call_sound_behavior.py b/data/src/elevenlabs/types/tool_call_sound_behavior.py new file mode 100644 index 0000000000000000000000000000000000000000..bbc2f10135597c69d3432743633ba70794db5a2b --- /dev/null +++ b/data/src/elevenlabs/types/tool_call_sound_behavior.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolCallSoundBehavior = typing.Union[typing.Literal["auto", "always"], typing.Any] diff --git a/data/src/elevenlabs/types/tool_call_sound_type.py b/data/src/elevenlabs/types/tool_call_sound_type.py new file mode 100644 index 0000000000000000000000000000000000000000..f979c901664bba7d22951f557bd72c36450a014b --- /dev/null +++ b/data/src/elevenlabs/types/tool_call_sound_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolCallSoundType = typing.Union[ + typing.Literal["typing", "elevator1", "elevator2", "elevator3", "elevator4"], typing.Any +] diff --git a/data/src/elevenlabs/types/tool_call_unit_test_model.py b/data/src/elevenlabs/types/tool_call_unit_test_model.py new file mode 100644 index 0000000000000000000000000000000000000000..95a2495fdf4802d6d517b28a1fdf87f58d80a25d --- /dev/null +++ b/data/src/elevenlabs/types/tool_call_unit_test_model.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from .conversation_initiation_source import ConversationInitiationSource +from .test_from_conversation_metadata_output import TestFromConversationMetadataOutput +from .unit_test_tool_call_evaluation_model_output import UnitTestToolCallEvaluationModelOutput + + +class ToolCallUnitTestModel(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelOutput] = pydantic.Field(default=None) + """ + How to evaluate the agent's tool call (if any). If empty, the tool call is not evaluated. + """ + + check_any_tool_matches: typing.Optional[bool] = pydantic.Field(default=None) + """ + If set to True this test will pass if any tool call returned by the LLM matches the criteria. Otherwise it will fail if more than one tool is returned by the agent. + """ + + 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 + + +update_forward_refs(ToolCallUnitTestModel) diff --git a/data/src/elevenlabs/types/tool_error_handling_mode.py b/data/src/elevenlabs/types/tool_error_handling_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..1a4e60229cd71fee4623cb40dae684d0bb70b640 --- /dev/null +++ b/data/src/elevenlabs/types/tool_error_handling_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolErrorHandlingMode = typing.Union[typing.Literal["auto", "summarized", "passthrough", "hide"], typing.Any] diff --git a/data/src/elevenlabs/types/tool_execution.py b/data/src/elevenlabs/types/tool_execution.py new file mode 100644 index 0000000000000000000000000000000000000000..076bfd87d8e1b814431394b4337d869b033ab96c --- /dev/null +++ b/data/src/elevenlabs/types/tool_execution.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .tool_execution_task_support import ToolExecutionTaskSupport + + +class ToolExecution(UncheckedBaseModel): + """ + Execution-related properties for a tool (2025-11-25 only). + """ + + task_support: typing_extensions.Annotated[ + typing.Optional[ToolExecutionTaskSupport], + FieldMetadata(alias="taskSupport"), + pydantic.Field(alias="taskSupport"), + ] = 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/data/src/elevenlabs/types/tool_execution_mode.py b/data/src/elevenlabs/types/tool_execution_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..6626fa691c9d8bd8bb3f29fdf6906cf613c88dc5 --- /dev/null +++ b/data/src/elevenlabs/types/tool_execution_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolExecutionMode = typing.Union[typing.Literal["immediate", "post_tool_speech", "async"], typing.Any] diff --git a/data/src/elevenlabs/types/tool_execution_response_model.py b/data/src/elevenlabs/types/tool_execution_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..499703a3e4d6c8fe63fa8ea01cf366ceb1086d92 --- /dev/null +++ b/data/src/elevenlabs/types/tool_execution_response_model.py @@ -0,0 +1,82 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .tool_execution_response_model_tool_call_details import ToolExecutionResponseModelToolCallDetails + + +class ToolExecutionResponseModel(UncheckedBaseModel): + tool_id: str = pydantic.Field() + """ + The ID of the tool that was executed + """ + + tool_request_id: str = pydantic.Field() + """ + The request/call ID associated with this tool execution + """ + + conversation_id: str = pydantic.Field() + """ + The ID of the conversation where the tool was executed + """ + + agent_id: str = pydantic.Field() + """ + The ID of the agent that ran the tool + """ + + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The branch ID if the agent has branches + """ + + timestamp: float = pydantic.Field() + """ + Unix timestamp when the tool was executed + """ + + latency_secs: float = pydantic.Field() + """ + How long the tool execution took + """ + + is_error: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the tool execution failed + """ + + request_payload: typing.Optional[str] = pydantic.Field(default=None) + """ + LLM-extracted parameters sent to the tool (JSON string) + """ + + response_payload: typing.Optional[str] = pydantic.Field(default=None) + """ + Response returned by the tool + """ + + error_message: typing.Optional[str] = pydantic.Field(default=None) + """ + Error message if the tool execution failed + """ + + error_type: typing.Optional[str] = pydantic.Field(default=None) + """ + Error category (internal, customer_config, customer_auth, external_server, external_client, client_timeout, unknown) + """ + + id: str + tool_call_details: typing.Optional[ToolExecutionResponseModelToolCallDetails] = 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/data/src/elevenlabs/types/tool_execution_response_model_tool_call_details.py b/data/src/elevenlabs/types/tool_execution_response_model_tool_call_details.py new file mode 100644 index 0000000000000000000000000000000000000000..04f2d96f3356bf4108dc76e1a8227c851a6adfa3 --- /dev/null +++ b/data/src/elevenlabs/types/tool_execution_response_model_tool_call_details.py @@ -0,0 +1,95 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .conversation_history_transcript_tool_call_webhook_details import ( + ConversationHistoryTranscriptToolCallWebhookDetails, +) + + +class ToolExecutionResponseModelToolCallDetails_ApiIntegrationWebhook(UncheckedBaseModel): + type: typing.Literal["api_integration_webhook"] = "api_integration_webhook" + integration_id: str + credential_id: str + integration_connection_id: str + webhook_details: ConversationHistoryTranscriptToolCallWebhookDetails + + 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 + + +class ToolExecutionResponseModelToolCallDetails_Client(UncheckedBaseModel): + type: typing.Literal["client"] = "client" + parameters: 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 + + +class ToolExecutionResponseModelToolCallDetails_Mcp(UncheckedBaseModel): + type: typing.Literal["mcp"] = "mcp" + mcp_server_id: str + mcp_server_name: str + integration_type: str + parameters: typing.Optional[typing.Dict[str, str]] = None + approval_policy: str + requires_approval: typing.Optional[bool] = None + mcp_tool_name: typing.Optional[str] = None + mcp_tool_description: 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 + + +class ToolExecutionResponseModelToolCallDetails_Webhook(UncheckedBaseModel): + type: typing.Literal["webhook"] = "webhook" + method: str + url: str + headers: typing.Optional[typing.Dict[str, str]] = None + path_params: typing.Optional[typing.Dict[str, str]] = None + query_params: typing.Optional[typing.Dict[str, str]] = None + body: 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 + + +ToolExecutionResponseModelToolCallDetails = typing_extensions.Annotated[ + typing.Union[ + ToolExecutionResponseModelToolCallDetails_ApiIntegrationWebhook, + ToolExecutionResponseModelToolCallDetails_Client, + ToolExecutionResponseModelToolCallDetails_Mcp, + ToolExecutionResponseModelToolCallDetails_Webhook, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/tool_execution_task_support.py b/data/src/elevenlabs/types/tool_execution_task_support.py new file mode 100644 index 0000000000000000000000000000000000000000..0ad535b76ef0fcc867e1127154b6ac11c676c500 --- /dev/null +++ b/data/src/elevenlabs/types/tool_execution_task_support.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolExecutionTaskSupport = typing.Union[typing.Literal["forbidden", "optional", "required"], typing.Any] diff --git a/data/src/elevenlabs/types/tool_interruption_mode.py b/data/src/elevenlabs/types/tool_interruption_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..39f230cd0528a9c01042b10fd8dcd6b98e47750f --- /dev/null +++ b/data/src/elevenlabs/types/tool_interruption_mode.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolInterruptionMode = typing.Union[ + typing.Literal["allow", "disable_during_tool", "disable_during_tool_and_turn"], typing.Any +] diff --git a/data/src/elevenlabs/types/tool_mock_config.py b/data/src/elevenlabs/types/tool_mock_config.py new file mode 100644 index 0000000000000000000000000000000000000000..22b0ec6d1a2f455456a4eec66e123c0c21815388 --- /dev/null +++ b/data/src/elevenlabs/types/tool_mock_config.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ToolMockConfig(UncheckedBaseModel): + default_return_value: typing.Optional[str] = None + default_is_error: 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/data/src/elevenlabs/types/tool_request_model.py b/data/src/elevenlabs/types/tool_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4b0daf7bd0e70dd454286a47ca68ba689cab61ac --- /dev/null +++ b/data/src/elevenlabs/types/tool_request_model.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .tool_request_model_tool_config import ToolRequestModelToolConfig +from .tool_response_mock_config_input import ToolResponseMockConfigInput + + +class ToolRequestModel(UncheckedBaseModel): + tool_config: ToolRequestModelToolConfig = pydantic.Field() + """ + Configuration for the tool + """ + + response_mocks: typing.Optional[typing.List[ToolResponseMockConfigInput]] = pydantic.Field(default=None) + """ + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + """ + + 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 + + +update_forward_refs(ToolRequestModel) diff --git a/data/src/elevenlabs/types/tool_request_model_tool_config.py b/data/src/elevenlabs/types/tool_request_model_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..ba5a0e3e7b31d13a42bb677aea7cbd4235b77cb6 --- /dev/null +++ b/data/src/elevenlabs/types/tool_request_model_tool_config.py @@ -0,0 +1,151 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .system_tool_config_input_params import SystemToolConfigInputParams +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .webhook_tool_api_schema_config_input import WebhookToolApiSchemaConfigInput + + +class ToolRequestModelToolConfig_Client(UncheckedBaseModel): + """ + Configuration for the tool + """ + + type: typing.Literal["client"] = "client" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyInput"] = None + expects_response: typing.Optional[bool] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = 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 + + +class ToolRequestModelToolConfig_Mcp(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["mcp"] = "mcp" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class ToolRequestModelToolConfig_System(UncheckedBaseModel): + """ + Configuration for the tool + """ + + type: typing.Literal["system"] = "system" + name: str + description: typing.Optional[str] = None + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + params: SystemToolConfigInputParams + + 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 + + +class ToolRequestModelToolConfig_Webhook(UncheckedBaseModel): + """ + Configuration for the tool + """ + + type: typing.Literal["webhook"] = "webhook" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = None + api_schema: WebhookToolApiSchemaConfigInput + follow_redirects: typing.Optional[bool] = None + follow_redirects_allowed_domains: typing.Optional[typing.List[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 + + +ToolRequestModelToolConfig = typing_extensions.Annotated[ + typing.Union[ + ToolRequestModelToolConfig_Client, + ToolRequestModelToolConfig_Mcp, + ToolRequestModelToolConfig_System, + ToolRequestModelToolConfig_Webhook, + ], + UnionMetadata(discriminant="type"), +] +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, I001 +from .array_json_schema_property_input_items import ArrayJsonSchemaPropertyInputItems # noqa: E402, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, I001 +from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + ToolRequestModelToolConfig_Client, + ArrayJsonSchemaPropertyInput=ArrayJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInputItems=ArrayJsonSchemaPropertyInputItems, + ObjectJsonSchemaPropertyInput=ObjectJsonSchemaPropertyInput, + ObjectJsonSchemaPropertyInputPropertiesValue=ObjectJsonSchemaPropertyInputPropertiesValue, +) +update_forward_refs(ToolRequestModelToolConfig_Webhook) diff --git a/data/src/elevenlabs/types/tool_response_mock_config_input.py b/data/src/elevenlabs/types/tool_response_mock_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..48e81d2db58cf364d1a0bc126c004f05122a784d --- /dev/null +++ b/data/src/elevenlabs/types/tool_response_mock_config_input.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .unit_test_tool_call_parameter import UnitTestToolCallParameter + + +class ToolResponseMockConfigInput(UncheckedBaseModel): + parameter_conditions: typing.Optional[typing.List[UnitTestToolCallParameter]] = pydantic.Field(default=None) + """ + If the list is empty, the mock will always activate. + """ + + mock_result: str = pydantic.Field() + """ + The return value the LLM sees when this mock is active. + """ + + is_error: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, the mock result is surfaced to the LLM as a tool error rather than a successful result. + """ + + 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/data/src/elevenlabs/types/tool_response_mock_config_output.py b/data/src/elevenlabs/types/tool_response_mock_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..5d946aec45c7e672a77498d8fb8c4b3da836b313 --- /dev/null +++ b/data/src/elevenlabs/types/tool_response_mock_config_output.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .unit_test_tool_call_parameter import UnitTestToolCallParameter + + +class ToolResponseMockConfigOutput(UncheckedBaseModel): + parameter_conditions: typing.Optional[typing.List[UnitTestToolCallParameter]] = pydantic.Field(default=None) + """ + If the list is empty, the mock will always activate. + """ + + mock_result: str = pydantic.Field() + """ + The return value the LLM sees when this mock is active. + """ + + is_error: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, the mock result is surfaced to the LLM as a tool error rather than a successful result. + """ + + 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/data/src/elevenlabs/types/tool_response_model.py b/data/src/elevenlabs/types/tool_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8b7be3414a789bc48e4bd1ebc5f6f1cb0f10a462 --- /dev/null +++ b/data/src/elevenlabs/types/tool_response_model.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .resource_access_info import ResourceAccessInfo +from .tool_response_mock_config_output import ToolResponseMockConfigOutput +from .tool_response_model_tool_config import ToolResponseModelToolConfig +from .tool_usage_stats_response_model import ToolUsageStatsResponseModel + + +class ToolResponseModel(UncheckedBaseModel): + id: str + tool_config: ToolResponseModelToolConfig = pydantic.Field() + """ + The type of tool + """ + + access_info: ResourceAccessInfo + usage_stats: ToolUsageStatsResponseModel + response_mocks: typing.Optional[typing.List[ToolResponseMockConfigOutput]] = pydantic.Field(default=None) + """ + Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins. + """ + + 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 + + +update_forward_refs(ToolResponseModel) diff --git a/data/src/elevenlabs/types/tool_response_model_tool_config.py b/data/src/elevenlabs/types/tool_response_model_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..fe32f9fe7fb700cedda58be09e34fe15d12ff800 --- /dev/null +++ b/data/src/elevenlabs/types/tool_response_model_tool_config.py @@ -0,0 +1,151 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .system_tool_config_output_params import SystemToolConfigOutputParams +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .webhook_tool_api_schema_config_output import WebhookToolApiSchemaConfigOutput + + +class ToolResponseModelToolConfig_Client(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["client"] = "client" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + parameters: typing.Optional["ObjectJsonSchemaPropertyOutput"] = None + expects_response: typing.Optional[bool] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = 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 + + +class ToolResponseModelToolConfig_Mcp(UncheckedBaseModel): + value: typing.Any + type: typing.Literal["mcp"] = "mcp" + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + + +class ToolResponseModelToolConfig_System(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["system"] = "system" + name: str + description: typing.Optional[str] = None + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + params: SystemToolConfigOutputParams + + 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 + + +class ToolResponseModelToolConfig_Webhook(UncheckedBaseModel): + """ + The type of tool + """ + + type: typing.Literal["webhook"] = "webhook" + name: str + description: str + response_timeout_secs: typing.Optional[int] = None + disable_interruptions: typing.Optional[bool] = None + interruption_mode: typing.Optional[ToolInterruptionMode] = None + force_pre_tool_speech: typing.Optional[bool] = None + pre_tool_speech: typing.Optional[PreToolSpeechMode] = None + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None + tool_call_sound: typing.Optional[ToolCallSoundType] = None + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None + dynamic_variables: typing.Optional[DynamicVariablesConfig] = None + execution_mode: typing.Optional[ToolExecutionMode] = None + api_schema: WebhookToolApiSchemaConfigOutput + follow_redirects: typing.Optional[bool] = None + follow_redirects_allowed_domains: typing.Optional[typing.List[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 + + +ToolResponseModelToolConfig = typing_extensions.Annotated[ + typing.Union[ + ToolResponseModelToolConfig_Client, + ToolResponseModelToolConfig_Mcp, + ToolResponseModelToolConfig_System, + ToolResponseModelToolConfig_Webhook, + ], + UnionMetadata(discriminant="type"), +] +from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, I001 +from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems # noqa: E402, I001 +from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, I001 +from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + ToolResponseModelToolConfig_Client, + ArrayJsonSchemaPropertyOutput=ArrayJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems, + ObjectJsonSchemaPropertyOutput=ObjectJsonSchemaPropertyOutput, + ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue, +) +update_forward_refs(ToolResponseModelToolConfig_Webhook) diff --git a/data/src/elevenlabs/types/tool_sort_by.py b/data/src/elevenlabs/types/tool_sort_by.py new file mode 100644 index 0000000000000000000000000000000000000000..5f15a9612b2e1fe78d53c097193342df720a8475 --- /dev/null +++ b/data/src/elevenlabs/types/tool_sort_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolSortBy = typing.Union[typing.Literal["name", "created_at"], typing.Any] diff --git a/data/src/elevenlabs/types/tool_type.py b/data/src/elevenlabs/types/tool_type.py new file mode 100644 index 0000000000000000000000000000000000000000..1699beac578a4a6a54e26de8a94d5c5fb0358a11 --- /dev/null +++ b/data/src/elevenlabs/types/tool_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolType = typing.Union[ + typing.Literal["system", "webhook", "client", "mcp", "workflow", "api_integration_webhook", "smb"], typing.Any +] diff --git a/data/src/elevenlabs/types/tool_type_filter.py b/data/src/elevenlabs/types/tool_type_filter.py new file mode 100644 index 0000000000000000000000000000000000000000..276caf808c97718ce2f7da61019adb922dcb656d --- /dev/null +++ b/data/src/elevenlabs/types/tool_type_filter.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ToolTypeFilter = typing.Union[typing.Literal["webhook", "client", "api_integration_webhook"], typing.Any] diff --git a/data/src/elevenlabs/types/tool_usage_stats_response_model.py b/data/src/elevenlabs/types/tool_usage_stats_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..586bd946802b67545329eceaffc63473371e0345 --- /dev/null +++ b/data/src/elevenlabs/types/tool_usage_stats_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ToolUsageStatsResponseModel(UncheckedBaseModel): + total_calls: typing.Optional[int] = pydantic.Field(default=None) + """ + The total number of calls to the tool + """ + + avg_latency_secs: float + + 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/data/src/elevenlabs/types/tools_response_model.py b/data/src/elevenlabs/types/tools_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..48a6aac268c87bfba929ad637fd735203bd46440 --- /dev/null +++ b/data/src/elevenlabs/types/tools_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .tool_response_model import ToolResponseModel + + +class ToolsResponseModel(UncheckedBaseModel): + tools: typing.List[ToolResponseModel] + next_cursor: typing.Optional[str] = None + has_more: bool + + 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 + + +update_forward_refs(ToolsResponseModel) diff --git a/data/src/elevenlabs/types/topic_discovery_settings.py b/data/src/elevenlabs/types/topic_discovery_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..a404bfa526f8bc0d2f77bda46d4da22311209685 --- /dev/null +++ b/data/src/elevenlabs/types/topic_discovery_settings.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TopicDiscoverySettings(UncheckedBaseModel): + """ + Per-agent topic-discovery configuration. Cadence and analysis window are + managed internally; this only exposes the customer-facing on/off toggle. + """ + + 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/data/src/elevenlabs/types/topic_evaluation_criteria_aggregate.py b/data/src/elevenlabs/types/topic_evaluation_criteria_aggregate.py new file mode 100644 index 0000000000000000000000000000000000000000..702bba9cd027c63d74196dbafe3941f0d198e7c1 --- /dev/null +++ b/data/src/elevenlabs/types/topic_evaluation_criteria_aggregate.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TopicEvaluationCriteriaAggregate(UncheckedBaseModel): + criteria_id: str + success_count: typing.Optional[int] = None + failure_count: typing.Optional[int] = None + unknown_count: typing.Optional[int] = 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/data/src/elevenlabs/types/topic_metrics_aggregate.py b/data/src/elevenlabs/types/topic_metrics_aggregate.py new file mode 100644 index 0000000000000000000000000000000000000000..13e2138d34fc94ab1b2ab2333b6553626e4cffaf --- /dev/null +++ b/data/src/elevenlabs/types/topic_metrics_aggregate.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .topic_evaluation_criteria_aggregate import TopicEvaluationCriteriaAggregate +from .topic_sentiment_aggregate import TopicSentimentAggregate + + +class TopicMetricsAggregate(UncheckedBaseModel): + conversation_count: typing.Optional[int] = None + sentiment: typing.Optional[TopicSentimentAggregate] = None + evaluation_criteria: typing.Optional[typing.List[TopicEvaluationCriteriaAggregate]] = 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/data/src/elevenlabs/types/topic_sentiment_aggregate.py b/data/src/elevenlabs/types/topic_sentiment_aggregate.py new file mode 100644 index 0000000000000000000000000000000000000000..3ae7b7e44f0908a66bd7264453aa30efc6fccd8d --- /dev/null +++ b/data/src/elevenlabs/types/topic_sentiment_aggregate.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .numeric_distribution_aggregate import NumericDistributionAggregate + + +class TopicSentimentAggregate(UncheckedBaseModel): + sentiment: typing.Optional[NumericDistributionAggregate] = None + frustration: typing.Optional[NumericDistributionAggregate] = None + positive_count: typing.Optional[int] = None + neutral_count: typing.Optional[int] = None + negative_count: typing.Optional[int] = 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/data/src/elevenlabs/types/topic_sort_by.py b/data/src/elevenlabs/types/topic_sort_by.py new file mode 100644 index 0000000000000000000000000000000000000000..13f7f1fc79030c2224d14c9a07e078f1735383a2 --- /dev/null +++ b/data/src/elevenlabs/types/topic_sort_by.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TopicSortBy = typing.Union[typing.Literal["conversations", "sentiment", "success_rate", "frustration"], typing.Any] diff --git a/data/src/elevenlabs/types/transcript_edit_error.py b/data/src/elevenlabs/types/transcript_edit_error.py new file mode 100644 index 0000000000000000000000000000000000000000..320dd5b45b4d031b9841a8d644edaeea357a4d29 --- /dev/null +++ b/data/src/elevenlabs/types/transcript_edit_error.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranscriptEditError(UncheckedBaseModel): + """ + An error returned in place of an edited transcript when the edit could not be produced. + """ + + error_type: typing.Literal["edit_failed"] = pydantic.Field(default="edit_failed") + """ + edit_failed: the edit could not be produced. + """ + + message: str = pydantic.Field() + """ + A short, user-facing explanation of the failure. + """ + + 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/data/src/elevenlabs/types/transcript_message.py b/data/src/elevenlabs/types/transcript_message.py new file mode 100644 index 0000000000000000000000000000000000000000..14b53f06af45d810b694bfb7d1bb647b87f10c1c --- /dev/null +++ b/data/src/elevenlabs/types/transcript_message.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .transcript_message_role import TranscriptMessageRole + + +class TranscriptMessage(UncheckedBaseModel): + """ + A single turn in the conversation history. + """ + + role: TranscriptMessageRole = pydantic.Field() + """ + The speaker for this turn. + """ + + content: str = pydantic.Field() + """ + The transcript text for this turn. + """ + + 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/data/src/elevenlabs/types/transcript_message_role.py b/data/src/elevenlabs/types/transcript_message_role.py new file mode 100644 index 0000000000000000000000000000000000000000..2f405a4a56b65e7b355c94a8312d9cc7cddfddc9 --- /dev/null +++ b/data/src/elevenlabs/types/transcript_message_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TranscriptMessageRole = typing.Union[typing.Literal["user", "agent"], typing.Any] diff --git a/data/src/elevenlabs/types/transcript_platform_event.py b/data/src/elevenlabs/types/transcript_platform_event.py new file mode 100644 index 0000000000000000000000000000000000000000..1ab1d138a3e9d0e2f85e586449c83d838fe21f1a --- /dev/null +++ b/data/src/elevenlabs/types/transcript_platform_event.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TranscriptPlatformEvent = typing.Union[typing.Literal["user_turn_timeout", "skip_turn_wait_elapsed"], typing.Any] diff --git a/data/src/elevenlabs/types/transcription_order_item_request.py b/data/src/elevenlabs/types/transcription_order_item_request.py new file mode 100644 index 0000000000000000000000000000000000000000..695f94aa049ac6034115d0ae2af771b5d7d26d36 --- /dev/null +++ b/data/src/elevenlabs/types/transcription_order_item_request.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .media_id import MediaId + + +class TranscriptionOrderItemRequest(UncheckedBaseModel): + media_ids: typing.List[MediaId] = pydantic.Field() + """ + The IDs of the uploaded media files to transcribe. + """ + + source_language: str = pydantic.Field() + """ + The language code of the source media (e.g. 'en', 'es'). + """ + + verbatim: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to transcribe every word exactly, including filler words. + """ + + instructions: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional free-text instructions for the transcription team. + """ + + 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/data/src/elevenlabs/types/transcription_word.py b/data/src/elevenlabs/types/transcription_word.py new file mode 100644 index 0000000000000000000000000000000000000000..80115daef0bb6c663743d612a6d39d571db23024 --- /dev/null +++ b/data/src/elevenlabs/types/transcription_word.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .transcription_word_type import TranscriptionWordType + + +class TranscriptionWord(UncheckedBaseModel): + """ + Word-level transcription data with timing information. + """ + + text: typing.Optional[str] = pydantic.Field(default=None) + """ + The transcribed word. + """ + + start: typing.Optional[float] = pydantic.Field(default=None) + """ + Start time in seconds. + """ + + end: typing.Optional[float] = pydantic.Field(default=None) + """ + End time in seconds. + """ + + type: typing.Optional[TranscriptionWordType] = pydantic.Field(default=None) + """ + The type of word. + """ + + speaker_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the speaker if available. + """ + + logprob: typing.Optional[float] = pydantic.Field(default=None) + """ + Confidence score for this word. + """ + + characters: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The characters in the word. + """ + + 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/data/src/elevenlabs/types/transcription_word_type.py b/data/src/elevenlabs/types/transcription_word_type.py new file mode 100644 index 0000000000000000000000000000000000000000..77ffeb804ab9f0492af601b2066cbc535d8b6adb --- /dev/null +++ b/data/src/elevenlabs/types/transcription_word_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TranscriptionWordType = typing.Union[typing.Literal["word", "spacing"], typing.Any] diff --git a/data/src/elevenlabs/types/transfer_branch_info_configured.py b/data/src/elevenlabs/types/transfer_branch_info_configured.py new file mode 100644 index 0000000000000000000000000000000000000000..3474bc3b474ad0df372ea17b8cbffd58096f01b9 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_branch_info_configured.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferBranchInfoConfigured(UncheckedBaseModel): + branch_id: 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/data/src/elevenlabs/types/transfer_branch_info_defaulting_to_main.py b/data/src/elevenlabs/types/transfer_branch_info_defaulting_to_main.py new file mode 100644 index 0000000000000000000000000000000000000000..300f161bcd3f2c3cd38d21c02be89f110921521d --- /dev/null +++ b/data/src/elevenlabs/types/transfer_branch_info_defaulting_to_main.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferBranchInfoDefaultingToMain(UncheckedBaseModel): + branch_id: 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/data/src/elevenlabs/types/transfer_branch_info_traffic_split.py b/data/src/elevenlabs/types/transfer_branch_info_traffic_split.py new file mode 100644 index 0000000000000000000000000000000000000000..306b16d876b9131c0e1cf3eb1a8568745d8cba52 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_branch_info_traffic_split.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferBranchInfoTrafficSplit(UncheckedBaseModel): + branch_id: str + traffic_percentage: float + + 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/data/src/elevenlabs/types/transfer_to_agent_tool_config_input.py b/data/src/elevenlabs/types/transfer_to_agent_tool_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..0c01758411d072e9c1a6f45b22ab2327e5dd4830 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_agent_tool_config_input.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_transfer_input import AgentTransferInput + + +class TransferToAgentToolConfigInput(UncheckedBaseModel): + transfers: typing.List[AgentTransferInput] + + 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/data/src/elevenlabs/types/transfer_to_agent_tool_config_output.py b/data/src/elevenlabs/types/transfer_to_agent_tool_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..dc5f89fddf0414313f91a2a85cdda738bdc81c74 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_agent_tool_config_output.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_transfer_output import AgentTransferOutput + + +class TransferToAgentToolConfigOutput(UncheckedBaseModel): + transfers: typing.List[AgentTransferOutput] + + 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/data/src/elevenlabs/types/transfer_to_agent_tool_result_error_model.py b/data/src/elevenlabs/types/transfer_to_agent_tool_result_error_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9dcd4d3f45701cd525168186c72df75d44a4b87b --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_agent_tool_result_error_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferToAgentToolResultErrorModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["error"]] = None + from_agent: str + error: 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/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_input.py b/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..ca4e7e1a937de3252c8251885c0f66776a9fdff5 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_input.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .transfer_to_agent_tool_result_success_model_input_branch_info import ( + TransferToAgentToolResultSuccessModelInputBranchInfo, +) + + +class TransferToAgentToolResultSuccessModelInput(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + from_agent: str + to_agent: str + to_node: typing.Optional[str] = None + condition: str + delay_ms: typing.Optional[int] = None + transfer_message: typing.Optional[str] = None + enable_transferred_agent_first_message: typing.Optional[bool] = None + branch_info: typing.Optional[TransferToAgentToolResultSuccessModelInputBranchInfo] = None + preserve_client_tts_overrides: typing.Optional[bool] = None + preserve_voice_settings: 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/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_input_branch_info.py b/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_input_branch_info.py new file mode 100644 index 0000000000000000000000000000000000000000..e356cc71dfda6d2c9f04a07533adef638fa75c64 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_input_branch_info.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class TransferToAgentToolResultSuccessModelInputBranchInfo_Configured(UncheckedBaseModel): + branch_reason: typing.Literal["configured"] = "configured" + branch_id: 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 + + +class TransferToAgentToolResultSuccessModelInputBranchInfo_DefaultingToMain(UncheckedBaseModel): + branch_reason: typing.Literal["defaulting_to_main"] = "defaulting_to_main" + branch_id: 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 + + +class TransferToAgentToolResultSuccessModelInputBranchInfo_TrafficSplit(UncheckedBaseModel): + branch_reason: typing.Literal["traffic_split"] = "traffic_split" + branch_id: str + traffic_percentage: float + + 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 + + +TransferToAgentToolResultSuccessModelInputBranchInfo = typing_extensions.Annotated[ + typing.Union[ + TransferToAgentToolResultSuccessModelInputBranchInfo_Configured, + TransferToAgentToolResultSuccessModelInputBranchInfo_DefaultingToMain, + TransferToAgentToolResultSuccessModelInputBranchInfo_TrafficSplit, + ], + UnionMetadata(discriminant="branch_reason"), +] diff --git a/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_output.py b/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..be7726772aafa848c5fe5868b057bd66eb4a968b --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_output.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .transfer_to_agent_tool_result_success_model_output_branch_info import ( + TransferToAgentToolResultSuccessModelOutputBranchInfo, +) + + +class TransferToAgentToolResultSuccessModelOutput(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + from_agent: str + to_agent: str + to_node: typing.Optional[str] = None + condition: str + delay_ms: typing.Optional[int] = None + transfer_message: typing.Optional[str] = None + enable_transferred_agent_first_message: typing.Optional[bool] = None + branch_info: typing.Optional[TransferToAgentToolResultSuccessModelOutputBranchInfo] = None + preserve_client_tts_overrides: typing.Optional[bool] = None + preserve_voice_settings: 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/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_output_branch_info.py b/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_output_branch_info.py new file mode 100644 index 0000000000000000000000000000000000000000..3b9952ee23de5fb775344595286a2e5327a94efb --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_agent_tool_result_success_model_output_branch_info.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class TransferToAgentToolResultSuccessModelOutputBranchInfo_Configured(UncheckedBaseModel): + branch_reason: typing.Literal["configured"] = "configured" + branch_id: 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 + + +class TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain(UncheckedBaseModel): + branch_reason: typing.Literal["defaulting_to_main"] = "defaulting_to_main" + branch_id: 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 + + +class TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit(UncheckedBaseModel): + branch_reason: typing.Literal["traffic_split"] = "traffic_split" + branch_id: str + traffic_percentage: float + + 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 + + +TransferToAgentToolResultSuccessModelOutputBranchInfo = typing_extensions.Annotated[ + typing.Union[ + TransferToAgentToolResultSuccessModelOutputBranchInfo_Configured, + TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain, + TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit, + ], + UnionMetadata(discriminant="branch_reason"), +] diff --git a/data/src/elevenlabs/types/transfer_to_number_result_amazon_connect_success_model.py b/data/src/elevenlabs/types/transfer_to_number_result_amazon_connect_success_model.py new file mode 100644 index 0000000000000000000000000000000000000000..022e253c7f6ff1f4d93ab9e5ae1ea9daecfef966 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_number_result_amazon_connect_success_model.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferToNumberResultAmazonConnectSuccessModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + reason: typing.Optional[str] = pydantic.Field(default=None) + """ + Why the agent escalated, as sent to Amazon Connect with the Escalate outcome. + """ + + client_message: typing.Optional[str] = pydantic.Field(default=None) + """ + Message spoken to the caller before the session was handed back to Amazon Connect. + """ + + note: typing.Optional[str] = pydantic.Field(default=None) + """ + Set when the agent echoed an invalid option and the only configured one was used. + """ + + 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/data/src/elevenlabs/types/transfer_to_number_result_error_model.py b/data/src/elevenlabs/types/transfer_to_number_result_error_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3709483f0675004d325fdb95c69377cc2bdc5651 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_number_result_error_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferToNumberResultErrorModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["error"]] = None + error: str + details: 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/data/src/elevenlabs/types/transfer_to_number_result_exotel_success_model.py b/data/src/elevenlabs/types/transfer_to_number_result_exotel_success_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c7628ffc217402f88819ffe7ee3db4330e61aeb2 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_number_result_exotel_success_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferToNumberResultExotelSuccessModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + agent_message: typing.Optional[str] = None + note: 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/data/src/elevenlabs/types/transfer_to_number_result_sip_success_model.py b/data/src/elevenlabs/types/transfer_to_number_result_sip_success_model.py new file mode 100644 index 0000000000000000000000000000000000000000..200026dd3e93dac3b800a2f7fc8542fcdcd7d809 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_number_result_sip_success_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferToNumberResultSipSuccessModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + note: 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/data/src/elevenlabs/types/transfer_to_number_result_twilio_success_model.py b/data/src/elevenlabs/types/transfer_to_number_result_twilio_success_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d1ca3c969a64c5ff7a1d39025eacc367aa6ebeba --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_number_result_twilio_success_model.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TransferToNumberResultTwilioSuccessModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + transfer_number: str + reason: typing.Optional[str] = None + client_message: typing.Optional[str] = None + agent_message: str + conference_name: str + post_dial_digits: typing.Optional[str] = None + note: 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/data/src/elevenlabs/types/transfer_to_number_tool_config_input.py b/data/src/elevenlabs/types/transfer_to_number_tool_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..59350f52b5cbefb4f0d16a1d5b11dcf1de33e218 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_number_tool_config_input.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .phone_number_transfer import PhoneNumberTransfer + + +class TransferToNumberToolConfigInput(UncheckedBaseModel): + transfers: typing.List[PhoneNumberTransfer] + enable_client_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to play a message to the client while they wait for transfer. Defaults to true for backward compatibility. + """ + + 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/data/src/elevenlabs/types/transfer_to_number_tool_config_output.py b/data/src/elevenlabs/types/transfer_to_number_tool_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..2420f33e2849cb2fa3de6e241beeb7065672e443 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_to_number_tool_config_output.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .phone_number_transfer import PhoneNumberTransfer + + +class TransferToNumberToolConfigOutput(UncheckedBaseModel): + transfers: typing.List[PhoneNumberTransfer] + enable_client_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to play a message to the client while they wait for transfer. Defaults to true for backward compatibility. + """ + + 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/data/src/elevenlabs/types/transfer_type_enum.py b/data/src/elevenlabs/types/transfer_type_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..8e085a155e955e7af24359fb59d9fce7439d0443 --- /dev/null +++ b/data/src/elevenlabs/types/transfer_type_enum.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TransferTypeEnum = typing.Union[typing.Literal["blind", "conference", "sip_refer"], typing.Any] diff --git a/data/src/elevenlabs/types/translate_audio_output_error.py b/data/src/elevenlabs/types/translate_audio_output_error.py new file mode 100644 index 0000000000000000000000000000000000000000..b6e314f55c8c52756f260ef43d0d6d006644be52 --- /dev/null +++ b/data/src/elevenlabs/types/translate_audio_output_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateAudioOutputError(UncheckedBaseModel): + message_type: typing.Literal["audio_output_error"] = "audio_output_error" + error: 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/data/src/elevenlabs/types/translate_audio_payload.py b/data/src/elevenlabs/types/translate_audio_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..2f50647b1b20617ecec610035f38b932ca3e576e --- /dev/null +++ b/data/src/elevenlabs/types/translate_audio_payload.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateAudioPayload(UncheckedBaseModel): + """ + Base64-encoded audio of the translated speech. + """ + + message_type: typing.Literal["audio"] = pydantic.Field(default="audio") + """ + The message type identifier. + """ + + data: str = pydantic.Field() + """ + Base64-encoded audio data. + """ + + sample_rate: int = pydantic.Field() + """ + Sample rate of the audio in Hz. + """ + + 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/data/src/elevenlabs/types/translate_auth_error.py b/data/src/elevenlabs/types/translate_auth_error.py new file mode 100644 index 0000000000000000000000000000000000000000..038b3a17f12be2412a35de8035b253202b198069 --- /dev/null +++ b/data/src/elevenlabs/types/translate_auth_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateAuthError(UncheckedBaseModel): + message_type: typing.Literal["auth_error"] = "auth_error" + error: 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/data/src/elevenlabs/types/translate_end_of_stream_payload.py b/data/src/elevenlabs/types/translate_end_of_stream_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..f5e70ff54e57607e5f0e5084d796707d430e623e --- /dev/null +++ b/data/src/elevenlabs/types/translate_end_of_stream_payload.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateEndOfStreamPayload(UncheckedBaseModel): + """ + Signal that the client has finished sending audio. + """ + + message_type: typing.Literal["end_of_stream"] = pydantic.Field(default="end_of_stream") + """ + The message type identifier. + """ + + 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/data/src/elevenlabs/types/translate_error_payload.py b/data/src/elevenlabs/types/translate_error_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..7978e75daf8e075eba772f8ebffc32b5f9bd6305 --- /dev/null +++ b/data/src/elevenlabs/types/translate_error_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateErrorPayload(UncheckedBaseModel): + """ + Error encountered during translation. + """ + + message_type: typing.Literal["error"] = pydantic.Field(default="error") + """ + The message type identifier. + """ + + error: str = pydantic.Field() + """ + Error message. + """ + + 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/data/src/elevenlabs/types/translate_final_transcript_payload.py b/data/src/elevenlabs/types/translate_final_transcript_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..f13a1b8e62700572cb13e942b0d3f4c3eac99ce1 --- /dev/null +++ b/data/src/elevenlabs/types/translate_final_transcript_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateFinalTranscriptPayload(UncheckedBaseModel): + """ + Final transcription of a completed segment. + """ + + message_type: typing.Literal["final_transcript"] = pydantic.Field(default="final_transcript") + """ + The message type identifier. + """ + + text: str = pydantic.Field() + """ + Final transcription text. + """ + + 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/data/src/elevenlabs/types/translate_input_audio_chunk_payload.py b/data/src/elevenlabs/types/translate_input_audio_chunk_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..effee088ae33d6ddbee227a73dad2d981297d10b --- /dev/null +++ b/data/src/elevenlabs/types/translate_input_audio_chunk_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateInputAudioChunkPayload(UncheckedBaseModel): + """ + A chunk of audio to be translated. + """ + + message_type: typing.Literal["input_audio_chunk"] = pydantic.Field(default="input_audio_chunk") + """ + The message type identifier. + """ + + audio_base_64: str = pydantic.Field() + """ + Base64-encoded audio data. Recommended chunk size is around 100 ms of audio. + """ + + 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/data/src/elevenlabs/types/translate_input_error.py b/data/src/elevenlabs/types/translate_input_error.py new file mode 100644 index 0000000000000000000000000000000000000000..dcb0118afd9948be33e53e8c41fe7e4ed7ccef4d --- /dev/null +++ b/data/src/elevenlabs/types/translate_input_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateInputError(UncheckedBaseModel): + message_type: typing.Literal["input_error"] = "input_error" + error: 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/data/src/elevenlabs/types/translate_input_format_enum.py b/data/src/elevenlabs/types/translate_input_format_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..b3482265f461706d8cd85c6f08627d6cc707d9a1 --- /dev/null +++ b/data/src/elevenlabs/types/translate_input_format_enum.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TranslateInputFormatEnum = typing.Union[ + typing.Literal["pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "pcm_48000", "ulaw_8000"], typing.Any +] diff --git a/data/src/elevenlabs/types/translate_output_format_enum.py b/data/src/elevenlabs/types/translate_output_format_enum.py new file mode 100644 index 0000000000000000000000000000000000000000..9ed7e4fca1c06493b8921b66b467b8c0595836d5 --- /dev/null +++ b/data/src/elevenlabs/types/translate_output_format_enum.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TranslateOutputFormatEnum = typing.Union[ + typing.Literal[ + "mp3_22050_32", + "mp3_44100_32", + "mp3_44100_64", + "mp3_44100_96", + "mp3_44100_128", + "mp3_44100_192", + "pcm_16000", + "pcm_22050", + "pcm_24000", + "pcm_44100", + "ulaw_8000", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/translate_partial_transcript_payload.py b/data/src/elevenlabs/types/translate_partial_transcript_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..1b373d5c18dc806170c18beded7d6845097f925d --- /dev/null +++ b/data/src/elevenlabs/types/translate_partial_transcript_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslatePartialTranscriptPayload(UncheckedBaseModel): + """ + Interim transcription of the source audio. + """ + + message_type: typing.Literal["partial_transcript"] = pydantic.Field(default="partial_transcript") + """ + The message type identifier. + """ + + text: str = pydantic.Field() + """ + Partial transcription text. + """ + + 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/data/src/elevenlabs/types/translate_payment_issue_error.py b/data/src/elevenlabs/types/translate_payment_issue_error.py new file mode 100644 index 0000000000000000000000000000000000000000..62a678273fc203a3fd47bd85d04e37f8b6863e48 --- /dev/null +++ b/data/src/elevenlabs/types/translate_payment_issue_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslatePaymentIssueError(UncheckedBaseModel): + message_type: typing.Literal["payment_issue"] = "payment_issue" + error: 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/data/src/elevenlabs/types/translate_queue_overflow_error.py b/data/src/elevenlabs/types/translate_queue_overflow_error.py new file mode 100644 index 0000000000000000000000000000000000000000..21b5035a47e4d7f3b0696dba7bade2062ecf3f55 --- /dev/null +++ b/data/src/elevenlabs/types/translate_queue_overflow_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateQueueOverflowError(UncheckedBaseModel): + message_type: typing.Literal["queue_overflow"] = "queue_overflow" + error: 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/data/src/elevenlabs/types/translate_quota_exceeded_error.py b/data/src/elevenlabs/types/translate_quota_exceeded_error.py new file mode 100644 index 0000000000000000000000000000000000000000..ada8c900a7b148f4ab7b0b1e084db5e828177a41 --- /dev/null +++ b/data/src/elevenlabs/types/translate_quota_exceeded_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateQuotaExceededError(UncheckedBaseModel): + message_type: typing.Literal["quota_exceeded"] = "quota_exceeded" + error: 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/data/src/elevenlabs/types/translate_rate_limited_error.py b/data/src/elevenlabs/types/translate_rate_limited_error.py new file mode 100644 index 0000000000000000000000000000000000000000..d20dd5f970e58698ec3d6a722b91cbb059e471b9 --- /dev/null +++ b/data/src/elevenlabs/types/translate_rate_limited_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateRateLimitedError(UncheckedBaseModel): + message_type: typing.Literal["rate_limited"] = "rate_limited" + error: 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/data/src/elevenlabs/types/translate_session_started_payload.py b/data/src/elevenlabs/types/translate_session_started_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..3286cfd5bbbd95114ee6a8e6af11b69377fab544 --- /dev/null +++ b/data/src/elevenlabs/types/translate_session_started_payload.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateSessionStartedPayload(UncheckedBaseModel): + """ + Confirms the session has been initialized. + """ + + message_type: typing.Literal["session_started"] = pydantic.Field(default="session_started") + """ + The message type identifier. + """ + + session_id: str = pydantic.Field() + """ + Unique identifier for this session. + """ + + client_session_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Client-defined session identifier, if provided during connection. + """ + + 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/data/src/elevenlabs/types/translate_status_payload.py b/data/src/elevenlabs/types/translate_status_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..5ea7b55c1187e43fa2843f8aaa8bbdae3caaa705 --- /dev/null +++ b/data/src/elevenlabs/types/translate_status_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateStatusPayload(UncheckedBaseModel): + """ + Session lifecycle update. + """ + + message_type: typing.Literal["status"] = pydantic.Field(default="status") + """ + The message type identifier. + """ + + status: str = pydantic.Field() + """ + Current session status (`started` or `stopped`). + """ + + 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/data/src/elevenlabs/types/translate_transcriber_error.py b/data/src/elevenlabs/types/translate_transcriber_error.py new file mode 100644 index 0000000000000000000000000000000000000000..f1d95d0d55e625ed1850439d3fc7479352b42c07 --- /dev/null +++ b/data/src/elevenlabs/types/translate_transcriber_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateTranscriberError(UncheckedBaseModel): + message_type: typing.Literal["transcriber_error"] = "transcriber_error" + error: 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/data/src/elevenlabs/types/translate_translation_error.py b/data/src/elevenlabs/types/translate_translation_error.py new file mode 100644 index 0000000000000000000000000000000000000000..c5d825922fe0b3a3a6349b425a305febc2a6545f --- /dev/null +++ b/data/src/elevenlabs/types/translate_translation_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateTranslationError(UncheckedBaseModel): + message_type: typing.Literal["translation_error"] = "translation_error" + error: 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/data/src/elevenlabs/types/translate_translation_payload.py b/data/src/elevenlabs/types/translate_translation_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..503951fa6aa295a36e39cce21b648a616eab25fc --- /dev/null +++ b/data/src/elevenlabs/types/translate_translation_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateTranslationPayload(UncheckedBaseModel): + """ + Translated text in the target language. + """ + + message_type: typing.Literal["translation"] = pydantic.Field(default="translation") + """ + The message type identifier. + """ + + text: str = pydantic.Field() + """ + Translated text. + """ + + 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/data/src/elevenlabs/types/translate_unaccepted_terms_error.py b/data/src/elevenlabs/types/translate_unaccepted_terms_error.py new file mode 100644 index 0000000000000000000000000000000000000000..5efc6aa408ff93b6d791efb8f7eab5cf2f1ca924 --- /dev/null +++ b/data/src/elevenlabs/types/translate_unaccepted_terms_error.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslateUnacceptedTermsError(UncheckedBaseModel): + message_type: typing.Literal["unaccepted_terms"] = "unaccepted_terms" + error: 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/data/src/elevenlabs/types/translated_string.py b/data/src/elevenlabs/types/translated_string.py new file mode 100644 index 0000000000000000000000000000000000000000..a29fb44dbbe1e826e7292946977b9e94ae1123c8 --- /dev/null +++ b/data/src/elevenlabs/types/translated_string.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TranslatedString(UncheckedBaseModel): + value: 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/data/src/elevenlabs/types/trigger_user_verification_params.py b/data/src/elevenlabs/types/trigger_user_verification_params.py new file mode 100644 index 0000000000000000000000000000000000000000..854e7ea19ef4cafb279f8e783daa14001e2e9cd3 --- /dev/null +++ b/data/src/elevenlabs/types/trigger_user_verification_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TriggerUserVerificationParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["trigger_user_verification"]] = 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/data/src/elevenlabs/types/triggered_guardrail_common_model.py b/data/src/elevenlabs/types/triggered_guardrail_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..cdc726eebefd4e815b2f5098c8be42239743722c --- /dev/null +++ b/data/src/elevenlabs/types/triggered_guardrail_common_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .guardrail_type import GuardrailType + + +class TriggeredGuardrailCommonModel(UncheckedBaseModel): + guardrail_type: GuardrailType + guardrail_name: 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/data/src/elevenlabs/types/tts_conversational_config_input.py b/data/src/elevenlabs/types/tts_conversational_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..883ead6e9a40cb86a1577d1c3c89b449a1c029de --- /dev/null +++ b/data/src/elevenlabs/types/tts_conversational_config_input.py @@ -0,0 +1,98 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .effects_spec_input import EffectsSpecInput +from .pydantic_pronunciation_dictionary_version_locator import PydanticPronunciationDictionaryVersionLocator +from .suggested_audio_tag import SuggestedAudioTag +from .supported_voice import SupportedVoice +from .text_normalisation_type import TextNormalisationType +from .tts_conversational_model import TtsConversationalModel +from .tts_optimize_streaming_latency import TtsOptimizeStreamingLatency +from .tts_output_format import TtsOutputFormat + + +class TtsConversationalConfigInput(UncheckedBaseModel): + model_id: typing.Optional[TtsConversationalModel] = pydantic.Field(default=None) + """ + The model to use for TTS + """ + + voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice ID to use for TTS + """ + + supported_voices: typing.Optional[typing.List[SupportedVoice]] = pydantic.Field(default=None) + """ + Additional supported voices for the agent + """ + + expressive_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, applies expressive audio tags prompt. Automatically disabled for non-v3 models. + """ + + suggested_audio_tags: typing.Optional[typing.List[SuggestedAudioTag]] = pydantic.Field(default=None) + """ + Suggested audio tags to boost expressive speech (for eleven_v3 and eleven_v3_conversational models). The agent can still use other tags not listed here. + """ + + agent_output_audio_format: typing.Optional[TtsOutputFormat] = pydantic.Field(default=None) + """ + The audio format to use for TTS + """ + + optimize_streaming_latency: typing.Optional[TtsOptimizeStreamingLatency] = pydantic.Field(default=None) + """ + Deprecated: this field is a no-op and is ignored. + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + The stability of generated speech + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + The speed of generated speech + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + The similarity boost for generated speech + """ + + text_normalisation_type: typing.Optional[TextNormalisationType] = pydantic.Field(default=None) + """ + Method for converting numbers to words before converting text to speech. If set to SYSTEM_PROMPT, the system prompt will be updated to include normalization instructions. If set to ELEVENLABS, the text will be normalized after generation, incurring slight additional latency. + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PydanticPronunciationDictionaryVersionLocator]] = ( + pydantic.Field(default=None) + ) + """ + The pronunciation dictionary locators + """ + + enable_phoneme_tags: typing.Optional[bool] = pydantic.Field(default=None) + """ + Opt-in to SSML phoneme tag handling for V3 models. When enabled, phoneme tags (inline and from pronunciation dictionaries) are parsed into inline IPA before being sent to the model. + """ + + audio_effects: typing.Optional[EffectsSpecInput] = pydantic.Field(default=None) + """ + Optional TTS effects spec: filter preset, distance (proximity EQ), and environment (convolution reverb). + """ + + 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/data/src/elevenlabs/types/tts_conversational_config_output.py b/data/src/elevenlabs/types/tts_conversational_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..5a483a156d5007716589549b2d0241a865196b62 --- /dev/null +++ b/data/src/elevenlabs/types/tts_conversational_config_output.py @@ -0,0 +1,98 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .effects_spec_output import EffectsSpecOutput +from .pydantic_pronunciation_dictionary_version_locator import PydanticPronunciationDictionaryVersionLocator +from .suggested_audio_tag import SuggestedAudioTag +from .supported_voice import SupportedVoice +from .text_normalisation_type import TextNormalisationType +from .tts_conversational_model import TtsConversationalModel +from .tts_optimize_streaming_latency import TtsOptimizeStreamingLatency +from .tts_output_format import TtsOutputFormat + + +class TtsConversationalConfigOutput(UncheckedBaseModel): + model_id: typing.Optional[TtsConversationalModel] = pydantic.Field(default=None) + """ + The model to use for TTS + """ + + voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice ID to use for TTS + """ + + supported_voices: typing.Optional[typing.List[SupportedVoice]] = pydantic.Field(default=None) + """ + Additional supported voices for the agent + """ + + expressive_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, applies expressive audio tags prompt. Automatically disabled for non-v3 models. + """ + + suggested_audio_tags: typing.Optional[typing.List[SuggestedAudioTag]] = pydantic.Field(default=None) + """ + Suggested audio tags to boost expressive speech (for eleven_v3 and eleven_v3_conversational models). The agent can still use other tags not listed here. + """ + + agent_output_audio_format: typing.Optional[TtsOutputFormat] = pydantic.Field(default=None) + """ + The audio format to use for TTS + """ + + optimize_streaming_latency: typing.Optional[TtsOptimizeStreamingLatency] = pydantic.Field(default=None) + """ + Deprecated: this field is a no-op and is ignored. + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + The stability of generated speech + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + The speed of generated speech + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + The similarity boost for generated speech + """ + + text_normalisation_type: typing.Optional[TextNormalisationType] = pydantic.Field(default=None) + """ + Method for converting numbers to words before converting text to speech. If set to SYSTEM_PROMPT, the system prompt will be updated to include normalization instructions. If set to ELEVENLABS, the text will be normalized after generation, incurring slight additional latency. + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PydanticPronunciationDictionaryVersionLocator]] = ( + pydantic.Field(default=None) + ) + """ + The pronunciation dictionary locators + """ + + enable_phoneme_tags: typing.Optional[bool] = pydantic.Field(default=None) + """ + Opt-in to SSML phoneme tag handling for V3 models. When enabled, phoneme tags (inline and from pronunciation dictionaries) are parsed into inline IPA before being sent to the model. + """ + + audio_effects: typing.Optional[EffectsSpecOutput] = pydantic.Field(default=None) + """ + Optional TTS effects spec: filter preset, distance (proximity EQ), and environment (convolution reverb). + """ + + 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/data/src/elevenlabs/types/tts_conversational_config_override.py b/data/src/elevenlabs/types/tts_conversational_config_override.py new file mode 100644 index 0000000000000000000000000000000000000000..faa86ec99ba16d5f81fa6d360403ac2e754e7ea9 --- /dev/null +++ b/data/src/elevenlabs/types/tts_conversational_config_override.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .pydantic_pronunciation_dictionary_version_locator import PydanticPronunciationDictionaryVersionLocator +from .supported_voice import SupportedVoice +from .tts_conversational_model import TtsConversationalModel + + +class TtsConversationalConfigOverride(UncheckedBaseModel): + model_id: typing.Optional[TtsConversationalModel] = pydantic.Field(default=None) + """ + The model to use for TTS + """ + + voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice ID to use for TTS + """ + + supported_voices: typing.Optional[typing.List[SupportedVoice]] = pydantic.Field(default=None) + """ + Additional supported voices for the agent + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + The stability of generated speech + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + The speed of generated speech + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + The similarity boost for generated speech + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PydanticPronunciationDictionaryVersionLocator]] = ( + pydantic.Field(default=None) + ) + """ + The pronunciation dictionary locators + """ + + 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/data/src/elevenlabs/types/tts_conversational_config_override_config.py b/data/src/elevenlabs/types/tts_conversational_config_override_config.py new file mode 100644 index 0000000000000000000000000000000000000000..571174d6b2ca7cc7b3f99b9c78ffaa5893255f9c --- /dev/null +++ b/data/src/elevenlabs/types/tts_conversational_config_override_config.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TtsConversationalConfigOverrideConfig(UncheckedBaseModel): + model_id: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the model_id field. + """ + + voice_id: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the voice_id field. + """ + + supported_voices: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the supported_voices field. + """ + + stability: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the stability field. + """ + + speed: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the speed field. + """ + + similarity_boost: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the similarity_boost field. + """ + + pronunciation_dictionary_locators: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow overriding the pronunciation_dictionary_locators field. + """ + + 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/data/src/elevenlabs/types/tts_conversational_config_workflow_override_input.py b/data/src/elevenlabs/types/tts_conversational_config_workflow_override_input.py new file mode 100644 index 0000000000000000000000000000000000000000..9cd7091e071240884b264cb596e0a1b9a595259e --- /dev/null +++ b/data/src/elevenlabs/types/tts_conversational_config_workflow_override_input.py @@ -0,0 +1,98 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .effects_spec_input import EffectsSpecInput +from .pydantic_pronunciation_dictionary_version_locator import PydanticPronunciationDictionaryVersionLocator +from .suggested_audio_tag import SuggestedAudioTag +from .supported_voice import SupportedVoice +from .text_normalisation_type import TextNormalisationType +from .tts_conversational_model import TtsConversationalModel +from .tts_optimize_streaming_latency import TtsOptimizeStreamingLatency +from .tts_output_format import TtsOutputFormat + + +class TtsConversationalConfigWorkflowOverrideInput(UncheckedBaseModel): + model_id: typing.Optional[TtsConversationalModel] = pydantic.Field(default=None) + """ + The model to use for TTS + """ + + voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice ID to use for TTS + """ + + supported_voices: typing.Optional[typing.List[SupportedVoice]] = pydantic.Field(default=None) + """ + Additional supported voices for the agent + """ + + expressive_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, applies expressive audio tags prompt. Automatically disabled for non-v3 models. + """ + + suggested_audio_tags: typing.Optional[typing.List[SuggestedAudioTag]] = pydantic.Field(default=None) + """ + Suggested audio tags to boost expressive speech (for eleven_v3 and eleven_v3_conversational models). The agent can still use other tags not listed here. + """ + + agent_output_audio_format: typing.Optional[TtsOutputFormat] = pydantic.Field(default=None) + """ + The audio format to use for TTS + """ + + optimize_streaming_latency: typing.Optional[TtsOptimizeStreamingLatency] = pydantic.Field(default=None) + """ + Deprecated: this field is a no-op and is ignored. + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + The stability of generated speech + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + The speed of generated speech + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + The similarity boost for generated speech + """ + + text_normalisation_type: typing.Optional[TextNormalisationType] = pydantic.Field(default=None) + """ + Method for converting numbers to words before converting text to speech. If set to SYSTEM_PROMPT, the system prompt will be updated to include normalization instructions. If set to ELEVENLABS, the text will be normalized after generation, incurring slight additional latency. + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PydanticPronunciationDictionaryVersionLocator]] = ( + pydantic.Field(default=None) + ) + """ + The pronunciation dictionary locators + """ + + enable_phoneme_tags: typing.Optional[bool] = pydantic.Field(default=None) + """ + Opt-in to SSML phoneme tag handling for V3 models. When enabled, phoneme tags (inline and from pronunciation dictionaries) are parsed into inline IPA before being sent to the model. + """ + + audio_effects: typing.Optional[EffectsSpecInput] = pydantic.Field(default=None) + """ + Optional TTS effects spec: filter preset, distance (proximity EQ), and environment (convolution reverb). + """ + + 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/data/src/elevenlabs/types/tts_conversational_config_workflow_override_output.py b/data/src/elevenlabs/types/tts_conversational_config_workflow_override_output.py new file mode 100644 index 0000000000000000000000000000000000000000..e121522fc5561bcdc87c7f59f64be63cd1f57e51 --- /dev/null +++ b/data/src/elevenlabs/types/tts_conversational_config_workflow_override_output.py @@ -0,0 +1,98 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .effects_spec_output import EffectsSpecOutput +from .pydantic_pronunciation_dictionary_version_locator import PydanticPronunciationDictionaryVersionLocator +from .suggested_audio_tag import SuggestedAudioTag +from .supported_voice import SupportedVoice +from .text_normalisation_type import TextNormalisationType +from .tts_conversational_model import TtsConversationalModel +from .tts_optimize_streaming_latency import TtsOptimizeStreamingLatency +from .tts_output_format import TtsOutputFormat + + +class TtsConversationalConfigWorkflowOverrideOutput(UncheckedBaseModel): + model_id: typing.Optional[TtsConversationalModel] = pydantic.Field(default=None) + """ + The model to use for TTS + """ + + voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice ID to use for TTS + """ + + supported_voices: typing.Optional[typing.List[SupportedVoice]] = pydantic.Field(default=None) + """ + Additional supported voices for the agent + """ + + expressive_mode: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, applies expressive audio tags prompt. Automatically disabled for non-v3 models. + """ + + suggested_audio_tags: typing.Optional[typing.List[SuggestedAudioTag]] = pydantic.Field(default=None) + """ + Suggested audio tags to boost expressive speech (for eleven_v3 and eleven_v3_conversational models). The agent can still use other tags not listed here. + """ + + agent_output_audio_format: typing.Optional[TtsOutputFormat] = pydantic.Field(default=None) + """ + The audio format to use for TTS + """ + + optimize_streaming_latency: typing.Optional[TtsOptimizeStreamingLatency] = pydantic.Field(default=None) + """ + Deprecated: this field is a no-op and is ignored. + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + The stability of generated speech + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + The speed of generated speech + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + The similarity boost for generated speech + """ + + text_normalisation_type: typing.Optional[TextNormalisationType] = pydantic.Field(default=None) + """ + Method for converting numbers to words before converting text to speech. If set to SYSTEM_PROMPT, the system prompt will be updated to include normalization instructions. If set to ELEVENLABS, the text will be normalized after generation, incurring slight additional latency. + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PydanticPronunciationDictionaryVersionLocator]] = ( + pydantic.Field(default=None) + ) + """ + The pronunciation dictionary locators + """ + + enable_phoneme_tags: typing.Optional[bool] = pydantic.Field(default=None) + """ + Opt-in to SSML phoneme tag handling for V3 models. When enabled, phoneme tags (inline and from pronunciation dictionaries) are parsed into inline IPA before being sent to the model. + """ + + audio_effects: typing.Optional[EffectsSpecOutput] = pydantic.Field(default=None) + """ + Optional TTS effects spec: filter preset, distance (proximity EQ), and environment (convolution reverb). + """ + + 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/data/src/elevenlabs/types/tts_conversational_model.py b/data/src/elevenlabs/types/tts_conversational_model.py new file mode 100644 index 0000000000000000000000000000000000000000..69e75e6e915f09b80cb4bb0c8a87e2dd044b0cff --- /dev/null +++ b/data/src/elevenlabs/types/tts_conversational_model.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TtsConversationalModel = typing.Union[ + typing.Literal[ + "eleven_turbo_v2", + "eleven_turbo_v2_5", + "eleven_flash_v2", + "eleven_flash_v2_5", + "eleven_multilingual_v2", + "eleven_v3_conversational", + "eleven_v4", + "eleven_v4_turbo", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/tts_model_family.py b/data/src/elevenlabs/types/tts_model_family.py new file mode 100644 index 0000000000000000000000000000000000000000..257a8446ea56a5fa2615adc0e119012c313fca72 --- /dev/null +++ b/data/src/elevenlabs/types/tts_model_family.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TtsModelFamily = typing.Union[ + typing.Literal["turbo", "flash", "multilingual", "v3_conversational", "v4", "v4_turbo"], typing.Any +] diff --git a/data/src/elevenlabs/types/tts_optimize_streaming_latency.py b/data/src/elevenlabs/types/tts_optimize_streaming_latency.py new file mode 100644 index 0000000000000000000000000000000000000000..36429b8dfec21c021489f9544a0f6965919895fc --- /dev/null +++ b/data/src/elevenlabs/types/tts_optimize_streaming_latency.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +TtsOptimizeStreamingLatency = int diff --git a/data/src/elevenlabs/types/tts_output_format.py b/data/src/elevenlabs/types/tts_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..d1bb069bf55ef729c3e2e206fcb97aa752890da8 --- /dev/null +++ b/data/src/elevenlabs/types/tts_output_format.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TtsOutputFormat = typing.Union[ + typing.Literal["pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "pcm_48000", "ulaw_8000"], typing.Any +] diff --git a/data/src/elevenlabs/types/tts_voice_settings.py b/data/src/elevenlabs/types/tts_voice_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..c896f68ef245a6394a05f72712e70b17f5520583 --- /dev/null +++ b/data/src/elevenlabs/types/tts_voice_settings.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TtsVoiceSettings(UncheckedBaseModel): + """ + Overrides for the voice's saved settings, applied to one generation. + """ + + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + How consistent the voice stays across generations. Lower values give more expressive, varied speech. + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + How closely the output adheres to the original voice. + """ + + style: typing.Optional[float] = pydantic.Field(default=None) + """ + How strongly the speaking style is exaggerated. + """ + + use_speaker_boost: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to boost similarity to the original speaker, at some latency cost. + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + The speed of the generated speech, where 1.0 is the voice's natural pace. + """ + + 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/data/src/elevenlabs/types/turn_comment_request_model.py b/data/src/elevenlabs/types/turn_comment_request_model.py new file mode 100644 index 0000000000000000000000000000000000000000..76c5104cd9d1d49415d394ae7d40849432bd9b00 --- /dev/null +++ b/data/src/elevenlabs/types/turn_comment_request_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TurnCommentRequestModel(UncheckedBaseModel): + turn_index: int = pydantic.Field() + """ + Zero-based index of the transcript turn this comment refers to. + """ + + comment: str = pydantic.Field() + """ + What went wrong at this turn. + """ + + 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/data/src/elevenlabs/types/turn_comment_response_model.py b/data/src/elevenlabs/types/turn_comment_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..19442d15a1070dc38e34141cae24d79d870df22a --- /dev/null +++ b/data/src/elevenlabs/types/turn_comment_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TurnCommentResponseModel(UncheckedBaseModel): + turn_index: int + comment: str + created_at_unix_secs: int + owner_user_id: 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/data/src/elevenlabs/types/turn_config.py b/data/src/elevenlabs/types/turn_config.py new file mode 100644 index 0000000000000000000000000000000000000000..fd073d383ec6f00a1913d6e150d7945594ce29fe --- /dev/null +++ b/data/src/elevenlabs/types/turn_config.py @@ -0,0 +1,83 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .soft_timeout_config import SoftTimeoutConfig +from .spelling_patience import SpellingPatience +from .turn_eagerness import TurnEagerness +from .turn_model import TurnModel + + +class TurnConfig(UncheckedBaseModel): + turn_timeout: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum wait time for the user's reply before re-engaging the user + """ + + initial_wait_time: typing.Optional[float] = pydantic.Field(default=None) + """ + How long the agent will wait for the user to start the conversation if the first message is empty. If not set, uses the regular turn_timeout. + """ + + silence_end_call_timeout: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum wait time since the user last spoke before terminating the call + """ + + turn_eagerness: typing.Optional[TurnEagerness] = pydantic.Field(default=None) + """ + Controls how eager the agent is to respond. Low = less eager (waits longer), Standard = default eagerness, High = more eager (responds sooner) + """ + + spelling_patience: typing.Optional[SpellingPatience] = pydantic.Field(default=None) + """ + Controls if the agent should be more patient when user is spelling numbers and named entities. Auto = model based, Off = never wait extra + """ + + speculative_turn: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, starts generating LLM responses during silence before full turn confidence is reached, reducing perceived latency. May increase LLM costs. + """ + + retranscribe_on_turn_timeout: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, if VAD detects no speech, attempts to re-transcribe accumulated audio at turn timeout. Disables silence discount billing while enabled for the active agent or workflow node. + """ + + turn_model: typing.Optional[TurnModel] = None + interruption_ignore_terms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of terms that should not trigger an interruption when spoken by the user (e.g. 'gotcha', 'understood'). Uses case-insensitive exact matching. + """ + + interruption_ignore_term_languages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Language codes for which preset ignore-term categories have been activated. Stored explicitly so display is not inferred from term overlap. + """ + + merge_with_default_ignore_terms: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, the curated default terms for interruption_ignore_term_languages are used in addition to interruption_ignore_terms. + """ + + transcribe_on_disabled_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + When interruptions are disabled, still transcribe what the user says so it can carry into the next turn. When off, user speech during a non-interruptible turn is ignored and won't trigger a turn. + """ + + soft_timeout_config: typing.Optional[SoftTimeoutConfig] = pydantic.Field(default=None) + """ + Configuration for soft timeout functionality. Provides immediate feedback during longer LLM responses. + """ + + 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/data/src/elevenlabs/types/turn_config_override.py b/data/src/elevenlabs/types/turn_config_override.py new file mode 100644 index 0000000000000000000000000000000000000000..4820f18f89cea9c751555dbd369550207b35a5ed --- /dev/null +++ b/data/src/elevenlabs/types/turn_config_override.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .soft_timeout_config_override import SoftTimeoutConfigOverride + + +class TurnConfigOverride(UncheckedBaseModel): + soft_timeout_config: typing.Optional[SoftTimeoutConfigOverride] = pydantic.Field(default=None) + """ + Configuration for soft timeout functionality. Provides immediate feedback during longer LLM responses. + """ + + 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/data/src/elevenlabs/types/turn_config_override_config.py b/data/src/elevenlabs/types/turn_config_override_config.py new file mode 100644 index 0000000000000000000000000000000000000000..af5124c7ffb7ba1c53e4a6bd0ebe66f4a4af3048 --- /dev/null +++ b/data/src/elevenlabs/types/turn_config_override_config.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .soft_timeout_config_override_config import SoftTimeoutConfigOverrideConfig + + +class TurnConfigOverrideConfig(UncheckedBaseModel): + soft_timeout_config: typing.Optional[SoftTimeoutConfigOverrideConfig] = pydantic.Field(default=None) + """ + Configures overrides for nested fields. + """ + + 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/data/src/elevenlabs/types/turn_config_workflow_override.py b/data/src/elevenlabs/types/turn_config_workflow_override.py new file mode 100644 index 0000000000000000000000000000000000000000..07ba7eedf09ffa2a4d6b32877f0f9d2bb891c37f --- /dev/null +++ b/data/src/elevenlabs/types/turn_config_workflow_override.py @@ -0,0 +1,87 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .soft_timeout_config_workflow_override import SoftTimeoutConfigWorkflowOverride +from .spelling_patience import SpellingPatience +from .turn_eagerness import TurnEagerness +from .turn_model import TurnModel + + +class TurnConfigWorkflowOverride(UncheckedBaseModel): + turn_timeout: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum wait time for the user's reply before re-engaging the user + """ + + initial_wait_time: typing.Optional[float] = pydantic.Field(default=None) + """ + How long the agent will wait for the user to start the conversation if the first message is empty. If not set, uses the regular turn_timeout. + """ + + silence_end_call_timeout: typing.Optional[float] = pydantic.Field(default=None) + """ + Maximum wait time since the user last spoke before terminating the call + """ + + turn_eagerness: typing.Optional[TurnEagerness] = pydantic.Field(default=None) + """ + Controls how eager the agent is to respond. Low = less eager (waits longer), Standard = default eagerness, High = more eager (responds sooner) + """ + + spelling_patience: typing.Optional[SpellingPatience] = pydantic.Field(default=None) + """ + Controls if the agent should be more patient when user is spelling numbers and named entities. Auto = model based, Off = never wait extra + """ + + speculative_turn: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, starts generating LLM responses during silence before full turn confidence is reached, reducing perceived latency. May increase LLM costs. + """ + + retranscribe_on_turn_timeout: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, if VAD detects no speech, attempts to re-transcribe accumulated audio at turn timeout. Disables silence discount billing while enabled for the active agent or workflow node. + """ + + turn_model: typing.Optional[TurnModel] = pydantic.Field(default=None) + """ + Version of the turn detection model to use. + """ + + interruption_ignore_terms: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of terms that should not trigger an interruption when spoken by the user (e.g. 'gotcha', 'understood'). Uses case-insensitive exact matching. + """ + + interruption_ignore_term_languages: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Language codes for which preset ignore-term categories have been activated. Stored explicitly so display is not inferred from term overlap. + """ + + merge_with_default_ignore_terms: typing.Optional[bool] = pydantic.Field(default=None) + """ + When enabled, the curated default terms for interruption_ignore_term_languages are used in addition to interruption_ignore_terms. + """ + + transcribe_on_disabled_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + When interruptions are disabled, still transcribe what the user says so it can carry into the next turn. When off, user speech during a non-interruptible turn is ignored and won't trigger a turn. + """ + + soft_timeout_config: typing.Optional[SoftTimeoutConfigWorkflowOverride] = pydantic.Field(default=None) + """ + Configuration for soft timeout functionality. Provides immediate feedback during longer LLM responses. + """ + + 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/data/src/elevenlabs/types/turn_detection_type.py b/data/src/elevenlabs/types/turn_detection_type.py new file mode 100644 index 0000000000000000000000000000000000000000..48ceda0d1dcc299d504cd4c9658660dbaa26c428 --- /dev/null +++ b/data/src/elevenlabs/types/turn_detection_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TurnDetectionType = typing.Union[typing.Literal["semantic_vad", "server_vad"], typing.Any] diff --git a/data/src/elevenlabs/types/turn_eagerness.py b/data/src/elevenlabs/types/turn_eagerness.py new file mode 100644 index 0000000000000000000000000000000000000000..f1d566ba368588be4a0afac85dea93cfd520d4ee --- /dev/null +++ b/data/src/elevenlabs/types/turn_eagerness.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TurnEagerness = typing.Union[typing.Literal["patient", "normal", "eager"], typing.Any] diff --git a/data/src/elevenlabs/types/turn_mode.py b/data/src/elevenlabs/types/turn_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..a82a3a3d32bd98dd23e32d48ad65f486eda0cc31 --- /dev/null +++ b/data/src/elevenlabs/types/turn_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TurnMode = typing.Union[typing.Literal["silence", "turn"], typing.Any] diff --git a/data/src/elevenlabs/types/turn_model.py b/data/src/elevenlabs/types/turn_model.py new file mode 100644 index 0000000000000000000000000000000000000000..f724a4f51d658b3fc018361910cb46297cda861e --- /dev/null +++ b/data/src/elevenlabs/types/turn_model.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TurnModel = typing.Union[typing.Literal["turn_v2", "turn_v3"], typing.Any] diff --git a/data/src/elevenlabs/types/twilio_answered_by.py b/data/src/elevenlabs/types/twilio_answered_by.py new file mode 100644 index 0000000000000000000000000000000000000000..06ab6af00749aaf7e646955cf184421c04cf9308 --- /dev/null +++ b/data/src/elevenlabs/types/twilio_answered_by.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TwilioAnsweredBy = typing.Union[ + typing.Literal[ + "human", "fax", "unknown", "machine_start", "machine_end_beep", "machine_end_silence", "machine_end_other" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/twilio_edge_location.py b/data/src/elevenlabs/types/twilio_edge_location.py new file mode 100644 index 0000000000000000000000000000000000000000..03f010799c2f17f2301b13c6e26a54eccbc5a7e8 --- /dev/null +++ b/data/src/elevenlabs/types/twilio_edge_location.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TwilioEdgeLocation = typing.Union[ + typing.Literal[ + "ashburn", "dublin", "frankfurt", "sao-paulo", "singapore", "sydney", "tokyo", "umatilla", "roaming" + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/twilio_machine_detection_action.py b/data/src/elevenlabs/types/twilio_machine_detection_action.py new file mode 100644 index 0000000000000000000000000000000000000000..d77e82d71fb6aa32ff6a6ca98a80d83bbfcc88e2 --- /dev/null +++ b/data/src/elevenlabs/types/twilio_machine_detection_action.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TwilioMachineDetectionAction = typing.Literal["hang_up"] diff --git a/data/src/elevenlabs/types/twilio_machine_detection_config.py b/data/src/elevenlabs/types/twilio_machine_detection_config.py new file mode 100644 index 0000000000000000000000000000000000000000..1f4842a82350254993d4e2f7d6429878ad8bbc01 --- /dev/null +++ b/data/src/elevenlabs/types/twilio_machine_detection_config.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .twilio_machine_detection_mode import TwilioMachineDetectionMode +from .twilio_machine_detection_rule import TwilioMachineDetectionRule + + +class TwilioMachineDetectionConfig(UncheckedBaseModel): + """ + How to run Twilio's carrier-level answering machine detection (AMD) on a call. + """ + + mode: typing.Optional[TwilioMachineDetectionMode] = pydantic.Field(default=None) + """ + How thorough the detection should be. `enable` returns a verdict as soon as Twilio can tell a human from a machine. `detect_message_end` also waits for the voicemail greeting to finish, which is what produces the `machine_end_*` verdicts, but returns a result later. + """ + + actions: typing.Optional[typing.List[TwilioMachineDetectionRule]] = pydantic.Field(default=None) + """ + Actions to take on the call per AMD verdict. Each action can appear in at most one rule, so list all of its verdicts together. Verdicts without a rule leave the call running. + """ + + 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/data/src/elevenlabs/types/twilio_machine_detection_mode.py b/data/src/elevenlabs/types/twilio_machine_detection_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..b253d34bc79a901336c8d66cdcc3f8f1e55d998c --- /dev/null +++ b/data/src/elevenlabs/types/twilio_machine_detection_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TwilioMachineDetectionMode = typing.Union[typing.Literal["enable", "detect_message_end"], typing.Any] diff --git a/data/src/elevenlabs/types/twilio_machine_detection_rule.py b/data/src/elevenlabs/types/twilio_machine_detection_rule.py new file mode 100644 index 0000000000000000000000000000000000000000..189a48864454ef9bc208de2ae17c70e04c2f5afc --- /dev/null +++ b/data/src/elevenlabs/types/twilio_machine_detection_rule.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .twilio_answered_by import TwilioAnsweredBy +from .twilio_machine_detection_action import TwilioMachineDetectionAction + + +class TwilioMachineDetectionRule(UncheckedBaseModel): + """ + Action to take on a live call for the given AMD verdicts. + """ + + action: TwilioMachineDetectionAction = "hang_up" + answered_by: typing.List[TwilioAnsweredBy] = pydantic.Field() + """ + Verdicts that trigger the action. + """ + + 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/data/src/elevenlabs/types/twilio_outbound_call_response.py b/data/src/elevenlabs/types/twilio_outbound_call_response.py new file mode 100644 index 0000000000000000000000000000000000000000..a41488bf59e1664de9e65364af33db86ebf4f927 --- /dev/null +++ b/data/src/elevenlabs/types/twilio_outbound_call_response.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TwilioOutboundCallResponse(UncheckedBaseModel): + success: bool + message: str + conversation_id: typing.Optional[str] = None + call_sid: typing_extensions.Annotated[ + typing.Optional[str], FieldMetadata(alias="callSid"), pydantic.Field(alias="callSid") + ] = 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/data/src/elevenlabs/types/twilio_region_id.py b/data/src/elevenlabs/types/twilio_region_id.py new file mode 100644 index 0000000000000000000000000000000000000000..993d8a6fa21213b42d93b85d44936d7e401ca066 --- /dev/null +++ b/data/src/elevenlabs/types/twilio_region_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TwilioRegionId = typing.Union[typing.Literal["us1", "ie1", "au1"], typing.Any] diff --git a/data/src/elevenlabs/types/txt_export_options.py b/data/src/elevenlabs/types/txt_export_options.py new file mode 100644 index 0000000000000000000000000000000000000000..914a768d63dd1c32db805e6a284fd42220909624 --- /dev/null +++ b/data/src/elevenlabs/types/txt_export_options.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class TxtExportOptions(UncheckedBaseModel): + max_characters_per_line: typing.Optional[int] = None + include_speakers: typing.Optional[bool] = None + include_timestamps: typing.Optional[bool] = None + segment_on_silence_longer_than_s: typing.Optional[float] = None + max_segment_duration_s: typing.Optional[float] = None + max_segment_chars: typing.Optional[int] = 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/data/src/elevenlabs/types/unit_test_run_response_model.py b/data/src/elevenlabs/types/unit_test_run_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c0c5a882a5c03f3bb3586d6aa025fd5366299614 --- /dev/null +++ b/data/src/elevenlabs/types/unit_test_run_response_model.py @@ -0,0 +1,57 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_charging_common_model import ConversationChargingCommonModel +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from .test_condition_result_common_model import TestConditionResultCommonModel +from .test_run_metadata import TestRunMetadata +from .test_run_status import TestRunStatus +from .unit_test_run_response_model_test_info import UnitTestRunResponseModelTestInfo + + +class UnitTestRunResponseModel(UncheckedBaseModel): + test_run_id: str + test_info: typing.Optional[UnitTestRunResponseModelTestInfo] = None + test_invocation_id: str + agent_id: str + branch_id: typing.Optional[str] = None + version_id: typing.Optional[str] = None + ran_against_draft: typing.Optional[bool] = None + workflow_node_id: typing.Optional[str] = None + status: TestRunStatus + agent_responses: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + test_id: str + test_name: typing.Optional[str] = None + condition_result: typing.Optional[TestConditionResultCommonModel] = None + last_updated_at_unix: typing.Optional[int] = None + metadata: typing.Optional[TestRunMetadata] = None + root_folder_id: typing.Optional[str] = None + root_folder_name: typing.Optional[str] = None + environment: typing.Optional[str] = None + credits_used: typing.Optional[int] = pydantic.Field(default=None) + """ + Credits billed for this test run. None for runs created before cost tracking. + """ + + charging: typing.Optional[ConversationChargingCommonModel] = pydantic.Field(default=None) + """ + Finalized billing and provider-usage breakdown for this test run. + """ + + 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 + + +update_forward_refs(UnitTestRunResponseModel) diff --git a/data/src/elevenlabs/types/unit_test_run_response_model_test_info.py b/data/src/elevenlabs/types/unit_test_run_response_model_test_info.py new file mode 100644 index 0000000000000000000000000000000000000000..f63e962ea45c077620c8726be74595098b0f346e --- /dev/null +++ b/data/src/elevenlabs/types/unit_test_run_response_model_test_info.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .agent_failure_response_example import AgentFailureResponseExample +from .agent_successful_response_example import AgentSuccessfulResponseExample +from .conversation_history_transcript_common_model_output import ConversationHistoryTranscriptCommonModelOutput +from .conversation_initiation_source import ConversationInitiationSource +from .llm import Llm +from .simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from .test_from_conversation_metadata_output import TestFromConversationMetadataOutput +from .tool_response_mock_config_output import ToolResponseMockConfigOutput +from .unit_test_tool_call_evaluation_model_output import UnitTestToolCallEvaluationModelOutput + + +class UnitTestRunResponseModelTestInfo_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = None + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = 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 + + +class UnitTestRunResponseModelTestInfo_Simulation(UncheckedBaseModel): + type: typing.Literal["simulation"] = "simulation" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + success_condition: typing.Optional[str] = None + success_conditions: typing.Optional[typing.List[str]] = None + simulation_scenario: typing.Optional[str] = None + simulation_max_turns: typing.Optional[int] = None + simulation_environment: typing.Optional[str] = None + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = None + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigOutput]]] = None + evaluation_model: typing.Optional[Llm] = None + simulated_user_model: typing.Optional[Llm] = 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 + + +class UnitTestRunResponseModelTestInfo_Tool(UncheckedBaseModel): + type: typing.Literal["tool"] = "tool" + from_conversation_metadata: typing.Optional[TestFromConversationMetadataOutput] = None + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = None + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelOutput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = None + environment: typing.Optional[str] = None + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelOutput] = None + check_any_tool_matches: 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 + + +UnitTestRunResponseModelTestInfo = typing_extensions.Annotated[ + typing.Union[ + UnitTestRunResponseModelTestInfo_Llm, + UnitTestRunResponseModelTestInfo_Simulation, + UnitTestRunResponseModelTestInfo_Tool, + ], + UnionMetadata(discriminant="type"), +] +update_forward_refs(UnitTestRunResponseModelTestInfo_Llm) +update_forward_refs(UnitTestRunResponseModelTestInfo_Simulation) +update_forward_refs(UnitTestRunResponseModelTestInfo_Tool) diff --git a/data/src/elevenlabs/types/unit_test_summary_response_model.py b/data/src/elevenlabs/types/unit_test_summary_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d0a81ce43073e706d586ec3037008cd59993bdf1 --- /dev/null +++ b/data/src/elevenlabs/types/unit_test_summary_response_model.py @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_test_entity_type import AgentTestEntityType +from .agent_test_folder_path_segment_response_model import AgentTestFolderPathSegmentResponseModel +from .conversation_initiation_source import ConversationInitiationSource +from .resource_access_info import ResourceAccessInfo +from .test_type import TestType + + +class UnitTestSummaryResponseModel(UncheckedBaseModel): + id: str = pydantic.Field() + """ + The ID of the test + """ + + name: str = pydantic.Field() + """ + Name of the test + """ + + access_info: typing.Optional[ResourceAccessInfo] = pydantic.Field(default=None) + """ + The access information of the test + """ + + created_at_unix_secs: int = pydantic.Field() + """ + Creation time of the test in unix seconds + """ + + last_updated_at_unix_secs: int = pydantic.Field() + """ + Last update time of the test in unix seconds + """ + + type: TestType = pydantic.Field() + """ + Type of the test or entity + """ + + entity_type: typing.Optional[AgentTestEntityType] = pydantic.Field(default=None) + """ + The type of entity (test or folder) + """ + + folder_parent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder + """ + + folder_path: typing.Optional[typing.List[AgentTestFolderPathSegmentResponseModel]] = pydantic.Field(default=None) + """ + The folder path segments from root to this entity + """ + + children_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Number of direct children (tests and subfolders) for folders only + """ + + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Channel the test simulates the conversation as. Null for folders or default behavior. + """ + + 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/data/src/elevenlabs/types/unit_test_tool_call_evaluation_model_input.py b/data/src/elevenlabs/types/unit_test_tool_call_evaluation_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..43be869d329a7f16280e22671166711efe3e2a57 --- /dev/null +++ b/data/src/elevenlabs/types/unit_test_tool_call_evaluation_model_input.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .referenced_tool_common_model import ReferencedToolCommonModel +from .unit_test_tool_call_parameter import UnitTestToolCallParameter +from .unit_test_workflow_node_transition_evaluation_node_id import UnitTestWorkflowNodeTransitionEvaluationNodeId + + +class UnitTestToolCallEvaluationModelInput(UncheckedBaseModel): + parameters: typing.Optional[typing.List[UnitTestToolCallParameter]] = pydantic.Field(default=None) + """ + Parameters to evaluate for the agent's tool call. If empty, the tool call parameters are not evaluated. + """ + + referenced_tool: typing.Optional[ReferencedToolCommonModel] = pydantic.Field(default=None) + """ + The tool to evaluate a call against. + """ + + verify_absence: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to verify that the tool was NOT called. + """ + + workflow_node_transition: typing.Optional[UnitTestWorkflowNodeTransitionEvaluationNodeId] = pydantic.Field( + default=None + ) + """ + Configuration for testing workflow node transitions. When set, the test will verify the agent transitions to the specified workflow node. + """ + + 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/data/src/elevenlabs/types/unit_test_tool_call_evaluation_model_output.py b/data/src/elevenlabs/types/unit_test_tool_call_evaluation_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..407c9e5f67f08f351046cd147c8d7fc0f987c07e --- /dev/null +++ b/data/src/elevenlabs/types/unit_test_tool_call_evaluation_model_output.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .referenced_tool_common_model import ReferencedToolCommonModel +from .unit_test_tool_call_parameter import UnitTestToolCallParameter +from .unit_test_workflow_node_transition_evaluation_node_id import UnitTestWorkflowNodeTransitionEvaluationNodeId + + +class UnitTestToolCallEvaluationModelOutput(UncheckedBaseModel): + parameters: typing.Optional[typing.List[UnitTestToolCallParameter]] = pydantic.Field(default=None) + """ + Parameters to evaluate for the agent's tool call. If empty, the tool call parameters are not evaluated. + """ + + referenced_tool: typing.Optional[ReferencedToolCommonModel] = pydantic.Field(default=None) + """ + The tool to evaluate a call against. + """ + + verify_absence: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to verify that the tool was NOT called. + """ + + workflow_node_transition: typing.Optional[UnitTestWorkflowNodeTransitionEvaluationNodeId] = pydantic.Field( + default=None + ) + """ + Configuration for testing workflow node transitions. When set, the test will verify the agent transitions to the specified workflow node. + """ + + 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/data/src/elevenlabs/types/unit_test_tool_call_parameter.py b/data/src/elevenlabs/types/unit_test_tool_call_parameter.py new file mode 100644 index 0000000000000000000000000000000000000000..c82fe8ed9c5436efa144f7921163701c69e0825a --- /dev/null +++ b/data/src/elevenlabs/types/unit_test_tool_call_parameter.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .unit_test_tool_call_parameter_eval import UnitTestToolCallParameterEval + + +class UnitTestToolCallParameter(UncheckedBaseModel): + eval: UnitTestToolCallParameterEval + path: 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/data/src/elevenlabs/types/unit_test_tool_call_parameter_eval.py b/data/src/elevenlabs/types/unit_test_tool_call_parameter_eval.py new file mode 100644 index 0000000000000000000000000000000000000000..99ffb0b9bae0300955a3ef2301340df6f2a83101 --- /dev/null +++ b/data/src/elevenlabs/types/unit_test_tool_call_parameter_eval.py @@ -0,0 +1,76 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class UnitTestToolCallParameterEval_Anything(UncheckedBaseModel): + type: typing.Literal["anything"] = "anything" + + 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 + + +class UnitTestToolCallParameterEval_Exact(UncheckedBaseModel): + type: typing.Literal["exact"] = "exact" + expected_value: 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 + + +class UnitTestToolCallParameterEval_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + description: 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 + + +class UnitTestToolCallParameterEval_Regex(UncheckedBaseModel): + type: typing.Literal["regex"] = "regex" + pattern: 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 + + +UnitTestToolCallParameterEval = typing_extensions.Annotated[ + typing.Union[ + UnitTestToolCallParameterEval_Anything, + UnitTestToolCallParameterEval_Exact, + UnitTestToolCallParameterEval_Llm, + UnitTestToolCallParameterEval_Regex, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/unit_test_workflow_node_transition_evaluation_node_id.py b/data/src/elevenlabs/types/unit_test_workflow_node_transition_evaluation_node_id.py new file mode 100644 index 0000000000000000000000000000000000000000..70e25cfd417997f35f9919ae72b62c11f395e008 --- /dev/null +++ b/data/src/elevenlabs/types/unit_test_workflow_node_transition_evaluation_node_id.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UnitTestWorkflowNodeTransitionEvaluationNodeId(UncheckedBaseModel): + type: typing.Optional[typing.Literal["node_id"]] = None + agent_id: str = pydantic.Field() + """ + The ID of the agent whose workflow contains the target node. + """ + + target_node_id: str = pydantic.Field() + """ + The ID of the workflow node that the agent should transition to. + """ + + 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/data/src/elevenlabs/types/update_agent_config_params.py b/data/src/elevenlabs/types/update_agent_config_params.py new file mode 100644 index 0000000000000000000000000000000000000000..c25a2057125c4251073b534b53f8ea700b3b3ac4 --- /dev/null +++ b/data/src/elevenlabs/types/update_agent_config_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateAgentConfigParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_agent_config"]] = 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/data/src/elevenlabs/types/update_agent_procedure_params.py b/data/src/elevenlabs/types/update_agent_procedure_params.py new file mode 100644 index 0000000000000000000000000000000000000000..e64e8497a39fd888f2df920d2a29110c5ee6bd8c --- /dev/null +++ b/data/src/elevenlabs/types/update_agent_procedure_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateAgentProcedureParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_agent_procedure"]] = 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/data/src/elevenlabs/types/update_agent_rule_params.py b/data/src/elevenlabs/types/update_agent_rule_params.py new file mode 100644 index 0000000000000000000000000000000000000000..871b4b215ea4805e3408f11bc53f2fd6e2f7a6cf --- /dev/null +++ b/data/src/elevenlabs/types/update_agent_rule_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateAgentRuleParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_agent_rule"]] = 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/data/src/elevenlabs/types/update_asset_params.py b/data/src/elevenlabs/types/update_asset_params.py new file mode 100644 index 0000000000000000000000000000000000000000..5b37cc1d17919b35e6fd18348c8d82070ac30fd7 --- /dev/null +++ b/data/src/elevenlabs/types/update_asset_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateAssetParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_asset"]] = 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/data/src/elevenlabs/types/update_audio_native_project_request.py b/data/src/elevenlabs/types/update_audio_native_project_request.py new file mode 100644 index 0000000000000000000000000000000000000000..bda627d4a3a2786daf16bc4d289e685db7e69f47 --- /dev/null +++ b/data/src/elevenlabs/types/update_audio_native_project_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateAudioNativeProjectRequest = typing.Any diff --git a/data/src/elevenlabs/types/update_basic_auth_request.py b/data/src/elevenlabs/types/update_basic_auth_request.py new file mode 100644 index 0000000000000000000000000000000000000000..813bed1b0340693d96fe2da9e5b03762b3013480 --- /dev/null +++ b/data/src/elevenlabs/types/update_basic_auth_request.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateBasicAuthRequest(UncheckedBaseModel): + provider: typing.Optional[str] = None + username: typing.Optional[str] = None + password: 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/data/src/elevenlabs/types/update_bearer_auth_request.py b/data/src/elevenlabs/types/update_bearer_auth_request.py new file mode 100644 index 0000000000000000000000000000000000000000..2af084d70987df4363a174e5738150dc03d7cfc6 --- /dev/null +++ b/data/src/elevenlabs/types/update_bearer_auth_request.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateBearerAuthRequest(UncheckedBaseModel): + provider: typing.Optional[str] = None + token: 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/data/src/elevenlabs/types/update_booking_page_appearance_params.py b/data/src/elevenlabs/types/update_booking_page_appearance_params.py new file mode 100644 index 0000000000000000000000000000000000000000..a8c77b7ea4a11571100b2a9faf36698b3610001a --- /dev/null +++ b/data/src/elevenlabs/types/update_booking_page_appearance_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateBookingPageAppearanceParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_booking_page_appearance"]] = 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/data/src/elevenlabs/types/update_booking_page_settings_params.py b/data/src/elevenlabs/types/update_booking_page_settings_params.py new file mode 100644 index 0000000000000000000000000000000000000000..9453086cc4486fff6651db978a56bb61225e73ee --- /dev/null +++ b/data/src/elevenlabs/types/update_booking_page_settings_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateBookingPageSettingsParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_booking_page_settings"]] = 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/data/src/elevenlabs/types/update_business_info_params.py b/data/src/elevenlabs/types/update_business_info_params.py new file mode 100644 index 0000000000000000000000000000000000000000..ca4989ba247e26c216d6bd5e4d325a25d00011b3 --- /dev/null +++ b/data/src/elevenlabs/types/update_business_info_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateBusinessInfoParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_business_info"]] = 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/data/src/elevenlabs/types/update_calendar_event_params.py b/data/src/elevenlabs/types/update_calendar_event_params.py new file mode 100644 index 0000000000000000000000000000000000000000..29edc702081f6ef78c550f15f3cd119dd37d3311 --- /dev/null +++ b/data/src/elevenlabs/types/update_calendar_event_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateCalendarEventParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_calendar_event"]] = 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/data/src/elevenlabs/types/update_chapter_request.py b/data/src/elevenlabs/types/update_chapter_request.py new file mode 100644 index 0000000000000000000000000000000000000000..aa90613520547ef010a86ad363a62915554c1e76 --- /dev/null +++ b/data/src/elevenlabs/types/update_chapter_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateChapterRequest = typing.Any diff --git a/data/src/elevenlabs/types/update_client_params.py b/data/src/elevenlabs/types/update_client_params.py new file mode 100644 index 0000000000000000000000000000000000000000..0e4c6c5a0f259cf9b39b2190e9da235c8c8e1940 --- /dev/null +++ b/data/src/elevenlabs/types/update_client_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateClientParams(UncheckedBaseModel): + """ + Update an existing client's information. + """ + + smb_tool_type: typing.Optional[typing.Literal["update_client"]] = 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/data/src/elevenlabs/types/update_group_session_seats_params.py b/data/src/elevenlabs/types/update_group_session_seats_params.py new file mode 100644 index 0000000000000000000000000000000000000000..2fc4cda09e112e567cd6376285022df624dc5364 --- /dev/null +++ b/data/src/elevenlabs/types/update_group_session_seats_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateGroupSessionSeatsParams(UncheckedBaseModel): + """ + Change the seat count of an existing group session registration. + """ + + smb_tool_type: typing.Optional[typing.Literal["update_group_session_seats"]] = 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/data/src/elevenlabs/types/update_holiday_params.py b/data/src/elevenlabs/types/update_holiday_params.py new file mode 100644 index 0000000000000000000000000000000000000000..ebe576a43a03ff6148cfe64ad3475426fe9d4ef9 --- /dev/null +++ b/data/src/elevenlabs/types/update_holiday_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateHolidayParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_holiday"]] = 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/data/src/elevenlabs/types/update_location_params.py b/data/src/elevenlabs/types/update_location_params.py new file mode 100644 index 0000000000000000000000000000000000000000..0e7dde03227c194e7bcf4256c5c6233d2a3f1132 --- /dev/null +++ b/data/src/elevenlabs/types/update_location_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateLocationParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_location"]] = 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/data/src/elevenlabs/types/update_o_auth_2_client_creds_request.py b/data/src/elevenlabs/types/update_o_auth_2_client_creds_request.py new file mode 100644 index 0000000000000000000000000000000000000000..60ef9b6fecb2c4e2d270f3716e74542e451559df --- /dev/null +++ b/data/src/elevenlabs/types/update_o_auth_2_client_creds_request.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateOAuth2ClientCredsRequest(UncheckedBaseModel): + provider: typing.Optional[str] = None + client_id: typing.Optional[str] = None + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None + basic_auth_in_header: typing.Optional[bool] = None + client_secret: typing.Optional[str] = None + custom_headers: 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/data/src/elevenlabs/types/update_o_auth_2_jwt_request.py b/data/src/elevenlabs/types/update_o_auth_2_jwt_request.py new file mode 100644 index 0000000000000000000000000000000000000000..c91120823dcd1fb7bbd83382fd8fa2313bdf82a1 --- /dev/null +++ b/data/src/elevenlabs/types/update_o_auth_2_jwt_request.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .update_o_auth_2_jwt_request_algorithm import UpdateOAuth2JwtRequestAlgorithm +from .update_o_auth_2_jwt_request_token_response_field import UpdateOAuth2JwtRequestTokenResponseField + + +class UpdateOAuth2JwtRequest(UncheckedBaseModel): + provider: typing.Optional[str] = None + algorithm: typing.Optional[UpdateOAuth2JwtRequestAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: typing.Optional[str] = None + audience: typing.Optional[str] = None + subject: typing.Optional[str] = None + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None + scopes: typing.Optional[typing.List[str]] = None + token_response_field: typing.Optional[UpdateOAuth2JwtRequestTokenResponseField] = None + secret_key: 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/data/src/elevenlabs/types/update_o_auth_2_jwt_request_algorithm.py b/data/src/elevenlabs/types/update_o_auth_2_jwt_request_algorithm.py new file mode 100644 index 0000000000000000000000000000000000000000..8914f4d148558c4e51284a52f3c5f1830b94cc1d --- /dev/null +++ b/data/src/elevenlabs/types/update_o_auth_2_jwt_request_algorithm.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateOAuth2JwtRequestAlgorithm = typing.Union[ + typing.Literal["HS256", "HS384", "HS512", "RS256", "RS384", "RS512"], typing.Any +] diff --git a/data/src/elevenlabs/types/update_o_auth_2_jwt_request_token_response_field.py b/data/src/elevenlabs/types/update_o_auth_2_jwt_request_token_response_field.py new file mode 100644 index 0000000000000000000000000000000000000000..f1034bc34553ac80557f98c81639b521b2132636 --- /dev/null +++ b/data/src/elevenlabs/types/update_o_auth_2_jwt_request_token_response_field.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateOAuth2JwtRequestTokenResponseField = typing.Union[typing.Literal["access_token", "id_token"], typing.Any] diff --git a/data/src/elevenlabs/types/update_order_params.py b/data/src/elevenlabs/types/update_order_params.py new file mode 100644 index 0000000000000000000000000000000000000000..8e57b547b492e84d97e61babf4ceed0a9c538082 --- /dev/null +++ b/data/src/elevenlabs/types/update_order_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateOrderParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_order"]] = 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/data/src/elevenlabs/types/update_order_request.py b/data/src/elevenlabs/types/update_order_request.py new file mode 100644 index 0000000000000000000000000000000000000000..61ca1c722f4d0b2d0ac1f62abd3a8c93f97973c5 --- /dev/null +++ b/data/src/elevenlabs/types/update_order_request.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateOrderRequest(UncheckedBaseModel): + name: str = pydantic.Field() + """ + The new name for the order. + """ + + 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/data/src/elevenlabs/types/update_order_response.py b/data/src/elevenlabs/types/update_order_response.py new file mode 100644 index 0000000000000000000000000000000000000000..0db03948fe7eb809a6921a43b2b3183e92bcabfc --- /dev/null +++ b/data/src/elevenlabs/types/update_order_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateOrderResponse(UncheckedBaseModel): + name: str = pydantic.Field() + """ + The updated order name. + """ + + 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/data/src/elevenlabs/types/update_product_params.py b/data/src/elevenlabs/types/update_product_params.py new file mode 100644 index 0000000000000000000000000000000000000000..d741828a8a1665c7eb30e197e57ed5299b7b5148 --- /dev/null +++ b/data/src/elevenlabs/types/update_product_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateProductParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_product"]] = 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/data/src/elevenlabs/types/update_project_request.py b/data/src/elevenlabs/types/update_project_request.py new file mode 100644 index 0000000000000000000000000000000000000000..606d3e189f617b2398c9d45e0779936fd045585b --- /dev/null +++ b/data/src/elevenlabs/types/update_project_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdateProjectRequest = typing.Any diff --git a/data/src/elevenlabs/types/update_pronunciation_dictionaries_request.py b/data/src/elevenlabs/types/update_pronunciation_dictionaries_request.py new file mode 100644 index 0000000000000000000000000000000000000000..a5848f6937a2e942ede8eab4a02c3ce6accfb40f --- /dev/null +++ b/data/src/elevenlabs/types/update_pronunciation_dictionaries_request.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UpdatePronunciationDictionariesRequest = typing.Any diff --git a/data/src/elevenlabs/types/update_response_unit_test_request.py b/data/src/elevenlabs/types/update_response_unit_test_request.py new file mode 100644 index 0000000000000000000000000000000000000000..b6b48d914e0425ce6486ab57ac180529e07c3120 --- /dev/null +++ b/data/src/elevenlabs/types/update_response_unit_test_request.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .agent_failure_response_example import AgentFailureResponseExample +from .agent_successful_response_example import AgentSuccessfulResponseExample +from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from .conversation_initiation_source import ConversationInitiationSource +from .test_from_conversation_metadata_input import TestFromConversationMetadataInput + + +class UpdateResponseUnitTestRequest(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + success_condition: typing.Optional[str] = pydantic.Field(default=None) + """ + A prompt that evaluates whether the agent's response is successful. Should return True or False. + """ + + success_examples: typing.Optional[typing.List[AgentSuccessfulResponseExample]] = pydantic.Field(default=None) + """ + Non-empty list of example responses that should be considered successful + """ + + failure_examples: typing.Optional[typing.List[AgentFailureResponseExample]] = pydantic.Field(default=None) + """ + Non-empty list of example responses that should be considered failures + """ + + name: str + parent_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder. If not provided, the test will be moved to the root level. + """ + + 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 + + +update_forward_refs(UpdateResponseUnitTestRequest) diff --git a/data/src/elevenlabs/types/update_service_params.py b/data/src/elevenlabs/types/update_service_params.py new file mode 100644 index 0000000000000000000000000000000000000000..c91c7a8eb0966b1128102dd0c2075079f4271e97 --- /dev/null +++ b/data/src/elevenlabs/types/update_service_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateServiceParams(UncheckedBaseModel): + """ + Update an existing service's information. + """ + + smb_tool_type: typing.Optional[typing.Literal["update_service"]] = 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/data/src/elevenlabs/types/update_simulation_test_request.py b/data/src/elevenlabs/types/update_simulation_test_request.py new file mode 100644 index 0000000000000000000000000000000000000000..070702c78b8bec4c903ea860909238c2716d9bc3 --- /dev/null +++ b/data/src/elevenlabs/types/update_simulation_test_request.py @@ -0,0 +1,103 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from .conversation_initiation_source import ConversationInitiationSource +from .llm import Llm +from .simulation_tool_mock_behavior_config import SimulationToolMockBehaviorConfig +from .test_from_conversation_metadata_input import TestFromConversationMetadataInput +from .tool_response_mock_config_input import ToolResponseMockConfigInput + + +class UpdateSimulationTestRequest(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + success_condition: typing.Optional[str] = pydantic.Field(default=None) + """ + Deprecated legacy single success criterion. Use success_conditions instead. At least one of success_condition or success_conditions is required. + """ + + success_conditions: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + List of prompts that evaluate whether the simulation was successful. If provided, all criteria are evaluated and merged into a final result. Capped at the maximum number of evaluation criteria. + """ + + simulation_scenario: typing.Optional[str] = pydantic.Field(default=None) + """ + Description of the simulation scenario and user persona for simulation tests. + """ + + simulation_max_turns: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of conversation turns for simulation tests. + """ + + simulation_environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to use when running this simulation test. If not provided, defaults to 'production'. + """ + + tool_mock_config: typing.Optional[SimulationToolMockBehaviorConfig] = pydantic.Field(default=None) + """ + Configuration for which tools to mock and fallback behavior. + """ + + tool_mock_overrides: typing.Optional[typing.Dict[str, typing.List[ToolResponseMockConfigInput]]] = pydantic.Field( + default=None + ) + """ + Test-specific response mocks, keyed by tool ID. Applied ahead of the tool's shared mocks and only within this test. Only take effect for tools that are mocked (see tool_mock_config). + """ + + evaluation_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model to use for evaluating simulation results. + """ + + simulated_user_model: typing.Optional[Llm] = pydantic.Field(default=None) + """ + LLM model for the simulated user. + """ + + name: str + parent_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder. If not provided, the test will be moved to the root level. + """ + + 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 + + +update_forward_refs(UpdateSimulationTestRequest) diff --git a/data/src/elevenlabs/types/update_staff_params.py b/data/src/elevenlabs/types/update_staff_params.py new file mode 100644 index 0000000000000000000000000000000000000000..03be1e72d88a9e946ed4eb00e6d7fdb2ad1ab5f1 --- /dev/null +++ b/data/src/elevenlabs/types/update_staff_params.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateStaffParams(UncheckedBaseModel): + """ + Update an existing staff member's information. + """ + + smb_tool_type: typing.Optional[typing.Literal["update_staff"]] = None + per_resource_timezones: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to offer a working_hours timezone, set from the workspace's enable_per_resource_timezones. While that is off every staff member uses the workspace timezone, so the key is not offered. + """ + + 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/data/src/elevenlabs/types/update_tool_call_unit_test_request.py b/data/src/elevenlabs/types/update_tool_call_unit_test_request.py new file mode 100644 index 0000000000000000000000000000000000000000..f982e6a64e1fe865e5241a9398ec02c1afa12d91 --- /dev/null +++ b/data/src/elevenlabs/types/update_tool_call_unit_test_request.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_common_model_input import ConversationHistoryTranscriptCommonModelInput +from .conversation_initiation_source import ConversationInitiationSource +from .test_from_conversation_metadata_input import TestFromConversationMetadataInput +from .unit_test_tool_call_evaluation_model_input import UnitTestToolCallEvaluationModelInput + + +class UpdateToolCallUnitTestRequest(UncheckedBaseModel): + from_conversation_metadata: typing.Optional[TestFromConversationMetadataInput] = pydantic.Field(default=None) + """ + Metadata of a conversation this test was created from (if applicable). + """ + + dynamic_variables: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Dynamic variables to replace in the agent config during testing + """ + + chat_history: typing.Optional[typing.List[ConversationHistoryTranscriptCommonModelInput]] = None + conversation_initiation_source: typing.Optional[ConversationInitiationSource] = pydantic.Field(default=None) + """ + Simulate the test as if the conversation originated from this channel. + """ + + environment: typing.Optional[str] = pydantic.Field(default=None) + """ + The environment to resolve environment-specific variable values against when running this test (URL, headers, auth connections). If not provided, defaults to 'production'. For simulation tests, simulation_environment takes precedence when set. + """ + + tool_call_parameters: typing.Optional[UnitTestToolCallEvaluationModelInput] = pydantic.Field(default=None) + """ + How to evaluate the agent's tool call (if any). If empty, the tool call is not evaluated. + """ + + check_any_tool_matches: typing.Optional[bool] = pydantic.Field(default=None) + """ + If set to True this test will pass if any tool call returned by the LLM matches the criteria. Otherwise it will fail if more than one tool is returned by the agent. + """ + + name: str + parent_folder_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the parent folder. If not provided, the test will be moved to the root level. + """ + + 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 + + +update_forward_refs(UpdateToolCallUnitTestRequest) diff --git a/data/src/elevenlabs/types/update_transfer_rule_params.py b/data/src/elevenlabs/types/update_transfer_rule_params.py new file mode 100644 index 0000000000000000000000000000000000000000..33e68c04655aa4684d441775f66f52ec395d3674 --- /dev/null +++ b/data/src/elevenlabs/types/update_transfer_rule_params.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateTransferRuleParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["update_transfer_rule"]] = None + post_dial_digits_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to offer the post_dial_digits parameter, set from the receptionists' enable_play_keypad_touch_tone_tool config. Digits saved while that is off are dropped when the receptionist is built, so the parameter is hidden rather than accepted and ignored. + """ + + 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/data/src/elevenlabs/types/update_workspace_member_response_model.py b/data/src/elevenlabs/types/update_workspace_member_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4f5f94e55ac88ec16a491cb1361904c78037b2b4 --- /dev/null +++ b/data/src/elevenlabs/types/update_workspace_member_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UpdateWorkspaceMemberResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the workspace member update request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/upsert_order_item_request.py b/data/src/elevenlabs/types/upsert_order_item_request.py new file mode 100644 index 0000000000000000000000000000000000000000..d80b98159f5315cf3367ba900b14b8b63f0220ea --- /dev/null +++ b/data/src/elevenlabs/types/upsert_order_item_request.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .item_id import ItemId +from .order_item_request_input import OrderItemRequestInput + + +class UpsertOrderItemRequest(UncheckedBaseModel): + item: OrderItemRequestInput = pydantic.Field() + """ + The order item to add or update. + """ + + item_id: typing.Optional[ItemId] = pydantic.Field(default=None) + """ + The ID of an existing item to update. Omit to create a new item. + """ + + 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/data/src/elevenlabs/types/upsert_order_item_response.py b/data/src/elevenlabs/types/upsert_order_item_response.py new file mode 100644 index 0000000000000000000000000000000000000000..2fb75589fa0a19f0d6452431de6ac46479d15ccf --- /dev/null +++ b/data/src/elevenlabs/types/upsert_order_item_response.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .item_id import ItemId +from .quote_info import QuoteInfo + + +class UpsertOrderItemResponse(UncheckedBaseModel): + item_id: ItemId = pydantic.Field() + """ + The ID of the upserted order item. + """ + + quote: typing.Optional[QuoteInfo] = pydantic.Field(default=None) + """ + The quoted price for this item. + """ + + 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/data/src/elevenlabs/types/url_avatar.py b/data/src/elevenlabs/types/url_avatar.py new file mode 100644 index 0000000000000000000000000000000000000000..e003136779a595baaca66790f2d7fb8318681271 --- /dev/null +++ b/data/src/elevenlabs/types/url_avatar.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UrlAvatar(UncheckedBaseModel): + custom_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The custom URL of the avatar + """ + + 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/data/src/elevenlabs/types/url_model.py b/data/src/elevenlabs/types/url_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1060023c6d972ad56f0805a169936f1774effbd1 --- /dev/null +++ b/data/src/elevenlabs/types/url_model.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UrlModel(UncheckedBaseModel): + """ + OCSF URL object. + + Spec: https://schema.ocsf.io/1.6.0/objects/url + """ + + url_string: typing.Optional[str] = pydantic.Field(default=None) + """ + Full URL string + """ + + scheme: typing.Optional[str] = pydantic.Field(default=None) + """ + URL scheme (e.g., https) + """ + + hostname: typing.Optional[str] = pydantic.Field(default=None) + """ + URL hostname + """ + + port: typing.Optional[int] = pydantic.Field(default=None) + """ + URL port + """ + + path: typing.Optional[str] = pydantic.Field(default=None) + """ + URL path + """ + + query_string: typing.Optional[str] = pydantic.Field(default=None) + """ + URL query string + """ + + 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/data/src/elevenlabs/types/url_secret_auth_response.py b/data/src/elevenlabs/types/url_secret_auth_response.py new file mode 100644 index 0000000000000000000000000000000000000000..6c8ef438a17ae4e12266fa33f53ae53fe5b52833 --- /dev/null +++ b/data/src/elevenlabs/types/url_secret_auth_response.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class UrlSecretAuthResponse(UncheckedBaseModel): + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/usage_aggregation_interval.py b/data/src/elevenlabs/types/usage_aggregation_interval.py new file mode 100644 index 0000000000000000000000000000000000000000..986eee66e81e11c3311acf7692380d0e62071ca2 --- /dev/null +++ b/data/src/elevenlabs/types/usage_aggregation_interval.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UsageAggregationInterval = typing.Union[typing.Literal["hour", "day", "week", "month", "cumulative"], typing.Any] diff --git a/data/src/elevenlabs/types/usage_characters_response_model.py b/data/src/elevenlabs/types/usage_characters_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5404ccd44475d436a0cca9c9c31427ba0b5e162d --- /dev/null +++ b/data/src/elevenlabs/types/usage_characters_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UsageCharactersResponseModel(UncheckedBaseModel): + time: typing.List[int] = pydantic.Field() + """ + The time axis with unix timestamps for each day. + """ + + usage: typing.Dict[str, typing.List[float]] = pydantic.Field() + """ + The usage of each breakdown type along the time axis. + """ + + 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/data/src/elevenlabs/types/user.py b/data/src/elevenlabs/types/user.py new file mode 100644 index 0000000000000000000000000000000000000000..97dd3fef47be6521561b03f51679b23b88eaa331 --- /dev/null +++ b/data/src/elevenlabs/types/user.py @@ -0,0 +1,95 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .seat_type import SeatType +from .subscription_response import SubscriptionResponse + + +class User(UncheckedBaseModel): + user_id: str = pydantic.Field() + """ + The unique identifier of the user. + """ + + workspace_id: str = pydantic.Field() + """ + The unique identifier of the workspace this user's API key belongs to. + """ + + subscription: SubscriptionResponse = pydantic.Field() + """ + Details of the user's subscription. + """ + + is_new_user: bool = pydantic.Field() + """ + Whether the user is new. This field is deprecated and will be removed in the future. Use 'created_at' instead. + """ + + can_use_delayed_payment_methods: bool = pydantic.Field() + """ + This field is deprecated and will be removed in a future major version. Instead use subscription.trust_on_invoice_creation. + """ + + is_onboarding_completed: bool = pydantic.Field() + """ + Whether the user's onboarding is completed. + """ + + is_onboarding_checklist_completed: bool = pydantic.Field() + """ + Whether the user's onboarding checklist is completed. + """ + + show_compliance_terms: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show compliance terms (ToS, Privacy Policy, biometric consent) during onboarding. Set for users signing up from the marketing site. + """ + + first_name: typing.Optional[str] = pydantic.Field(default=None) + """ + First name of the user. + """ + + is_api_key_hashed: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the user's API key is hashed. + """ + + xi_api_key_preview: typing.Optional[str] = pydantic.Field(default=None) + """ + The preview of the user's API key. + """ + + referral_link_code: typing.Optional[str] = pydantic.Field(default=None) + """ + The referral link code of the user. + """ + + partnerstack_partner_default_link: typing.Optional[str] = pydantic.Field(default=None) + """ + The Partnerstack partner default link of the user. + """ + + created_at: int = pydantic.Field() + """ + The unix timestamp of the user's creation. 0 if the user was created before the unix timestamp was added. + """ + + seat_type: SeatType = pydantic.Field() + """ + The seat type of the user. + """ + + 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/data/src/elevenlabs/types/user_access_management_activity_id.py b/data/src/elevenlabs/types/user_access_management_activity_id.py new file mode 100644 index 0000000000000000000000000000000000000000..9cf52f308253fc50e85cd03998f0dc7fecb6b658 --- /dev/null +++ b/data/src/elevenlabs/types/user_access_management_activity_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +UserAccessManagementActivityId = int diff --git a/data/src/elevenlabs/types/user_feedback.py b/data/src/elevenlabs/types/user_feedback.py new file mode 100644 index 0000000000000000000000000000000000000000..bd9762c9c90876b4fe2b2ee392fdf9b41768d637 --- /dev/null +++ b/data/src/elevenlabs/types/user_feedback.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .user_feedback_score import UserFeedbackScore + + +class UserFeedback(UncheckedBaseModel): + score: UserFeedbackScore + time_in_call_secs: int + + 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/data/src/elevenlabs/types/user_feedback_score.py b/data/src/elevenlabs/types/user_feedback_score.py new file mode 100644 index 0000000000000000000000000000000000000000..5b8c3ec26fe8bfdea4a4f8296c5f72c0c93b132e --- /dev/null +++ b/data/src/elevenlabs/types/user_feedback_score.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UserFeedbackScore = typing.Union[typing.Literal["like", "dislike"], typing.Any] diff --git a/data/src/elevenlabs/types/user_model.py b/data/src/elevenlabs/types/user_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9849cb570ed4da8936aa2807c2fb157b96589a2c --- /dev/null +++ b/data/src/elevenlabs/types/user_model.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .user_type_id import UserTypeId + + +class UserModel(UncheckedBaseModel): + """ + OCSF User object. + + Spec: https://schema.ocsf.io/1.6.0/objects/user + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + Username + """ + + uid: typing.Optional[str] = pydantic.Field(default=None) + """ + Unique user identifier + """ + + type_id: typing.Optional[UserTypeId] = pydantic.Field(default=None) + """ + Account type identifier + """ + + type: typing.Optional[str] = pydantic.Field(default=None) + """ + Account type description + """ + + email_addr: typing.Optional[str] = pydantic.Field(default=None) + """ + User email address + """ + + full_name: typing.Optional[str] = pydantic.Field(default=None) + """ + Full name of the user + """ + + domain: typing.Optional[str] = pydantic.Field(default=None) + """ + User's domain + """ + + 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/data/src/elevenlabs/types/user_transcript_payload.py b/data/src/elevenlabs/types/user_transcript_payload.py new file mode 100644 index 0000000000000000000000000000000000000000..2cc192164fe0c12702ed2993b5f1cbb1ef2fac27 --- /dev/null +++ b/data/src/elevenlabs/types/user_transcript_payload.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .transcript_message import TranscriptMessage + + +class UserTranscriptPayload(UncheckedBaseModel): + """ + Payload containing the full conversation history sent by ElevenLabs each time + the user finishes speaking. + """ + + type: typing.Literal["user_transcript"] = pydantic.Field(default="user_transcript") + """ + The message type identifier. + """ + + user_transcript: typing.List[TranscriptMessage] = pydantic.Field() + """ + Full conversation history up to and including the latest user turn, ordered + chronologically. Contains both `user` and `agent` turns. + """ + + event_id: typing.Optional[int] = pydantic.Field(default=None) + """ + Monotonically increasing identifier for this transcript event. Pass this value + back in every `agent_response` message so ElevenLabs can correlate responses and + discard any that belong to an interrupted turn. + """ + + 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/data/src/elevenlabs/types/user_type_id.py b/data/src/elevenlabs/types/user_type_id.py new file mode 100644 index 0000000000000000000000000000000000000000..0891b82c8898a7678f5cc52998523fdf52c3aeff --- /dev/null +++ b/data/src/elevenlabs/types/user_type_id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +UserTypeId = int diff --git a/data/src/elevenlabs/types/user_voice_collection_response_model.py b/data/src/elevenlabs/types/user_voice_collection_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..6012c1ddc7788d01c27c8c293795a4e2b6afcf52 --- /dev/null +++ b/data/src/elevenlabs/types/user_voice_collection_response_model.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .user_voice_collection_response_model_permission_on_resource import ( + UserVoiceCollectionResponseModelPermissionOnResource, +) + + +class UserVoiceCollectionResponseModel(UncheckedBaseModel): + collection_id: str = pydantic.Field() + """ + The ID of the voice collection. + """ + + title: str = pydantic.Field() + """ + The title of the voice collection. + """ + + icon: str = pydantic.Field() + """ + The icon of the voice collection. + """ + + permission_on_resource: UserVoiceCollectionResponseModelPermissionOnResource = pydantic.Field() + """ + The caller's access role on the voice collection. + """ + + 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/data/src/elevenlabs/types/user_voice_collection_response_model_permission_on_resource.py b/data/src/elevenlabs/types/user_voice_collection_response_model_permission_on_resource.py new file mode 100644 index 0000000000000000000000000000000000000000..e51b1e749d226f2f57124cd15a971ffbe349d4de --- /dev/null +++ b/data/src/elevenlabs/types/user_voice_collection_response_model_permission_on_resource.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UserVoiceCollectionResponseModelPermissionOnResource = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/types/users_sort_by.py b/data/src/elevenlabs/types/users_sort_by.py new file mode 100644 index 0000000000000000000000000000000000000000..825f45908653699f49d34ea85ede44843beb255a --- /dev/null +++ b/data/src/elevenlabs/types/users_sort_by.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UsersSortBy = typing.Union[ + typing.Literal["last_contact_unix_secs", "conversation_count", "average_sentiment_score"], typing.Any +] diff --git a/data/src/elevenlabs/types/utterance_response_model.py b/data/src/elevenlabs/types/utterance_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..c3fc7fda13d8a5bb5c84267894c9f3334086fa18 --- /dev/null +++ b/data/src/elevenlabs/types/utterance_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class UtteranceResponseModel(UncheckedBaseModel): + start: float = pydantic.Field() + """ + The start time of the utterance in seconds. + """ + + end: float = pydantic.Field() + """ + The end time of the utterance in seconds. + """ + + 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/data/src/elevenlabs/types/uui_transfer_config.py b/data/src/elevenlabs/types/uui_transfer_config.py new file mode 100644 index 0000000000000000000000000000000000000000..3e71e7db63377c7e484bdf09360a04bc8ecc10ab --- /dev/null +++ b/data/src/elevenlabs/types/uui_transfer_config.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .uui_transfer_config_protocol_discriminator_mode import UuiTransferConfigProtocolDiscriminatorMode + + +class UuiTransferConfig(UncheckedBaseModel): + """ + User-to-User Information envelope for SIP REFER transfers (RFC 7433). + + Outbound payloads are hex-encoded (the only encoding RFC 7433 defines). The + protocol discriminator axis lets per-platform formats (Talkdesk, Genesys, ...) + be expressed by configuration rather than scattered transfer flags. Further + axes (ASCII encoding, header name, purpose/content parameters) can be added + here without touching the transfer model. + """ + + data: str = pydantic.Field() + """ + UUI payload to send on SIP REFER transfers. Supports inline dynamic variables and is hex-encoded at transfer time. + """ + + protocol_discriminator: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional one-octet protocol discriminator (two hex digits, e.g. '00'). Required by platforms such as Genesys Cloud, which otherwise strip the first octet of the payload. Leave unset for platforms like Talkdesk that expect a bare hex payload. + """ + + protocol_discriminator_mode: typing.Optional[UuiTransferConfigProtocolDiscriminatorMode] = pydantic.Field( + default=None + ) + """ + How to attach protocol_discriminator. 'prefix' prepends the octet to the hex payload (User-to-User=XX;encoding=hex). 'pd_parameter' sends it as a separate parameter (User-to-User=;pd=XX;encoding=hex). Ignored when protocol_discriminator is unset. + """ + + 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/data/src/elevenlabs/types/uui_transfer_config_protocol_discriminator_mode.py b/data/src/elevenlabs/types/uui_transfer_config_protocol_discriminator_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..45c25e9d940887c087bef277d5a6fda9855cb773 --- /dev/null +++ b/data/src/elevenlabs/types/uui_transfer_config_protocol_discriminator_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +UuiTransferConfigProtocolDiscriminatorMode = typing.Union[typing.Literal["prefix", "pd_parameter"], typing.Any] diff --git a/data/src/elevenlabs/types/vad_config.py b/data/src/elevenlabs/types/vad_config.py new file mode 100644 index 0000000000000000000000000000000000000000..49ca3b3ad4a44beb1b03894a71386157ca85d1e5 --- /dev/null +++ b/data/src/elevenlabs/types/vad_config.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VadConfig(UncheckedBaseModel): + 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/data/src/elevenlabs/types/vad_config_workflow_override.py b/data/src/elevenlabs/types/vad_config_workflow_override.py new file mode 100644 index 0000000000000000000000000000000000000000..d6125cdae511cba6646fcf80053ddfdee030965f --- /dev/null +++ b/data/src/elevenlabs/types/vad_config_workflow_override.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VadConfigWorkflowOverride(UncheckedBaseModel): + 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/data/src/elevenlabs/types/validate_user_verification_code_params.py b/data/src/elevenlabs/types/validate_user_verification_code_params.py new file mode 100644 index 0000000000000000000000000000000000000000..33afab874448c0772c906e5df7e5878458855807 --- /dev/null +++ b/data/src/elevenlabs/types/validate_user_verification_code_params.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class ValidateUserVerificationCodeParams(UncheckedBaseModel): + smb_tool_type: typing.Optional[typing.Literal["validate_user_verification_code"]] = 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/data/src/elevenlabs/types/validation_error.py b/data/src/elevenlabs/types/validation_error.py new file mode 100644 index 0000000000000000000000000000000000000000..0438bc05d8c068581b9a95edf3baacdf46528dd9 --- /dev/null +++ b/data/src/elevenlabs/types/validation_error.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .validation_error_loc_item import ValidationErrorLocItem + + +class ValidationError(UncheckedBaseModel): + loc: typing.List[ValidationErrorLocItem] + msg: str + type: 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/data/src/elevenlabs/types/validation_error_loc_item.py b/data/src/elevenlabs/types/validation_error_loc_item.py new file mode 100644 index 0000000000000000000000000000000000000000..9a0a83fef5597edb1eb8ccd35e6f9900814cd547 --- /dev/null +++ b/data/src/elevenlabs/types/validation_error_loc_item.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +ValidationErrorLocItem = typing.Union[str, int] diff --git a/data/src/elevenlabs/types/veo_31_fast_request.py b/data/src/elevenlabs/types/veo_31_fast_request.py new file mode 100644 index 0000000000000000000000000000000000000000..24e74337f4c5ef2cf2b35040d7a63d2a89a00aa7 --- /dev/null +++ b/data/src/elevenlabs/types/veo_31_fast_request.py @@ -0,0 +1,87 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .image_reference import ImageReference +from .veo_31_fast_request_aspect_ratio import Veo31FastRequestAspectRatio +from .veo_31_fast_request_resolution import Veo31FastRequestResolution +from .veo_image_reference import VeoImageReference +from .webhook_target import WebhookTarget + + +class Veo31FastRequest(UncheckedBaseModel): + """ + Request body for the Google Veo 3.1 Fast video model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the video to generate. + """ + + negative_prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + A text description of what the video should avoid. + """ + + seed: typing.Optional[int] = pydantic.Field(default=None) + """ + A seed for reproducible generation: the same seed and inputs give similar output across generations. Omit for random. + """ + + enhance_prompt: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model may rewrite the prompt to improve results. + """ + + duration_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The duration of the output video in seconds. + """ + + aspect_ratio: typing.Optional[Veo31FastRequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output video. + """ + + resolution: typing.Optional[Veo31FastRequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output video. + """ + + generate_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to generate audio with the video. + """ + + start_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's first frame. + """ + + end_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's last frame. + """ + + images: typing.Optional[typing.List[VeoImageReference]] = pydantic.Field(default=None) + """ + Up to 3 reference images to draw subjects or style from. Cannot be combined with `start_frame`/`end_frame`, and requires the 8-second duration. + """ + + 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/data/src/elevenlabs/types/veo_31_fast_request_aspect_ratio.py b/data/src/elevenlabs/types/veo_31_fast_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..9f039fc5e5ebfce4190c7a7aa7dcd7010f3cf1f1 --- /dev/null +++ b/data/src/elevenlabs/types/veo_31_fast_request_aspect_ratio.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Veo31FastRequestAspectRatio = typing.Union[typing.Literal["16:9", "9:16"], typing.Any] diff --git a/data/src/elevenlabs/types/veo_31_fast_request_resolution.py b/data/src/elevenlabs/types/veo_31_fast_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..ef9ec6dc80eb19f5d96f1bb471dc66590acb0eb3 --- /dev/null +++ b/data/src/elevenlabs/types/veo_31_fast_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Veo31FastRequestResolution = typing.Union[typing.Literal["720p", "1080p", "4K"], typing.Any] diff --git a/data/src/elevenlabs/types/veo_31_request.py b/data/src/elevenlabs/types/veo_31_request.py new file mode 100644 index 0000000000000000000000000000000000000000..b66415b1de4ac340be52a4f7581689d3fb28310e --- /dev/null +++ b/data/src/elevenlabs/types/veo_31_request.py @@ -0,0 +1,87 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .image_reference import ImageReference +from .veo_31_request_aspect_ratio import Veo31RequestAspectRatio +from .veo_31_request_resolution import Veo31RequestResolution +from .veo_image_reference import VeoImageReference +from .webhook_target import WebhookTarget + + +class Veo31Request(UncheckedBaseModel): + """ + Request body for the Google Veo 3.1 video model. + """ + + webhook: typing.Optional[WebhookTarget] = pydantic.Field(default=None) + """ + Include to send the generation's result to the workspace's configured flows webhooks once it completes or fails. The webhook payload matches the terminal response of the corresponding GET endpoint. + """ + + prompt: str = pydantic.Field() + """ + A text description of the video to generate. + """ + + negative_prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + A text description of what the video should avoid. + """ + + seed: typing.Optional[int] = pydantic.Field(default=None) + """ + A seed for reproducible generation: the same seed and inputs give similar output across generations. Omit for random. + """ + + enhance_prompt: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the model may rewrite the prompt to improve results. + """ + + duration_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The duration of the output video in seconds. + """ + + aspect_ratio: typing.Optional[Veo31RequestAspectRatio] = pydantic.Field(default=None) + """ + The aspect ratio of the output video. + """ + + resolution: typing.Optional[Veo31RequestResolution] = pydantic.Field(default=None) + """ + The resolution of the output video. + """ + + generate_audio: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to generate audio with the video. + """ + + start_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's first frame. + """ + + end_frame: typing.Optional[ImageReference] = pydantic.Field(default=None) + """ + The image to use as the video's last frame. + """ + + images: typing.Optional[typing.List[VeoImageReference]] = pydantic.Field(default=None) + """ + Up to 3 reference images to draw subjects or style from. Cannot be combined with `start_frame`/`end_frame`, and requires the 8-second duration. + """ + + 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/data/src/elevenlabs/types/veo_31_request_aspect_ratio.py b/data/src/elevenlabs/types/veo_31_request_aspect_ratio.py new file mode 100644 index 0000000000000000000000000000000000000000..4f078b844b3e215fc8a65ccbc663871afb46218a --- /dev/null +++ b/data/src/elevenlabs/types/veo_31_request_aspect_ratio.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Veo31RequestAspectRatio = typing.Union[typing.Literal["16:9", "9:16"], typing.Any] diff --git a/data/src/elevenlabs/types/veo_31_request_resolution.py b/data/src/elevenlabs/types/veo_31_request_resolution.py new file mode 100644 index 0000000000000000000000000000000000000000..0443435a4152c6af8e63e33c825bb305c0ef1917 --- /dev/null +++ b/data/src/elevenlabs/types/veo_31_request_resolution.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Veo31RequestResolution = typing.Union[typing.Literal["720p", "1080p", "4K"], typing.Any] diff --git a/data/src/elevenlabs/types/veo_image_reference.py b/data/src/elevenlabs/types/veo_image_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..d5e47ece8c8f3e1da2231cb6251cd8b625b01e29 --- /dev/null +++ b/data/src/elevenlabs/types/veo_image_reference.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .image_reference import ImageReference +from .veo_image_reference_role import VeoImageReferenceRole + + +class VeoImageReference(UncheckedBaseModel): + """ + A reference image guiding a Veo generation, with its role. + """ + + image: ImageReference = pydantic.Field() + """ + The reference image. + """ + + role: VeoImageReferenceRole = pydantic.Field() + """ + How the model uses the image: `subject` places its subject or scene elements into the video; `style` transfers its visual style. + """ + + 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/data/src/elevenlabs/types/veo_image_reference_role.py b/data/src/elevenlabs/types/veo_image_reference_role.py new file mode 100644 index 0000000000000000000000000000000000000000..a72644a2ce3f3be7963964f68db844dfcb72532d --- /dev/null +++ b/data/src/elevenlabs/types/veo_image_reference_role.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VeoImageReferenceRole = typing.Union[typing.Literal["subject", "style"], typing.Any] diff --git a/data/src/elevenlabs/types/verbosity.py b/data/src/elevenlabs/types/verbosity.py new file mode 100644 index 0000000000000000000000000000000000000000..2a954d82adc250bc94ca0e87472dcd867adc2bca --- /dev/null +++ b/data/src/elevenlabs/types/verbosity.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Verbosity = typing.Union[typing.Literal["auto", "concise", "thorough"], typing.Any] diff --git a/data/src/elevenlabs/types/verification_attempt_response.py b/data/src/elevenlabs/types/verification_attempt_response.py new file mode 100644 index 0000000000000000000000000000000000000000..2976422783414cfd1d370316c3cdcfcc1e38699c --- /dev/null +++ b/data/src/elevenlabs/types/verification_attempt_response.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .recording_response import RecordingResponse + + +class VerificationAttemptResponse(UncheckedBaseModel): + text: str = pydantic.Field() + """ + The text of the verification attempt. + """ + + date_unix: int = pydantic.Field() + """ + The date of the verification attempt in Unix time. + """ + + accepted: bool = pydantic.Field() + """ + Whether the verification attempt was accepted. + """ + + similarity: float = pydantic.Field() + """ + The similarity of the verification attempt. + """ + + levenshtein_distance: float = pydantic.Field() + """ + The Levenshtein distance of the verification attempt. + """ + + recording: typing.Optional[RecordingResponse] = pydantic.Field(default=None) + """ + The recording of the verification attempt. + """ + + 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/data/src/elevenlabs/types/verified_voice_language_response_model.py b/data/src/elevenlabs/types/verified_voice_language_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d5f5bdae478fab10fadd288a5772bef8b3e9bfc9 --- /dev/null +++ b/data/src/elevenlabs/types/verified_voice_language_response_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VerifiedVoiceLanguageResponseModel(UncheckedBaseModel): + language: str = pydantic.Field() + """ + The language of the voice. + """ + + model_id: str = pydantic.Field() + """ + The voice's model ID. + """ + + accent: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice's accent, if applicable. + """ + + locale: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice's locale, if applicable. + """ + + preview_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice's preview URL, if applicable. + """ + + 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/data/src/elevenlabs/types/verify_pvc_voice_captcha_response_model.py b/data/src/elevenlabs/types/verify_pvc_voice_captcha_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..67abea0f152c546871446c279f0fb0a41f66a024 --- /dev/null +++ b/data/src/elevenlabs/types/verify_pvc_voice_captcha_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VerifyPvcVoiceCaptchaResponseModel(UncheckedBaseModel): + status: str = pydantic.Field() + """ + The status of the verify PVC captcha request. If the request was successful, the status will be 'ok'. Otherwise an error message with status 500 will be returned. + """ + + 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/data/src/elevenlabs/types/video_analysis.py b/data/src/elevenlabs/types/video_analysis.py new file mode 100644 index 0000000000000000000000000000000000000000..4feffc15271c95e30e0a9869c156e9f5e43e35ea --- /dev/null +++ b/data/src/elevenlabs/types/video_analysis.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .video_analysis_result import VideoAnalysisResult +from .video_analysis_status import VideoAnalysisStatus + + +class VideoAnalysis(UncheckedBaseModel): + status: VideoAnalysisStatus + data: typing.Optional[VideoAnalysisResult] = None + updated_at_ms: typing.Optional[int] = 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/data/src/elevenlabs/types/video_analysis_result.py b/data/src/elevenlabs/types/video_analysis_result.py new file mode 100644 index 0000000000000000000000000000000000000000..f8aafd5b095e0727090cf9b50b5fecc68d81644e --- /dev/null +++ b/data/src/elevenlabs/types/video_analysis_result.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .video_key_moment import VideoKeyMoment +from .video_segment import VideoSegment +from .video_subject import VideoSubject + + +class VideoAnalysisResult(UncheckedBaseModel): + title: str + description: str + content_type: typing.Optional[str] = None + overall_pacing: typing.Optional[str] = None + subjects: typing.Optional[typing.List[VideoSubject]] = None + segments: typing.Optional[typing.List[VideoSegment]] = None + key_moments: typing.Optional[typing.List[VideoKeyMoment]] = 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/data/src/elevenlabs/types/video_analysis_status.py b/data/src/elevenlabs/types/video_analysis_status.py new file mode 100644 index 0000000000000000000000000000000000000000..dd296513a8cfe7c4ab1f57a317264282a7092893 --- /dev/null +++ b/data/src/elevenlabs/types/video_analysis_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VideoAnalysisStatus = typing.Union[typing.Literal["processing", "completed", "failed"], typing.Any] diff --git a/data/src/elevenlabs/types/video_generation_request.py b/data/src/elevenlabs/types/video_generation_request.py new file mode 100644 index 0000000000000000000000000000000000000000..632e9597939d1cb85fd095293f06e5b0aefa9da6 --- /dev/null +++ b/data/src/elevenlabs/types/video_generation_request.py @@ -0,0 +1,210 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .audio_reference import AudioReference +from .bytedance_seedance_2_fast_request_aspect_ratio import BytedanceSeedance2FastRequestAspectRatio +from .bytedance_seedance_2_fast_request_resolution import BytedanceSeedance2FastRequestResolution +from .bytedance_seedance_2_mini_request_aspect_ratio import BytedanceSeedance2MiniRequestAspectRatio +from .bytedance_seedance_2_mini_request_resolution import BytedanceSeedance2MiniRequestResolution +from .bytedance_seedance_2_request_aspect_ratio import BytedanceSeedance2RequestAspectRatio +from .bytedance_seedance_2_request_resolution import BytedanceSeedance2RequestResolution +from .bytedance_seedance_25_request_aspect_ratio import BytedanceSeedance25RequestAspectRatio +from .bytedance_seedance_25_request_resolution import BytedanceSeedance25RequestResolution +from .creatify_aurora_request_resolution import CreatifyAuroraRequestResolution +from .image_reference import ImageReference +from .veo_31_fast_request_aspect_ratio import Veo31FastRequestAspectRatio +from .veo_31_fast_request_resolution import Veo31FastRequestResolution +from .veo_31_request_aspect_ratio import Veo31RequestAspectRatio +from .veo_31_request_resolution import Veo31RequestResolution +from .veo_image_reference import VeoImageReference +from .video_reference import VideoReference +from .webhook_target import WebhookTarget + + +class VideoGenerationRequest_BytedanceSeedanceV2(UncheckedBaseModel): + model_id: typing.Literal["bytedance-seedance-v2"] = "bytedance-seedance-v2" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + aspect_ratio: typing.Optional[BytedanceSeedance2RequestAspectRatio] = None + duration_secs: typing.Optional[int] = None + seed: typing.Optional[int] = None + generate_audio: typing.Optional[bool] = None + start_frame: typing.Optional[ImageReference] = None + end_frame: typing.Optional[ImageReference] = None + images: typing.Optional[typing.List[ImageReference]] = None + videos: typing.Optional[typing.List[VideoReference]] = None + audios: typing.Optional[typing.List[AudioReference]] = None + resolution: typing.Optional[BytedanceSeedance2RequestResolution] = 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 + + +class VideoGenerationRequest_BytedanceSeedanceV2Fast(UncheckedBaseModel): + model_id: typing.Literal["bytedance-seedance-v2-fast"] = "bytedance-seedance-v2-fast" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + aspect_ratio: typing.Optional[BytedanceSeedance2FastRequestAspectRatio] = None + duration_secs: typing.Optional[int] = None + seed: typing.Optional[int] = None + generate_audio: typing.Optional[bool] = None + start_frame: typing.Optional[ImageReference] = None + end_frame: typing.Optional[ImageReference] = None + images: typing.Optional[typing.List[ImageReference]] = None + videos: typing.Optional[typing.List[VideoReference]] = None + audios: typing.Optional[typing.List[AudioReference]] = None + resolution: typing.Optional[BytedanceSeedance2FastRequestResolution] = 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 + + +class VideoGenerationRequest_BytedanceSeedanceV2Mini(UncheckedBaseModel): + model_id: typing.Literal["bytedance-seedance-v2-mini"] = "bytedance-seedance-v2-mini" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + aspect_ratio: typing.Optional[BytedanceSeedance2MiniRequestAspectRatio] = None + duration_secs: typing.Optional[int] = None + seed: typing.Optional[int] = None + generate_audio: typing.Optional[bool] = None + start_frame: typing.Optional[ImageReference] = None + end_frame: typing.Optional[ImageReference] = None + images: typing.Optional[typing.List[ImageReference]] = None + videos: typing.Optional[typing.List[VideoReference]] = None + audios: typing.Optional[typing.List[AudioReference]] = None + resolution: typing.Optional[BytedanceSeedance2MiniRequestResolution] = 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 + + +class VideoGenerationRequest_BytedanceSeedanceV25(UncheckedBaseModel): + model_id: typing.Literal["bytedance-seedance-v2.5"] = "bytedance-seedance-v2.5" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + aspect_ratio: typing.Optional[BytedanceSeedance25RequestAspectRatio] = None + resolution: typing.Optional[BytedanceSeedance25RequestResolution] = None + duration_secs: typing.Optional[int] = None + generate_audio: typing.Optional[bool] = None + start_frame: typing.Optional[ImageReference] = None + end_frame: typing.Optional[ImageReference] = None + images: typing.Optional[typing.List[ImageReference]] = None + videos: typing.Optional[typing.List[VideoReference]] = None + audios: typing.Optional[typing.List[AudioReference]] = 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 + + +class VideoGenerationRequest_CreatifyAurora(UncheckedBaseModel): + model_id: typing.Literal["creatify-aurora"] = "creatify-aurora" + webhook: typing.Optional[WebhookTarget] = None + image: ImageReference + audio: AudioReference + resolution: typing.Optional[CreatifyAuroraRequestResolution] = None + guidance_scale: typing.Optional[float] = None + audio_guidance_scale: 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 + + +class VideoGenerationRequest_Veo31FastGenerate001(UncheckedBaseModel): + model_id: typing.Literal["veo-3.1-fast-generate-001"] = "veo-3.1-fast-generate-001" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + negative_prompt: typing.Optional[str] = None + seed: typing.Optional[int] = None + enhance_prompt: typing.Optional[bool] = None + duration_secs: typing.Optional[int] = None + aspect_ratio: typing.Optional[Veo31FastRequestAspectRatio] = None + resolution: typing.Optional[Veo31FastRequestResolution] = None + generate_audio: typing.Optional[bool] = None + start_frame: typing.Optional[ImageReference] = None + end_frame: typing.Optional[ImageReference] = None + images: typing.Optional[typing.List[VeoImageReference]] = 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 + + +class VideoGenerationRequest_Veo31Generate001(UncheckedBaseModel): + model_id: typing.Literal["veo-3.1-generate-001"] = "veo-3.1-generate-001" + webhook: typing.Optional[WebhookTarget] = None + prompt: str + negative_prompt: typing.Optional[str] = None + seed: typing.Optional[int] = None + enhance_prompt: typing.Optional[bool] = None + duration_secs: typing.Optional[int] = None + aspect_ratio: typing.Optional[Veo31RequestAspectRatio] = None + resolution: typing.Optional[Veo31RequestResolution] = None + generate_audio: typing.Optional[bool] = None + start_frame: typing.Optional[ImageReference] = None + end_frame: typing.Optional[ImageReference] = None + images: typing.Optional[typing.List[VeoImageReference]] = 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 + + +VideoGenerationRequest = typing_extensions.Annotated[ + typing.Union[ + VideoGenerationRequest_BytedanceSeedanceV2, + VideoGenerationRequest_BytedanceSeedanceV2Fast, + VideoGenerationRequest_BytedanceSeedanceV2Mini, + VideoGenerationRequest_BytedanceSeedanceV25, + VideoGenerationRequest_CreatifyAurora, + VideoGenerationRequest_Veo31FastGenerate001, + VideoGenerationRequest_Veo31Generate001, + ], + UnionMetadata(discriminant="model_id"), +] diff --git a/data/src/elevenlabs/types/video_key_moment.py b/data/src/elevenlabs/types/video_key_moment.py new file mode 100644 index 0000000000000000000000000000000000000000..9a766b10331174246b12ce9803fdb7ff9d088edf --- /dev/null +++ b/data/src/elevenlabs/types/video_key_moment.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VideoKeyMoment(UncheckedBaseModel): + timestamp_ms: int + type: str + description: 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/data/src/elevenlabs/types/video_reference.py b/data/src/elevenlabs/types/video_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..e09e50e4b1a3ad489a033e742d1a61bb460e01dd --- /dev/null +++ b/data/src/elevenlabs/types/video_reference.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .inline_video_reference_mime_type import InlineVideoReferenceMimeType + + +class VideoReference_Asset(UncheckedBaseModel): + type: typing.Literal["asset"] = "asset" + asset_id: 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 + + +class VideoReference_Generation(UncheckedBaseModel): + type: typing.Literal["generation"] = "generation" + generation_id: 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 + + +class VideoReference_InlineBase64(UncheckedBaseModel): + type: typing.Literal["inline_base64"] = "inline_base64" + content_base_64: typing_extensions.Annotated[ + str, FieldMetadata(alias="content_base64"), pydantic.Field(alias="content_base64") + ] + mime_type: InlineVideoReferenceMimeType + + 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 + + +VideoReference = typing_extensions.Annotated[ + typing.Union[VideoReference_Asset, VideoReference_Generation, VideoReference_InlineBase64], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/video_schema.py b/data/src/elevenlabs/types/video_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..b467eec30ba95570c2d091e868b5692e58653533 --- /dev/null +++ b/data/src/elevenlabs/types/video_schema.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VideoSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: 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/data/src/elevenlabs/types/video_segment.py b/data/src/elevenlabs/types/video_segment.py new file mode 100644 index 0000000000000000000000000000000000000000..499ae88740e602f12d56e3a982d044b584ca305b --- /dev/null +++ b/data/src/elevenlabs/types/video_segment.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VideoSegment(UncheckedBaseModel): + start_ms: int + end_ms: int + description: str + subjects: typing.Optional[typing.List[str]] = None + shot_type: typing.Optional[str] = None + camera_movement: typing.Optional[str] = None + transition_in: typing.Optional[str] = None + has_speech: typing.Optional[bool] = None + has_music: typing.Optional[bool] = None + pacing: 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/data/src/elevenlabs/types/video_subject.py b/data/src/elevenlabs/types/video_subject.py new file mode 100644 index 0000000000000000000000000000000000000000..20c626faa70f1c3f14b9cec92dee1fce10b4c33b --- /dev/null +++ b/data/src/elevenlabs/types/video_subject.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VideoSubject(UncheckedBaseModel): + name: str + description: 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/data/src/elevenlabs/types/visited_agent_ref.py b/data/src/elevenlabs/types/visited_agent_ref.py new file mode 100644 index 0000000000000000000000000000000000000000..961316dbfa38172e058e70fde8cceee77c6e316a --- /dev/null +++ b/data/src/elevenlabs/types/visited_agent_ref.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VisitedAgentRef(UncheckedBaseModel): + """ + An agent (and optional branch) that participated in the call, in first-seen transcript order. + """ + + agent_id: str + branch_id: 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/data/src/elevenlabs/types/voice.py b/data/src/elevenlabs/types/voice.py new file mode 100644 index 0000000000000000000000000000000000000000..9f6e81dabac7f834f4bc6260790199b822e51b76 --- /dev/null +++ b/data/src/elevenlabs/types/voice.py @@ -0,0 +1,158 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .fine_tuning_response import FineTuningResponse +from .verified_voice_language_response_model import VerifiedVoiceLanguageResponseModel +from .voice_category import VoiceCategory +from .voice_labelling_status import VoiceLabellingStatus +from .voice_recording_quality import VoiceRecordingQuality +from .voice_safety_control import VoiceSafetyControl +from .voice_sample import VoiceSample +from .voice_settings import VoiceSettings +from .voice_sharing_response import VoiceSharingResponse +from .voice_verification_response import VoiceVerificationResponse + + +class Voice(UncheckedBaseModel): + voice_id: str = pydantic.Field() + """ + The ID of the voice. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the voice. + """ + + samples: typing.Optional[typing.List[VoiceSample]] = pydantic.Field(default=None) + """ + List of samples associated with the voice. + """ + + category: typing.Optional[VoiceCategory] = pydantic.Field(default=None) + """ + The category of the voice. + """ + + fine_tuning: typing.Optional[FineTuningResponse] = pydantic.Field(default=None) + """ + Fine-tuning information for the voice. + """ + + labels: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + Labels associated with the voice. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the voice. + """ + + preview_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The preview URL of the voice. + """ + + available_for_tiers: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The tiers the voice is available for. + """ + + settings: typing.Optional[VoiceSettings] = pydantic.Field(default=None) + """ + The settings of the voice. + """ + + sharing: typing.Optional[VoiceSharingResponse] = pydantic.Field(default=None) + """ + The sharing information of the voice. + """ + + high_quality_base_model_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The base model IDs for high-quality voices. + """ + + verified_languages: typing.Optional[typing.List[VerifiedVoiceLanguageResponseModel]] = pydantic.Field(default=None) + """ + The verified languages of the voice. + """ + + collection_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The IDs of collections this voice belongs to. + """ + + safety_control: typing.Optional[VoiceSafetyControl] = pydantic.Field(default=None) + """ + The safety controls of the voice. + """ + + voice_verification: typing.Optional[VoiceVerificationResponse] = pydantic.Field(default=None) + """ + The voice verification of the voice. + """ + + permission_on_resource: typing.Optional[str] = pydantic.Field(default=None) + """ + The permission on the resource of the voice. + """ + + is_owner: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the voice is owned by the user. + """ + + is_legacy: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the voice is legacy. + """ + + is_mixed: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the voice is mixed. + """ + + favorited_at_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + Timestamp when the voice was marked as favorite in Unix time. + """ + + created_at_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The creation time of the voice in Unix time. + """ + + is_bookmarked: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the voice is bookmarked by the current user. Only relevant for community (library-copied) voices. + """ + + recording_quality: typing.Optional[VoiceRecordingQuality] = pydantic.Field(default=None) + """ + The recording quality of the voice as determined by the review pipeline. + """ + + labelling_status: typing.Optional[VoiceLabellingStatus] = pydantic.Field(default=None) + """ + The review pipeline status of the voice. + """ + + recording_quality_reason: typing.Optional[str] = pydantic.Field(default=None) + """ + The reason for the recording quality assessment, as determined by the review pipeline. + """ + + 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/data/src/elevenlabs/types/voice_accent_response_model.py b/data/src/elevenlabs/types/voice_accent_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..13b8fb64ad5f6bcfde758e969ae197f6e87511ed --- /dev/null +++ b/data/src/elevenlabs/types/voice_accent_response_model.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceAccentResponseModel(UncheckedBaseModel): + accent: str = pydantic.Field() + """ + The accent value used for filtering shared voices via the `accent` query parameter on `GET /v1/shared-voices`. + """ + + language: str = pydantic.Field() + """ + The language code this accent belongs to, e.g. `en`. + """ + + code: str = pydantic.Field() + """ + The full accent code, e.g. `en-american`. + """ + + name: str = pydantic.Field() + """ + The human-readable accent name, e.g. `American`. + """ + + 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/data/src/elevenlabs/types/voice_category.py b/data/src/elevenlabs/types/voice_category.py new file mode 100644 index 0000000000000000000000000000000000000000..e4a8d4533d736ef15a5c5c26493c3a3ced12be3d --- /dev/null +++ b/data/src/elevenlabs/types/voice_category.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceCategory = typing.Union[ + typing.Literal["generated", "cloned", "premade", "professional", "famous", "high_quality"], typing.Any +] diff --git a/data/src/elevenlabs/types/voice_design_preview_response.py b/data/src/elevenlabs/types/voice_design_preview_response.py new file mode 100644 index 0000000000000000000000000000000000000000..67031397f4f051b1da9af219cc5416f4df44e18f --- /dev/null +++ b/data/src/elevenlabs/types/voice_design_preview_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .voice_preview_response_model import VoicePreviewResponseModel + + +class VoiceDesignPreviewResponse(UncheckedBaseModel): + previews: typing.List[VoicePreviewResponseModel] = pydantic.Field() + """ + The previews of the generated voices. + """ + + text: str = pydantic.Field() + """ + The text used to preview the voices. + """ + + 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/data/src/elevenlabs/types/voice_generation_parameter_option_response.py b/data/src/elevenlabs/types/voice_generation_parameter_option_response.py new file mode 100644 index 0000000000000000000000000000000000000000..0b03302284d7ea446852a8bf4ee2fd7fe97f08dd --- /dev/null +++ b/data/src/elevenlabs/types/voice_generation_parameter_option_response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceGenerationParameterOptionResponse = typing.Any diff --git a/data/src/elevenlabs/types/voice_generation_parameter_response.py b/data/src/elevenlabs/types/voice_generation_parameter_response.py new file mode 100644 index 0000000000000000000000000000000000000000..cfc069154f28efab1c953a41da1179a7179440b6 --- /dev/null +++ b/data/src/elevenlabs/types/voice_generation_parameter_response.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceGenerationParameterResponse = typing.Any diff --git a/data/src/elevenlabs/types/voice_labelling_status.py b/data/src/elevenlabs/types/voice_labelling_status.py new file mode 100644 index 0000000000000000000000000000000000000000..1fbb19da1109d45e26479ad6a571c33e3d17ab20 --- /dev/null +++ b/data/src/elevenlabs/types/voice_labelling_status.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceLabellingStatus = typing.Union[typing.Literal["in_review", "review_complete"], typing.Any] diff --git a/data/src/elevenlabs/types/voice_mail_detection_result_success_model.py b/data/src/elevenlabs/types/voice_mail_detection_result_success_model.py new file mode 100644 index 0000000000000000000000000000000000000000..69db5c7b53b523eb5fa5da0580db7f92463d8377 --- /dev/null +++ b/data/src/elevenlabs/types/voice_mail_detection_result_success_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceMailDetectionResultSuccessModel(UncheckedBaseModel): + status: typing.Optional[typing.Literal["success"]] = None + voicemail_message: typing.Optional[str] = None + reason: 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/data/src/elevenlabs/types/voice_preview_response_model.py b/data/src/elevenlabs/types/voice_preview_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..03af00150fbf769b6f00a6aaff55dd27ca5306dd --- /dev/null +++ b/data/src/elevenlabs/types/voice_preview_response_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoicePreviewResponseModel(UncheckedBaseModel): + audio_base_64: str = pydantic.Field() + """ + The base64 encoded audio of the preview. + """ + + generated_voice_id: str = pydantic.Field() + """ + The ID of the generated voice. Use it to create a voice from the preview. + """ + + media_type: str = pydantic.Field() + """ + The media type of the preview. + """ + + duration_secs: float = pydantic.Field() + """ + The duration of the preview in seconds. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + The language of the preview. + """ + + 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/data/src/elevenlabs/types/voice_recording_quality.py b/data/src/elevenlabs/types/voice_recording_quality.py new file mode 100644 index 0000000000000000000000000000000000000000..53ce1dcbd2dc702baf0b4a87cd6ec6f6d593ed43 --- /dev/null +++ b/data/src/elevenlabs/types/voice_recording_quality.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceRecordingQuality = typing.Union[typing.Literal["studio", "good", "ok", "poor", "bad"], typing.Any] diff --git a/data/src/elevenlabs/types/voice_reference.py b/data/src/elevenlabs/types/voice_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..3bd4557a21c7016d3787a90122edc8165d4549d0 --- /dev/null +++ b/data/src/elevenlabs/types/voice_reference.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceReference(UncheckedBaseModel): + """ + A voice this workspace can use. + """ + + voice_id: str = pydantic.Field() + """ + The ID of a voice in this workspace. + """ + + 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/data/src/elevenlabs/types/voice_safety_control.py b/data/src/elevenlabs/types/voice_safety_control.py new file mode 100644 index 0000000000000000000000000000000000000000..ed1e0ae35df98e186dec6347093d731277727447 --- /dev/null +++ b/data/src/elevenlabs/types/voice_safety_control.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceSafetyControl = typing.Union[ + typing.Literal["NONE", "BAN", "CAPTCHA", "ENTERPRISE_BAN", "ENTERPRISE_CAPTCHA"], typing.Any +] diff --git a/data/src/elevenlabs/types/voice_sample.py b/data/src/elevenlabs/types/voice_sample.py new file mode 100644 index 0000000000000000000000000000000000000000..363f04b99507aa1dfeddff52d961076afc5596dc --- /dev/null +++ b/data/src/elevenlabs/types/voice_sample.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .speaker_separation_response_model import SpeakerSeparationResponseModel + + +class VoiceSample(UncheckedBaseModel): + sample_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the sample. + """ + + file_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the sample file. + """ + + mime_type: typing.Optional[str] = pydantic.Field(default=None) + """ + The MIME type of the sample file. + """ + + size_bytes: typing.Optional[int] = pydantic.Field(default=None) + """ + The size of the sample file in bytes. + """ + + hash: typing.Optional[str] = pydantic.Field(default=None) + """ + The hash of the sample file. + """ + + duration_secs: typing.Optional[float] = None + remove_background_noise: typing.Optional[bool] = None + has_isolated_audio: typing.Optional[bool] = None + has_isolated_audio_preview: typing.Optional[bool] = None + speaker_separation: typing.Optional[SpeakerSeparationResponseModel] = None + trim_start: typing.Optional[int] = None + trim_end: typing.Optional[int] = 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/data/src/elevenlabs/types/voice_sample_preview_response_model.py b/data/src/elevenlabs/types/voice_sample_preview_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5c8982c5bc8b396c8aaa466f8b8708acc887a6e8 --- /dev/null +++ b/data/src/elevenlabs/types/voice_sample_preview_response_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceSamplePreviewResponseModel(UncheckedBaseModel): + audio_base_64: str = pydantic.Field() + """ + The base64 encoded audio. + """ + + voice_id: str = pydantic.Field() + """ + The ID of the voice. + """ + + sample_id: str = pydantic.Field() + """ + The ID of the sample. + """ + + media_type: str = pydantic.Field() + """ + The media type of the audio. + """ + + duration_secs: typing.Optional[float] = pydantic.Field(default=None) + """ + The duration of the audio in seconds. + """ + + 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/data/src/elevenlabs/types/voice_sample_visual_waveform_response_model.py b/data/src/elevenlabs/types/voice_sample_visual_waveform_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..59e0f177f1602ace49383205612673a4790273d0 --- /dev/null +++ b/data/src/elevenlabs/types/voice_sample_visual_waveform_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceSampleVisualWaveformResponseModel(UncheckedBaseModel): + sample_id: str = pydantic.Field() + """ + The ID of the sample. + """ + + visual_waveform: typing.List[float] = pydantic.Field() + """ + The visual waveform of the sample, represented as a list of floats. + """ + + 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/data/src/elevenlabs/types/voice_schema.py b/data/src/elevenlabs/types/voice_schema.py new file mode 100644 index 0000000000000000000000000000000000000000..8c06ada16c0e30a1ade74dee1ac415d25d866c14 --- /dev/null +++ b/data/src/elevenlabs/types/voice_schema.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceSchema(UncheckedBaseModel): + title: typing.Optional[str] = None + description: 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/data/src/elevenlabs/types/voice_segment.py b/data/src/elevenlabs/types/voice_segment.py new file mode 100644 index 0000000000000000000000000000000000000000..43e677a3b2749002061ee13396ddca5d4bd311fa --- /dev/null +++ b/data/src/elevenlabs/types/voice_segment.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceSegment(UncheckedBaseModel): + voice_id: str = pydantic.Field() + """ + The voice ID used for this segment + """ + + start_time_seconds: float = pydantic.Field() + """ + Start time of this voice segment + """ + + end_time_seconds: float = pydantic.Field() + """ + End time of this voice segment + """ + + character_start_index: int = pydantic.Field() + """ + Start index in the characters array + """ + + character_end_index: int = pydantic.Field() + """ + End index in the characters array (exclusive) + """ + + dialogue_input_index: int = pydantic.Field() + """ + Line of the dialogue (script) that this segment is a part of. + """ + + 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/data/src/elevenlabs/types/voice_settings.py b/data/src/elevenlabs/types/voice_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..66259a808754dcc4aca34640a9caeb4b1b62bab3 --- /dev/null +++ b/data/src/elevenlabs/types/voice_settings.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceSettings(UncheckedBaseModel): + stability: typing.Optional[float] = pydantic.Field(default=None) + """ + Determines how stable the voice is and the randomness between each generation. Lower values introduce broader emotional range for the voice. Higher values can result in a monotonous voice with limited emotion. + """ + + use_speaker_boost: typing.Optional[bool] = pydantic.Field(default=None) + """ + This setting boosts the similarity to the original speaker. Using this setting requires a slightly higher computational load, which in turn increases latency. + """ + + similarity_boost: typing.Optional[float] = pydantic.Field(default=None) + """ + Determines how closely the AI should adhere to the original voice when attempting to replicate it. + """ + + style: typing.Optional[float] = pydantic.Field(default=None) + """ + Determines the style exaggeration of the voice. This setting attempts to amplify the style of the original speaker. It does consume additional computational resources and might increase latency if set to anything other than 0. + """ + + speed: typing.Optional[float] = pydantic.Field(default=None) + """ + Adjusts the speed of the voice. A value of 1.0 is the default speed, while values less than 1.0 slow down the speech, and values greater than 1.0 speed it up. + """ + + 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/data/src/elevenlabs/types/voice_sharing_moderation_check_response_model.py b/data/src/elevenlabs/types/voice_sharing_moderation_check_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..88bc35648a3bc731b9d759ddf425627eb44ec858 --- /dev/null +++ b/data/src/elevenlabs/types/voice_sharing_moderation_check_response_model.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceSharingModerationCheckResponseModel(UncheckedBaseModel): + date_checked_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The date the moderation check was made in Unix time. + """ + + name_value: typing.Optional[str] = pydantic.Field(default=None) + """ + The name value of the voice. + """ + + name_check: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the name check was successful. + """ + + description_value: typing.Optional[str] = pydantic.Field(default=None) + """ + The description value of the voice. + """ + + description_check: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the description check was successful. + """ + + sample_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of sample IDs. + """ + + sample_checks: typing.Optional[typing.List[float]] = pydantic.Field(default=None) + """ + A list of sample checks. + """ + + captcha_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of captcha IDs. + """ + + captcha_checks: typing.Optional[typing.List[float]] = pydantic.Field(default=None) + """ + A list of CAPTCHA check values. + """ + + 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/data/src/elevenlabs/types/voice_sharing_response.py b/data/src/elevenlabs/types/voice_sharing_response.py new file mode 100644 index 0000000000000000000000000000000000000000..1dc171affeb6ae397c73a729630b15593897416b --- /dev/null +++ b/data/src/elevenlabs/types/voice_sharing_response.py @@ -0,0 +1,188 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .reader_resource_response_model import ReaderResourceResponseModel +from .review_status import ReviewStatus +from .voice_sharing_moderation_check_response_model import VoiceSharingModerationCheckResponseModel +from .voice_sharing_response_category import VoiceSharingResponseCategory +from .voice_sharing_state import VoiceSharingState + + +class VoiceSharingResponse(UncheckedBaseModel): + status: typing.Optional[VoiceSharingState] = pydantic.Field(default=None) + """ + The status of the voice sharing. + """ + + history_item_sample_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The sample ID of the history item. + """ + + date_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The date of the voice sharing in Unix time. + """ + + whitelisted_emails: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + A list of whitelisted emails. + """ + + public_owner_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the public owner. + """ + + original_voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the original voice. + """ + + financial_rewards_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether financial rewards are enabled. + """ + + free_users_allowed: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether free users are allowed. + """ + + live_moderation_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether live moderation is enabled. + """ + + rate: typing.Optional[float] = pydantic.Field(default=None) + """ + The rate of the voice sharing. + """ + + fiat_rate: typing.Optional[float] = pydantic.Field(default=None) + """ + The rate of the voice sharing in USD per 1000 credits. + """ + + notice_period: typing.Optional[int] = pydantic.Field(default=None) + """ + The notice period of the voice sharing. + """ + + disable_at_unix: typing.Optional[int] = pydantic.Field(default=None) + """ + The date of the voice sharing in Unix time. + """ + + voice_mixing_allowed: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether voice mixing is allowed. + """ + + featured: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the voice is featured. + """ + + category: typing.Optional[VoiceSharingResponseCategory] = pydantic.Field(default=None) + """ + The category of the voice. + """ + + reader_app_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the reader app is enabled. + """ + + image_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The image URL of the voice. + """ + + ban_reason: typing.Optional[str] = pydantic.Field(default=None) + """ + The ban reason of the voice. + """ + + liked_by_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of likes on the voice. + """ + + cloned_by_count: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of clones on the voice. + """ + + name: typing.Optional[str] = pydantic.Field(default=None) + """ + The name of the voice. + """ + + description: typing.Optional[str] = pydantic.Field(default=None) + """ + The description of the voice. + """ + + labels: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + The labels of the voice. + """ + + review_status: typing.Optional[ReviewStatus] = pydantic.Field(default=None) + """ + The review status of the voice. + """ + + review_message: typing.Optional[str] = pydantic.Field(default=None) + """ + The review message of the voice. + """ + + enabled_in_library: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the voice is enabled in the library. + """ + + instagram_username: typing.Optional[str] = pydantic.Field(default=None) + """ + The Instagram username of the voice. + """ + + twitter_username: typing.Optional[str] = pydantic.Field(default=None) + """ + The Twitter/X username of the voice. + """ + + youtube_username: typing.Optional[str] = pydantic.Field(default=None) + """ + The YouTube username of the voice. + """ + + tiktok_username: typing.Optional[str] = pydantic.Field(default=None) + """ + The TikTok username of the voice. + """ + + moderation_check: typing.Optional[VoiceSharingModerationCheckResponseModel] = pydantic.Field(default=None) + """ + The moderation check of the voice. + """ + + reader_restricted_on: typing.Optional[typing.List[ReaderResourceResponseModel]] = pydantic.Field(default=None) + """ + The reader restricted on of the voice. + """ + + 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/data/src/elevenlabs/types/voice_sharing_response_category.py b/data/src/elevenlabs/types/voice_sharing_response_category.py new file mode 100644 index 0000000000000000000000000000000000000000..86a9dec73533380086ac28b9cd18576db01bacb8 --- /dev/null +++ b/data/src/elevenlabs/types/voice_sharing_response_category.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceSharingResponseCategory = typing.Union[ + typing.Literal["generated", "cloned", "premade", "professional", "famous", "high_quality"], typing.Any +] diff --git a/data/src/elevenlabs/types/voice_sharing_state.py b/data/src/elevenlabs/types/voice_sharing_state.py new file mode 100644 index 0000000000000000000000000000000000000000..4b3ddc17d7559ad20b112e27f5791b6def00ab4b --- /dev/null +++ b/data/src/elevenlabs/types/voice_sharing_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoiceSharingState = typing.Union[typing.Literal["enabled", "disabled", "copied", "copied_disabled"], typing.Any] diff --git a/data/src/elevenlabs/types/voice_statistics_response_model.py b/data/src/elevenlabs/types/voice_statistics_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..fe5c3ab959e46aa460495e75589d589584049e23 --- /dev/null +++ b/data/src/elevenlabs/types/voice_statistics_response_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoiceStatisticsResponseModel(UncheckedBaseModel): + project_voice_ref_id: str = pydantic.Field() + """ + The project voice reference ID. + """ + + characters_unconverted: int = pydantic.Field() + """ + The number of unconverted characters for this voice. + """ + + characters_converted: int = pydantic.Field() + """ + The number of converted characters for this voice. + """ + + credits_needed_to_convert: typing.Optional[int] = pydantic.Field(default=None) + """ + The number of credits needed to convert the remaining audio for this voice. + """ + + voice_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The voice ID. + """ + + 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/data/src/elevenlabs/types/voice_verification_response.py b/data/src/elevenlabs/types/voice_verification_response.py new file mode 100644 index 0000000000000000000000000000000000000000..5928c4cdf28369ff29933c44a1e298b0a588872d --- /dev/null +++ b/data/src/elevenlabs/types/voice_verification_response.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .verification_attempt_response import VerificationAttemptResponse + + +class VoiceVerificationResponse(UncheckedBaseModel): + requires_verification: bool = pydantic.Field() + """ + Whether the voice requires verification. + """ + + is_verified: bool = pydantic.Field() + """ + Whether the voice has been verified. + """ + + verification_failures: typing.List[str] = pydantic.Field() + """ + List of verification failures. + """ + + verification_attempts_count: int = pydantic.Field() + """ + The number of verification attempts. + """ + + language: typing.Optional[str] = pydantic.Field(default=None) + """ + The language of the voice. + """ + + verification_attempts: typing.Optional[typing.List[VerificationAttemptResponse]] = pydantic.Field(default=None) + """ + Number of times a verification was attempted. + """ + + 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/data/src/elevenlabs/types/voicemail_detection_tool_config.py b/data/src/elevenlabs/types/voicemail_detection_tool_config.py new file mode 100644 index 0000000000000000000000000000000000000000..445f45f8679b3a6282825ab34312e89bc6305028 --- /dev/null +++ b/data/src/elevenlabs/types/voicemail_detection_tool_config.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoicemailDetectionToolConfig(UncheckedBaseModel): + """ + Allows the agent to detect when a voicemail system is encountered. + + This tool should be invoked by the LLM when it detects that the call has been + answered by a voicemail system rather than a human. If a voicemail message + is configured, it will be played; otherwise the call will end immediately. + """ + + voicemail_message: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional message to leave on voicemail when detected. If not provided, the call will end immediately when voicemail is detected. Supports dynamic variables (e.g., {{system__time}}, {{system__call_duration_secs}}, {{custom_variable}}). + """ + + 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/data/src/elevenlabs/types/voices_not_permitted_warning.py b/data/src/elevenlabs/types/voices_not_permitted_warning.py new file mode 100644 index 0000000000000000000000000000000000000000..329cca6424590fb9507c06ebc1d144e3a64fa98c --- /dev/null +++ b/data/src/elevenlabs/types/voices_not_permitted_warning.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class VoicesNotPermittedWarning(UncheckedBaseModel): + type: typing.Literal["voices_not_permitted"] = pydantic.Field(default="voices_not_permitted") + """ + Identifies this warning; branch on it to read the other fields. + """ + + speaker_ids: typing.List[str] = pydantic.Field() + """ + Speakers whose voices were not permitted for cloning. The dub used a replacement voice for each of them; all other speakers are unaffected. + """ + + message: str = pydantic.Field() + """ + Human-readable description of the warning, for display. The wording may change at any time, so we recommend branching on `type` instead. + """ + + 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/data/src/elevenlabs/types/webhook_auth_method_type.py b/data/src/elevenlabs/types/webhook_auth_method_type.py new file mode 100644 index 0000000000000000000000000000000000000000..c28d655ddcb464b32bd8a53a1039d51219751449 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_auth_method_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WebhookAuthMethodType = typing.Union[typing.Literal["hmac", "oauth2", "mtls"], typing.Any] diff --git a/data/src/elevenlabs/types/webhook_event_type.py b/data/src/elevenlabs/types/webhook_event_type.py new file mode 100644 index 0000000000000000000000000000000000000000..cfc28bad14708646b561e0c8cbc46c8edba735f5 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_event_type.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WebhookEventType = typing.Union[ + typing.Literal[ + "transcript", + "audio", + "call_initiation_failure", + "answering_machine_detection", + "unredacted_transcript", + "unredacted_audio", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/webhook_hmac_settings.py b/data/src/elevenlabs/types/webhook_hmac_settings.py new file mode 100644 index 0000000000000000000000000000000000000000..2207f93fda4dee5559a7eb2375aa92f466985aa2 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_hmac_settings.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WebhookHmacSettings(UncheckedBaseModel): + """ + Settings for creating an HMAC-authenticated webhook + """ + + auth_type: typing.Literal["hmac"] = pydantic.Field(default="hmac") + """ + The authentication type for this webhook + """ + + name: str = pydantic.Field() + """ + The display name for this webhook + """ + + webhook_url: str = pydantic.Field() + """ + The HTTPS callback URL that will be called when this webhook is triggered + """ + + request_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = pydantic.Field(default=None) + """ + Optional custom request headers to include with each webhook delivery + """ + + 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/data/src/elevenlabs/types/webhook_target.py b/data/src/elevenlabs/types/webhook_target.py new file mode 100644 index 0000000000000000000000000000000000000000..e5a988de2dd36c116d82a07e99d77b5dea285097 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_target.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WebhookTarget_All(UncheckedBaseModel): + type: typing.Literal["all"] = "all" + + 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 + + +class WebhookTarget_Ids(UncheckedBaseModel): + type: typing.Literal["ids"] = "ids" + ids: typing.List[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 + + +WebhookTarget = typing_extensions.Annotated[ + typing.Union[WebhookTarget_All, WebhookTarget_Ids], UnionMetadata(discriminant="type") +] diff --git a/data/src/elevenlabs/types/webhook_target_all.py b/data/src/elevenlabs/types/webhook_target_all.py new file mode 100644 index 0000000000000000000000000000000000000000..676f3db7c02189e279ffff06fa017c77db3bb2cb --- /dev/null +++ b/data/src/elevenlabs/types/webhook_target_all.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WebhookTargetAll(UncheckedBaseModel): + """ + Deliver the result to all of the workspace's configured flows webhooks. + """ + + 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/data/src/elevenlabs/types/webhook_target_ids.py b/data/src/elevenlabs/types/webhook_target_ids.py new file mode 100644 index 0000000000000000000000000000000000000000..fa125edafd18e5916bec1a79bf92df0e00fdd337 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_target_ids.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WebhookTargetIds(UncheckedBaseModel): + """ + Deliver the result to specific configured flows webhooks. + """ + + ids: typing.List[str] = pydantic.Field() + """ + The IDs of the workspace flows webhooks to deliver the result to. Each must be one of the workspace's configured flows webhooks. + """ + + 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/data/src/elevenlabs/types/webhook_tool_api_schema_config_input.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..d959a81bd3d236a3350178e9a6fe6bbdf5c1ab1a --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .literal_json_schema_property import LiteralJsonSchemaProperty +from .query_params_json_schema_input import QueryParamsJsonSchemaInput +from .response_filter import ResponseFilter +from .webhook_tool_api_schema_config_input_auth_connection import WebhookToolApiSchemaConfigInputAuthConnection +from .webhook_tool_api_schema_config_input_content_type import WebhookToolApiSchemaConfigInputContentType +from .webhook_tool_api_schema_config_input_method import WebhookToolApiSchemaConfigInputMethod +from .webhook_tool_api_schema_config_input_request_headers_value import ( + WebhookToolApiSchemaConfigInputRequestHeadersValue, +) + + +class WebhookToolApiSchemaConfigInput(UncheckedBaseModel): + request_headers: typing.Optional[typing.Dict[str, WebhookToolApiSchemaConfigInputRequestHeadersValue]] = ( + pydantic.Field(default=None) + ) + """ + Headers that should be included in the request + """ + + url: str = pydantic.Field() + """ + The URL that the webhook will be sent to. May include path parameters, e.g. https://example.com/agents/{agent_id} + """ + + method: typing.Optional[WebhookToolApiSchemaConfigInputMethod] = pydantic.Field(default=None) + """ + The HTTP method to use for the webhook + """ + + path_params_schema: typing.Optional[typing.Dict[str, LiteralJsonSchemaProperty]] = pydantic.Field(default=None) + """ + Schema for path parameters, if any. The keys should match the placeholders in the URL. + """ + + query_params_schema: typing.Optional[QueryParamsJsonSchemaInput] = pydantic.Field(default=None) + """ + Schema for any query params, if any. These will be added to end of the URL as query params. Note: properties in a query param must all be literal types + """ + + request_body_schema: typing.Optional["ObjectJsonSchemaPropertyInput"] = pydantic.Field(default=None) + """ + Schema for the body parameters, if any. Used for POST/PATCH/PUT requests. The schema should be an object which will be sent as the json body + """ + + response_body_schema: typing.Optional["ObjectJsonSchemaPropertyInput"] = pydantic.Field(default=None) + """ + Schema describing the expected response body structure. For documentation only; not surfaced to the LLM. + """ + + response_filter: typing.Optional[ResponseFilter] = pydantic.Field(default=None) + """ + Optional allow-list filter applied to the response before the LLM sees it, so large responses don't pollute the context. Defaults to the full response. + """ + + content_type: typing.Optional[WebhookToolApiSchemaConfigInputContentType] = pydantic.Field(default=None) + """ + Content type for the request body. Only applies to POST/PUT/PATCH requests. + """ + + auth_resolved_params: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + URL placeholders resolved from the auth connection (e.g. secrets injected via UrlSecretAuthConnection) rather than from path_params_schema. + """ + + auth_connection: typing.Optional[WebhookToolApiSchemaConfigInputAuthConnection] = pydantic.Field(default=None) + """ + Optional auth connection to use for authentication with this webhook + """ + + 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 + + +from .array_json_schema_property_input import ArrayJsonSchemaPropertyInput # noqa: E402, I001 +from .array_json_schema_property_input_items import ArrayJsonSchemaPropertyInputItems # noqa: E402, I001 +from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput # noqa: E402, I001 +from .object_json_schema_property_input_properties_value import ObjectJsonSchemaPropertyInputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + WebhookToolApiSchemaConfigInput, + ArrayJsonSchemaPropertyInput=ArrayJsonSchemaPropertyInput, + ArrayJsonSchemaPropertyInputItems=ArrayJsonSchemaPropertyInputItems, + ObjectJsonSchemaPropertyInput=ObjectJsonSchemaPropertyInput, + ObjectJsonSchemaPropertyInputPropertiesValue=ObjectJsonSchemaPropertyInputPropertiesValue, +) diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_auth_connection.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_auth_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..5aff89d9c0224873258b7863686fdfde1ab35bc1 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_auth_connection.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .auth_connection_locator import AuthConnectionLocator +from .environment_auth_connection_locator import EnvironmentAuthConnectionLocator + +WebhookToolApiSchemaConfigInputAuthConnection = typing.Union[AuthConnectionLocator, EnvironmentAuthConnectionLocator] diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_content_type.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_content_type.py new file mode 100644 index 0000000000000000000000000000000000000000..aa2d7d6372cfa59c9faf63b18f3fcc10d3ea308e --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_content_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WebhookToolApiSchemaConfigInputContentType = typing.Union[ + typing.Literal["application/json", "application/x-www-form-urlencoded"], typing.Any +] diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_method.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_method.py new file mode 100644 index 0000000000000000000000000000000000000000..b37a6f9ebac4f3b5fd50fca666f7586597157a43 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_method.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WebhookToolApiSchemaConfigInputMethod = typing.Union[ + typing.Literal["GET", "POST", "PUT", "PATCH", "DELETE"], typing.Any +] diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_request_headers_value.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..46ccfacff72b8a007faba2d759d200a407341a40 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_input_request_headers_value.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable +from .conv_ai_env_var_locator import ConvAiEnvVarLocator +from .conv_ai_secret_locator import ConvAiSecretLocator + +WebhookToolApiSchemaConfigInputRequestHeadersValue = typing.Union[ + str, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator +] diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_output.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..5fabdb183cadc3d57ca9726ab6d500843dde8657 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .literal_json_schema_property import LiteralJsonSchemaProperty +from .query_params_json_schema_output import QueryParamsJsonSchemaOutput +from .response_filter import ResponseFilter +from .webhook_tool_api_schema_config_output_auth_connection import WebhookToolApiSchemaConfigOutputAuthConnection +from .webhook_tool_api_schema_config_output_content_type import WebhookToolApiSchemaConfigOutputContentType +from .webhook_tool_api_schema_config_output_method import WebhookToolApiSchemaConfigOutputMethod +from .webhook_tool_api_schema_config_output_request_headers_value import ( + WebhookToolApiSchemaConfigOutputRequestHeadersValue, +) + + +class WebhookToolApiSchemaConfigOutput(UncheckedBaseModel): + request_headers: typing.Optional[typing.Dict[str, WebhookToolApiSchemaConfigOutputRequestHeadersValue]] = ( + pydantic.Field(default=None) + ) + """ + Headers that should be included in the request + """ + + url: str = pydantic.Field() + """ + The URL that the webhook will be sent to. May include path parameters, e.g. https://example.com/agents/{agent_id} + """ + + method: typing.Optional[WebhookToolApiSchemaConfigOutputMethod] = pydantic.Field(default=None) + """ + The HTTP method to use for the webhook + """ + + path_params_schema: typing.Optional[typing.Dict[str, LiteralJsonSchemaProperty]] = pydantic.Field(default=None) + """ + Schema for path parameters, if any. The keys should match the placeholders in the URL. + """ + + query_params_schema: typing.Optional[QueryParamsJsonSchemaOutput] = pydantic.Field(default=None) + """ + Schema for any query params, if any. These will be added to end of the URL as query params. Note: properties in a query param must all be literal types + """ + + request_body_schema: typing.Optional["ObjectJsonSchemaPropertyOutput"] = pydantic.Field(default=None) + """ + Schema for the body parameters, if any. Used for POST/PATCH/PUT requests. The schema should be an object which will be sent as the json body + """ + + response_body_schema: typing.Optional["ObjectJsonSchemaPropertyOutput"] = pydantic.Field(default=None) + """ + Schema describing the expected response body structure. For documentation only; not surfaced to the LLM. + """ + + response_filter: typing.Optional[ResponseFilter] = pydantic.Field(default=None) + """ + Optional allow-list filter applied to the response before the LLM sees it, so large responses don't pollute the context. Defaults to the full response. + """ + + content_type: typing.Optional[WebhookToolApiSchemaConfigOutputContentType] = pydantic.Field(default=None) + """ + Content type for the request body. Only applies to POST/PUT/PATCH requests. + """ + + auth_resolved_params: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + URL placeholders resolved from the auth connection (e.g. secrets injected via UrlSecretAuthConnection) rather than from path_params_schema. + """ + + auth_connection: typing.Optional[WebhookToolApiSchemaConfigOutputAuthConnection] = pydantic.Field(default=None) + """ + Optional auth connection to use for authentication with this webhook + """ + + 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 + + +from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput # noqa: E402, I001 +from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems # noqa: E402, I001 +from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput # noqa: E402, I001 +from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue # noqa: E402, I001 + +update_forward_refs( + WebhookToolApiSchemaConfigOutput, + ArrayJsonSchemaPropertyOutput=ArrayJsonSchemaPropertyOutput, + ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems, + ObjectJsonSchemaPropertyOutput=ObjectJsonSchemaPropertyOutput, + ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue, +) diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_auth_connection.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_auth_connection.py new file mode 100644 index 0000000000000000000000000000000000000000..a7194cc7d3862ba4ca1af454c1c2ffa88ccfa9a6 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_auth_connection.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .auth_connection_locator import AuthConnectionLocator +from .environment_auth_connection_locator import EnvironmentAuthConnectionLocator + +WebhookToolApiSchemaConfigOutputAuthConnection = typing.Union[AuthConnectionLocator, EnvironmentAuthConnectionLocator] diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_content_type.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_content_type.py new file mode 100644 index 0000000000000000000000000000000000000000..b3d9b9e1279381256a8c1db7ba1b2879e3092061 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_content_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WebhookToolApiSchemaConfigOutputContentType = typing.Union[ + typing.Literal["application/json", "application/x-www-form-urlencoded"], typing.Any +] diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_method.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_method.py new file mode 100644 index 0000000000000000000000000000000000000000..6fbbf99ff65bc24d03f9671ed4443cf5df888e72 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_method.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WebhookToolApiSchemaConfigOutputMethod = typing.Union[ + typing.Literal["GET", "POST", "PUT", "PATCH", "DELETE"], typing.Any +] diff --git a/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_request_headers_value.py b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_request_headers_value.py new file mode 100644 index 0000000000000000000000000000000000000000..334556178a4dd6b5730516da8ee83134bd27ec5b --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_api_schema_config_output_request_headers_value.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .conv_ai_dynamic_variable import ConvAiDynamicVariable +from .conv_ai_env_var_locator import ConvAiEnvVarLocator +from .conv_ai_secret_locator import ConvAiSecretLocator + +WebhookToolApiSchemaConfigOutputRequestHeadersValue = typing.Union[ + str, ConvAiSecretLocator, ConvAiDynamicVariable, ConvAiEnvVarLocator +] diff --git a/data/src/elevenlabs/types/webhook_tool_config_input.py b/data/src/elevenlabs/types/webhook_tool_config_input.py new file mode 100644 index 0000000000000000000000000000000000000000..bc3398cf6766a7f993c143c5424dc74d2465f9c2 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_config_input.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .webhook_tool_api_schema_config_input import WebhookToolApiSchemaConfigInput + + +class WebhookToolConfigInput(UncheckedBaseModel): + """ + A webhook tool is a tool that calls an external webhook from our server + """ + + name: str + description: str = pydantic.Field() + """ + Description of when the tool should be used and what it does. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for the tool call to complete. Must be between 5 and 300 seconds (inclusive). + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while this tool is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, the agent will speak before the tool call. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution. If not specified, no tool call sound will be played. + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play. 'auto' only plays when there's pre-tool speech, 'always' plays for every tool call. + """ + + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = pydantic.Field(default=None) + """ + Controls how tool errors are processed before being shared with the agent. 'auto' determines handling based on tool type (summarized for native integrations, hide for others), 'summarized' sends an LLM-generated summary, 'passthrough' sends the raw error, 'hide' does not share the error with the agent. + """ + + dynamic_variables: typing.Optional[DynamicVariablesConfig] = pydantic.Field(default=None) + """ + Configuration for dynamic variables + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + Determines when and how the tool executes: 'immediate' executes the tool right away when requested by the LLM, 'post_tool_speech' waits for the agent to finish speaking before executing, 'async' runs the tool in the background without blocking - best for long-running operations. + """ + + api_schema: WebhookToolApiSchemaConfigInput = pydantic.Field() + """ + The schema for the outgoing webhoook, including parameters and URL specification + """ + + follow_redirects: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to resolve a redirect from the endpoint and return the final response. One redirect is followed, as a GET without the request body; nothing configured on this tool (headers, authentication, client certificate) is sent to the redirect target. Both the endpoint and the redirect target must use HTTPS. Not supported for API integration tools. + """ + + follow_redirects_allowed_domains: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Domains a redirect may point at, e.g. 'test.example.com'. Required when following redirects, and a target outside the list is refused. + """ + + 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 + + +update_forward_refs(WebhookToolConfigInput) diff --git a/data/src/elevenlabs/types/webhook_tool_config_output.py b/data/src/elevenlabs/types/webhook_tool_config_output.py new file mode 100644 index 0000000000000000000000000000000000000000..13bcbea423eebf140269f6cbe6e02161705fb4f5 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_tool_config_output.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .dynamic_variable_assignment import DynamicVariableAssignment +from .dynamic_variables_config import DynamicVariablesConfig +from .pre_tool_speech_mode import PreToolSpeechMode +from .tool_call_sound_behavior import ToolCallSoundBehavior +from .tool_call_sound_type import ToolCallSoundType +from .tool_error_handling_mode import ToolErrorHandlingMode +from .tool_execution_mode import ToolExecutionMode +from .tool_interruption_mode import ToolInterruptionMode +from .webhook_tool_api_schema_config_output import WebhookToolApiSchemaConfigOutput + + +class WebhookToolConfigOutput(UncheckedBaseModel): + """ + A webhook tool is a tool that calls an external webhook from our server + """ + + name: str + description: str = pydantic.Field() + """ + Description of when the tool should be used and what it does. + """ + + response_timeout_secs: typing.Optional[int] = pydantic.Field(default=None) + """ + The maximum time in seconds to wait for the tool call to complete. Must be between 5 and 300 seconds (inclusive). + """ + + disable_interruptions: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `interruption_mode` instead. If true, the user will not be able to interrupt the agent while this tool is running. + """ + + interruption_mode: typing.Optional[ToolInterruptionMode] = pydantic.Field(default=None) + """ + Controls whether the user can interrupt the agent around this tool call. 'allow' (default) lets the user interrupt at any time, 'disable_during_tool' suppresses interruptions only while the tool is running, 'disable_during_tool_and_turn' suppresses interruptions while the tool runs and for the agent response that follows it. + """ + + force_pre_tool_speech: typing.Optional[bool] = pydantic.Field(default=None) + """ + DEPRECATED: use `pre_tool_speech` instead. If true, the agent will speak before the tool call. + """ + + pre_tool_speech: typing.Optional[PreToolSpeechMode] = pydantic.Field(default=None) + """ + Controls whether the agent speaks before this tool is called. 'auto' (default) decides based on recent tool latency, 'force' always asks the agent to speak, 'off' fully opts out regardless of latency. + """ + + assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = pydantic.Field(default=None) + """ + Configuration for extracting values from tool responses and assigning them to dynamic variables + """ + + tool_call_sound: typing.Optional[ToolCallSoundType] = pydantic.Field(default=None) + """ + Predefined tool call sound type to play during tool execution. If not specified, no tool call sound will be played. + """ + + tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = pydantic.Field(default=None) + """ + Determines when the tool call sound should play. 'auto' only plays when there's pre-tool speech, 'always' plays for every tool call. + """ + + tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = pydantic.Field(default=None) + """ + Controls how tool errors are processed before being shared with the agent. 'auto' determines handling based on tool type (summarized for native integrations, hide for others), 'summarized' sends an LLM-generated summary, 'passthrough' sends the raw error, 'hide' does not share the error with the agent. + """ + + dynamic_variables: typing.Optional[DynamicVariablesConfig] = pydantic.Field(default=None) + """ + Configuration for dynamic variables + """ + + execution_mode: typing.Optional[ToolExecutionMode] = pydantic.Field(default=None) + """ + Determines when and how the tool executes: 'immediate' executes the tool right away when requested by the LLM, 'post_tool_speech' waits for the agent to finish speaking before executing, 'async' runs the tool in the background without blocking - best for long-running operations. + """ + + api_schema: WebhookToolApiSchemaConfigOutput = pydantic.Field() + """ + The schema for the outgoing webhoook, including parameters and URL specification + """ + + follow_redirects: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to resolve a redirect from the endpoint and return the final response. One redirect is followed, as a GET without the request body; nothing configured on this tool (headers, authentication, client certificate) is sent to the redirect target. Both the endpoint and the redirect target must use HTTPS. Not supported for API integration tools. + """ + + follow_redirects_allowed_domains: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Domains a redirect may point at, e.g. 'test.example.com'. Required when following redirects, and a target outside the list is refused. + """ + + 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 + + +update_forward_refs(WebhookToolConfigOutput) diff --git a/data/src/elevenlabs/types/webhook_transcript_format.py b/data/src/elevenlabs/types/webhook_transcript_format.py new file mode 100644 index 0000000000000000000000000000000000000000..2263caf8314fd6dc7bb07afe37ee02b89a68ac16 --- /dev/null +++ b/data/src/elevenlabs/types/webhook_transcript_format.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WebhookTranscriptFormat = typing.Union[typing.Literal["json", "opentelemetry"], typing.Any] diff --git a/data/src/elevenlabs/types/webhook_usage_type.py b/data/src/elevenlabs/types/webhook_usage_type.py new file mode 100644 index 0000000000000000000000000000000000000000..1692a4532b5c24ad32d27f8250c5671f7710932d --- /dev/null +++ b/data/src/elevenlabs/types/webhook_usage_type.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WebhookUsageType = typing.Union[ + typing.Literal[ + "ConvAI Agent Settings", + "ConvAI Settings", + "Voice Library Removal Notices", + "Speech to Text", + "Agent QA Evaluations", + "ConvAI Alerting", + "Flows", + "Dubbing", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/websocket_tts_client_message_multi.py b/data/src/elevenlabs/types/websocket_tts_client_message_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..03dbeed5a7cfeaaa23b91006eec12c46af50f31d --- /dev/null +++ b/data/src/elevenlabs/types/websocket_tts_client_message_multi.py @@ -0,0 +1,88 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .generation_config import GenerationConfig +from .pronunciation_dictionary_locator import PronunciationDictionaryLocator +from .realtime_voice_settings import RealtimeVoiceSettings + + +class WebsocketTtsClientMessageMulti(UncheckedBaseModel): + """ + Message sent from the client to the multi-context TTS WebSocket. + """ + + text: typing.Optional[str] = pydantic.Field(default=None) + """ + Text to be synthesized. + For the first message establishing a new context (identified by `context_id`, or a default context if `context_id` is absent), this should be a single space character (' '). + For subsequent messages to an active context, this is the text to synthesize. + This field can be null or an empty string if the message is primarily for control (e.g., using `flush`, `close_context`, or `close_socket`). + """ + + voice_settings: typing.Optional[RealtimeVoiceSettings] = pydantic.Field(default=None) + """ + Voice settings. Can only be provided in the first message for a given context_id (or first message overall if context_id is not used/default). + """ + + generation_config: typing.Optional[GenerationConfig] = pydantic.Field(default=None) + """ + Generation config. Can only be provided in the first message for a given context_id (or first message overall if context_id is not used/default). + """ + + xi_api_key: typing_extensions.Annotated[ + typing.Optional[str], + FieldMetadata(alias="xi-api-key"), + pydantic.Field( + alias="xi-api-key", + description="Your ElevenLabs API key. Can only be provided in the first message for a given context_id if not present in the header.", + ), + ] = None + authorization: typing.Optional[str] = pydantic.Field(default=None) + """ + Your authorization bearer token. Can only be provided in the first message for a given context_id if not present in the header. + """ + + flush: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, flushes the audio buffer and returns the remaining audio for the specified `context_id`. + """ + + pronunciation_dictionary_locators: typing.Optional[typing.List[PronunciationDictionaryLocator]] = pydantic.Field( + default=None + ) + """ + Optional list of pronunciation dictionary locators. Can only be provided in the first message for a given context_id. + """ + + context_id: typing_extensions.Annotated[ + typing.Optional[str], + FieldMetadata(alias="contextId"), + pydantic.Field( + alias="contextId", + description="An identifier for the text-to-speech context. Allows managing multiple independent audio generation streams over a single WebSocket connection. If omitted, a default context is used.", + ), + ] = None + close_context: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, closes the specified `contextId`. No further audio will be generated for this context. The `text` field is ignored. + """ + + close_socket: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, flushes all contexts and closes the entire WebSocket connection. The `text` and `contextId` fields are ignored. + """ + + 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/data/src/elevenlabs/types/websocket_tts_server_message_multi.py b/data/src/elevenlabs/types/websocket_tts_server_message_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..1952af16c3b822c1b73ea0804a4bff854359a6e7 --- /dev/null +++ b/data/src/elevenlabs/types/websocket_tts_server_message_multi.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .alignment import Alignment +from .normalized_alignment import NormalizedAlignment + + +class WebsocketTtsServerMessageMulti(UncheckedBaseModel): + """ + Message sent from the server to the client for the multi-context TTS WebSocket. + """ + + audio: typing.Optional[str] = pydantic.Field(default=None) + """ + A generated partial audio chunk, encoded using the selected output_format (e.g., MP3 as a base64 string). + """ + + is_final: typing.Optional[bool] = pydantic.Field(default=None) + """ + If true, indicates that this is the final message for the specified contextId. This is sent when a context is closed. `audio` will be null or empty. + """ + + normalized_alignment: typing_extensions.Annotated[ + typing.Optional[NormalizedAlignment], + FieldMetadata(alias="normalizedAlignment"), + pydantic.Field(alias="normalizedAlignment"), + ] = None + alignment: typing.Optional[Alignment] = None + context_id: typing_extensions.Annotated[ + typing.Optional[str], + FieldMetadata(alias="contextId"), + pydantic.Field(alias="contextId", description="The context identifier to which this message pertains."), + ] = 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/data/src/elevenlabs/types/whats_app_account_type.py b/data/src/elevenlabs/types/whats_app_account_type.py new file mode 100644 index 0000000000000000000000000000000000000000..1c483333603386124b22a7c24814674aee76cb6e --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_account_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WhatsAppAccountType = typing.Union[typing.Literal["cloud_api", "coexistence"], typing.Any] diff --git a/data/src/elevenlabs/types/whats_app_auth_response.py b/data/src/elevenlabs/types/whats_app_auth_response.py new file mode 100644 index 0000000000000000000000000000000000000000..e47282d1f91eb776243b2c96ae43862bcc9ce6d5 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_auth_response.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .auth_connection_dependencies import AuthConnectionDependencies +from .auth_connection_status import AuthConnectionStatus + + +class WhatsAppAuthResponse(UncheckedBaseModel): + name: str + provider: typing.Optional[typing.Literal["whatsapp"]] = None + phone_number_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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/data/src/elevenlabs/types/whats_app_call_permission_request.py b/data/src/elevenlabs/types/whats_app_call_permission_request.py new file mode 100644 index 0000000000000000000000000000000000000000..f3ef855aeee2f8a157ab8df66b8ea86027a48e1c --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_call_permission_request.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_call_permission_request_state import WhatsAppCallPermissionRequestState + + +class WhatsAppCallPermissionRequest(UncheckedBaseModel): + state: WhatsAppCallPermissionRequestState + requested_at_unix: typing.Optional[int] = 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/data/src/elevenlabs/types/whats_app_call_permission_request_state.py b/data/src/elevenlabs/types/whats_app_call_permission_request_state.py new file mode 100644 index 0000000000000000000000000000000000000000..769a0446d9447ea96e68f0647020c7283211d6e9 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_call_permission_request_state.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WhatsAppCallPermissionRequestState = typing.Union[typing.Literal["blocked", "sent", "accepted", "declined"], typing.Any] diff --git a/data/src/elevenlabs/types/whats_app_conversation_info.py b/data/src/elevenlabs/types/whats_app_conversation_info.py new file mode 100644 index 0000000000000000000000000000000000000000..fb8f83a63831ea2df69357957e71ca26fb2271a7 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_conversation_info.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_call_permission_request import WhatsAppCallPermissionRequest +from .whats_app_conversation_info_direction import WhatsAppConversationInfoDirection +from .whats_app_recipient import WhatsAppRecipient + + +class WhatsAppConversationInfo(UncheckedBaseModel): + direction: typing.Optional[WhatsAppConversationInfoDirection] = None + whatsapp_phone_number_id: typing.Optional[str] = None + whatsapp_user_id: str + awaiting_first_user_message: typing.Optional[bool] = None + recipient: typing.Optional[WhatsAppRecipient] = None + call_permission_request: typing.Optional[WhatsAppCallPermissionRequest] = 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/data/src/elevenlabs/types/whats_app_conversation_info_direction.py b/data/src/elevenlabs/types/whats_app_conversation_info_direction.py new file mode 100644 index 0000000000000000000000000000000000000000..169557bb94903398e50e13c25ae9cb0055e04edd --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_conversation_info_direction.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WhatsAppConversationInfoDirection = typing.Union[typing.Literal["inbound", "outbound", "unknown"], typing.Any] diff --git a/data/src/elevenlabs/types/whats_app_outbound_call_response.py b/data/src/elevenlabs/types/whats_app_outbound_call_response.py new file mode 100644 index 0000000000000000000000000000000000000000..40138e716d06fb2e7eb8c049591d91229233b74c --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_outbound_call_response.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WhatsAppOutboundCallResponse(UncheckedBaseModel): + success: bool + message: str + conversation_id: 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/data/src/elevenlabs/types/whats_app_outbound_message_response.py b/data/src/elevenlabs/types/whats_app_outbound_message_response.py new file mode 100644 index 0000000000000000000000000000000000000000..dc9d251a5a2f09eb1ba48ee697b47abdb9f7977c --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_outbound_message_response.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WhatsAppOutboundMessageResponse(UncheckedBaseModel): + conversation_id: 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/data/src/elevenlabs/types/whats_app_recipient.py b/data/src/elevenlabs/types/whats_app_recipient.py new file mode 100644 index 0000000000000000000000000000000000000000..1bbc1c3124b303223f56f9845e2ce861d1a7ede4 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_recipient.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WhatsAppRecipient(UncheckedBaseModel): + """ + A WhatsApp user by phone number and/or BSUID; the phone wins where one is needed. + """ + + phone: typing.Optional[str] = None + bsuid: 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/data/src/elevenlabs/types/whats_app_template_body_component_params.py b/data/src/elevenlabs/types/whats_app_template_body_component_params.py new file mode 100644 index 0000000000000000000000000000000000000000..778917bb07823b1671be08aa181b99bb8d8c651e --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_body_component_params.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_template_text_param import WhatsAppTemplateTextParam + + +class WhatsAppTemplateBodyComponentParams(UncheckedBaseModel): + parameters: typing.List[WhatsAppTemplateTextParam] + + 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/data/src/elevenlabs/types/whats_app_template_button_component_params.py b/data/src/elevenlabs/types/whats_app_template_button_component_params.py new file mode 100644 index 0000000000000000000000000000000000000000..fe0d00321b4f59fea62e75152d9ef901e7fb9de6 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_button_component_params.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_template_text_param import WhatsAppTemplateTextParam + + +class WhatsAppTemplateButtonComponentParams(UncheckedBaseModel): + parameters: typing.List[WhatsAppTemplateTextParam] + index: int + sub_type: 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/data/src/elevenlabs/types/whats_app_template_document_param.py b/data/src/elevenlabs/types/whats_app_template_document_param.py new file mode 100644 index 0000000000000000000000000000000000000000..14870f36be547ced7c96aa2d78d486bb38fe29a8 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_document_param.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_template_document_param_details import WhatsAppTemplateDocumentParamDetails + + +class WhatsAppTemplateDocumentParam(UncheckedBaseModel): + document: WhatsAppTemplateDocumentParamDetails + + 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/data/src/elevenlabs/types/whats_app_template_document_param_details.py b/data/src/elevenlabs/types/whats_app_template_document_param_details.py new file mode 100644 index 0000000000000000000000000000000000000000..1dc90eac61400346d93f7a3ee619148e4da83223 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_document_param_details.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WhatsAppTemplateDocumentParamDetails(UncheckedBaseModel): + link: str + filename: 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/data/src/elevenlabs/types/whats_app_template_header_component_params.py b/data/src/elevenlabs/types/whats_app_template_header_component_params.py new file mode 100644 index 0000000000000000000000000000000000000000..e91acd644ffe1139bfedd07e755fe11e1f54ede6 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_header_component_params.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_template_header_component_params_parameters_item import ( + WhatsAppTemplateHeaderComponentParamsParametersItem, +) + + +class WhatsAppTemplateHeaderComponentParams(UncheckedBaseModel): + parameters: typing.List[WhatsAppTemplateHeaderComponentParamsParametersItem] + + 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/data/src/elevenlabs/types/whats_app_template_header_component_params_parameters_item.py b/data/src/elevenlabs/types/whats_app_template_header_component_params_parameters_item.py new file mode 100644 index 0000000000000000000000000000000000000000..983df4dcfe55a6a9eb8f0f7be84949eceff5b731 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_header_component_params_parameters_item.py @@ -0,0 +1,81 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .whats_app_template_document_param_details import WhatsAppTemplateDocumentParamDetails +from .whats_app_template_image_param_details import WhatsAppTemplateImageParamDetails +from .whats_app_template_location_param_details import WhatsAppTemplateLocationParamDetails + + +class WhatsAppTemplateHeaderComponentParamsParametersItem_Document(UncheckedBaseModel): + type: typing.Literal["document"] = "document" + document: WhatsAppTemplateDocumentParamDetails + + 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 + + +class WhatsAppTemplateHeaderComponentParamsParametersItem_Image(UncheckedBaseModel): + type: typing.Literal["image"] = "image" + image: WhatsAppTemplateImageParamDetails + + 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 + + +class WhatsAppTemplateHeaderComponentParamsParametersItem_Location(UncheckedBaseModel): + type: typing.Literal["location"] = "location" + location: WhatsAppTemplateLocationParamDetails + + 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 + + +class WhatsAppTemplateHeaderComponentParamsParametersItem_Text(UncheckedBaseModel): + type: typing.Literal["text"] = "text" + parameter_name: typing.Optional[str] = None + text: 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 + + +WhatsAppTemplateHeaderComponentParamsParametersItem = typing_extensions.Annotated[ + typing.Union[ + WhatsAppTemplateHeaderComponentParamsParametersItem_Document, + WhatsAppTemplateHeaderComponentParamsParametersItem_Image, + WhatsAppTemplateHeaderComponentParamsParametersItem_Location, + WhatsAppTemplateHeaderComponentParamsParametersItem_Text, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/whats_app_template_image_param.py b/data/src/elevenlabs/types/whats_app_template_image_param.py new file mode 100644 index 0000000000000000000000000000000000000000..d6f068264714aee59a91dc34affbb561bfc06610 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_image_param.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_template_image_param_details import WhatsAppTemplateImageParamDetails + + +class WhatsAppTemplateImageParam(UncheckedBaseModel): + image: WhatsAppTemplateImageParamDetails + + 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/data/src/elevenlabs/types/whats_app_template_image_param_details.py b/data/src/elevenlabs/types/whats_app_template_image_param_details.py new file mode 100644 index 0000000000000000000000000000000000000000..ae9048f86399842ddb2c2fcc0b2b1c4b7a155d8a --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_image_param_details.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WhatsAppTemplateImageParamDetails(UncheckedBaseModel): + link: 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/data/src/elevenlabs/types/whats_app_template_location_param.py b/data/src/elevenlabs/types/whats_app_template_location_param.py new file mode 100644 index 0000000000000000000000000000000000000000..5ab1f0bc096219f1dbe8e2c1ba5a9a4a05911889 --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_location_param.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .whats_app_template_location_param_details import WhatsAppTemplateLocationParamDetails + + +class WhatsAppTemplateLocationParam(UncheckedBaseModel): + location: WhatsAppTemplateLocationParamDetails + + 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/data/src/elevenlabs/types/whats_app_template_location_param_details.py b/data/src/elevenlabs/types/whats_app_template_location_param_details.py new file mode 100644 index 0000000000000000000000000000000000000000..1a6e8d3b76601198ac8da5001d8bfc27c25a5b5d --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_location_param_details.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WhatsAppTemplateLocationParamDetails(UncheckedBaseModel): + latitude: str + longitude: str + name: str + address: 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/data/src/elevenlabs/types/whats_app_template_text_param.py b/data/src/elevenlabs/types/whats_app_template_text_param.py new file mode 100644 index 0000000000000000000000000000000000000000..1e7853f1bf30b843db8d0ac3e10dae56bd73ec1a --- /dev/null +++ b/data/src/elevenlabs/types/whats_app_template_text_param.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WhatsAppTemplateTextParam(UncheckedBaseModel): + parameter_name: typing.Optional[str] = None + type: typing.Optional[typing.Literal["text"]] = None + text: 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/data/src/elevenlabs/types/widget_config.py b/data/src/elevenlabs/types/widget_config.py new file mode 100644 index 0000000000000000000000000000000000000000..310fac11c0bcf64d5a6a3364fe5e55f8fef0ebc2 --- /dev/null +++ b/data/src/elevenlabs/types/widget_config.py @@ -0,0 +1,279 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .allowlist_item import AllowlistItem +from .embed_variant import EmbedVariant +from .widget_config_avatar import WidgetConfigAvatar +from .widget_config_syntax_highlight_theme import WidgetConfigSyntaxHighlightTheme +from .widget_end_feedback_config import WidgetEndFeedbackConfig +from .widget_expandable import WidgetExpandable +from .widget_feedback_mode import WidgetFeedbackMode +from .widget_language_preset import WidgetLanguagePreset +from .widget_placement import WidgetPlacement +from .widget_styles import WidgetStyles +from .widget_text_contents import WidgetTextContents + + +class WidgetConfig(UncheckedBaseModel): + variant: typing.Optional[EmbedVariant] = pydantic.Field(default=None) + """ + The variant of the widget + """ + + placement: typing.Optional[WidgetPlacement] = pydantic.Field(default=None) + """ + The placement of the widget on the screen + """ + + expandable: typing.Optional[WidgetExpandable] = pydantic.Field(default=None) + """ + Whether the widget is expandable + """ + + avatar: typing.Optional[WidgetConfigAvatar] = pydantic.Field(default=None) + """ + The avatar of the widget + """ + + feedback_mode: typing.Optional[WidgetFeedbackMode] = pydantic.Field(default=None) + """ + The feedback mode of the widget + """ + + end_feedback: typing.Optional[WidgetEndFeedbackConfig] = pydantic.Field(default=None) + """ + Configuration for feedback collected at the end of the conversation + """ + + bg_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The background color of the widget + """ + + text_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The text color of the widget + """ + + btn_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The button color of the widget + """ + + btn_text_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The button text color of the widget + """ + + border_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The border color of the widget + """ + + focus_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The focus color of the widget + """ + + border_radius: typing.Optional[int] = pydantic.Field(default=None) + """ + The border radius of the widget + """ + + btn_radius: typing.Optional[int] = pydantic.Field(default=None) + """ + The button radius of the widget + """ + + action_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The action text of the widget + """ + + start_call_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The start call text of the widget + """ + + end_call_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The end call text of the widget + """ + + expand_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The expand text of the widget + """ + + listening_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display when the agent is listening + """ + + speaking_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display when the agent is speaking + """ + + shareable_page_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display when sharing + """ + + shareable_page_show_terms: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show terms and conditions on the shareable page + """ + + terms_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display for terms and conditions + """ + + terms_html: typing.Optional[str] = pydantic.Field(default=None) + """ + The HTML to display for terms and conditions + """ + + terms_key: typing.Optional[str] = pydantic.Field(default=None) + """ + The key to display for terms and conditions + """ + + show_avatar_when_collapsed: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show the avatar when the widget is collapsed + """ + + disable_banner: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to disable the banner + """ + + override_link: typing.Optional[str] = pydantic.Field(default=None) + """ + The override link for the widget + """ + + markdown_link_allowed_hosts: typing.Optional[typing.List[AllowlistItem]] = pydantic.Field(default=None) + """ + List of allowed hostnames for clickable markdown links. Use { hostname: '*' } to allow any domain. Empty means no links are allowed. + """ + + markdown_link_include_www: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to automatically include www. variants of allowed hosts + """ + + markdown_link_allow_http: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow http:// in addition to https:// for allowed hosts + """ + + mic_muting_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable mic muting + """ + + transcript_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget should show the conversation transcript as it goes on + """ + + text_input_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the user should be able to send text messages + """ + + conversation_mode_toggle_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable the conversation mode toggle in the widget + """ + + default_expanded: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget should be expanded by default + """ + + always_expanded: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget should always be expanded + """ + + dismissible: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget can be dismissed by the user + """ + + show_agent_status: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show agent working/done/error status during tool use + """ + + show_conversation_id: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show the conversation ID after disconnection. + """ + + strip_audio_tags: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to strip audio markup from messages. + """ + + syntax_highlight_theme: typing.Optional[WidgetConfigSyntaxHighlightTheme] = pydantic.Field(default=None) + """ + Theme for code block syntax highlighting. Defaults to auto-detection by the widget when not set. + """ + + text_contents: typing.Optional[WidgetTextContents] = pydantic.Field(default=None) + """ + Text contents of the widget + """ + + styles: typing.Optional[WidgetStyles] = pydantic.Field(default=None) + """ + Styles for the widget + """ + + show_resize_button: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show the resize button + """ + + end_confirmation_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to ask the user to confirm before ending a chat or call + """ + + language_selector: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show the language selector + """ + + supports_text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget can switch to text only mode + """ + + custom_avatar_path: typing.Optional[str] = pydantic.Field(default=None) + """ + The custom avatar path + """ + + language_presets: typing.Optional[typing.Dict[str, WidgetLanguagePreset]] = pydantic.Field(default=None) + """ + Language presets for the widget + """ + + 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/data/src/elevenlabs/types/widget_config_avatar.py b/data/src/elevenlabs/types/widget_config_avatar.py new file mode 100644 index 0000000000000000000000000000000000000000..9f25368a34d2f0758d0d794423d9f974131e3af2 --- /dev/null +++ b/data/src/elevenlabs/types/widget_config_avatar.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WidgetConfigAvatar_Orb(UncheckedBaseModel): + """ + The avatar of the widget + """ + + type: typing.Literal["orb"] = "orb" + color_1: typing.Optional[str] = None + color_2: 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 + + +class WidgetConfigAvatar_Url(UncheckedBaseModel): + """ + The avatar of the widget + """ + + type: typing.Literal["url"] = "url" + custom_url: 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 + + +class WidgetConfigAvatar_Image(UncheckedBaseModel): + """ + The avatar of the widget + """ + + type: typing.Literal["image"] = "image" + url: 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 + + +WidgetConfigAvatar = typing_extensions.Annotated[ + typing.Union[WidgetConfigAvatar_Orb, WidgetConfigAvatar_Url, WidgetConfigAvatar_Image], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/widget_config_response.py b/data/src/elevenlabs/types/widget_config_response.py new file mode 100644 index 0000000000000000000000000000000000000000..e9f48a02d5b16e67bf6e36f9af994f8ca122ca72 --- /dev/null +++ b/data/src/elevenlabs/types/widget_config_response.py @@ -0,0 +1,288 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .allowlist_item import AllowlistItem +from .embed_variant import EmbedVariant +from .file_input_config import FileInputConfig +from .widget_config_response_avatar import WidgetConfigResponseAvatar +from .widget_config_response_syntax_highlight_theme import WidgetConfigResponseSyntaxHighlightTheme +from .widget_end_feedback_config import WidgetEndFeedbackConfig +from .widget_expandable import WidgetExpandable +from .widget_feedback_mode import WidgetFeedbackMode +from .widget_language_preset_response import WidgetLanguagePresetResponse +from .widget_placement import WidgetPlacement +from .widget_styles import WidgetStyles +from .widget_text_contents import WidgetTextContents + + +class WidgetConfigResponse(UncheckedBaseModel): + variant: typing.Optional[EmbedVariant] = pydantic.Field(default=None) + """ + The variant of the widget + """ + + placement: typing.Optional[WidgetPlacement] = pydantic.Field(default=None) + """ + The placement of the widget on the screen + """ + + expandable: typing.Optional[WidgetExpandable] = pydantic.Field(default=None) + """ + Whether the widget is expandable + """ + + avatar: typing.Optional[WidgetConfigResponseAvatar] = pydantic.Field(default=None) + """ + The avatar of the widget + """ + + feedback_mode: typing.Optional[WidgetFeedbackMode] = pydantic.Field(default=None) + """ + The feedback mode of the widget + """ + + end_feedback: typing.Optional[WidgetEndFeedbackConfig] = pydantic.Field(default=None) + """ + Configuration for feedback collected at the end of the conversation + """ + + bg_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The background color of the widget + """ + + text_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The text color of the widget + """ + + btn_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The button color of the widget + """ + + btn_text_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The button text color of the widget + """ + + border_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The border color of the widget + """ + + focus_color: typing.Optional[str] = pydantic.Field(default=None) + """ + The focus color of the widget + """ + + border_radius: typing.Optional[int] = pydantic.Field(default=None) + """ + The border radius of the widget + """ + + btn_radius: typing.Optional[int] = pydantic.Field(default=None) + """ + The button radius of the widget + """ + + action_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The action text of the widget + """ + + start_call_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The start call text of the widget + """ + + end_call_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The end call text of the widget + """ + + expand_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The expand text of the widget + """ + + listening_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display when the agent is listening + """ + + speaking_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display when the agent is speaking + """ + + shareable_page_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display when sharing + """ + + shareable_page_show_terms: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show terms and conditions on the shareable page + """ + + terms_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display for terms and conditions + """ + + terms_html: typing.Optional[str] = pydantic.Field(default=None) + """ + The HTML to display for terms and conditions + """ + + terms_key: typing.Optional[str] = pydantic.Field(default=None) + """ + The key to display for terms and conditions + """ + + show_avatar_when_collapsed: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show the avatar when the widget is collapsed + """ + + disable_banner: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to disable the banner + """ + + override_link: typing.Optional[str] = pydantic.Field(default=None) + """ + The override link for the widget + """ + + markdown_link_allowed_hosts: typing.Optional[typing.List[AllowlistItem]] = pydantic.Field(default=None) + """ + List of allowed hostnames for clickable markdown links. Use { hostname: '*' } to allow any domain. Empty means no links are allowed. + """ + + markdown_link_include_www: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to automatically include www. variants of allowed hosts + """ + + markdown_link_allow_http: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to allow http:// in addition to https:// for allowed hosts + """ + + mic_muting_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable mic muting + """ + + transcript_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget should show the conversation transcript as it goes on + """ + + text_input_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the user should be able to send text messages + """ + + conversation_mode_toggle_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable the conversation mode toggle in the widget + """ + + default_expanded: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget should be expanded by default + """ + + always_expanded: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget should always be expanded + """ + + dismissible: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the widget can be dismissed by the user + """ + + show_agent_status: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show agent working/done/error status during tool use + """ + + show_conversation_id: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show the conversation ID after disconnection. + """ + + strip_audio_tags: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to strip audio markup from messages. + """ + + syntax_highlight_theme: typing.Optional[WidgetConfigResponseSyntaxHighlightTheme] = pydantic.Field(default=None) + """ + Theme for code block syntax highlighting. Defaults to auto-detection by the widget when not set. + """ + + text_contents: typing.Optional[WidgetTextContents] = pydantic.Field(default=None) + """ + Text contents of the widget + """ + + styles: typing.Optional[WidgetStyles] = pydantic.Field(default=None) + """ + Styles for the widget + """ + + show_resize_button: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to show the resize button + """ + + end_confirmation_enabled: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to ask the user to confirm before ending a chat or call + """ + + language: str + supported_language_overrides: typing.Optional[typing.List[str]] = None + language_presets: typing.Optional[typing.Dict[str, WidgetLanguagePresetResponse]] = pydantic.Field(default=None) + """ + Language presets for the widget + """ + + text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the agent uses text-only mode + """ + + supports_text_only: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the agent can be switched to text-only mode + """ + + first_message: typing.Optional[str] = None + use_rtc: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to use WebRTC for conversation connections + """ + + file_input_config: typing.Optional[FileInputConfig] = pydantic.Field(default=None) + """ + Configuration for file upload in the widget + """ + + 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/data/src/elevenlabs/types/widget_config_response_avatar.py b/data/src/elevenlabs/types/widget_config_response_avatar.py new file mode 100644 index 0000000000000000000000000000000000000000..ddd656f2077b0a9f34199c5f222fabae07c81116 --- /dev/null +++ b/data/src/elevenlabs/types/widget_config_response_avatar.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WidgetConfigResponseAvatar_Orb(UncheckedBaseModel): + """ + The avatar of the widget + """ + + type: typing.Literal["orb"] = "orb" + color_1: typing.Optional[str] = None + color_2: 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 + + +class WidgetConfigResponseAvatar_Url(UncheckedBaseModel): + """ + The avatar of the widget + """ + + type: typing.Literal["url"] = "url" + custom_url: 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 + + +class WidgetConfigResponseAvatar_Image(UncheckedBaseModel): + """ + The avatar of the widget + """ + + type: typing.Literal["image"] = "image" + url: 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 + + +WidgetConfigResponseAvatar = typing_extensions.Annotated[ + typing.Union[WidgetConfigResponseAvatar_Orb, WidgetConfigResponseAvatar_Url, WidgetConfigResponseAvatar_Image], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/widget_config_response_syntax_highlight_theme.py b/data/src/elevenlabs/types/widget_config_response_syntax_highlight_theme.py new file mode 100644 index 0000000000000000000000000000000000000000..2ae2ce5d4dabb6a887c977733c5f24a6014a5760 --- /dev/null +++ b/data/src/elevenlabs/types/widget_config_response_syntax_highlight_theme.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WidgetConfigResponseSyntaxHighlightTheme = typing.Union[typing.Literal["light", "dark"], typing.Any] diff --git a/data/src/elevenlabs/types/widget_config_syntax_highlight_theme.py b/data/src/elevenlabs/types/widget_config_syntax_highlight_theme.py new file mode 100644 index 0000000000000000000000000000000000000000..0b4e9740a1ce468e4293b125a4dd06f8d51d104b --- /dev/null +++ b/data/src/elevenlabs/types/widget_config_syntax_highlight_theme.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WidgetConfigSyntaxHighlightTheme = typing.Union[typing.Literal["light", "dark"], typing.Any] diff --git a/data/src/elevenlabs/types/widget_end_feedback_config.py b/data/src/elevenlabs/types/widget_end_feedback_config.py new file mode 100644 index 0000000000000000000000000000000000000000..c5de7a8ffd45db4f1d65e3b550ad53760d7abe74 --- /dev/null +++ b/data/src/elevenlabs/types/widget_end_feedback_config.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .widget_end_feedback_type import WidgetEndFeedbackType + + +class WidgetEndFeedbackConfig(UncheckedBaseModel): + type: typing.Optional[WidgetEndFeedbackType] = pydantic.Field(default=None) + """ + The type of feedback to collect at the end of the conversation + """ + + 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/data/src/elevenlabs/types/widget_end_feedback_type.py b/data/src/elevenlabs/types/widget_end_feedback_type.py new file mode 100644 index 0000000000000000000000000000000000000000..9502550ef865f59d0fd7586ce0d3c340affe9e0e --- /dev/null +++ b/data/src/elevenlabs/types/widget_end_feedback_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WidgetEndFeedbackType = typing.Literal["rating"] diff --git a/data/src/elevenlabs/types/widget_expandable.py b/data/src/elevenlabs/types/widget_expandable.py new file mode 100644 index 0000000000000000000000000000000000000000..028ac36a9673ebd1192486cb25dd3f141fcc94d9 --- /dev/null +++ b/data/src/elevenlabs/types/widget_expandable.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WidgetExpandable = typing.Union[typing.Literal["never", "mobile", "desktop", "always"], typing.Any] diff --git a/data/src/elevenlabs/types/widget_feedback_mode.py b/data/src/elevenlabs/types/widget_feedback_mode.py new file mode 100644 index 0000000000000000000000000000000000000000..8dc295de2e8d005fe15286ab027ef418e6900a31 --- /dev/null +++ b/data/src/elevenlabs/types/widget_feedback_mode.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WidgetFeedbackMode = typing.Union[typing.Literal["none", "during", "end"], typing.Any] diff --git a/data/src/elevenlabs/types/widget_language_preset.py b/data/src/elevenlabs/types/widget_language_preset.py new file mode 100644 index 0000000000000000000000000000000000000000..75934e96003762d51e062da4e9a26304e81a3a64 --- /dev/null +++ b/data/src/elevenlabs/types/widget_language_preset.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .widget_terms_translation import WidgetTermsTranslation +from .widget_text_contents import WidgetTextContents +from .widget_text_contents_translation import WidgetTextContentsTranslation + + +class WidgetLanguagePreset(UncheckedBaseModel): + text_contents: typing.Optional[WidgetTextContents] = pydantic.Field(default=None) + """ + The text contents for the selected language + """ + + text_contents_translation: typing.Optional[WidgetTextContentsTranslation] = pydantic.Field(default=None) + """ + The translation cache for the text contents + """ + + terms_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display for terms and conditions in this language + """ + + terms_html: typing.Optional[str] = pydantic.Field(default=None) + """ + The HTML to display for terms and conditions in this language + """ + + terms_key: typing.Optional[str] = pydantic.Field(default=None) + """ + The key to display for terms and conditions in this language + """ + + terms_translation: typing.Optional[WidgetTermsTranslation] = pydantic.Field(default=None) + """ + The translation cache for the terms + """ + + 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/data/src/elevenlabs/types/widget_language_preset_response.py b/data/src/elevenlabs/types/widget_language_preset_response.py new file mode 100644 index 0000000000000000000000000000000000000000..38a0bf202fffb6698036cd7787506b89d48643e4 --- /dev/null +++ b/data/src/elevenlabs/types/widget_language_preset_response.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .widget_text_contents import WidgetTextContents + + +class WidgetLanguagePresetResponse(UncheckedBaseModel): + first_message: typing.Optional[str] = None + text_contents: typing.Optional[WidgetTextContents] = pydantic.Field(default=None) + """ + The text contents for the selected language + """ + + terms_text: typing.Optional[str] = pydantic.Field(default=None) + """ + The text to display for terms and conditions in this language + """ + + terms_html: typing.Optional[str] = pydantic.Field(default=None) + """ + The HTML to display for terms and conditions in this language + """ + + terms_key: typing.Optional[str] = pydantic.Field(default=None) + """ + The key to display for terms and conditions in this language + """ + + 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/data/src/elevenlabs/types/widget_placement.py b/data/src/elevenlabs/types/widget_placement.py new file mode 100644 index 0000000000000000000000000000000000000000..8517c3eff4715f40df5a0d2135f890b50713580b --- /dev/null +++ b/data/src/elevenlabs/types/widget_placement.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WidgetPlacement = typing.Union[ + typing.Literal["top-left", "top", "top-right", "bottom-left", "bottom", "bottom-right"], typing.Any +] diff --git a/data/src/elevenlabs/types/widget_styles.py b/data/src/elevenlabs/types/widget_styles.py new file mode 100644 index 0000000000000000000000000000000000000000..43bb358e6c2433cc4d090b2649245f36c02fb423 --- /dev/null +++ b/data/src/elevenlabs/types/widget_styles.py @@ -0,0 +1,118 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WidgetStyles(UncheckedBaseModel): + base: typing.Optional[str] = pydantic.Field(default=None) + """ + The base background color. + """ + + base_hover: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of the base background when hovered. + """ + + base_active: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of the base background when active (clicked). + """ + + base_border: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of the border against the base background. + """ + + base_subtle: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of subtle text against the base background. + """ + + base_primary: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of primary text against the base background. + """ + + base_error: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of error text against the base background. + """ + + accent: typing.Optional[str] = pydantic.Field(default=None) + """ + The accent background color. + """ + + accent_hover: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of the accent background when hovered. + """ + + accent_active: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of the accent background when active (clicked). + """ + + accent_border: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of the border against the accent background. + """ + + accent_subtle: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of subtle text against the accent background. + """ + + accent_primary: typing.Optional[str] = pydantic.Field(default=None) + """ + The color of primary text against the accent background. + """ + + overlay_padding: typing.Optional[float] = pydantic.Field(default=None) + """ + The padding around the edges of the viewport. + """ + + button_radius: typing.Optional[float] = pydantic.Field(default=None) + """ + The radius of the buttons. + """ + + input_radius: typing.Optional[float] = pydantic.Field(default=None) + """ + The radius of the input fields. + """ + + bubble_radius: typing.Optional[float] = pydantic.Field(default=None) + """ + The radius of the chat bubbles. + """ + + sheet_radius: typing.Optional[float] = pydantic.Field(default=None) + """ + The default radius of sheets. + """ + + compact_sheet_radius: typing.Optional[float] = pydantic.Field(default=None) + """ + The radius of the sheet in compact mode. + """ + + dropdown_sheet_radius: typing.Optional[float] = pydantic.Field(default=None) + """ + The radius of the dropdown sheet. + """ + + 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/data/src/elevenlabs/types/widget_terms_translation.py b/data/src/elevenlabs/types/widget_terms_translation.py new file mode 100644 index 0000000000000000000000000000000000000000..3e20cc0ae38227949565570566cd0fa5110986c5 --- /dev/null +++ b/data/src/elevenlabs/types/widget_terms_translation.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WidgetTermsTranslation(UncheckedBaseModel): + source_hash: str + text: 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/data/src/elevenlabs/types/widget_text_contents.py b/data/src/elevenlabs/types/widget_text_contents.py new file mode 100644 index 0000000000000000000000000000000000000000..a8c883117adadbaae721c0bd3174191842d45e2d --- /dev/null +++ b/data/src/elevenlabs/types/widget_text_contents.py @@ -0,0 +1,290 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WidgetTextContents(UncheckedBaseModel): + main_label: typing.Optional[str] = pydantic.Field(default=None) + """ + Call to action displayed inside the compact and full variants. + """ + + start_call: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the start call button. + """ + + start_chat: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the start chat button (text only) + """ + + new_call: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the new call button. Displayed when the caller already finished at least one call in order ot start the next one. + """ + + end_call: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the end call button. + """ + + mute_microphone: typing.Optional[str] = pydantic.Field(default=None) + """ + ARIA label for the mute microphone button. + """ + + change_language: typing.Optional[str] = pydantic.Field(default=None) + """ + ARIA label for the change language dropdown. + """ + + collapse: typing.Optional[str] = pydantic.Field(default=None) + """ + ARIA label for the collapse button. + """ + + expand: typing.Optional[str] = pydantic.Field(default=None) + """ + ARIA label for the expand button. + """ + + copied: typing.Optional[str] = pydantic.Field(default=None) + """ + Text displayed when the user copies a value using the copy button. + """ + + accept_terms: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the accept terms button. + """ + + dismiss_terms: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the cancel terms button. + """ + + listening_status: typing.Optional[str] = pydantic.Field(default=None) + """ + Status displayed when the agent is listening. + """ + + speaking_status: typing.Optional[str] = pydantic.Field(default=None) + """ + Status displayed when the agent is speaking. + """ + + connecting_status: typing.Optional[str] = pydantic.Field(default=None) + """ + Status displayed when the agent is connecting. + """ + + chatting_status: typing.Optional[str] = pydantic.Field(default=None) + """ + Status displayed when the agent is chatting (text only) + """ + + queue_waiting_status: typing.Optional[str] = pydantic.Field(default=None) + """ + Status displayed while waiting in the queue for an available agent. + """ + + queue_waiting_status_short: typing.Optional[str] = pydantic.Field(default=None) + """ + Short status displayed while waiting for an available agent. + """ + + input_label: typing.Optional[str] = pydantic.Field(default=None) + """ + ARIA label for the text message input. + """ + + input_placeholder: typing.Optional[str] = pydantic.Field(default=None) + """ + Placeholder text for the text message input. + """ + + input_placeholder_text_only: typing.Optional[str] = pydantic.Field(default=None) + """ + Placeholder text for the text message input (text only) + """ + + input_placeholder_new_conversation: typing.Optional[str] = pydantic.Field(default=None) + """ + Placeholder text for the text message input when starting a new conversation (text only) + """ + + user_ended_conversation: typing.Optional[str] = pydantic.Field(default=None) + """ + Information message displayed when the user ends the conversation. + """ + + agent_ended_conversation: typing.Optional[str] = pydantic.Field(default=None) + """ + Information message displayed when the agent ends the conversation. + """ + + conversation_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Text label used next to the conversation ID. + """ + + error_occurred: typing.Optional[str] = pydantic.Field(default=None) + """ + Text label used when an error occurs. + """ + + queue_timed_out: typing.Optional[str] = pydantic.Field(default=None) + """ + Error message displayed when the queue wait times out. + """ + + copy_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label used for the copy ID button. + """ + + initiate_feedback: typing.Optional[str] = pydantic.Field(default=None) + """ + Text displayed to prompt the user for feedback. + """ + + request_follow_up_feedback: typing.Optional[str] = pydantic.Field(default=None) + """ + Text displayed to request additional feedback details. + """ + + thanks_for_feedback: typing.Optional[str] = pydantic.Field(default=None) + """ + Text displayed to thank the user for providing feedback. + """ + + thanks_for_feedback_details: typing.Optional[str] = pydantic.Field(default=None) + """ + Additional text displayed explaining the value of user feedback. + """ + + follow_up_feedback_placeholder: typing.Optional[str] = pydantic.Field(default=None) + """ + Placeholder text for the follow-up feedback input field. + """ + + submit: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the submit button. + """ + + go_back: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the go back button. + """ + + send_message: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the send message button. + """ + + text_mode: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the switch to text mode button. + """ + + voice_mode: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the switch to voice mode button. + """ + + switched_to_text_mode: typing.Optional[str] = pydantic.Field(default=None) + """ + Toast notification displayed when switching to text mode. + """ + + switched_to_voice_mode: typing.Optional[str] = pydantic.Field(default=None) + """ + Toast notification displayed when switching to voice mode. + """ + + copy_: typing_extensions.Annotated[ + typing.Optional[str], + FieldMetadata(alias="copy"), + pydantic.Field(alias="copy", description="Text and ARIA label for the copy button."), + ] = None + download: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the download button. + """ + + wrap: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the wrap toggle button. + """ + + agent_working: typing.Optional[str] = pydantic.Field(default=None) + """ + Status text displayed when the agent is processing a tool call. + """ + + agent_done: typing.Optional[str] = pydantic.Field(default=None) + """ + Status text displayed when the agent finishes processing a tool call. + """ + + agent_error: typing.Optional[str] = pydantic.Field(default=None) + """ + Status text displayed when the agent encounters an error during a tool call. + """ + + attach_file: typing.Optional[str] = pydantic.Field(default=None) + """ + Text and ARIA label for the attach file button. + """ + + remove_file: typing.Optional[str] = pydantic.Field(default=None) + """ + ARIA label for the remove file button. + """ + + file_upload_error: typing.Optional[str] = pydantic.Field(default=None) + """ + Error message displayed when a file fails to upload. + """ + + file_type_unsupported: typing.Optional[str] = pydantic.Field(default=None) + """ + Error message displayed when an unsupported file type is selected. Followed by the list of accepted types. + """ + + file_too_large: typing.Optional[str] = pydantic.Field(default=None) + """ + Error message displayed when a file exceeds the maximum size limit. + """ + + file_limit_reached: typing.Optional[str] = pydantic.Field(default=None) + """ + Error message displayed when the maximum number of files for a conversation is reached. + """ + + typing_indicator: typing.Optional[str] = pydantic.Field(default=None) + """ + Status text displayed while the agent is typing. + """ + + rich_content_unavailable: typing.Optional[str] = pydantic.Field(default=None) + """ + Fallback message displayed when rich content cannot be rendered. + """ + + 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/data/src/elevenlabs/types/widget_text_contents_translation.py b/data/src/elevenlabs/types/widget_text_contents_translation.py new file mode 100644 index 0000000000000000000000000000000000000000..701226348b8d3487a21c8b8a6c5ac281ecfc90e2 --- /dev/null +++ b/data/src/elevenlabs/types/widget_text_contents_translation.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WidgetTextContentsTranslation(UncheckedBaseModel): + source: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + The source text each translated field was derived from + """ + + text: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None) + """ + The last auto-translated output for each translated field + """ + + 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/data/src/elevenlabs/types/word_timestamp.py b/data/src/elevenlabs/types/word_timestamp.py new file mode 100644 index 0000000000000000000000000000000000000000..a5dca5569aada5bdf1a7558c061a0a6a6760d6e2 --- /dev/null +++ b/data/src/elevenlabs/types/word_timestamp.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WordTimestamp(UncheckedBaseModel): + word: str + start_ms: int + end_ms: int + + 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/data/src/elevenlabs/types/workflow_edge_model_input.py b/data/src/elevenlabs/types/workflow_edge_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..c9527eb4d5e632be6eca7d2982d565fc05f710c5 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_edge_model_input.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .workflow_edge_model_input_backward_condition import WorkflowEdgeModelInputBackwardCondition +from .workflow_edge_model_input_forward_condition import WorkflowEdgeModelInputForwardCondition + + +class WorkflowEdgeModelInput(UncheckedBaseModel): + source: str = pydantic.Field() + """ + ID of the source node. + """ + + target: str = pydantic.Field() + """ + ID of the target node. + """ + + forward_condition: typing.Optional[WorkflowEdgeModelInputForwardCondition] = pydantic.Field(default=None) + """ + Condition that must be met for the edge to be traversed in the forward direction (source to target). + """ + + backward_condition: typing.Optional[WorkflowEdgeModelInputBackwardCondition] = pydantic.Field(default=None) + """ + Condition that must be met for the edge to be traversed in the backward direction (target to source). + """ + + 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 + + +update_forward_refs(WorkflowEdgeModelInput) diff --git a/data/src/elevenlabs/types/workflow_edge_model_input_backward_condition.py b/data/src/elevenlabs/types/workflow_edge_model_input_backward_condition.py new file mode 100644 index 0000000000000000000000000000000000000000..998a515d884923d679d0f6dafda34231213302d4 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_edge_model_input_backward_condition.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowEdgeModelInputBackwardCondition_Expression(UncheckedBaseModel): + type: typing.Literal["expression"] = "expression" + label: typing.Optional[str] = None + expression: "AstNodeInput" + + 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 + + +class WorkflowEdgeModelInputBackwardCondition_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + label: typing.Optional[str] = None + condition: 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 + + +class WorkflowEdgeModelInputBackwardCondition_Result(UncheckedBaseModel): + type: typing.Literal["result"] = "result" + label: typing.Optional[str] = None + successful: bool + + 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 + + +class WorkflowEdgeModelInputBackwardCondition_Unconditional(UncheckedBaseModel): + type: typing.Literal["unconditional"] = "unconditional" + label: 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 + + +WorkflowEdgeModelInputBackwardCondition = typing_extensions.Annotated[ + typing.Union[ + WorkflowEdgeModelInputBackwardCondition_Expression, + WorkflowEdgeModelInputBackwardCondition_Llm, + WorkflowEdgeModelInputBackwardCondition_Result, + WorkflowEdgeModelInputBackwardCondition_Unconditional, + ], + UnionMetadata(discriminant="type"), +] +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + WorkflowEdgeModelInputBackwardCondition_Expression, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/workflow_edge_model_input_forward_condition.py b/data/src/elevenlabs/types/workflow_edge_model_input_forward_condition.py new file mode 100644 index 0000000000000000000000000000000000000000..1eb46574e710a4a63f665d70895217da9cb0fe3c --- /dev/null +++ b/data/src/elevenlabs/types/workflow_edge_model_input_forward_condition.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowEdgeModelInputForwardCondition_Expression(UncheckedBaseModel): + type: typing.Literal["expression"] = "expression" + label: typing.Optional[str] = None + expression: "AstNodeInput" + + 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 + + +class WorkflowEdgeModelInputForwardCondition_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + label: typing.Optional[str] = None + condition: 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 + + +class WorkflowEdgeModelInputForwardCondition_Result(UncheckedBaseModel): + type: typing.Literal["result"] = "result" + label: typing.Optional[str] = None + successful: bool + + 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 + + +class WorkflowEdgeModelInputForwardCondition_Unconditional(UncheckedBaseModel): + type: typing.Literal["unconditional"] = "unconditional" + label: 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 + + +WorkflowEdgeModelInputForwardCondition = typing_extensions.Annotated[ + typing.Union[ + WorkflowEdgeModelInputForwardCondition_Expression, + WorkflowEdgeModelInputForwardCondition_Llm, + WorkflowEdgeModelInputForwardCondition_Result, + WorkflowEdgeModelInputForwardCondition_Unconditional, + ], + UnionMetadata(discriminant="type"), +] +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + WorkflowEdgeModelInputForwardCondition_Expression, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/workflow_edge_model_output.py b/data/src/elevenlabs/types/workflow_edge_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..232ca7c50f5de67fffb50a30de841f48c11b32dd --- /dev/null +++ b/data/src/elevenlabs/types/workflow_edge_model_output.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .workflow_edge_model_output_backward_condition import WorkflowEdgeModelOutputBackwardCondition +from .workflow_edge_model_output_forward_condition import WorkflowEdgeModelOutputForwardCondition + + +class WorkflowEdgeModelOutput(UncheckedBaseModel): + source: str = pydantic.Field() + """ + ID of the source node. + """ + + target: str = pydantic.Field() + """ + ID of the target node. + """ + + forward_condition: typing.Optional[WorkflowEdgeModelOutputForwardCondition] = pydantic.Field(default=None) + """ + Condition that must be met for the edge to be traversed in the forward direction (source to target). + """ + + backward_condition: typing.Optional[WorkflowEdgeModelOutputBackwardCondition] = pydantic.Field(default=None) + """ + Condition that must be met for the edge to be traversed in the backward direction (target to source). + """ + + 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 + + +update_forward_refs(WorkflowEdgeModelOutput) diff --git a/data/src/elevenlabs/types/workflow_edge_model_output_backward_condition.py b/data/src/elevenlabs/types/workflow_edge_model_output_backward_condition.py new file mode 100644 index 0000000000000000000000000000000000000000..01d02d58cf5513a72cccbf36fe741f731589945e --- /dev/null +++ b/data/src/elevenlabs/types/workflow_edge_model_output_backward_condition.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowEdgeModelOutputBackwardCondition_Expression(UncheckedBaseModel): + type: typing.Literal["expression"] = "expression" + label: typing.Optional[str] = None + expression: "AstNodeOutput" + + 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 + + +class WorkflowEdgeModelOutputBackwardCondition_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + label: typing.Optional[str] = None + condition: 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 + + +class WorkflowEdgeModelOutputBackwardCondition_Result(UncheckedBaseModel): + type: typing.Literal["result"] = "result" + label: typing.Optional[str] = None + successful: bool + + 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 + + +class WorkflowEdgeModelOutputBackwardCondition_Unconditional(UncheckedBaseModel): + type: typing.Literal["unconditional"] = "unconditional" + label: 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 + + +WorkflowEdgeModelOutputBackwardCondition = typing_extensions.Annotated[ + typing.Union[ + WorkflowEdgeModelOutputBackwardCondition_Expression, + WorkflowEdgeModelOutputBackwardCondition_Llm, + WorkflowEdgeModelOutputBackwardCondition_Result, + WorkflowEdgeModelOutputBackwardCondition_Unconditional, + ], + UnionMetadata(discriminant="type"), +] +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + WorkflowEdgeModelOutputBackwardCondition_Expression, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/workflow_edge_model_output_forward_condition.py b/data/src/elevenlabs/types/workflow_edge_model_output_forward_condition.py new file mode 100644 index 0000000000000000000000000000000000000000..75d5854b31a491271dab20f6867525abd37fae1e --- /dev/null +++ b/data/src/elevenlabs/types/workflow_edge_model_output_forward_condition.py @@ -0,0 +1,112 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowEdgeModelOutputForwardCondition_Expression(UncheckedBaseModel): + type: typing.Literal["expression"] = "expression" + label: typing.Optional[str] = None + expression: "AstNodeOutput" + + 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 + + +class WorkflowEdgeModelOutputForwardCondition_Llm(UncheckedBaseModel): + type: typing.Literal["llm"] = "llm" + label: typing.Optional[str] = None + condition: 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 + + +class WorkflowEdgeModelOutputForwardCondition_Result(UncheckedBaseModel): + type: typing.Literal["result"] = "result" + label: typing.Optional[str] = None + successful: bool + + 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 + + +class WorkflowEdgeModelOutputForwardCondition_Unconditional(UncheckedBaseModel): + type: typing.Literal["unconditional"] = "unconditional" + label: 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 + + +WorkflowEdgeModelOutputForwardCondition = typing_extensions.Annotated[ + typing.Union[ + WorkflowEdgeModelOutputForwardCondition_Expression, + WorkflowEdgeModelOutputForwardCondition_Llm, + WorkflowEdgeModelOutputForwardCondition_Result, + WorkflowEdgeModelOutputForwardCondition_Unconditional, + ], + UnionMetadata(discriminant="type"), +] +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + WorkflowEdgeModelOutputForwardCondition_Expression, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/workflow_end_node_model_input.py b/data/src/elevenlabs/types/workflow_end_node_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..d54f4f5c4be78ff91ab3c75adb8cb3eaf207b578 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_end_node_model_input.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_input import PositionInput +from .workflow_end_node_outcome import WorkflowEndNodeOutcome + + +class WorkflowEndNodeModelInput(UncheckedBaseModel): + position: typing.Optional[PositionInput] = pydantic.Field(default=None) + """ + Position of the node in the workflow. + """ + + edge_order: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + outcome: typing.Optional[WorkflowEndNodeOutcome] = pydantic.Field(default=None) + """ + Whether reaching this End node ends the conversation as a success or a failure. + """ + + 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/data/src/elevenlabs/types/workflow_end_node_model_output.py b/data/src/elevenlabs/types/workflow_end_node_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..4ca3a8fa50a447d624c3df9b6d95847bee6bd618 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_end_node_model_output.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_output import PositionOutput +from .workflow_end_node_outcome import WorkflowEndNodeOutcome + + +class WorkflowEndNodeModelOutput(UncheckedBaseModel): + position: PositionOutput = pydantic.Field() + """ + Position of the node in the workflow. + """ + + edge_order: typing.List[str] = pydantic.Field() + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + outcome: WorkflowEndNodeOutcome = pydantic.Field() + """ + Whether reaching this End node ends the conversation as a success or a failure. + """ + + 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/data/src/elevenlabs/types/workflow_end_node_outcome.py b/data/src/elevenlabs/types/workflow_end_node_outcome.py new file mode 100644 index 0000000000000000000000000000000000000000..a07be62b7518651565dff9632e9cc0aa2054ca80 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_end_node_outcome.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkflowEndNodeOutcome = typing.Union[typing.Literal["success", "failure"], typing.Any] diff --git a/data/src/elevenlabs/types/workflow_expression_condition_model_input.py b/data/src/elevenlabs/types/workflow_expression_condition_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..e60523dd8758b92bc67e2093ebb0104f791e9806 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_expression_condition_model_input.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowExpressionConditionModelInput(UncheckedBaseModel): + label: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional human-readable label for the condition used throughout the UI. + """ + + expression: "AstNodeInput" = pydantic.Field() + """ + Expression to evaluate. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + WorkflowExpressionConditionModelInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/workflow_expression_condition_model_output.py b/data/src/elevenlabs/types/workflow_expression_condition_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..d6cb61d2e351aabdda79cf1149b5cc2bccb2a801 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_expression_condition_model_output.py @@ -0,0 +1,64 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowExpressionConditionModelOutput(UncheckedBaseModel): + label: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional human-readable label for the condition used throughout the UI. + """ + + expression: "AstNodeOutput" = pydantic.Field() + """ + Expression to evaluate. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + WorkflowExpressionConditionModelOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/workflow_features_usage_common_model.py b/data/src/elevenlabs/types/workflow_features_usage_common_model.py new file mode 100644 index 0000000000000000000000000000000000000000..4009de9edde3b94faa31ee470b769c8d7fc6cc25 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_features_usage_common_model.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .feature_status_common_model import FeatureStatusCommonModel + + +class WorkflowFeaturesUsageCommonModel(UncheckedBaseModel): + enabled: typing.Optional[bool] = None + tool_node: typing.Optional[FeatureStatusCommonModel] = None + standalone_agent_node: typing.Optional[FeatureStatusCommonModel] = None + phone_number_node: typing.Optional[FeatureStatusCommonModel] = None + end_node: typing.Optional[FeatureStatusCommonModel] = None + override_agent_node: typing.Optional[FeatureStatusCommonModel] = 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/data/src/elevenlabs/types/workflow_llm_condition_model_input.py b/data/src/elevenlabs/types/workflow_llm_condition_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..2ecf958441a157c90998a5e2c8a35b312e1fe4b7 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_llm_condition_model_input.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowLlmConditionModelInput(UncheckedBaseModel): + label: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional human-readable label for the condition used throughout the UI. + """ + + condition: str = pydantic.Field() + """ + Condition to evaluate + """ + + 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/data/src/elevenlabs/types/workflow_llm_condition_model_output.py b/data/src/elevenlabs/types/workflow_llm_condition_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..430c669be127f1547944c2fd26dd19092e987e29 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_llm_condition_model_output.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowLlmConditionModelOutput(UncheckedBaseModel): + label: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional human-readable label for the condition used throughout the UI. + """ + + condition: str = pydantic.Field() + """ + Condition to evaluate + """ + + 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/data/src/elevenlabs/types/workflow_override_agent_node_model_input.py b/data/src/elevenlabs/types/workflow_override_agent_node_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..7fb088dc120ec51b431c01b433b927ceac0945b0 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_override_agent_node_model_input.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversational_config_api_model_workflow_override_input import ConversationalConfigApiModelWorkflowOverrideInput +from .entry_behavior import EntryBehavior +from .knowledge_base_locator import KnowledgeBaseLocator +from .position_input import PositionInput + + +class WorkflowOverrideAgentNodeModelInput(UncheckedBaseModel): + position: typing.Optional[PositionInput] = pydantic.Field(default=None) + """ + Position of the node in the workflow. + """ + + edge_order: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + conversation_config: typing.Optional[ConversationalConfigApiModelWorkflowOverrideInput] = pydantic.Field( + default=None + ) + """ + Configuration overrides applied while the subagent is conducting the conversation. + """ + + additional_prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + Specific goal for this subagent. It will be added to the system prompt and can be used to further refine the agent's behavior in this specific context. + """ + + additional_knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) + """ + Additional knowledge base documents that the subagent has access to. These will be used in addition to the main agent's documents. + """ + + additional_tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + IDs of additional tools that the subagent has access to. These will be used in addition to the main agent's tools. + """ + + label: str = pydantic.Field() + """ + Human-readable label for the node used throughout the UI. + """ + + entry_behavior: typing.Optional[EntryBehavior] = pydantic.Field(default=None) + """ + Dictates whether this node should immediately generate a response upon entry or wait for the user input. When set to "auto", the behavior will be decided based on the type of the preceding node: "wait_for_user" after the "say" and "start" nodes and "generate_immediately" otherwise. + """ + + 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 + + +update_forward_refs(WorkflowOverrideAgentNodeModelInput) diff --git a/data/src/elevenlabs/types/workflow_override_agent_node_model_output.py b/data/src/elevenlabs/types/workflow_override_agent_node_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..7a8a1d47927978330d5ea7ceb7f55c53cb545527 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_override_agent_node_model_output.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversational_config_api_model_workflow_override_output import ConversationalConfigApiModelWorkflowOverrideOutput +from .entry_behavior import EntryBehavior +from .knowledge_base_locator import KnowledgeBaseLocator +from .position_output import PositionOutput + + +class WorkflowOverrideAgentNodeModelOutput(UncheckedBaseModel): + position: PositionOutput = pydantic.Field() + """ + Position of the node in the workflow. + """ + + edge_order: typing.List[str] = pydantic.Field() + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + conversation_config: ConversationalConfigApiModelWorkflowOverrideOutput = pydantic.Field() + """ + Configuration overrides applied while the subagent is conducting the conversation. + """ + + additional_prompt: str = pydantic.Field() + """ + Specific goal for this subagent. It will be added to the system prompt and can be used to further refine the agent's behavior in this specific context. + """ + + additional_knowledge_base: typing.List[KnowledgeBaseLocator] = pydantic.Field() + """ + Additional knowledge base documents that the subagent has access to. These will be used in addition to the main agent's documents. + """ + + additional_tool_ids: typing.List[str] = pydantic.Field() + """ + IDs of additional tools that the subagent has access to. These will be used in addition to the main agent's tools. + """ + + label: str = pydantic.Field() + """ + Human-readable label for the node used throughout the UI. + """ + + entry_behavior: EntryBehavior = pydantic.Field() + """ + Dictates whether this node should immediately generate a response upon entry or wait for the user input. When set to "auto", the behavior will be decided based on the type of the preceding node: "wait_for_user" after the "say" and "start" nodes and "generate_immediately" otherwise. + """ + + 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 + + +update_forward_refs(WorkflowOverrideAgentNodeModelOutput) diff --git a/data/src/elevenlabs/types/workflow_phone_number_node_model_input.py b/data/src/elevenlabs/types/workflow_phone_number_node_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..c96d55e6443e8121af5ecc128b56b277c05361e2 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_phone_number_node_model_input.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_input import PositionInput +from .transfer_type_enum import TransferTypeEnum +from .uui_transfer_config import UuiTransferConfig +from .workflow_phone_number_node_model_input_custom_sip_headers_item import ( + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem, +) +from .workflow_phone_number_node_model_input_post_dial_digits import WorkflowPhoneNumberNodeModelInputPostDialDigits +from .workflow_phone_number_node_model_input_transfer_destination import ( + WorkflowPhoneNumberNodeModelInputTransferDestination, +) + + +class WorkflowPhoneNumberNodeModelInput(UncheckedBaseModel): + custom_sip_headers: typing.Optional[typing.List[WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem]] = ( + pydantic.Field(default=None) + ) + """ + Custom SIP headers to include when transferring the call. Each header can be either a static value or a dynamic variable reference. + """ + + transfer_destination: WorkflowPhoneNumberNodeModelInputTransferDestination + transfer_type: typing.Optional[TransferTypeEnum] = None + sip_refer_play_dialtone: typing.Optional[bool] = pydantic.Field(default=None) + """ + When True, a ringing tone is played on the original call leg while a SIP REFER transfer completes. The tone is carried over RTP to the SIP peer executing the REFER, so disable this if the receiving system (e.g. an SBC or contact center) should not hear it. When disabled the caller hears silence until the transfer completes. SIP REFER transfers only. + """ + + uui: typing.Optional[UuiTransferConfig] = pydantic.Field(default=None) + """ + User-to-User Information (RFC 7433) to attach to SIP REFER transfers. Carries call context such as CRM identifiers or escalation reason across the transfer boundary. + """ + + post_dial_digits: typing.Optional[WorkflowPhoneNumberNodeModelInputPostDialDigits] = pydantic.Field(default=None) + """ + DTMF digits to send after call connects (e.g., 'ww1234' for extension). Can be either a static value or a dynamic variable reference. Use 'w' for 0.5s pause. Only supported for Twilio transfers. + """ + + position: typing.Optional[PositionInput] = pydantic.Field(default=None) + """ + Position of the node in the workflow. + """ + + edge_order: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + 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/data/src/elevenlabs/types/workflow_phone_number_node_model_input_custom_sip_headers_item.py b/data/src/elevenlabs/types/workflow_phone_number_node_model_input_custom_sip_headers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..efb0de809360725a286b6c5e066fe8f69e3d3b07 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_phone_number_node_model_input_custom_sip_headers_item.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Dynamic(UncheckedBaseModel): + type: typing.Literal["dynamic"] = "dynamic" + value: str + key: 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 + + +class WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Static(UncheckedBaseModel): + type: typing.Literal["static"] = "static" + key: str + value: 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 + + +WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem = typing_extensions.Annotated[ + typing.Union[ + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Dynamic, + WorkflowPhoneNumberNodeModelInputCustomSipHeadersItem_Static, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/workflow_phone_number_node_model_input_post_dial_digits.py b/data/src/elevenlabs/types/workflow_phone_number_node_model_input_post_dial_digits.py new file mode 100644 index 0000000000000000000000000000000000000000..e7e7ddd346178591f1929c815242346650853844 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_phone_number_node_model_input_post_dial_digits.py @@ -0,0 +1,46 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowPhoneNumberNodeModelInputPostDialDigits_Dynamic(UncheckedBaseModel): + type: typing.Literal["dynamic"] = "dynamic" + value: 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 + + +class WorkflowPhoneNumberNodeModelInputPostDialDigits_Static(UncheckedBaseModel): + type: typing.Literal["static"] = "static" + value: 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 + + +WorkflowPhoneNumberNodeModelInputPostDialDigits = typing_extensions.Annotated[ + typing.Union[ + WorkflowPhoneNumberNodeModelInputPostDialDigits_Dynamic, WorkflowPhoneNumberNodeModelInputPostDialDigits_Static + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/workflow_phone_number_node_model_input_transfer_destination.py b/data/src/elevenlabs/types/workflow_phone_number_node_model_input_transfer_destination.py new file mode 100644 index 0000000000000000000000000000000000000000..7c4bb73c5f756a6356531ae96da90a703eae0908 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_phone_number_node_model_input_transfer_destination.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowPhoneNumberNodeModelInputTransferDestination_Phone(UncheckedBaseModel): + type: typing.Literal["phone"] = "phone" + phone_number: 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 + + +class WorkflowPhoneNumberNodeModelInputTransferDestination_PhoneDynamicVariable(UncheckedBaseModel): + type: typing.Literal["phone_dynamic_variable"] = "phone_dynamic_variable" + phone_number: 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 + + +class WorkflowPhoneNumberNodeModelInputTransferDestination_SipUri(UncheckedBaseModel): + type: typing.Literal["sip_uri"] = "sip_uri" + sip_uri: 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 + + +class WorkflowPhoneNumberNodeModelInputTransferDestination_SipUriDynamicVariable(UncheckedBaseModel): + type: typing.Literal["sip_uri_dynamic_variable"] = "sip_uri_dynamic_variable" + sip_uri: 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 + + +WorkflowPhoneNumberNodeModelInputTransferDestination = typing_extensions.Annotated[ + typing.Union[ + WorkflowPhoneNumberNodeModelInputTransferDestination_Phone, + WorkflowPhoneNumberNodeModelInputTransferDestination_PhoneDynamicVariable, + WorkflowPhoneNumberNodeModelInputTransferDestination_SipUri, + WorkflowPhoneNumberNodeModelInputTransferDestination_SipUriDynamicVariable, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/workflow_phone_number_node_model_output.py b/data/src/elevenlabs/types/workflow_phone_number_node_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..332d4643a34bc53f9c999d5ad386cc3d3f60c9c2 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_phone_number_node_model_output.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_output import PositionOutput +from .transfer_type_enum import TransferTypeEnum +from .uui_transfer_config import UuiTransferConfig +from .workflow_phone_number_node_model_output_custom_sip_headers_item import ( + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem, +) +from .workflow_phone_number_node_model_output_post_dial_digits import WorkflowPhoneNumberNodeModelOutputPostDialDigits +from .workflow_phone_number_node_model_output_transfer_destination import ( + WorkflowPhoneNumberNodeModelOutputTransferDestination, +) + + +class WorkflowPhoneNumberNodeModelOutput(UncheckedBaseModel): + custom_sip_headers: typing.List[WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem] = pydantic.Field() + """ + Custom SIP headers to include when transferring the call. Each header can be either a static value or a dynamic variable reference. + """ + + transfer_destination: WorkflowPhoneNumberNodeModelOutputTransferDestination + transfer_type: TransferTypeEnum + sip_refer_play_dialtone: bool = pydantic.Field() + """ + When True, a ringing tone is played on the original call leg while a SIP REFER transfer completes. The tone is carried over RTP to the SIP peer executing the REFER, so disable this if the receiving system (e.g. an SBC or contact center) should not hear it. When disabled the caller hears silence until the transfer completes. SIP REFER transfers only. + """ + + uui: typing.Optional[UuiTransferConfig] = pydantic.Field(default=None) + """ + User-to-User Information (RFC 7433) to attach to SIP REFER transfers. Carries call context such as CRM identifiers or escalation reason across the transfer boundary. + """ + + post_dial_digits: typing.Optional[WorkflowPhoneNumberNodeModelOutputPostDialDigits] = pydantic.Field(default=None) + """ + DTMF digits to send after call connects (e.g., 'ww1234' for extension). Can be either a static value or a dynamic variable reference. Use 'w' for 0.5s pause. Only supported for Twilio transfers. + """ + + position: PositionOutput = pydantic.Field() + """ + Position of the node in the workflow. + """ + + edge_order: typing.List[str] = pydantic.Field() + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + 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/data/src/elevenlabs/types/workflow_phone_number_node_model_output_custom_sip_headers_item.py b/data/src/elevenlabs/types/workflow_phone_number_node_model_output_custom_sip_headers_item.py new file mode 100644 index 0000000000000000000000000000000000000000..acb3bfa628e2fd2db6b8e8fc38313bf7e0930742 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_phone_number_node_model_output_custom_sip_headers_item.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Dynamic(UncheckedBaseModel): + type: typing.Literal["dynamic"] = "dynamic" + value: str + key: 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 + + +class WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Static(UncheckedBaseModel): + type: typing.Literal["static"] = "static" + key: str + value: 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 + + +WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem = typing_extensions.Annotated[ + typing.Union[ + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Dynamic, + WorkflowPhoneNumberNodeModelOutputCustomSipHeadersItem_Static, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/workflow_phone_number_node_model_output_post_dial_digits.py b/data/src/elevenlabs/types/workflow_phone_number_node_model_output_post_dial_digits.py new file mode 100644 index 0000000000000000000000000000000000000000..df1839fe557871d66c47ac6b6607236cf418d306 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_phone_number_node_model_output_post_dial_digits.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowPhoneNumberNodeModelOutputPostDialDigits_Dynamic(UncheckedBaseModel): + type: typing.Literal["dynamic"] = "dynamic" + value: 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 + + +class WorkflowPhoneNumberNodeModelOutputPostDialDigits_Static(UncheckedBaseModel): + type: typing.Literal["static"] = "static" + value: 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 + + +WorkflowPhoneNumberNodeModelOutputPostDialDigits = typing_extensions.Annotated[ + typing.Union[ + WorkflowPhoneNumberNodeModelOutputPostDialDigits_Dynamic, + WorkflowPhoneNumberNodeModelOutputPostDialDigits_Static, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/workflow_phone_number_node_model_output_transfer_destination.py b/data/src/elevenlabs/types/workflow_phone_number_node_model_output_transfer_destination.py new file mode 100644 index 0000000000000000000000000000000000000000..916d934eda1c44a878188f6d64d2f30a8557bc79 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_phone_number_node_model_output_transfer_destination.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata + + +class WorkflowPhoneNumberNodeModelOutputTransferDestination_Phone(UncheckedBaseModel): + type: typing.Literal["phone"] = "phone" + phone_number: 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 + + +class WorkflowPhoneNumberNodeModelOutputTransferDestination_PhoneDynamicVariable(UncheckedBaseModel): + type: typing.Literal["phone_dynamic_variable"] = "phone_dynamic_variable" + phone_number: 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 + + +class WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUri(UncheckedBaseModel): + type: typing.Literal["sip_uri"] = "sip_uri" + sip_uri: 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 + + +class WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUriDynamicVariable(UncheckedBaseModel): + type: typing.Literal["sip_uri_dynamic_variable"] = "sip_uri_dynamic_variable" + sip_uri: 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 + + +WorkflowPhoneNumberNodeModelOutputTransferDestination = typing_extensions.Annotated[ + typing.Union[ + WorkflowPhoneNumberNodeModelOutputTransferDestination_Phone, + WorkflowPhoneNumberNodeModelOutputTransferDestination_PhoneDynamicVariable, + WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUri, + WorkflowPhoneNumberNodeModelOutputTransferDestination_SipUriDynamicVariable, + ], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/workflow_result_condition_model_input.py b/data/src/elevenlabs/types/workflow_result_condition_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..c0091a937fbf2508e86d236f527f1d214d8c55d7 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_result_condition_model_input.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowResultConditionModelInput(UncheckedBaseModel): + label: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional human-readable label for the condition used throughout the UI. + """ + + successful: bool = pydantic.Field() + """ + Whether all tools in the previously executed tool node were executed successfully. + """ + + 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/data/src/elevenlabs/types/workflow_result_condition_model_output.py b/data/src/elevenlabs/types/workflow_result_condition_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..66efd4f88775834d77e829dfbe9fc3c14d8007cf --- /dev/null +++ b/data/src/elevenlabs/types/workflow_result_condition_model_output.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowResultConditionModelOutput(UncheckedBaseModel): + label: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional human-readable label for the condition used throughout the UI. + """ + + successful: bool = pydantic.Field() + """ + Whether all tools in the previously executed tool node were executed successfully. + """ + + 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/data/src/elevenlabs/types/workflow_say_node_model_input.py b/data/src/elevenlabs/types/workflow_say_node_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..b77eedc8e743f1df35b393e693e5a7309b73a31c --- /dev/null +++ b/data/src/elevenlabs/types/workflow_say_node_model_input.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversational_config_api_model_workflow_override_input import ConversationalConfigApiModelWorkflowOverrideInput +from .knowledge_base_locator import KnowledgeBaseLocator +from .position_input import PositionInput +from .workflow_say_node_model_input_message import WorkflowSayNodeModelInputMessage + + +class WorkflowSayNodeModelInput(UncheckedBaseModel): + position: typing.Optional[PositionInput] = pydantic.Field(default=None) + """ + Position of the node in the workflow. + """ + + edge_order: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + conversation_config: typing.Optional[ConversationalConfigApiModelWorkflowOverrideInput] = pydantic.Field( + default=None + ) + """ + Configuration overrides applied while this node speaks, such as the voice or, for prompt messages, the LLM and system prompt. + """ + + additional_prompt: typing.Optional[str] = pydantic.Field(default=None) + """ + Accepted for consistency with subagent nodes but not used. Describe the message in `message.prompt`, or replace the system prompt with `conversation_config.agent.prompt.prompt`. + """ + + additional_knowledge_base: typing.Optional[typing.List[KnowledgeBaseLocator]] = pydantic.Field(default=None) + """ + Knowledge base documents available to the LLM while this node generates its message, in addition to the agent's documents. + """ + + additional_tool_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Accepted for consistency with subagent nodes but not used. A say node cannot call tools. + """ + + label: str = pydantic.Field() + """ + Human-readable label for the node used throughout the UI. + """ + + message: WorkflowSayNodeModelInputMessage = pydantic.Field() + """ + Message spoken by this node. Use `literal` for exact text or `prompt` to have the LLM generate the message from a description. + """ + + wait_for_speech_completion: typing.Optional[bool] = pydantic.Field(default=None) + """ + When true, the workflow only moves to the next node after the message has been fully spoken. + """ + + wait_for_user_response: typing.Optional[bool] = pydantic.Field(default=None) + """ + When true, the node speaks its message and then waits for the user to reply before evaluating outgoing edges, so edges can branch on the reply. If the user stays silent, the workflow advances after the turn timeout. + """ + + 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 + + +update_forward_refs(WorkflowSayNodeModelInput) diff --git a/data/src/elevenlabs/types/workflow_say_node_model_input_message.py b/data/src/elevenlabs/types/workflow_say_node_model_input_message.py new file mode 100644 index 0000000000000000000000000000000000000000..d57eba0fc5db5c05e47c23eeaf4dba49e206324c --- /dev/null +++ b/data/src/elevenlabs/types/workflow_say_node_model_input_message.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .translated_string import TranslatedString + + +class WorkflowSayNodeModelInputMessage_Literal(UncheckedBaseModel): + """ + Message spoken by this node. Use `literal` for exact text or `prompt` to have the LLM generate the message from a description. + """ + + type: typing.Literal["literal"] = "literal" + text: str + text_translations: typing.Optional[typing.Dict[str, TranslatedString]] = 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 + + +class WorkflowSayNodeModelInputMessage_Prompt(UncheckedBaseModel): + """ + Message spoken by this node. Use `literal` for exact text or `prompt` to have the LLM generate the message from a description. + """ + + type: typing.Literal["prompt"] = "prompt" + prompt: 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 + + +WorkflowSayNodeModelInputMessage = typing_extensions.Annotated[ + typing.Union[WorkflowSayNodeModelInputMessage_Literal, WorkflowSayNodeModelInputMessage_Prompt], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/workflow_say_node_model_output.py b/data/src/elevenlabs/types/workflow_say_node_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..43e1b49209591e161250efe518b5dc7151d31546 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_say_node_model_output.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversational_config_api_model_workflow_override_output import ConversationalConfigApiModelWorkflowOverrideOutput +from .knowledge_base_locator import KnowledgeBaseLocator +from .position_output import PositionOutput +from .workflow_say_node_model_output_message import WorkflowSayNodeModelOutputMessage + + +class WorkflowSayNodeModelOutput(UncheckedBaseModel): + position: PositionOutput = pydantic.Field() + """ + Position of the node in the workflow. + """ + + edge_order: typing.List[str] = pydantic.Field() + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + conversation_config: ConversationalConfigApiModelWorkflowOverrideOutput = pydantic.Field() + """ + Configuration overrides applied while this node speaks, such as the voice or, for prompt messages, the LLM and system prompt. + """ + + additional_prompt: str = pydantic.Field() + """ + Accepted for consistency with subagent nodes but not used. Describe the message in `message.prompt`, or replace the system prompt with `conversation_config.agent.prompt.prompt`. + """ + + additional_knowledge_base: typing.List[KnowledgeBaseLocator] = pydantic.Field() + """ + Knowledge base documents available to the LLM while this node generates its message, in addition to the agent's documents. + """ + + additional_tool_ids: typing.List[str] = pydantic.Field() + """ + Accepted for consistency with subagent nodes but not used. A say node cannot call tools. + """ + + label: str = pydantic.Field() + """ + Human-readable label for the node used throughout the UI. + """ + + message: WorkflowSayNodeModelOutputMessage = pydantic.Field() + """ + Message spoken by this node. Use `literal` for exact text or `prompt` to have the LLM generate the message from a description. + """ + + wait_for_speech_completion: bool = pydantic.Field() + """ + When true, the workflow only moves to the next node after the message has been fully spoken. + """ + + wait_for_user_response: bool = pydantic.Field() + """ + When true, the node speaks its message and then waits for the user to reply before evaluating outgoing edges, so edges can branch on the reply. If the user stays silent, the workflow advances after the turn timeout. + """ + + 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 + + +update_forward_refs(WorkflowSayNodeModelOutput) diff --git a/data/src/elevenlabs/types/workflow_say_node_model_output_message.py b/data/src/elevenlabs/types/workflow_say_node_model_output_message.py new file mode 100644 index 0000000000000000000000000000000000000000..02c6e048e3cb4f2c5a9935878f99e39edef65ecd --- /dev/null +++ b/data/src/elevenlabs/types/workflow_say_node_model_output_message.py @@ -0,0 +1,54 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .translated_string import TranslatedString + + +class WorkflowSayNodeModelOutputMessage_Literal(UncheckedBaseModel): + """ + Message spoken by this node. Use `literal` for exact text or `prompt` to have the LLM generate the message from a description. + """ + + type: typing.Literal["literal"] = "literal" + text: str + text_translations: typing.Dict[str, TranslatedString] + + 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 + + +class WorkflowSayNodeModelOutputMessage_Prompt(UncheckedBaseModel): + """ + Message spoken by this node. Use `literal` for exact text or `prompt` to have the LLM generate the message from a description. + """ + + type: typing.Literal["prompt"] = "prompt" + prompt: 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 + + +WorkflowSayNodeModelOutputMessage = typing_extensions.Annotated[ + typing.Union[WorkflowSayNodeModelOutputMessage_Literal, WorkflowSayNodeModelOutputMessage_Prompt], + UnionMetadata(discriminant="type"), +] diff --git a/data/src/elevenlabs/types/workflow_standalone_agent_node_model_input.py b/data/src/elevenlabs/types/workflow_standalone_agent_node_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..7a50264017725468829f36d153090e8e9fbdee1c --- /dev/null +++ b/data/src/elevenlabs/types/workflow_standalone_agent_node_model_input.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_input import PositionInput + + +class WorkflowStandaloneAgentNodeModelInput(UncheckedBaseModel): + position: typing.Optional[PositionInput] = pydantic.Field(default=None) + """ + Position of the node in the workflow. + """ + + edge_order: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + agent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the agent to transfer the conversation to. None means transfer within the current agent. + """ + + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional branch ID for the target agent. None follows the target agent's traffic deployment, or uses its main branch when node_id is set. + """ + + node_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional target node ID in the destination agent's workflow. When set, the transfer starts at this node instead of the default entry node. + """ + + delay_ms: typing.Optional[int] = pydantic.Field(default=None) + """ + Artificial delay in milliseconds applied before transferring the conversation. + """ + + transfer_message: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional message sent to the user before the transfer is initiated. + """ + + enable_transferred_agent_first_message: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether to enable the transferred agent to send its configured first message after the transfer. + """ + + preserve_client_tts_overrides: typing.Optional[bool] = pydantic.Field(default=None) + """ + Defines whether TTS client overrides should be carried over to the transferred agent. + """ + + preserve_voice_settings: typing.Optional[bool] = pydantic.Field(default=None) + """ + Defines whether the base voice, TTS model and voice settings should be carried over to the transferred agent. + """ + + 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/data/src/elevenlabs/types/workflow_standalone_agent_node_model_output.py b/data/src/elevenlabs/types/workflow_standalone_agent_node_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..93433b841d212016763fe19509e31c96661eb199 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_standalone_agent_node_model_output.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_output import PositionOutput + + +class WorkflowStandaloneAgentNodeModelOutput(UncheckedBaseModel): + position: PositionOutput = pydantic.Field() + """ + Position of the node in the workflow. + """ + + edge_order: typing.List[str] = pydantic.Field() + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + agent_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the agent to transfer the conversation to. None means transfer within the current agent. + """ + + branch_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional branch ID for the target agent. None follows the target agent's traffic deployment, or uses its main branch when node_id is set. + """ + + node_id: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional target node ID in the destination agent's workflow. When set, the transfer starts at this node instead of the default entry node. + """ + + delay_ms: int = pydantic.Field() + """ + Artificial delay in milliseconds applied before transferring the conversation. + """ + + transfer_message: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional message sent to the user before the transfer is initiated. + """ + + enable_transferred_agent_first_message: bool = pydantic.Field() + """ + Whether to enable the transferred agent to send its configured first message after the transfer. + """ + + preserve_client_tts_overrides: bool = pydantic.Field() + """ + Defines whether TTS client overrides should be carried over to the transferred agent. + """ + + preserve_voice_settings: bool = pydantic.Field() + """ + Defines whether the base voice, TTS model and voice settings should be carried over to the transferred agent. + """ + + 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/data/src/elevenlabs/types/workflow_start_node_model_input.py b/data/src/elevenlabs/types/workflow_start_node_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..6f1dfef1cd0bfb6b02ec323135dbb04b36c48627 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_start_node_model_input.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_input import PositionInput + + +class WorkflowStartNodeModelInput(UncheckedBaseModel): + position: typing.Optional[PositionInput] = pydantic.Field(default=None) + """ + Position of the node in the workflow. + """ + + edge_order: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + 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/data/src/elevenlabs/types/workflow_start_node_model_output.py b/data/src/elevenlabs/types/workflow_start_node_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..6eda84e0679ccb786942ff51c64ad3ce00459d07 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_start_node_model_output.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_output import PositionOutput + + +class WorkflowStartNodeModelOutput(UncheckedBaseModel): + position: PositionOutput = pydantic.Field() + """ + Position of the node in the workflow. + """ + + edge_order: typing.List[str] = pydantic.Field() + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + 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/data/src/elevenlabs/types/workflow_state_update_input.py b/data/src/elevenlabs/types/workflow_state_update_input.py new file mode 100644 index 0000000000000000000000000000000000000000..5a67a507728131a124ef15bab351a2bf45887e51 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_state_update_input.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowStateUpdateInput(UncheckedBaseModel): + type: typing.Optional[typing.Literal["dynamic_variable"]] = None + variable_name: str = pydantic.Field() + """ + Name of the dynamic variable to assign. + """ + + expression: "AstNodeInput" = pydantic.Field() + """ + Expression whose result is assigned to the variable. It can combine constants, other dynamic variables, LLM-extracted values and operators. + """ + + required: typing.Optional[bool] = pydantic.Field(default=None) + """ + When false, the LLM may omit the values this update relies on. The update is then skipped and the variable keeps its current value. + """ + + 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 + + +from .ast_addition_operator_node_input import AstAdditionOperatorNodeInput # noqa: E402, I001 +from .ast_and_operator_node_input import AstAndOperatorNodeInput # noqa: E402, I001 +from .ast_conditional_operator_node_input import AstConditionalOperatorNodeInput # noqa: E402, I001 +from .ast_division_operator_node_input import AstDivisionOperatorNodeInput # noqa: E402, I001 +from .ast_equals_operator_node_input import AstEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_operator_node_input import AstGreaterThanOperatorNodeInput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_input import AstGreaterThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_operator_node_input import AstLessThanOperatorNodeInput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_input import AstLessThanOrEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_multiplication_operator_node_input import AstMultiplicationOperatorNodeInput # noqa: E402, I001 +from .ast_node_input import AstNodeInput # noqa: E402, I001 +from .ast_not_equals_operator_node_input import AstNotEqualsOperatorNodeInput # noqa: E402, I001 +from .ast_or_operator_node_input import AstOrOperatorNodeInput # noqa: E402, I001 +from .ast_subtraction_operator_node_input import AstSubtractionOperatorNodeInput # noqa: E402, I001 + +update_forward_refs( + WorkflowStateUpdateInput, + AstAdditionOperatorNodeInput=AstAdditionOperatorNodeInput, + AstAndOperatorNodeInput=AstAndOperatorNodeInput, + AstConditionalOperatorNodeInput=AstConditionalOperatorNodeInput, + AstDivisionOperatorNodeInput=AstDivisionOperatorNodeInput, + AstEqualsOperatorNodeInput=AstEqualsOperatorNodeInput, + AstGreaterThanOperatorNodeInput=AstGreaterThanOperatorNodeInput, + AstGreaterThanOrEqualsOperatorNodeInput=AstGreaterThanOrEqualsOperatorNodeInput, + AstLessThanOperatorNodeInput=AstLessThanOperatorNodeInput, + AstLessThanOrEqualsOperatorNodeInput=AstLessThanOrEqualsOperatorNodeInput, + AstMultiplicationOperatorNodeInput=AstMultiplicationOperatorNodeInput, + AstNodeInput=AstNodeInput, + AstNotEqualsOperatorNodeInput=AstNotEqualsOperatorNodeInput, + AstOrOperatorNodeInput=AstOrOperatorNodeInput, + AstSubtractionOperatorNodeInput=AstSubtractionOperatorNodeInput, +) diff --git a/data/src/elevenlabs/types/workflow_state_update_output.py b/data/src/elevenlabs/types/workflow_state_update_output.py new file mode 100644 index 0000000000000000000000000000000000000000..ae25112a95514090f0d08dc5d405b83c30a5095c --- /dev/null +++ b/data/src/elevenlabs/types/workflow_state_update_output.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowStateUpdateOutput(UncheckedBaseModel): + type: typing.Literal["dynamic_variable"] = "dynamic_variable" + variable_name: str = pydantic.Field() + """ + Name of the dynamic variable to assign. + """ + + expression: "AstNodeOutput" = pydantic.Field() + """ + Expression whose result is assigned to the variable. It can combine constants, other dynamic variables, LLM-extracted values and operators. + """ + + required: bool = pydantic.Field() + """ + When false, the LLM may omit the values this update relies on. The update is then skipped and the variable keeps its current value. + """ + + 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 + + +from .ast_addition_operator_node_output import AstAdditionOperatorNodeOutput # noqa: E402, I001 +from .ast_and_operator_node_output import AstAndOperatorNodeOutput # noqa: E402, I001 +from .ast_conditional_operator_node_output import AstConditionalOperatorNodeOutput # noqa: E402, I001 +from .ast_division_operator_node_output import AstDivisionOperatorNodeOutput # noqa: E402, I001 +from .ast_equals_operator_node_output import AstEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_operator_node_output import AstGreaterThanOperatorNodeOutput # noqa: E402, I001 +from .ast_greater_than_or_equals_operator_node_output import AstGreaterThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_operator_node_output import AstLessThanOperatorNodeOutput # noqa: E402, I001 +from .ast_less_than_or_equals_operator_node_output import AstLessThanOrEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_multiplication_operator_node_output import AstMultiplicationOperatorNodeOutput # noqa: E402, I001 +from .ast_node_output import AstNodeOutput # noqa: E402, I001 +from .ast_not_equals_operator_node_output import AstNotEqualsOperatorNodeOutput # noqa: E402, I001 +from .ast_or_operator_node_output import AstOrOperatorNodeOutput # noqa: E402, I001 +from .ast_subtraction_operator_node_output import AstSubtractionOperatorNodeOutput # noqa: E402, I001 + +update_forward_refs( + WorkflowStateUpdateOutput, + AstAdditionOperatorNodeOutput=AstAdditionOperatorNodeOutput, + AstAndOperatorNodeOutput=AstAndOperatorNodeOutput, + AstConditionalOperatorNodeOutput=AstConditionalOperatorNodeOutput, + AstDivisionOperatorNodeOutput=AstDivisionOperatorNodeOutput, + AstEqualsOperatorNodeOutput=AstEqualsOperatorNodeOutput, + AstGreaterThanOperatorNodeOutput=AstGreaterThanOperatorNodeOutput, + AstGreaterThanOrEqualsOperatorNodeOutput=AstGreaterThanOrEqualsOperatorNodeOutput, + AstLessThanOperatorNodeOutput=AstLessThanOperatorNodeOutput, + AstLessThanOrEqualsOperatorNodeOutput=AstLessThanOrEqualsOperatorNodeOutput, + AstMultiplicationOperatorNodeOutput=AstMultiplicationOperatorNodeOutput, + AstNodeOutput=AstNodeOutput, + AstNotEqualsOperatorNodeOutput=AstNotEqualsOperatorNodeOutput, + AstOrOperatorNodeOutput=AstOrOperatorNodeOutput, + AstSubtractionOperatorNodeOutput=AstSubtractionOperatorNodeOutput, +) diff --git a/data/src/elevenlabs/types/workflow_tool_edge_step_model.py b/data/src/elevenlabs/types/workflow_tool_edge_step_model.py new file mode 100644 index 0000000000000000000000000000000000000000..8d69a8f327352d0f0661b12c685fdad10c5ac2e8 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_edge_step_model.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowToolEdgeStepModel(UncheckedBaseModel): + step_latency_secs: float + edge_id: str + target_node_id: 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/data/src/elevenlabs/types/workflow_tool_locator.py b/data/src/elevenlabs/types/workflow_tool_locator.py new file mode 100644 index 0000000000000000000000000000000000000000..7352e5b16e6b37478e2f2eac7e968e8b5b4b6efd --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_locator.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .workflow_tool_locator_schema_overrides_value import WorkflowToolLocatorSchemaOverridesValue + + +class WorkflowToolLocator(UncheckedBaseModel): + tool_id: str + schema_overrides: typing.Optional[typing.Dict[str, typing.Optional[WorkflowToolLocatorSchemaOverridesValue]]] = ( + pydantic.Field(default=None) + ) + """ + Per-node parameter overrides applied on top of the tool's own configuration. Keys are dotted parameter paths (webhook tools prefix keys with path_params./query_params./request_body.). These take precedence over any overrides already defined on the tool itself. + """ + + 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/data/src/elevenlabs/types/workflow_tool_locator_schema_overrides_value.py b/data/src/elevenlabs/types/workflow_tool_locator_schema_overrides_value.py new file mode 100644 index 0000000000000000000000000000000000000000..5063e7b3b6c315742af724b0341e2e23e1b1803f --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_locator_schema_overrides_value.py @@ -0,0 +1,77 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .constant_schema_override_constant_value import ConstantSchemaOverrideConstantValue + + +class WorkflowToolLocatorSchemaOverridesValue_Constant(UncheckedBaseModel): + source: typing.Literal["constant"] = "constant" + constant_value: typing.Optional[ConstantSchemaOverrideConstantValue] = 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 + + +class WorkflowToolLocatorSchemaOverridesValue_DynamicVariable(UncheckedBaseModel): + source: typing.Literal["dynamic_variable"] = "dynamic_variable" + dynamic_variable: 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 + + +class WorkflowToolLocatorSchemaOverridesValue_Llm(UncheckedBaseModel): + source: typing.Literal["llm"] = "llm" + prompt: 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 + + +class WorkflowToolLocatorSchemaOverridesValue_Omit(UncheckedBaseModel): + source: typing.Literal["omit"] = "omit" + + 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 + + +WorkflowToolLocatorSchemaOverridesValue = typing_extensions.Annotated[ + typing.Union[ + WorkflowToolLocatorSchemaOverridesValue_Constant, + WorkflowToolLocatorSchemaOverridesValue_DynamicVariable, + WorkflowToolLocatorSchemaOverridesValue_Llm, + WorkflowToolLocatorSchemaOverridesValue_Omit, + ], + UnionMetadata(discriminant="source"), +] diff --git a/data/src/elevenlabs/types/workflow_tool_max_iterations_exceeded_step_model.py b/data/src/elevenlabs/types/workflow_tool_max_iterations_exceeded_step_model.py new file mode 100644 index 0000000000000000000000000000000000000000..1407bd1a5ad9e40a46f9a07999f68b12a3126745 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_max_iterations_exceeded_step_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowToolMaxIterationsExceededStepModel(UncheckedBaseModel): + step_latency_secs: float + max_iterations: int + + 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/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_input.py b/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..881c5a185aaeebc1c406c71fe04614697f3e7089 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_input.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_tool_call_common_model_input import ( + ConversationHistoryTranscriptToolCallCommonModelInput, +) + + +class WorkflowToolNestedToolsStepModelInput(UncheckedBaseModel): + step_latency_secs: float + node_id: str + requests: typing.List[ConversationHistoryTranscriptToolCallCommonModelInput] + results: typing.List["WorkflowToolNestedToolsStepModelInputResultsItem"] + is_successful: bool + + 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 + + +from .conversation_history_transcript_workflow_tools_result_common_model_input import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, +) # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_input_results_item import WorkflowToolNestedToolsStepModelInputResultsItem # noqa: E402, I001 +from .workflow_tool_response_model_input import WorkflowToolResponseModelInput # noqa: E402, I001 +from .workflow_tool_response_model_input_steps_item import WorkflowToolResponseModelInputStepsItem # noqa: E402, I001 + +update_forward_refs( + WorkflowToolNestedToolsStepModelInput, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput=ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, + WorkflowToolNestedToolsStepModelInputResultsItem=WorkflowToolNestedToolsStepModelInputResultsItem, + WorkflowToolResponseModelInput=WorkflowToolResponseModelInput, + WorkflowToolResponseModelInputStepsItem=WorkflowToolResponseModelInputStepsItem, +) diff --git a/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_input_results_item.py b/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_input_results_item.py new file mode 100644 index 0000000000000000000000000000000000000000..915ec1226ca7dde6efe6ddab3c815cb582eea21d --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_input_results_item.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .conversation_history_transcript_api_integration_webhook_tools_result_common_model_input import ( + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput, +) +from .conversation_history_transcript_other_tools_result_common_model import ( + ConversationHistoryTranscriptOtherToolsResultCommonModel, +) +from .conversation_history_transcript_system_tool_result_common_model_input import ( + ConversationHistoryTranscriptSystemToolResultCommonModelInput, +) + +if typing.TYPE_CHECKING: + from .conversation_history_transcript_workflow_tools_result_common_model_input import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, + ) +WorkflowToolNestedToolsStepModelInputResultsItem = typing.Union[ + ConversationHistoryTranscriptOtherToolsResultCommonModel, + ConversationHistoryTranscriptSystemToolResultCommonModelInput, + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelInput, + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput", +] diff --git a/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_output.py b/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..0ca73c17854afa010f66f52fc648b4309ce778bd --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_output.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .conversation_history_transcript_tool_call_common_model_output import ( + ConversationHistoryTranscriptToolCallCommonModelOutput, +) + + +class WorkflowToolNestedToolsStepModelOutput(UncheckedBaseModel): + step_latency_secs: float + node_id: str + requests: typing.List[ConversationHistoryTranscriptToolCallCommonModelOutput] + results: typing.List["WorkflowToolNestedToolsStepModelOutputResultsItem"] + is_successful: bool + + 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 + + +from .conversation_history_transcript_workflow_tools_result_common_model_output import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, +) # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_output_results_item import WorkflowToolNestedToolsStepModelOutputResultsItem # noqa: E402, I001 +from .workflow_tool_response_model_output import WorkflowToolResponseModelOutput # noqa: E402, I001 +from .workflow_tool_response_model_output_steps_item import WorkflowToolResponseModelOutputStepsItem # noqa: E402, I001 + +update_forward_refs( + WorkflowToolNestedToolsStepModelOutput, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput=ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, + WorkflowToolNestedToolsStepModelOutputResultsItem=WorkflowToolNestedToolsStepModelOutputResultsItem, + WorkflowToolResponseModelOutput=WorkflowToolResponseModelOutput, + WorkflowToolResponseModelOutputStepsItem=WorkflowToolResponseModelOutputStepsItem, +) diff --git a/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_output_results_item.py b/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_output_results_item.py new file mode 100644 index 0000000000000000000000000000000000000000..e6b87db1af23e510ae48349b104f35cc8710586d --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_nested_tools_step_model_output_results_item.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .conversation_history_transcript_api_integration_webhook_tools_result_common_model_output import ( + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput, +) +from .conversation_history_transcript_other_tools_result_common_model import ( + ConversationHistoryTranscriptOtherToolsResultCommonModel, +) +from .conversation_history_transcript_system_tool_result_common_model_output import ( + ConversationHistoryTranscriptSystemToolResultCommonModelOutput, +) + +if typing.TYPE_CHECKING: + from .conversation_history_transcript_workflow_tools_result_common_model_output import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, + ) +WorkflowToolNestedToolsStepModelOutputResultsItem = typing.Union[ + ConversationHistoryTranscriptOtherToolsResultCommonModel, + ConversationHistoryTranscriptSystemToolResultCommonModelOutput, + ConversationHistoryTranscriptApiIntegrationWebhookToolsResultCommonModelOutput, + "ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput", +] diff --git a/data/src/elevenlabs/types/workflow_tool_node_model_input.py b/data/src/elevenlabs/types/workflow_tool_node_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..b22ce9350330b3a115282bb22cdcdb56f5c5b484 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_node_model_input.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_input import PositionInput +from .workflow_tool_locator import WorkflowToolLocator + + +class WorkflowToolNodeModelInput(UncheckedBaseModel): + position: typing.Optional[PositionInput] = pydantic.Field(default=None) + """ + Position of the node in the workflow. + """ + + edge_order: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + tools: typing.Optional[typing.List[WorkflowToolLocator]] = pydantic.Field(default=None) + """ + List of tools to execute in parallel. The entire node is considered successful if all tools are executed successfully. + """ + + 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/data/src/elevenlabs/types/workflow_tool_node_model_output.py b/data/src/elevenlabs/types/workflow_tool_node_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..63e688f7f1752ccfee1ea4bd9ab1f8c21729fb46 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_node_model_output.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_output import PositionOutput +from .workflow_tool_locator import WorkflowToolLocator + + +class WorkflowToolNodeModelOutput(UncheckedBaseModel): + position: PositionOutput = pydantic.Field() + """ + Position of the node in the workflow. + """ + + edge_order: typing.List[str] = pydantic.Field() + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + tools: typing.List[WorkflowToolLocator] = pydantic.Field() + """ + List of tools to execute in parallel. The entire node is considered successful if all tools are executed successfully. + """ + + 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/data/src/elevenlabs/types/workflow_tool_response_model_input.py b/data/src/elevenlabs/types/workflow_tool_response_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..48d241ffad8d531ef281bcf4d8044796536ca696 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_response_model_input.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowToolResponseModelInput(UncheckedBaseModel): + """ + A common model for workflow tool responses. + """ + + steps: typing.Optional[typing.List["WorkflowToolResponseModelInputStepsItem"]] = 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 + + +from .conversation_history_transcript_workflow_tools_result_common_model_input import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, +) # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_input import WorkflowToolNestedToolsStepModelInput # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_input_results_item import WorkflowToolNestedToolsStepModelInputResultsItem # noqa: E402, I001 +from .workflow_tool_response_model_input_steps_item import WorkflowToolResponseModelInputStepsItem # noqa: E402, I001 + +update_forward_refs( + WorkflowToolResponseModelInput, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput=ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, + WorkflowToolNestedToolsStepModelInput=WorkflowToolNestedToolsStepModelInput, + WorkflowToolNestedToolsStepModelInputResultsItem=WorkflowToolNestedToolsStepModelInputResultsItem, + WorkflowToolResponseModelInputStepsItem=WorkflowToolResponseModelInputStepsItem, +) diff --git a/data/src/elevenlabs/types/workflow_tool_response_model_input_steps_item.py b/data/src/elevenlabs/types/workflow_tool_response_model_input_steps_item.py new file mode 100644 index 0000000000000000000000000000000000000000..2731a7553d024a24c587545b9a197797e4a99910 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_response_model_input_steps_item.py @@ -0,0 +1,85 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .conversation_history_transcript_tool_call_common_model_input import ( + ConversationHistoryTranscriptToolCallCommonModelInput, +) + + +class WorkflowToolResponseModelInputStepsItem_Edge(UncheckedBaseModel): + type: typing.Literal["edge"] = "edge" + step_latency_secs: float + edge_id: str + target_node_id: 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 + + +class WorkflowToolResponseModelInputStepsItem_MaxIterationsExceeded(UncheckedBaseModel): + type: typing.Literal["max_iterations_exceeded"] = "max_iterations_exceeded" + step_latency_secs: float + max_iterations: int + + 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 + + +class WorkflowToolResponseModelInputStepsItem_NestedTools(UncheckedBaseModel): + type: typing.Literal["nested_tools"] = "nested_tools" + step_latency_secs: float + node_id: str + requests: typing.List[ConversationHistoryTranscriptToolCallCommonModelInput] + results: typing.List["WorkflowToolNestedToolsStepModelInputResultsItem"] + is_successful: bool + + 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 + + +WorkflowToolResponseModelInputStepsItem = typing_extensions.Annotated[ + typing.Union[ + WorkflowToolResponseModelInputStepsItem_Edge, + WorkflowToolResponseModelInputStepsItem_MaxIterationsExceeded, + WorkflowToolResponseModelInputStepsItem_NestedTools, + ], + UnionMetadata(discriminant="type"), +] +from .conversation_history_transcript_workflow_tools_result_common_model_input import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, +) # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_input_results_item import WorkflowToolNestedToolsStepModelInputResultsItem # noqa: E402, I001 +from .workflow_tool_response_model_input import WorkflowToolResponseModelInput # noqa: E402, I001 + +update_forward_refs( + WorkflowToolResponseModelInputStepsItem_NestedTools, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput=ConversationHistoryTranscriptWorkflowToolsResultCommonModelInput, + WorkflowToolNestedToolsStepModelInputResultsItem=WorkflowToolNestedToolsStepModelInputResultsItem, + WorkflowToolResponseModelInput=WorkflowToolResponseModelInput, + WorkflowToolResponseModelInputStepsItem=WorkflowToolResponseModelInputStepsItem, +) diff --git a/data/src/elevenlabs/types/workflow_tool_response_model_output.py b/data/src/elevenlabs/types/workflow_tool_response_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..d063aebdb8ec43dd3173b77158a067470039633e --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_response_model_output.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowToolResponseModelOutput(UncheckedBaseModel): + """ + A common model for workflow tool responses. + """ + + steps: typing.Optional[typing.List["WorkflowToolResponseModelOutputStepsItem"]] = 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 + + +from .conversation_history_transcript_workflow_tools_result_common_model_output import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, +) # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_output import WorkflowToolNestedToolsStepModelOutput # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_output_results_item import WorkflowToolNestedToolsStepModelOutputResultsItem # noqa: E402, I001 +from .workflow_tool_response_model_output_steps_item import WorkflowToolResponseModelOutputStepsItem # noqa: E402, I001 + +update_forward_refs( + WorkflowToolResponseModelOutput, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput=ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, + WorkflowToolNestedToolsStepModelOutput=WorkflowToolNestedToolsStepModelOutput, + WorkflowToolNestedToolsStepModelOutputResultsItem=WorkflowToolNestedToolsStepModelOutputResultsItem, + WorkflowToolResponseModelOutputStepsItem=WorkflowToolResponseModelOutputStepsItem, +) diff --git a/data/src/elevenlabs/types/workflow_tool_response_model_output_steps_item.py b/data/src/elevenlabs/types/workflow_tool_response_model_output_steps_item.py new file mode 100644 index 0000000000000000000000000000000000000000..98f35b927e40a8ba94221c619ecc9d191015ac11 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_tool_response_model_output_steps_item.py @@ -0,0 +1,85 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .conversation_history_transcript_tool_call_common_model_output import ( + ConversationHistoryTranscriptToolCallCommonModelOutput, +) + + +class WorkflowToolResponseModelOutputStepsItem_Edge(UncheckedBaseModel): + type: typing.Literal["edge"] = "edge" + step_latency_secs: float + edge_id: str + target_node_id: 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 + + +class WorkflowToolResponseModelOutputStepsItem_MaxIterationsExceeded(UncheckedBaseModel): + type: typing.Literal["max_iterations_exceeded"] = "max_iterations_exceeded" + step_latency_secs: float + max_iterations: int + + 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 + + +class WorkflowToolResponseModelOutputStepsItem_NestedTools(UncheckedBaseModel): + type: typing.Literal["nested_tools"] = "nested_tools" + step_latency_secs: float + node_id: str + requests: typing.List[ConversationHistoryTranscriptToolCallCommonModelOutput] + results: typing.List["WorkflowToolNestedToolsStepModelOutputResultsItem"] + is_successful: bool + + 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 + + +WorkflowToolResponseModelOutputStepsItem = typing_extensions.Annotated[ + typing.Union[ + WorkflowToolResponseModelOutputStepsItem_Edge, + WorkflowToolResponseModelOutputStepsItem_MaxIterationsExceeded, + WorkflowToolResponseModelOutputStepsItem_NestedTools, + ], + UnionMetadata(discriminant="type"), +] +from .conversation_history_transcript_workflow_tools_result_common_model_output import ( + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, +) # noqa: E402, I001 +from .workflow_tool_nested_tools_step_model_output_results_item import WorkflowToolNestedToolsStepModelOutputResultsItem # noqa: E402, I001 +from .workflow_tool_response_model_output import WorkflowToolResponseModelOutput # noqa: E402, I001 + +update_forward_refs( + WorkflowToolResponseModelOutputStepsItem_NestedTools, + ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput=ConversationHistoryTranscriptWorkflowToolsResultCommonModelOutput, + WorkflowToolNestedToolsStepModelOutputResultsItem=WorkflowToolNestedToolsStepModelOutputResultsItem, + WorkflowToolResponseModelOutput=WorkflowToolResponseModelOutput, + WorkflowToolResponseModelOutputStepsItem=WorkflowToolResponseModelOutputStepsItem, +) diff --git a/data/src/elevenlabs/types/workflow_unconditional_model_input.py b/data/src/elevenlabs/types/workflow_unconditional_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..31232cf64b79b4da78034e36b52c74ee04faf6b7 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_unconditional_model_input.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowUnconditionalModelInput(UncheckedBaseModel): + label: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional human-readable label for the condition used throughout the UI. + """ + + 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/data/src/elevenlabs/types/workflow_unconditional_model_output.py b/data/src/elevenlabs/types/workflow_unconditional_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..d4508c666a2d8fa3bd044cfd7b5ea194b552634d --- /dev/null +++ b/data/src/elevenlabs/types/workflow_unconditional_model_output.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkflowUnconditionalModelOutput(UncheckedBaseModel): + label: typing.Optional[str] = pydantic.Field(default=None) + """ + Optional human-readable label for the condition used throughout the UI. + """ + + 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/data/src/elevenlabs/types/workflow_update_state_node_model_input.py b/data/src/elevenlabs/types/workflow_update_state_node_model_input.py new file mode 100644 index 0000000000000000000000000000000000000000..e3b3561777cd381f7b5f1c91659f0bd7e6a4a090 --- /dev/null +++ b/data/src/elevenlabs/types/workflow_update_state_node_model_input.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_input import PositionInput +from .workflow_state_update_input import WorkflowStateUpdateInput + + +class WorkflowUpdateStateNodeModelInput(UncheckedBaseModel): + position: typing.Optional[PositionInput] = pydantic.Field(default=None) + """ + Position of the node in the workflow. + """ + + edge_order: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + label: str = pydantic.Field() + """ + Human-readable label for the node used throughout the UI. + """ + + updates: typing.List[WorkflowStateUpdateInput] = pydantic.Field() + """ + State updates applied when the workflow reaches this node. A node accepts at most 50 updates. + """ + + 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 + + +update_forward_refs(WorkflowUpdateStateNodeModelInput) diff --git a/data/src/elevenlabs/types/workflow_update_state_node_model_output.py b/data/src/elevenlabs/types/workflow_update_state_node_model_output.py new file mode 100644 index 0000000000000000000000000000000000000000..eaa12ab22798b0433a3e12c4b0540f1189d6a2fe --- /dev/null +++ b/data/src/elevenlabs/types/workflow_update_state_node_model_output.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.unchecked_base_model import UncheckedBaseModel +from .position_output import PositionOutput +from .workflow_state_update_output import WorkflowStateUpdateOutput + + +class WorkflowUpdateStateNodeModelOutput(UncheckedBaseModel): + position: PositionOutput = pydantic.Field() + """ + Position of the node in the workflow. + """ + + edge_order: typing.List[str] = pydantic.Field() + """ + The ids of outgoing edges in the order they should be evaluated. + """ + + label: str = pydantic.Field() + """ + Human-readable label for the node used throughout the UI. + """ + + updates: typing.List[WorkflowStateUpdateOutput] = pydantic.Field() + """ + State updates applied when the workflow reaches this node. A node accepts at most 50 updates. + """ + + 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 + + +update_forward_refs(WorkflowUpdateStateNodeModelOutput) diff --git a/data/src/elevenlabs/types/workspace_analytics_query_response_model.py b/data/src/elevenlabs/types/workspace_analytics_query_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d969494725c1eea601d399c65ea1d6c69b99fa6a --- /dev/null +++ b/data/src/elevenlabs/types/workspace_analytics_query_response_model.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .column_unit import ColumnUnit +from .workspace_analytics_query_response_model_column_types_item import ( + WorkspaceAnalyticsQueryResponseModelColumnTypesItem, +) +from .workspace_analytics_query_response_model_rows_item_item import WorkspaceAnalyticsQueryResponseModelRowsItemItem + + +class WorkspaceAnalyticsQueryResponseModel(UncheckedBaseModel): + columns: typing.List[str] + column_types: typing.List[WorkspaceAnalyticsQueryResponseModelColumnTypesItem] + rows: typing.List[typing.List[typing.Optional[WorkspaceAnalyticsQueryResponseModelRowsItemItem]]] + column_units: typing.List[typing.Optional[ColumnUnit]] + + 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/data/src/elevenlabs/types/workspace_analytics_query_response_model_column_types_item.py b/data/src/elevenlabs/types/workspace_analytics_query_response_model_column_types_item.py new file mode 100644 index 0000000000000000000000000000000000000000..2658abd940d7aaf2774904b452011340dec7e6a3 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_analytics_query_response_model_column_types_item.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceAnalyticsQueryResponseModelColumnTypesItem = typing.Union[ + typing.Literal["String", "Float", "DateTime", "Int", "Bool", "JSON", "Map", "Array"], typing.Any +] diff --git a/data/src/elevenlabs/types/workspace_analytics_query_response_model_rows_item_item.py b/data/src/elevenlabs/types/workspace_analytics_query_response_model_rows_item_item.py new file mode 100644 index 0000000000000000000000000000000000000000..255cf5a9782ebe0846c2d69b5f56c633b9178506 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_analytics_query_response_model_rows_item_item.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +WorkspaceAnalyticsQueryResponseModelRowsItemItem = typing.Union[str, int, float, bool, dt.datetime] diff --git a/data/src/elevenlabs/types/workspace_api_key_list_response_model.py b/data/src/elevenlabs/types/workspace_api_key_list_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..ad6ee07a9a95bd7da77045be63b44f180f080a31 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_api_key_list_response_model.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .workspace_api_key_response_model import WorkspaceApiKeyResponseModel + + +class WorkspaceApiKeyListResponseModel(UncheckedBaseModel): + api_keys: typing_extensions.Annotated[ + typing.List[WorkspaceApiKeyResponseModel], FieldMetadata(alias="api-keys"), pydantic.Field(alias="api-keys") + ] + + 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/data/src/elevenlabs/types/workspace_api_key_response_model.py b/data/src/elevenlabs/types/workspace_api_key_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..aba274a7f6e1abd692f1df5452f8b51e4651552c --- /dev/null +++ b/data/src/elevenlabs/types/workspace_api_key_response_model.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .lock_reason import LockReason +from .permission_type import PermissionType +from .platform_limits import PlatformLimits + + +class WorkspaceApiKeyResponseModel(UncheckedBaseModel): + name: str + hint: str + key_id: str + service_account_user_id: str + created_at_unix: typing.Optional[int] = None + is_disabled: typing.Optional[bool] = None + permissions: typing.Optional[typing.List[PermissionType]] = None + disable_reason: typing.Optional[LockReason] = None + character_limit: typing.Optional[int] = pydantic.Field(default=None) + """ + Maximum number of credits allowed in the current billing period. + """ + + character_count: typing.Optional[int] = pydantic.Field(default=None) + """ + Credits already used in the current billing period. + """ + + hashed_xi_api_key: str + allowed_ips: typing.Optional[typing.List[str]] = None + third_party_disable_allowed: typing.Optional[bool] = None + platform_limits: typing.Optional[PlatformLimits] = pydantic.Field(default=None) + """ + Per-API-key concurrency limits (TTS/dubbing/music). Enterprise-only. + """ + + 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/data/src/elevenlabs/types/workspace_audit_log_entry_response.py b/data/src/elevenlabs/types/workspace_audit_log_entry_response.py new file mode 100644 index 0000000000000000000000000000000000000000..d8ca003e635956d48ef2c7103a7a11c4c166d287 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_audit_log_entry_response.py @@ -0,0 +1,123 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .actor_model import ActorModel +from .device_model import DeviceModel +from .http_request_model import HttpRequestModel +from .severity_id import SeverityId +from .status_id import StatusId +from .workspace_audit_log_entry_response_activity_id import WorkspaceAuditLogEntryResponseActivityId + + +class WorkspaceAuditLogEntryResponse(UncheckedBaseModel): + """ + Audit log entry with Firestore document ID for API responses. + """ + + metadata: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Event metadata + """ + + time: typing.Optional[int] = pydantic.Field(default=None) + """ + Event time in milliseconds since epoch + """ + + activity_id: WorkspaceAuditLogEntryResponseActivityId = pydantic.Field() + """ + Activity ID + """ + + activity_name: str = pydantic.Field() + """ + Activity name + """ + + category_name: typing.Optional[str] = pydantic.Field(default=None) + """ + Event category + """ + + category_uid: typing.Optional[int] = pydantic.Field(default=None) + """ + Category UID for IAM + """ + + class_name: typing.Optional[str] = pydantic.Field(default=None) + """ + Event class name + """ + + class_uid: typing.Optional[int] = pydantic.Field(default=None) + """ + Event class UID + """ + + severity_id: typing.Optional[SeverityId] = pydantic.Field(default=None) + """ + Severity level + """ + + status_id: StatusId = pydantic.Field() + """ + Status of the action + """ + + actor: ActorModel = pydantic.Field() + """ + Actor performing the action + """ + + device: typing.Optional[DeviceModel] = pydantic.Field(default=None) + """ + Device information + """ + + http_request: typing.Optional[HttpRequestModel] = pydantic.Field(default=None) + """ + HTTP request details + """ + + message: str = pydantic.Field() + """ + Human-readable event description + """ + + unmapped: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + Attributes not mapped to OCSF + """ + + id: str = pydantic.Field() + """ + Firestore document ID + """ + + time_dt: typing.Optional[str] = pydantic.Field(default=None) + """ + Event time in human-readable RFC 3339 format, derived from 'time'. + """ + + type_uid: typing.Optional[int] = pydantic.Field(default=None) + """ + OCSF type_uid is class_uid * 100 + activity_id. + """ + + type_name: typing.Optional[str] = pydantic.Field(default=None) + """ + OCSF type_name combines class_name and activity_name. + """ + + 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/data/src/elevenlabs/types/workspace_audit_log_entry_response_activity_id.py b/data/src/elevenlabs/types/workspace_audit_log_entry_response_activity_id.py new file mode 100644 index 0000000000000000000000000000000000000000..d177893277947fe585ec65b08505bcb2ff5faab7 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_audit_log_entry_response_activity_id.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .account_change_activity_id import AccountChangeActivityId +from .authentication_activity_id import AuthenticationActivityId +from .entity_management_activity_id import EntityManagementActivityId +from .group_management_activity_id import GroupManagementActivityId +from .user_access_management_activity_id import UserAccessManagementActivityId + +WorkspaceAuditLogEntryResponseActivityId = typing.Union[ + AccountChangeActivityId, + AuthenticationActivityId, + EntityManagementActivityId, + UserAccessManagementActivityId, + GroupManagementActivityId, +] diff --git a/data/src/elevenlabs/types/workspace_audit_logs_page_response.py b/data/src/elevenlabs/types/workspace_audit_logs_page_response.py new file mode 100644 index 0000000000000000000000000000000000000000..fd61c9a13a520ec54fb8e91dd16d4f6837a26eb8 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_audit_logs_page_response.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .workspace_audit_log_entry_response import WorkspaceAuditLogEntryResponse + + +class WorkspaceAuditLogsPageResponse(UncheckedBaseModel): + """ + Paginated workspace audit log response. + """ + + entries: typing.List[WorkspaceAuditLogEntryResponse] + has_more: bool + next_cursor: 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/data/src/elevenlabs/types/workspace_batch_calls_response.py b/data/src/elevenlabs/types/workspace_batch_calls_response.py new file mode 100644 index 0000000000000000000000000000000000000000..72c52e2d13c831a057f4d9bb62a051ac31d9376c --- /dev/null +++ b/data/src/elevenlabs/types/workspace_batch_calls_response.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .batch_call_response import BatchCallResponse + + +class WorkspaceBatchCallsResponse(UncheckedBaseModel): + batch_calls: typing.List[BatchCallResponse] + next_doc: typing.Optional[str] = pydantic.Field(default=None) + """ + The next document, used to paginate through the batch calls + """ + + has_more: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether there are more batch calls to paginate through + """ + + 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/data/src/elevenlabs/types/workspace_create_api_key_response_model.py b/data/src/elevenlabs/types/workspace_create_api_key_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..38acccef6e2698b7ce70b0a1e1eb78dced1521d3 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_create_api_key_response_model.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkspaceCreateApiKeyResponseModel(UncheckedBaseModel): + xi_api_key: typing_extensions.Annotated[str, FieldMetadata(alias="xi-api-key"), pydantic.Field(alias="xi-api-key")] + key_id: 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/data/src/elevenlabs/types/workspace_create_service_account_response_model.py b/data/src/elevenlabs/types/workspace_create_service_account_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..e0cc7d1e2f5027e323cd7eca8e1fc8d0020fb851 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_create_service_account_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkspaceCreateServiceAccountResponseModel(UncheckedBaseModel): + service_account_user_id: typing_extensions.Annotated[ + str, FieldMetadata(alias="service-account-user-id"), pydantic.Field(alias="service-account-user-id") + ] + + 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/data/src/elevenlabs/types/workspace_create_webhook_response_model.py b/data/src/elevenlabs/types/workspace_create_webhook_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..98f6bfbcc521b998ea28e1b6ddf1622c02a63b08 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_create_webhook_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkspaceCreateWebhookResponseModel(UncheckedBaseModel): + webhook_id: str + webhook_secret: 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/data/src/elevenlabs/types/workspace_group_by_name_response_model.py b/data/src/elevenlabs/types/workspace_group_by_name_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..5369eeda3e69e313268156662184f2f745dacf4f --- /dev/null +++ b/data/src/elevenlabs/types/workspace_group_by_name_response_model.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class WorkspaceGroupByNameResponseModel(UncheckedBaseModel): + name: str = pydantic.Field() + """ + The name of the workspace group. + """ + + id: str = pydantic.Field() + """ + The ID of the workspace group. + """ + + members_emails: typing.List[str] = pydantic.Field() + """ + The emails of the members of the workspace group. + """ + + 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/data/src/elevenlabs/types/workspace_group_permission.py b/data/src/elevenlabs/types/workspace_group_permission.py new file mode 100644 index 0000000000000000000000000000000000000000..c67588c0d8f045447582737a62a9c09dd0b8e556 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_group_permission.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceGroupPermission = typing.Union[ + typing.Literal[ + "text_to_speech", + "speech_to_speech", + "speech_to_text", + "voice_lab", + "sound_effects", + "projects", + "voiceover_studio", + "dubbing", + "audio_native", + "conversational_ai", + "conversational_ai_read", + "voice_isolator", + "ai_speech_classifier", + "synthid_detector", + "add_voice_from_voice_library", + "create_instant_voice_clone", + "create_professional_voice_clone", + "create_user_api_key", + "publish_studio_project", + "music", + "image_video_generation", + "flows", + "templates", + "share_voice_externally", + "publish_voice_to_voice_library", + "view_fiat_balance", + "workspace_analytics_full_read", + "service_accounts_manage", + "webhooks_manage", + "group_members_manage", + "workspace_members_invite", + "workspace_members_remove", + "terms_of_service_accept", + "audit_log_read", + "conversation_privacy_manage", + "all_resources_access", + "copy_resources_cross_workspace", + "voice_design", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/workspace_group_response_model.py b/data/src/elevenlabs/types/workspace_group_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..3ef7fbb332cb0dee4006ef837a903327cd8bf640 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_group_response_model.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .scim_group_response_model import ScimGroupResponseModel +from .workspace_group_permission import WorkspaceGroupPermission +from .workspace_group_response_model_group_concurrency_limit import WorkspaceGroupResponseModelGroupConcurrencyLimit +from .workspace_group_response_model_group_dubbing_concurrency_limit import ( + WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit, +) +from .workspace_group_response_model_group_music_concurrency_limit import ( + WorkspaceGroupResponseModelGroupMusicConcurrencyLimit, +) +from .workspace_group_response_model_group_pvc_limit import WorkspaceGroupResponseModelGroupPvcLimit +from .workspace_group_response_model_group_usage_limit import WorkspaceGroupResponseModelGroupUsageLimit + + +class WorkspaceGroupResponseModel(UncheckedBaseModel): + name: str + id: str + members: typing.List[str] + permissions: typing.Optional[typing.List[WorkspaceGroupPermission]] = None + group_usage_limit: typing.Optional[WorkspaceGroupResponseModelGroupUsageLimit] = None + group_pvc_limit: typing.Optional[WorkspaceGroupResponseModelGroupPvcLimit] = None + group_concurrency_limit: typing.Optional[WorkspaceGroupResponseModelGroupConcurrencyLimit] = None + group_dubbing_concurrency_limit: typing.Optional[WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit] = None + group_music_concurrency_limit: typing.Optional[WorkspaceGroupResponseModelGroupMusicConcurrencyLimit] = None + character_count: typing.Optional[int] = None + is_scim_synced: typing.Optional[bool] = None + scim_group: typing.Optional[ScimGroupResponseModel] = None + scim_frozen: 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/data/src/elevenlabs/types/workspace_group_response_model_group_concurrency_limit.py b/data/src/elevenlabs/types/workspace_group_response_model_group_concurrency_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..abffafcb8e9305fffb4c48ad9e254c7120d1c6aa --- /dev/null +++ b/data/src/elevenlabs/types/workspace_group_response_model_group_concurrency_limit.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceGroupResponseModelGroupConcurrencyLimit = typing.Union[int, typing.Literal["unlimited"]] diff --git a/data/src/elevenlabs/types/workspace_group_response_model_group_dubbing_concurrency_limit.py b/data/src/elevenlabs/types/workspace_group_response_model_group_dubbing_concurrency_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..03a99f005631605c6ba0ad4f6b922d0546093432 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_group_response_model_group_dubbing_concurrency_limit.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceGroupResponseModelGroupDubbingConcurrencyLimit = typing.Union[int, typing.Literal["unlimited"]] diff --git a/data/src/elevenlabs/types/workspace_group_response_model_group_music_concurrency_limit.py b/data/src/elevenlabs/types/workspace_group_response_model_group_music_concurrency_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..86b8a39a89d1665b9e408e9b656758e04840a55a --- /dev/null +++ b/data/src/elevenlabs/types/workspace_group_response_model_group_music_concurrency_limit.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceGroupResponseModelGroupMusicConcurrencyLimit = typing.Union[int, typing.Literal["unlimited"]] diff --git a/data/src/elevenlabs/types/workspace_group_response_model_group_pvc_limit.py b/data/src/elevenlabs/types/workspace_group_response_model_group_pvc_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..10f78fa2974c73ef1ef7a4acaa783622f2073271 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_group_response_model_group_pvc_limit.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceGroupResponseModelGroupPvcLimit = typing.Union[int, typing.Literal["unlimited"]] diff --git a/data/src/elevenlabs/types/workspace_group_response_model_group_usage_limit.py b/data/src/elevenlabs/types/workspace_group_response_model_group_usage_limit.py new file mode 100644 index 0000000000000000000000000000000000000000..1c727088c6ec0d8d430c9d55b72e66143024f0f8 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_group_response_model_group_usage_limit.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceGroupResponseModelGroupUsageLimit = typing.Union[int, typing.Literal["unlimited"]] diff --git a/data/src/elevenlabs/types/workspace_member_response_model.py b/data/src/elevenlabs/types/workspace_member_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..a093bf253973b46327b379af5ba5afd54be5cd1b --- /dev/null +++ b/data/src/elevenlabs/types/workspace_member_response_model.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .seat_type import SeatType + + +class WorkspaceMemberResponseModel(UncheckedBaseModel): + """ + Public workspace member fields exposed via GET /v1/workspace/members. + """ + + user_id: str = pydantic.Field() + """ + The user ID of the workspace member. + """ + + email: str = pydantic.Field() + """ + The email address of the workspace member. + """ + + first_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The first name of the workspace member, if available. + """ + + seat_type: typing.Optional[SeatType] = pydantic.Field(default=None) + """ + The seat type (role) of the workspace member. + """ + + is_owner: bool = pydantic.Field() + """ + Whether the member is the workspace owner. + """ + + is_locked: bool = pydantic.Field() + """ + Whether the member's account is locked in this workspace. + """ + + 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/data/src/elevenlabs/types/workspace_resource_type.py b/data/src/elevenlabs/types/workspace_resource_type.py new file mode 100644 index 0000000000000000000000000000000000000000..0ead222b8fa24050fcd122bfceeeec3c5b5dd484 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_resource_type.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceResourceType = typing.Union[ + typing.Literal[ + "voice", + "voice_collection", + "pronunciation_dictionary", + "dubbing", + "dubbing_project", + "project", + "convai_agents", + "convai_knowledge_base_documents", + "convai_tools", + "convai_settings", + "convai_secrets", + "workspace_auth_connections", + "convai_phone_numbers", + "convai_mcp_servers", + "convai_api_integration_connections", + "convai_api_integration_trigger_connections", + "convai_batch_calls", + "convai_agent_response_tests", + "convai_test_suite_invocations", + "convai_crawl_jobs", + "convai_crawl_tasks", + "convai_kb_external_sync_jobs", + "convai_whatsapp_accounts", + "convai_agent_versions", + "convai_agent_branches", + "convai_agent_versions_deployments", + "convai_agent_experiments", + "convai_memory_entries", + "convai_templates", + "dashboard", + "dashboard_configuration", + "convai_agent_drafts", + "resource_locators", + "assets", + "content_generations", + "content_templates", + "content_skills", + "songs", + "transcription_tasks", + "avatars", + "avatar_video_generations", + "resource_collection", + "studio_projects", + "convai_analysis_items", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/types/workspace_service_account_list_response_model.py b/data/src/elevenlabs/types/workspace_service_account_list_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..9cb7231541506c830b080e87ebc3257eeaed84b9 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_service_account_list_response_model.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .workspace_service_account_response_model import WorkspaceServiceAccountResponseModel + + +class WorkspaceServiceAccountListResponseModel(UncheckedBaseModel): + service_accounts: typing_extensions.Annotated[ + typing.List[WorkspaceServiceAccountResponseModel], + FieldMetadata(alias="service-accounts"), + pydantic.Field(alias="service-accounts"), + ] + + 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/data/src/elevenlabs/types/workspace_service_account_response_model.py b/data/src/elevenlabs/types/workspace_service_account_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..d33b63fec343999ccc432f8be895d604c23f81e8 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_service_account_response_model.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel +from .default_sharing_group_response_model import DefaultSharingGroupResponseModel +from .workspace_api_key_response_model import WorkspaceApiKeyResponseModel + + +class WorkspaceServiceAccountResponseModel(UncheckedBaseModel): + service_account_user_id: str + name: str + created_at_unix: typing.Optional[int] = None + api_keys: typing_extensions.Annotated[ + typing.List[WorkspaceApiKeyResponseModel], FieldMetadata(alias="api-keys"), pydantic.Field(alias="api-keys") + ] + default_sharing_groups: typing.Optional[typing.List[DefaultSharingGroupResponseModel]] = 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/data/src/elevenlabs/types/workspace_webhook_event_type.py b/data/src/elevenlabs/types/workspace_webhook_event_type.py new file mode 100644 index 0000000000000000000000000000000000000000..85f3b95b35065e50861e39b1dcf5a2f2cbd5e716 --- /dev/null +++ b/data/src/elevenlabs/types/workspace_webhook_event_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WorkspaceWebhookEventType = typing.Union[ + typing.Literal["voice_library_removal_notice", "speech_to_text", "agent_qa", "flows"], typing.Any +] diff --git a/data/src/elevenlabs/types/workspace_webhook_list_response_model.py b/data/src/elevenlabs/types/workspace_webhook_list_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..468b01b893ec2730d2df180fd857a5422ee8a09e --- /dev/null +++ b/data/src/elevenlabs/types/workspace_webhook_list_response_model.py @@ -0,0 +1,24 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .workspace_webhook_response_model import WorkspaceWebhookResponseModel + + +class WorkspaceWebhookListResponseModel(UncheckedBaseModel): + webhooks: typing.List[WorkspaceWebhookResponseModel] = pydantic.Field() + """ + List of webhooks currently configured for the workspace + """ + + 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/data/src/elevenlabs/types/workspace_webhook_response_model.py b/data/src/elevenlabs/types/workspace_webhook_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2d797f32a6bb451515a59781d767554b21c649dc --- /dev/null +++ b/data/src/elevenlabs/types/workspace_webhook_response_model.py @@ -0,0 +1,76 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .webhook_auth_method_type import WebhookAuthMethodType +from .workspace_webhook_event_type import WorkspaceWebhookEventType +from .workspace_webhook_usage_response_model import WorkspaceWebhookUsageResponseModel + + +class WorkspaceWebhookResponseModel(UncheckedBaseModel): + name: str = pydantic.Field() + """ + The display name for this webhook. + """ + + webhook_id: str = pydantic.Field() + """ + The unique ID for this webhook. + """ + + webhook_url: str = pydantic.Field() + """ + The HTTPS callback URL that is called when this webhook is triggered in the platform. + """ + + is_disabled: bool = pydantic.Field() + """ + Whether the webhook has been manually disabled by a user. + """ + + is_auto_disabled: bool = pydantic.Field() + """ + Whether the webhook has been automatically disabled due to repeated consecutive failures over a long period of time. + """ + + created_at_unix: int = pydantic.Field() + """ + Original creation time of the webhook. + """ + + auth_type: WebhookAuthMethodType = pydantic.Field() + """ + The authentication mode used to secure the webhook. + """ + + usage: typing.Optional[typing.List[WorkspaceWebhookUsageResponseModel]] = pydantic.Field(default=None) + """ + The list of products that are currently configured to trigger this webhook. + """ + + events: typing.Optional[typing.List[WorkspaceWebhookEventType]] = pydantic.Field(default=None) + """ + The workspace-level events this webhook is currently subscribed to. Only populated when usages are requested. + """ + + most_recent_failure_error_code: typing.Optional[int] = pydantic.Field(default=None) + """ + The most recent error code returned from the callback URL. + """ + + most_recent_failure_timestamp: typing.Optional[int] = pydantic.Field(default=None) + """ + The most recent time the webhook failed, failures are any non-200 codes returned by the callback URL. + """ + + 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/data/src/elevenlabs/types/workspace_webhook_usage_response_model.py b/data/src/elevenlabs/types/workspace_webhook_usage_response_model.py new file mode 100644 index 0000000000000000000000000000000000000000..28aaddcc245725d3e1759067ab7208eaa10448ff --- /dev/null +++ b/data/src/elevenlabs/types/workspace_webhook_usage_response_model.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .webhook_usage_type import WebhookUsageType + + +class WorkspaceWebhookUsageResponseModel(UncheckedBaseModel): + usage_type: WebhookUsageType + + 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/data/src/elevenlabs/url_utils.py b/data/src/elevenlabs/url_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..dc7d48a741de48429eff0dc64c3bb941c87fd051 --- /dev/null +++ b/data/src/elevenlabs/url_utils.py @@ -0,0 +1,28 @@ +import urllib.parse +from typing import Any, Sequence, Tuple, Union + + +_WS_SCHEME = {"https": "wss", "http": "ws"} + + +def build_ws_url( + base_url: str, + path_segments: Sequence[Any], + params: Union[Sequence[Tuple[str, str]], dict], +) -> str: + """Build a WebSocket URL with proper percent-encoding. + + Converts http(s) schemes to ws(s), appends percent-encoded + *path_segments* beneath the existing base path, and encodes + *params* as the query string. + """ + parsed = urllib.parse.urlparse(base_url) + path = "/".join(urllib.parse.quote(str(seg), safe="") for seg in path_segments) + return urllib.parse.urlunparse(( + _WS_SCHEME.get(parsed.scheme, parsed.scheme), + parsed.netloc, + parsed.path.rstrip("/") + "/" + path, + "", + urllib.parse.urlencode(params, quote_via=urllib.parse.quote), + "", + )) diff --git a/data/src/elevenlabs/usage/__init__.py b/data/src/elevenlabs/usage/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/usage/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/usage/client.py b/data/src/elevenlabs/usage/client.py new file mode 100644 index 0000000000000000000000000000000000000000..142285193ee470ad5f67ad0cc010bd2e333871cb --- /dev/null +++ b/data/src/elevenlabs/usage/client.py @@ -0,0 +1,201 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.breakdown_types import BreakdownTypes +from ..types.metric_type import MetricType +from ..types.usage_aggregation_interval import UsageAggregationInterval +from ..types.usage_characters_response_model import UsageCharactersResponseModel +from .raw_client import AsyncRawUsageClient, RawUsageClient + + +class UsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawUsageClient + """ + return self._raw_client + + def get( + self, + *, + start_unix: int, + end_unix: int, + include_workspace_metrics: typing.Optional[bool] = None, + breakdown_type: typing.Optional[BreakdownTypes] = None, + aggregation_interval: typing.Optional[UsageAggregationInterval] = None, + aggregation_bucket_size: typing.Optional[int] = None, + metric: typing.Optional[MetricType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> UsageCharactersResponseModel: + """ + (Deprecated) This endpoint is deprecated. Use /v1/workspace/analytics/query/usage-by-product-over-time instead, which exposes the bucket size as `interval_seconds` (an integer in seconds) rather than `aggregation_interval`. Returns the usage metrics for the current user or the entire workspace they are part of. The response provides a time axis based on the specified aggregation interval (default: day), with usage values for each interval along that axis. Usage is broken down by the selected breakdown type. For example, breakdown type "voice" will return the usage of each voice for each interval along the time axis. + + Parameters + ---------- + start_unix : int + UTC Unix timestamp for the start of the usage window, in milliseconds. To include the first day of the window, the timestamp should be at 00:00:00 of that day. + + end_unix : int + UTC Unix timestamp for the end of the usage window, in milliseconds. To include the last day of the window, the timestamp should be at 23:59:59 of that day. + + include_workspace_metrics : typing.Optional[bool] + Whether or not to include the statistics of the entire workspace. + + breakdown_type : typing.Optional[BreakdownTypes] + How to break down the information. Cannot be "user" if include_workspace_metrics is False. + + aggregation_interval : typing.Optional[UsageAggregationInterval] + How to aggregate usage data over time. Can be "hour", "day", "week", "month", or "cumulative". + + aggregation_bucket_size : typing.Optional[int] + Aggregation bucket size in seconds. Overrides the aggregation interval. + + metric : typing.Optional[MetricType] + Which metric to aggregate. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UsageCharactersResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.usage.get( + start_unix=1, + end_unix=1, + include_workspace_metrics=True, + breakdown_type="none", + aggregation_interval="hour", + aggregation_bucket_size=1, + metric="credits", + ) + """ + _response = self._raw_client.get( + start_unix=start_unix, + end_unix=end_unix, + include_workspace_metrics=include_workspace_metrics, + breakdown_type=breakdown_type, + aggregation_interval=aggregation_interval, + aggregation_bucket_size=aggregation_bucket_size, + metric=metric, + request_options=request_options, + ) + return _response.data + + +class AsyncUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawUsageClient + """ + return self._raw_client + + async def get( + self, + *, + start_unix: int, + end_unix: int, + include_workspace_metrics: typing.Optional[bool] = None, + breakdown_type: typing.Optional[BreakdownTypes] = None, + aggregation_interval: typing.Optional[UsageAggregationInterval] = None, + aggregation_bucket_size: typing.Optional[int] = None, + metric: typing.Optional[MetricType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> UsageCharactersResponseModel: + """ + (Deprecated) This endpoint is deprecated. Use /v1/workspace/analytics/query/usage-by-product-over-time instead, which exposes the bucket size as `interval_seconds` (an integer in seconds) rather than `aggregation_interval`. Returns the usage metrics for the current user or the entire workspace they are part of. The response provides a time axis based on the specified aggregation interval (default: day), with usage values for each interval along that axis. Usage is broken down by the selected breakdown type. For example, breakdown type "voice" will return the usage of each voice for each interval along the time axis. + + Parameters + ---------- + start_unix : int + UTC Unix timestamp for the start of the usage window, in milliseconds. To include the first day of the window, the timestamp should be at 00:00:00 of that day. + + end_unix : int + UTC Unix timestamp for the end of the usage window, in milliseconds. To include the last day of the window, the timestamp should be at 23:59:59 of that day. + + include_workspace_metrics : typing.Optional[bool] + Whether or not to include the statistics of the entire workspace. + + breakdown_type : typing.Optional[BreakdownTypes] + How to break down the information. Cannot be "user" if include_workspace_metrics is False. + + aggregation_interval : typing.Optional[UsageAggregationInterval] + How to aggregate usage data over time. Can be "hour", "day", "week", "month", or "cumulative". + + aggregation_bucket_size : typing.Optional[int] + Aggregation bucket size in seconds. Overrides the aggregation interval. + + metric : typing.Optional[MetricType] + Which metric to aggregate. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UsageCharactersResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.usage.get( + start_unix=1, + end_unix=1, + include_workspace_metrics=True, + breakdown_type="none", + aggregation_interval="hour", + aggregation_bucket_size=1, + metric="credits", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + start_unix=start_unix, + end_unix=end_unix, + include_workspace_metrics=include_workspace_metrics, + breakdown_type=breakdown_type, + aggregation_interval=aggregation_interval, + aggregation_bucket_size=aggregation_bucket_size, + metric=metric, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/usage/raw_client.py b/data/src/elevenlabs/usage/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b334c1b99dfb6f0aa776637daddee1a35c20c755 --- /dev/null +++ b/data/src/elevenlabs/usage/raw_client.py @@ -0,0 +1,207 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.breakdown_types import BreakdownTypes +from ..types.metric_type import MetricType +from ..types.usage_aggregation_interval import UsageAggregationInterval +from ..types.usage_characters_response_model import UsageCharactersResponseModel +from pydantic import ValidationError + + +class RawUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + *, + start_unix: int, + end_unix: int, + include_workspace_metrics: typing.Optional[bool] = None, + breakdown_type: typing.Optional[BreakdownTypes] = None, + aggregation_interval: typing.Optional[UsageAggregationInterval] = None, + aggregation_bucket_size: typing.Optional[int] = None, + metric: typing.Optional[MetricType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UsageCharactersResponseModel]: + """ + (Deprecated) This endpoint is deprecated. Use /v1/workspace/analytics/query/usage-by-product-over-time instead, which exposes the bucket size as `interval_seconds` (an integer in seconds) rather than `aggregation_interval`. Returns the usage metrics for the current user or the entire workspace they are part of. The response provides a time axis based on the specified aggregation interval (default: day), with usage values for each interval along that axis. Usage is broken down by the selected breakdown type. For example, breakdown type "voice" will return the usage of each voice for each interval along the time axis. + + Parameters + ---------- + start_unix : int + UTC Unix timestamp for the start of the usage window, in milliseconds. To include the first day of the window, the timestamp should be at 00:00:00 of that day. + + end_unix : int + UTC Unix timestamp for the end of the usage window, in milliseconds. To include the last day of the window, the timestamp should be at 23:59:59 of that day. + + include_workspace_metrics : typing.Optional[bool] + Whether or not to include the statistics of the entire workspace. + + breakdown_type : typing.Optional[BreakdownTypes] + How to break down the information. Cannot be "user" if include_workspace_metrics is False. + + aggregation_interval : typing.Optional[UsageAggregationInterval] + How to aggregate usage data over time. Can be "hour", "day", "week", "month", or "cumulative". + + aggregation_bucket_size : typing.Optional[int] + Aggregation bucket size in seconds. Overrides the aggregation interval. + + metric : typing.Optional[MetricType] + Which metric to aggregate. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UsageCharactersResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/usage/character-stats", + method="GET", + params={ + "start_unix": start_unix, + "end_unix": end_unix, + "include_workspace_metrics": include_workspace_metrics, + "breakdown_type": breakdown_type, + "aggregation_interval": aggregation_interval, + "aggregation_bucket_size": aggregation_bucket_size, + "metric": metric, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UsageCharactersResponseModel, + construct_type( + type_=UsageCharactersResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + *, + start_unix: int, + end_unix: int, + include_workspace_metrics: typing.Optional[bool] = None, + breakdown_type: typing.Optional[BreakdownTypes] = None, + aggregation_interval: typing.Optional[UsageAggregationInterval] = None, + aggregation_bucket_size: typing.Optional[int] = None, + metric: typing.Optional[MetricType] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UsageCharactersResponseModel]: + """ + (Deprecated) This endpoint is deprecated. Use /v1/workspace/analytics/query/usage-by-product-over-time instead, which exposes the bucket size as `interval_seconds` (an integer in seconds) rather than `aggregation_interval`. Returns the usage metrics for the current user or the entire workspace they are part of. The response provides a time axis based on the specified aggregation interval (default: day), with usage values for each interval along that axis. Usage is broken down by the selected breakdown type. For example, breakdown type "voice" will return the usage of each voice for each interval along the time axis. + + Parameters + ---------- + start_unix : int + UTC Unix timestamp for the start of the usage window, in milliseconds. To include the first day of the window, the timestamp should be at 00:00:00 of that day. + + end_unix : int + UTC Unix timestamp for the end of the usage window, in milliseconds. To include the last day of the window, the timestamp should be at 23:59:59 of that day. + + include_workspace_metrics : typing.Optional[bool] + Whether or not to include the statistics of the entire workspace. + + breakdown_type : typing.Optional[BreakdownTypes] + How to break down the information. Cannot be "user" if include_workspace_metrics is False. + + aggregation_interval : typing.Optional[UsageAggregationInterval] + How to aggregate usage data over time. Can be "hour", "day", "week", "month", or "cumulative". + + aggregation_bucket_size : typing.Optional[int] + Aggregation bucket size in seconds. Overrides the aggregation interval. + + metric : typing.Optional[MetricType] + Which metric to aggregate. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UsageCharactersResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/usage/character-stats", + method="GET", + params={ + "start_unix": start_unix, + "end_unix": end_unix, + "include_workspace_metrics": include_workspace_metrics, + "breakdown_type": breakdown_type, + "aggregation_interval": aggregation_interval, + "aggregation_bucket_size": aggregation_bucket_size, + "metric": metric, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UsageCharactersResponseModel, + construct_type( + type_=UsageCharactersResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/user/__init__.py b/data/src/elevenlabs/user/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..59f00b1a4c8bd560f3f3100b360d92553a4c9014 --- /dev/null +++ b/data/src/elevenlabs/user/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import subscription +_dynamic_imports: typing.Dict[str, str] = {"subscription": ".subscription"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["subscription"] diff --git a/data/src/elevenlabs/user/client.py b/data/src/elevenlabs/user/client.py new file mode 100644 index 0000000000000000000000000000000000000000..9fec481714b5c65f9b9cd875739d325ed3593a50 --- /dev/null +++ b/data/src/elevenlabs/user/client.py @@ -0,0 +1,125 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.user import User +from .raw_client import AsyncRawUserClient, RawUserClient + +if typing.TYPE_CHECKING: + from .subscription.client import AsyncSubscriptionClient, SubscriptionClient + + +class UserClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawUserClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._subscription: typing.Optional[SubscriptionClient] = None + + @property + def with_raw_response(self) -> RawUserClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawUserClient + """ + return self._raw_client + + def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> User: + """ + Gets information about the user + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + User + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.user.get() + """ + _response = self._raw_client.get(request_options=request_options) + return _response.data + + @property + def subscription(self): + if self._subscription is None: + from .subscription.client import SubscriptionClient # noqa: E402 + + self._subscription = SubscriptionClient(client_wrapper=self._client_wrapper) + return self._subscription + + +class AsyncUserClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawUserClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._subscription: typing.Optional[AsyncSubscriptionClient] = None + + @property + def with_raw_response(self) -> AsyncRawUserClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawUserClient + """ + return self._raw_client + + async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> User: + """ + Gets information about the user + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + User + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user.get() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(request_options=request_options) + return _response.data + + @property + def subscription(self): + if self._subscription is None: + from .subscription.client import AsyncSubscriptionClient # noqa: E402 + + self._subscription = AsyncSubscriptionClient(client_wrapper=self._client_wrapper) + return self._subscription diff --git a/data/src/elevenlabs/user/raw_client.py b/data/src/elevenlabs/user/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c88b062670a979421ede254b159f97caf115d4e6 --- /dev/null +++ b/data/src/elevenlabs/user/raw_client.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.user import User +from pydantic import ValidationError + + +class RawUserClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[User]: + """ + Gets information about the user + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[User] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/user", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + User, + construct_type( + type_=User, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawUserClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[User]: + """ + Gets information about the user + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[User] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/user", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + User, + construct_type( + type_=User, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/user/subscription/__init__.py b/data/src/elevenlabs/user/subscription/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/user/subscription/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/user/subscription/client.py b/data/src/elevenlabs/user/subscription/client.py new file mode 100644 index 0000000000000000000000000000000000000000..060fe368c4cf186ac21f16d88b20a30cc66eb13e --- /dev/null +++ b/data/src/elevenlabs/user/subscription/client.py @@ -0,0 +1,100 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.subscription import Subscription +from .raw_client import AsyncRawSubscriptionClient, RawSubscriptionClient + + +class SubscriptionClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSubscriptionClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSubscriptionClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSubscriptionClient + """ + return self._raw_client + + def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> Subscription: + """ + Gets extended information about the users subscription + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Subscription + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.user.subscription.get() + """ + _response = self._raw_client.get(request_options=request_options) + return _response.data + + +class AsyncSubscriptionClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSubscriptionClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSubscriptionClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSubscriptionClient + """ + return self._raw_client + + async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> Subscription: + """ + Gets extended information about the users subscription + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Subscription + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.user.subscription.get() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/user/subscription/raw_client.py b/data/src/elevenlabs/user/subscription/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..88d49fdd1338c9c30769ce68bc5133b04f11255b --- /dev/null +++ b/data/src/elevenlabs/user/subscription/raw_client.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.subscription import Subscription +from pydantic import ValidationError + + +class RawSubscriptionClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Subscription]: + """ + Gets extended information about the users subscription + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Subscription] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/user/subscription", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Subscription, + construct_type( + type_=Subscription, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSubscriptionClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[Subscription]: + """ + Gets extended information about the users subscription + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Subscription] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/user/subscription", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Subscription, + construct_type( + type_=Subscription, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/v_1_dubbing_realtime/__init__.py b/data/src/elevenlabs/v_1_dubbing_realtime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d032ea55bdd30aa1e1946109ddc4605367bdf77c --- /dev/null +++ b/data/src/elevenlabs/v_1_dubbing_realtime/__init__.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + ReceiveDubbingStreamMessage, + SendDubbingStreamMessage, + TextToDialogueInputFormat, + TextToDialogueOutputFormat, + ) +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveDubbingStreamMessage": ".types", + "SendDubbingStreamMessage": ".types", + "TextToDialogueInputFormat": ".types", + "TextToDialogueOutputFormat": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ReceiveDubbingStreamMessage", + "SendDubbingStreamMessage", + "TextToDialogueInputFormat", + "TextToDialogueOutputFormat", +] diff --git a/data/src/elevenlabs/v_1_dubbing_realtime/types/__init__.py b/data/src/elevenlabs/v_1_dubbing_realtime/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0e501df4cde71cc5b1c252e3746ecb27b334d2ad --- /dev/null +++ b/data/src/elevenlabs/v_1_dubbing_realtime/types/__init__.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .receive_dubbing_stream_message import ReceiveDubbingStreamMessage + from .send_dubbing_stream_message import SendDubbingStreamMessage + from .text_to_dialogue_input_format import TextToDialogueInputFormat + from .text_to_dialogue_output_format import TextToDialogueOutputFormat +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveDubbingStreamMessage": ".receive_dubbing_stream_message", + "SendDubbingStreamMessage": ".send_dubbing_stream_message", + "TextToDialogueInputFormat": ".text_to_dialogue_input_format", + "TextToDialogueOutputFormat": ".text_to_dialogue_output_format", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ReceiveDubbingStreamMessage", + "SendDubbingStreamMessage", + "TextToDialogueInputFormat", + "TextToDialogueOutputFormat", +] diff --git a/data/src/elevenlabs/v_1_dubbing_realtime/types/receive_dubbing_stream_message.py b/data/src/elevenlabs/v_1_dubbing_realtime/types/receive_dubbing_stream_message.py new file mode 100644 index 0000000000000000000000000000000000000000..7f788801eba772566b027f71454f3f7a060b6404 --- /dev/null +++ b/data/src/elevenlabs/v_1_dubbing_realtime/types/receive_dubbing_stream_message.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.dubbing_audio import DubbingAudio +from ...types.dubbing_audio_output_error import DubbingAudioOutputError +from ...types.dubbing_auth_error import DubbingAuthError +from ...types.dubbing_committed_transcript import DubbingCommittedTranscript +from ...types.dubbing_error import DubbingError +from ...types.dubbing_input_error import DubbingInputError +from ...types.dubbing_invalid_request_error import DubbingInvalidRequestError +from ...types.dubbing_partial_transcript import DubbingPartialTranscript +from ...types.dubbing_queue_overflow_error import DubbingQueueOverflowError +from ...types.dubbing_rate_limited_error import DubbingRateLimitedError +from ...types.dubbing_session_started import DubbingSessionStarted +from ...types.dubbing_status import DubbingStatus +from ...types.dubbing_transcriber_error import DubbingTranscriberError +from ...types.dubbing_translation import DubbingTranslation +from ...types.dubbing_translation_error import DubbingTranslationError + +ReceiveDubbingStreamMessage = typing.Union[ + DubbingSessionStarted, + DubbingStatus, + DubbingPartialTranscript, + DubbingCommittedTranscript, + DubbingTranslation, + DubbingAudio, + DubbingError, + DubbingAuthError, + DubbingRateLimitedError, + DubbingQueueOverflowError, + DubbingInvalidRequestError, + DubbingInputError, + DubbingTranscriberError, + DubbingTranslationError, + DubbingAudioOutputError, +] diff --git a/data/src/elevenlabs/v_1_dubbing_realtime/types/send_dubbing_stream_message.py b/data/src/elevenlabs/v_1_dubbing_realtime/types/send_dubbing_stream_message.py new file mode 100644 index 0000000000000000000000000000000000000000..4bd521a9c36650ee9fcea9f153277677ab441913 --- /dev/null +++ b/data/src/elevenlabs/v_1_dubbing_realtime/types/send_dubbing_stream_message.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.dubbing_end_of_stream import DubbingEndOfStream +from ...types.dubbing_input_audio_chunk import DubbingInputAudioChunk + +SendDubbingStreamMessage = typing.Union[DubbingInputAudioChunk, DubbingEndOfStream] diff --git a/data/src/elevenlabs/v_1_dubbing_realtime/types/text_to_dialogue_input_format.py b/data/src/elevenlabs/v_1_dubbing_realtime/types/text_to_dialogue_input_format.py new file mode 100644 index 0000000000000000000000000000000000000000..75c03e4046b576da871c6e971dcc925e1ab568bd --- /dev/null +++ b/data/src/elevenlabs/v_1_dubbing_realtime/types/text_to_dialogue_input_format.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueInputFormat = typing.Union[ + typing.Literal["pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "pcm_48000", "ulaw_8000"], typing.Any +] diff --git a/data/src/elevenlabs/v_1_dubbing_realtime/types/text_to_dialogue_output_format.py b/data/src/elevenlabs/v_1_dubbing_realtime/types/text_to_dialogue_output_format.py new file mode 100644 index 0000000000000000000000000000000000000000..8c8dbbc2c22e370ece4d2067c6fd85061578f635 --- /dev/null +++ b/data/src/elevenlabs/v_1_dubbing_realtime/types/text_to_dialogue_output_format.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueOutputFormat = typing.Union[ + typing.Literal["pcm_8000", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "pcm_48000", "ulaw_8000"], typing.Any +] diff --git a/data/src/elevenlabs/v_1_speech_to_text_realtime/__init__.py b/data/src/elevenlabs/v_1_speech_to_text_realtime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bfd5b1fc30684a274d7ee6ba3d2b3e3f3d69bc12 --- /dev/null +++ b/data/src/elevenlabs/v_1_speech_to_text_realtime/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ReceiveTranscription, TextToDialogueCommitStrategy +_dynamic_imports: typing.Dict[str, str] = {"ReceiveTranscription": ".types", "TextToDialogueCommitStrategy": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveTranscription", "TextToDialogueCommitStrategy"] diff --git a/data/src/elevenlabs/v_1_speech_to_text_realtime/types/__init__.py b/data/src/elevenlabs/v_1_speech_to_text_realtime/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7bb70bab5695a1203761f31326e85e6767260b1f --- /dev/null +++ b/data/src/elevenlabs/v_1_speech_to_text_realtime/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .receive_transcription import ReceiveTranscription + from .text_to_dialogue_commit_strategy import TextToDialogueCommitStrategy +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveTranscription": ".receive_transcription", + "TextToDialogueCommitStrategy": ".text_to_dialogue_commit_strategy", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveTranscription", "TextToDialogueCommitStrategy"] diff --git a/data/src/elevenlabs/v_1_speech_to_text_realtime/types/receive_transcription.py b/data/src/elevenlabs/v_1_speech_to_text_realtime/types/receive_transcription.py new file mode 100644 index 0000000000000000000000000000000000000000..da93e83a527741686931e00ad242d0b1b2906cca --- /dev/null +++ b/data/src/elevenlabs/v_1_speech_to_text_realtime/types/receive_transcription.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.committed_transcript_entities_payload import CommittedTranscriptEntitiesPayload +from ...types.committed_transcript_payload import CommittedTranscriptPayload +from ...types.committed_transcript_with_timestamps_payload import CommittedTranscriptWithTimestampsPayload +from ...types.edited_transcript import EditedTranscript +from ...types.partial_transcript_payload import PartialTranscriptPayload +from ...types.scribe_auth_error_payload import ScribeAuthErrorPayload +from ...types.scribe_chunk_size_exceeded_error_payload import ScribeChunkSizeExceededErrorPayload +from ...types.scribe_error_payload import ScribeErrorPayload +from ...types.scribe_input_error_payload import ScribeInputErrorPayload +from ...types.scribe_insufficient_audio_activity_error_payload import ScribeInsufficientAudioActivityErrorPayload +from ...types.scribe_invalid_request_error import ScribeInvalidRequestError +from ...types.scribe_queue_overflow_error_payload import ScribeQueueOverflowErrorPayload +from ...types.scribe_quota_exceeded_error_payload import ScribeQuotaExceededErrorPayload +from ...types.scribe_rate_limited_error_payload import ScribeRateLimitedErrorPayload +from ...types.scribe_resource_exhausted_error_payload import ScribeResourceExhaustedErrorPayload +from ...types.scribe_session_time_limit_exceeded_error_payload import ScribeSessionTimeLimitExceededErrorPayload +from ...types.scribe_throttled_error_payload import ScribeThrottledErrorPayload +from ...types.scribe_transcriber_error_payload import ScribeTranscriberErrorPayload +from ...types.scribe_unaccepted_terms_error_payload import ScribeUnacceptedTermsErrorPayload +from ...types.scribe_warning import ScribeWarning +from ...types.session_started_payload import SessionStartedPayload + +ReceiveTranscription = typing.Union[ + SessionStartedPayload, + PartialTranscriptPayload, + CommittedTranscriptPayload, + CommittedTranscriptWithTimestampsPayload, + CommittedTranscriptEntitiesPayload, + EditedTranscript, + ScribeWarning, + ScribeErrorPayload, + ScribeAuthErrorPayload, + ScribeQuotaExceededErrorPayload, + ScribeThrottledErrorPayload, + ScribeUnacceptedTermsErrorPayload, + ScribeRateLimitedErrorPayload, + ScribeQueueOverflowErrorPayload, + ScribeResourceExhaustedErrorPayload, + ScribeSessionTimeLimitExceededErrorPayload, + ScribeInputErrorPayload, + ScribeInvalidRequestError, + ScribeChunkSizeExceededErrorPayload, + ScribeInsufficientAudioActivityErrorPayload, + ScribeTranscriberErrorPayload, +] diff --git a/data/src/elevenlabs/v_1_speech_to_text_realtime/types/text_to_dialogue_commit_strategy.py b/data/src/elevenlabs/v_1_speech_to_text_realtime/types/text_to_dialogue_commit_strategy.py new file mode 100644 index 0000000000000000000000000000000000000000..a636816d790ce3bea079d024e5c440cc46fe33be --- /dev/null +++ b/data/src/elevenlabs/v_1_speech_to_text_realtime/types/text_to_dialogue_commit_strategy.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueCommitStrategy = typing.Union[typing.Literal["manual", "vad", "turn_prediction"], typing.Any] diff --git a/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/__init__.py b/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..607837da54e8bfe616eaca81dedcc07ad67d4f5f --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ReceiveTextToDialogueWebsocketMessageMulti +_dynamic_imports: typing.Dict[str, str] = {"ReceiveTextToDialogueWebsocketMessageMulti": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveTextToDialogueWebsocketMessageMulti"] diff --git a/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/types/__init__.py b/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..18a83b97fa81fdb1fe2e1c3755034058ea069fa4 --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/types/__init__.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .receive_text_to_dialogue_websocket_message_multi import ReceiveTextToDialogueWebsocketMessageMulti +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveTextToDialogueWebsocketMessageMulti": ".receive_text_to_dialogue_websocket_message_multi" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveTextToDialogueWebsocketMessageMulti"] diff --git a/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/types/receive_text_to_dialogue_websocket_message_multi.py b/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/types/receive_text_to_dialogue_websocket_message_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..0f1af1cdfda3d0584d5be20016fe749c48c06a1a --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_dialogue_multi_stream_input/types/receive_text_to_dialogue_websocket_message_multi.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.text_to_dialogue_websocket_audio_chunk_multi import TextToDialogueWebsocketAudioChunkMulti +from ...types.text_to_dialogue_websocket_error import TextToDialogueWebsocketError +from ...types.text_to_dialogue_websocket_final_audio_for_turn_multi import TextToDialogueWebsocketFinalAudioForTurnMulti +from ...types.text_to_dialogue_websocket_final_multi import TextToDialogueWebsocketFinalMulti + +ReceiveTextToDialogueWebsocketMessageMulti = typing.Union[ + TextToDialogueWebsocketAudioChunkMulti, + TextToDialogueWebsocketFinalAudioForTurnMulti, + TextToDialogueWebsocketFinalMulti, + TextToDialogueWebsocketError, +] diff --git a/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/__init__.py b/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..65c8c4160fbbee3a06d3fe94ff4444c2e595309d --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ReceiveTextToDialogueWebsocketMessage +_dynamic_imports: typing.Dict[str, str] = {"ReceiveTextToDialogueWebsocketMessage": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveTextToDialogueWebsocketMessage"] diff --git a/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/types/__init__.py b/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9ba5b06883e8b9e6dd7533893ddc77e8e24de710 --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/types/__init__.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .receive_text_to_dialogue_websocket_message import ReceiveTextToDialogueWebsocketMessage +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveTextToDialogueWebsocketMessage": ".receive_text_to_dialogue_websocket_message" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveTextToDialogueWebsocketMessage"] diff --git a/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/types/receive_text_to_dialogue_websocket_message.py b/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/types/receive_text_to_dialogue_websocket_message.py new file mode 100644 index 0000000000000000000000000000000000000000..b08e5dc86d60d7643405f97304fef946084ef356 --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_dialogue_stream_input/types/receive_text_to_dialogue_websocket_message.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.text_to_dialogue_websocket_audio_chunk import TextToDialogueWebsocketAudioChunk +from ...types.text_to_dialogue_websocket_error import TextToDialogueWebsocketError +from ...types.text_to_dialogue_websocket_final import TextToDialogueWebsocketFinal +from ...types.text_to_dialogue_websocket_final_audio_for_turn import TextToDialogueWebsocketFinalAudioForTurn + +ReceiveTextToDialogueWebsocketMessage = typing.Union[ + TextToDialogueWebsocketAudioChunk, + TextToDialogueWebsocketFinalAudioForTurn, + TextToDialogueWebsocketFinal, + TextToDialogueWebsocketError, +] diff --git a/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/__init__.py b/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f6d676b79ac58b67d914075a63a20f3e45903330 --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ReceiveMessageMulti, SendMessageMulti +_dynamic_imports: typing.Dict[str, str] = {"ReceiveMessageMulti": ".types", "SendMessageMulti": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveMessageMulti", "SendMessageMulti"] diff --git a/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/__init__.py b/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0f70bab0308908e88ba547afc639343d9884792f --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .receive_message_multi import ReceiveMessageMulti + from .send_message_multi import SendMessageMulti +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveMessageMulti": ".receive_message_multi", + "SendMessageMulti": ".send_message_multi", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveMessageMulti", "SendMessageMulti"] diff --git a/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/receive_message_multi.py b/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/receive_message_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..d5f2d8666125ef21a942ba1670b9241f05f51e3a --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/receive_message_multi.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.audio_output_multi import AudioOutputMulti +from ...types.final_output_multi import FinalOutputMulti + +ReceiveMessageMulti = typing.Union[AudioOutputMulti, FinalOutputMulti] diff --git a/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/send_message_multi.py b/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/send_message_multi.py new file mode 100644 index 0000000000000000000000000000000000000000..d06d7d2877c209cafdf3baeace103cb59ce14689 --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_speech_voice_id_multi_stream_input/types/send_message_multi.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.close_context import CloseContext +from ...types.close_socket import CloseSocket +from ...types.flush_context import FlushContext +from ...types.initialise_context import InitialiseContext +from ...types.initialize_connection_multi import InitializeConnectionMulti +from ...types.keep_context_alive import KeepContextAlive +from ...types.send_text_multi import SendTextMulti + +SendMessageMulti = typing.Union[ + InitializeConnectionMulti, + InitialiseContext, + SendTextMulti, + FlushContext, + CloseContext, + CloseSocket, + KeepContextAlive, +] diff --git a/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/__init__.py b/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3ce5d15f0488fd88856b079efaf49bdd0946acab --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ReceiveMessage, SendMessage +_dynamic_imports: typing.Dict[str, str] = {"ReceiveMessage": ".types", "SendMessage": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveMessage", "SendMessage"] diff --git a/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/__init__.py b/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0c784f863f1630839dabd873590d830af8cef100 --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/__init__.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .receive_message import ReceiveMessage + from .send_message import SendMessage +_dynamic_imports: typing.Dict[str, str] = {"ReceiveMessage": ".receive_message", "SendMessage": ".send_message"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["ReceiveMessage", "SendMessage"] diff --git a/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/receive_message.py b/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/receive_message.py new file mode 100644 index 0000000000000000000000000000000000000000..813ba8670d1b33e04edb7d8ade55449da0211957 --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/receive_message.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.audio_output import AudioOutput +from ...types.final_output import FinalOutput + +ReceiveMessage = typing.Union[AudioOutput, FinalOutput] diff --git a/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/send_message.py b/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/send_message.py new file mode 100644 index 0000000000000000000000000000000000000000..8ae3c8350503ad6ea08d4477d9bcdd86c926e756 --- /dev/null +++ b/data/src/elevenlabs/v_1_text_to_speech_voice_id_stream_input/types/send_message.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.close_connection import CloseConnection +from ...types.initialize_connection import InitializeConnection +from ...types.send_text import SendText + +SendMessage = typing.Union[InitializeConnection, SendText, CloseConnection] diff --git a/data/src/elevenlabs/v_1_translation_realtime/__init__.py b/data/src/elevenlabs/v_1_translation_realtime/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4a2ff9cff06c1b5e5acc9edc8752c33004d5d301 --- /dev/null +++ b/data/src/elevenlabs/v_1_translation_realtime/__init__.py @@ -0,0 +1,52 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + ReceiveTranslateStreamMessage, + SendTranslateStreamMessage, + TextToDialogueApplyTextNormalization, + TextToDialogueEagerness, + TextToDialogueTtsModelId, + ) +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveTranslateStreamMessage": ".types", + "SendTranslateStreamMessage": ".types", + "TextToDialogueApplyTextNormalization": ".types", + "TextToDialogueEagerness": ".types", + "TextToDialogueTtsModelId": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ReceiveTranslateStreamMessage", + "SendTranslateStreamMessage", + "TextToDialogueApplyTextNormalization", + "TextToDialogueEagerness", + "TextToDialogueTtsModelId", +] diff --git a/data/src/elevenlabs/v_1_translation_realtime/types/__init__.py b/data/src/elevenlabs/v_1_translation_realtime/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7c2a51f5a9feda314814a988b2bfc600fb607218 --- /dev/null +++ b/data/src/elevenlabs/v_1_translation_realtime/types/__init__.py @@ -0,0 +1,50 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .receive_translate_stream_message import ReceiveTranslateStreamMessage + from .send_translate_stream_message import SendTranslateStreamMessage + from .text_to_dialogue_apply_text_normalization import TextToDialogueApplyTextNormalization + from .text_to_dialogue_eagerness import TextToDialogueEagerness + from .text_to_dialogue_tts_model_id import TextToDialogueTtsModelId +_dynamic_imports: typing.Dict[str, str] = { + "ReceiveTranslateStreamMessage": ".receive_translate_stream_message", + "SendTranslateStreamMessage": ".send_translate_stream_message", + "TextToDialogueApplyTextNormalization": ".text_to_dialogue_apply_text_normalization", + "TextToDialogueEagerness": ".text_to_dialogue_eagerness", + "TextToDialogueTtsModelId": ".text_to_dialogue_tts_model_id", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "ReceiveTranslateStreamMessage", + "SendTranslateStreamMessage", + "TextToDialogueApplyTextNormalization", + "TextToDialogueEagerness", + "TextToDialogueTtsModelId", +] diff --git a/data/src/elevenlabs/v_1_translation_realtime/types/receive_translate_stream_message.py b/data/src/elevenlabs/v_1_translation_realtime/types/receive_translate_stream_message.py new file mode 100644 index 0000000000000000000000000000000000000000..48e26c1d6254b339fab94d966f80574b64a2ce18 --- /dev/null +++ b/data/src/elevenlabs/v_1_translation_realtime/types/receive_translate_stream_message.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.translate_audio_output_error import TranslateAudioOutputError +from ...types.translate_audio_payload import TranslateAudioPayload +from ...types.translate_auth_error import TranslateAuthError +from ...types.translate_error_payload import TranslateErrorPayload +from ...types.translate_final_transcript_payload import TranslateFinalTranscriptPayload +from ...types.translate_input_error import TranslateInputError +from ...types.translate_partial_transcript_payload import TranslatePartialTranscriptPayload +from ...types.translate_payment_issue_error import TranslatePaymentIssueError +from ...types.translate_queue_overflow_error import TranslateQueueOverflowError +from ...types.translate_quota_exceeded_error import TranslateQuotaExceededError +from ...types.translate_rate_limited_error import TranslateRateLimitedError +from ...types.translate_session_started_payload import TranslateSessionStartedPayload +from ...types.translate_status_payload import TranslateStatusPayload +from ...types.translate_transcriber_error import TranslateTranscriberError +from ...types.translate_translation_error import TranslateTranslationError +from ...types.translate_translation_payload import TranslateTranslationPayload +from ...types.translate_unaccepted_terms_error import TranslateUnacceptedTermsError + +ReceiveTranslateStreamMessage = typing.Union[ + TranslateSessionStartedPayload, + TranslateStatusPayload, + TranslatePartialTranscriptPayload, + TranslateFinalTranscriptPayload, + TranslateTranslationPayload, + TranslateAudioPayload, + TranslateErrorPayload, + TranslateAuthError, + TranslateRateLimitedError, + TranslateQueueOverflowError, + TranslateInputError, + TranslateTranscriberError, + TranslateTranslationError, + TranslateAudioOutputError, + TranslateQuotaExceededError, + TranslatePaymentIssueError, + TranslateUnacceptedTermsError, +] diff --git a/data/src/elevenlabs/v_1_translation_realtime/types/send_translate_stream_message.py b/data/src/elevenlabs/v_1_translation_realtime/types/send_translate_stream_message.py new file mode 100644 index 0000000000000000000000000000000000000000..2189dbbe64e37a0d0e60a882fa5764714689b763 --- /dev/null +++ b/data/src/elevenlabs/v_1_translation_realtime/types/send_translate_stream_message.py @@ -0,0 +1,8 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...types.translate_end_of_stream_payload import TranslateEndOfStreamPayload +from ...types.translate_input_audio_chunk_payload import TranslateInputAudioChunkPayload + +SendTranslateStreamMessage = typing.Union[TranslateInputAudioChunkPayload, TranslateEndOfStreamPayload] diff --git a/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_apply_text_normalization.py b/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_apply_text_normalization.py new file mode 100644 index 0000000000000000000000000000000000000000..abf61c89a276497f04e9a7a460820946ef69216d --- /dev/null +++ b/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_apply_text_normalization.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueApplyTextNormalization = typing.Union[typing.Literal["auto", "on", "off"], typing.Any] diff --git a/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_eagerness.py b/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_eagerness.py new file mode 100644 index 0000000000000000000000000000000000000000..ca755bd53e48d81afc41a5e1c5ec2bc789bab52e --- /dev/null +++ b/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_eagerness.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueEagerness = typing.Union[typing.Literal["low", "medium", "high"], typing.Any] diff --git a/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_tts_model_id.py b/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_tts_model_id.py new file mode 100644 index 0000000000000000000000000000000000000000..60bf8694bcd6d738e6a14b735c2ddaa4ded504a3 --- /dev/null +++ b/data/src/elevenlabs/v_1_translation_realtime/types/text_to_dialogue_tts_model_id.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +TextToDialogueTtsModelId = typing.Union[typing.Literal["eleven_flash_v2_5", "eleven_v3", "eleven_v4_turbo"], typing.Any] diff --git a/data/src/elevenlabs/version.py b/data/src/elevenlabs/version.py new file mode 100644 index 0000000000000000000000000000000000000000..d337e9e228883faf6151b29e75f285814fe0e69a --- /dev/null +++ b/data/src/elevenlabs/version.py @@ -0,0 +1,3 @@ +from importlib import metadata + +__version__ = metadata.version("elevenlabs") diff --git a/data/src/elevenlabs/voices/__init__.py b/data/src/elevenlabs/voices/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9a829751e7025e47c4e304e93f11991f432d71ba --- /dev/null +++ b/data/src/elevenlabs/voices/__init__.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import EditVoiceRequestLabels, VoicesGetSharedRequestCategory, VoicesGetSharedRequestSort + from . import accents, collections, ivc, pvc, samples, settings + from .ivc import AddVoiceRequestLabels +_dynamic_imports: typing.Dict[str, str] = { + "AddVoiceRequestLabels": ".ivc", + "EditVoiceRequestLabels": ".types", + "VoicesGetSharedRequestCategory": ".types", + "VoicesGetSharedRequestSort": ".types", + "accents": ".accents", + "collections": ".collections", + "ivc": ".ivc", + "pvc": ".pvc", + "samples": ".samples", + "settings": ".settings", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AddVoiceRequestLabels", + "EditVoiceRequestLabels", + "VoicesGetSharedRequestCategory", + "VoicesGetSharedRequestSort", + "accents", + "collections", + "ivc", + "pvc", + "samples", + "settings", +] diff --git a/data/src/elevenlabs/voices/accents/__init__.py b/data/src/elevenlabs/voices/accents/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/voices/accents/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/voices/accents/client.py b/data/src/elevenlabs/voices/accents/client.py new file mode 100644 index 0000000000000000000000000000000000000000..d04a6a9aaed3741abe58d4254b868df6022b9c18 --- /dev/null +++ b/data/src/elevenlabs/voices/accents/client.py @@ -0,0 +1,130 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.get_voice_accents_response_model import GetVoiceAccentsResponseModel +from .raw_client import AsyncRawAccentsClient, RawAccentsClient + + +class AccentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAccentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAccentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAccentsClient + """ + return self._raw_client + + def get( + self, + *, + language: typing.Optional[str] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetVoiceAccentsResponseModel: + """ + Gets the list of available accents in the shared voice library. + + Parameters + ---------- + language : typing.Optional[str] + If provided, only accents for this language code are returned. + + model_id : typing.Optional[str] + If provided, returns the accents available for this model. Defaults to the most complete accent list when omitted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetVoiceAccentsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.accents.get( + language="language", + model_id="model_id", + ) + """ + _response = self._raw_client.get(language=language, model_id=model_id, request_options=request_options) + return _response.data + + +class AsyncAccentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAccentsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAccentsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAccentsClient + """ + return self._raw_client + + async def get( + self, + *, + language: typing.Optional[str] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetVoiceAccentsResponseModel: + """ + Gets the list of available accents in the shared voice library. + + Parameters + ---------- + language : typing.Optional[str] + If provided, only accents for this language code are returned. + + model_id : typing.Optional[str] + If provided, returns the accents available for this model. Defaults to the most complete accent list when omitted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetVoiceAccentsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.accents.get( + language="language", + model_id="model_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(language=language, model_id=model_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/voices/accents/raw_client.py b/data/src/elevenlabs/voices/accents/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..225a308763202fcdbbf7e41a65d4eb81c7984c52 --- /dev/null +++ b/data/src/elevenlabs/voices/accents/raw_client.py @@ -0,0 +1,154 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.get_voice_accents_response_model import GetVoiceAccentsResponseModel +from pydantic import ValidationError + + +class RawAccentsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + *, + language: typing.Optional[str] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetVoiceAccentsResponseModel]: + """ + Gets the list of available accents in the shared voice library. + + Parameters + ---------- + language : typing.Optional[str] + If provided, only accents for this language code are returned. + + model_id : typing.Optional[str] + If provided, returns the accents available for this model. Defaults to the most complete accent list when omitted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetVoiceAccentsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/accents", + method="GET", + params={ + "language": language, + "model_id": model_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetVoiceAccentsResponseModel, + construct_type( + type_=GetVoiceAccentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAccentsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + *, + language: typing.Optional[str] = None, + model_id: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetVoiceAccentsResponseModel]: + """ + Gets the list of available accents in the shared voice library. + + Parameters + ---------- + language : typing.Optional[str] + If provided, only accents for this language code are returned. + + model_id : typing.Optional[str] + If provided, returns the accents available for this model. Defaults to the most complete accent list when omitted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetVoiceAccentsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/accents", + method="GET", + params={ + "language": language, + "model_id": model_id, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetVoiceAccentsResponseModel, + construct_type( + type_=GetVoiceAccentsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/client.py b/data/src/elevenlabs/voices/client.py new file mode 100644 index 0000000000000000000000000000000000000000..afaa161781ee08dec9595483fc67ef5b9694c9b0 --- /dev/null +++ b/data/src/elevenlabs/voices/client.py @@ -0,0 +1,1483 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .. import core +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.add_voice_response_model import AddVoiceResponseModel +from ..types.delete_voice_response_model import DeleteVoiceResponseModel +from ..types.edit_voice_response_model import EditVoiceResponseModel +from ..types.get_library_voices_response import GetLibraryVoicesResponse +from ..types.get_voices_response import GetVoicesResponse +from ..types.get_voices_v_2_response import GetVoicesV2Response +from ..types.replicate_voice_to_isolated_environment_response_model import ( + ReplicateVoiceToIsolatedEnvironmentResponseModel, +) +from ..types.voice import Voice +from .raw_client import AsyncRawVoicesClient, RawVoicesClient +from .types.edit_voice_request_labels import EditVoiceRequestLabels +from .types.voices_get_shared_request_category import VoicesGetSharedRequestCategory +from .types.voices_get_shared_request_sort import VoicesGetSharedRequestSort + +if typing.TYPE_CHECKING: + from .accents.client import AccentsClient, AsyncAccentsClient + from .collections.client import AsyncCollectionsClient, CollectionsClient + from .ivc.client import AsyncIvcClient, IvcClient + from .pvc.client import AsyncPvcClient, PvcClient + from .samples.client import AsyncSamplesClient, SamplesClient + from .settings.client import AsyncSettingsClient, SettingsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class VoicesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawVoicesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._collections: typing.Optional[CollectionsClient] = None + self._settings: typing.Optional[SettingsClient] = None + self._accents: typing.Optional[AccentsClient] = None + self._ivc: typing.Optional[IvcClient] = None + self._pvc: typing.Optional[PvcClient] = None + self._samples: typing.Optional[SamplesClient] = None + + @property + def with_raw_response(self) -> RawVoicesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawVoicesClient + """ + return self._raw_client + + def get_all( + self, *, show_legacy: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> GetVoicesResponse: + """ + Returns a list of all available voices for a user. Stops working once the user's workspace exceeds 500 voices. + + Parameters + ---------- + show_legacy : typing.Optional[bool] + If set to true, legacy premade voices will be included in responses from /v1/voices + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetVoicesResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.get_all( + show_legacy=True, + ) + """ + _response = self._raw_client.get_all(show_legacy=show_legacy, request_options=request_options) + return _response.data + + def get( + self, + voice_id: str, + *, + with_settings: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> Voice: + """ + Returns metadata about a specific voice. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + with_settings : typing.Optional[bool] + This parameter is now deprecated. It is ignored and will be removed in a future version. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Voice + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + with_settings=True, + ) + """ + _response = self._raw_client.get(voice_id, with_settings=with_settings, request_options=request_options) + return _response.data + + def delete( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteVoiceResponseModel: + """ + Deletes a voice by its ID. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteVoiceResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.delete(voice_id, request_options=request_options) + return _response.data + + def update( + self, + voice_id: str, + *, + name: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[EditVoiceRequestLabels] = OMIT, + moderate_metadata: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> EditVoiceResponseModel: + """ + Edit a voice created by you. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + description : typing.Optional[str] + A description of the voice. + + labels : typing.Optional[EditVoiceRequestLabels] + Labels for the voice. Keys can be language, accent, gender, or age. + + moderate_metadata : typing.Optional[bool] + Run synchronous LLM moderation over the voice name and description when they change. Has no effect unless the voice_library_metadata_moderation feature flag is enabled for the user. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditVoiceResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + name="name", + ) + """ + _response = self._raw_client.update( + voice_id, + name=name, + files=files, + remove_background_noise=remove_background_noise, + description=description, + labels=labels, + moderate_metadata=moderate_metadata, + request_options=request_options, + ) + return _response.data + + def search( + self, + *, + next_page_token: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + sort: typing.Optional[str] = None, + sort_direction: typing.Optional[str] = None, + voice_type: typing.Optional[str] = None, + category: typing.Optional[str] = None, + fine_tuning_state: typing.Optional[str] = None, + collection_id: typing.Optional[str] = None, + gender: typing.Optional[str] = None, + age: typing.Optional[str] = None, + language: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + accent: typing.Optional[str] = None, + use_cases: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + min_notice_period_days: typing.Optional[int] = None, + include_custom_rates: typing.Optional[bool] = None, + include_live_moderated: typing.Optional[bool] = None, + high_quality: typing.Optional[bool] = None, + include_total_count: typing.Optional[bool] = None, + voice_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetVoicesV2Response: + """ + Gets a list of all available voices for a user with search, filtering and pagination. + + Parameters + ---------- + next_page_token : typing.Optional[str] + The next page token to use for pagination. Returned from the previous request. Use this in combination with the has_more flag for reliable pagination. + + page_size : typing.Optional[int] + How many voices to return at maximum. Can not exceed 100, defaults to 10. Page 0 may include more voices due to default voices being included. + + search : typing.Optional[str] + Search term to filter voices by. Searches in name, description, labels, category. + + sort : typing.Optional[str] + Which field to sort by, one of 'created_at_unix' or 'name'. 'created_at_unix' may not be available for older voices. + + sort_direction : typing.Optional[str] + Which direction to sort the voices in. 'asc' or 'desc'. + + voice_type : typing.Optional[str] + Type of the voice to filter by. One of 'personal', 'community', 'default', 'workspace', 'non-default', 'non-community', 'saved'. 'non-default' is equal to all but 'default'. 'non-community' is equal to 'personal' and 'workspace' combined (excludes library copies). 'saved' is equal to non-default, but includes default voices if they have been added to a collection. + + category : typing.Optional[str] + Category of the voice to filter by. One of 'premade', 'cloned', 'generated', 'professional' + + fine_tuning_state : typing.Optional[str] + State of the voice's fine tuning to filter by. Applicable only to professional voices clones. One of 'draft', 'not_verified', 'not_started', 'queued', 'fine_tuning', 'fine_tuned', 'failed', 'delayed' + + collection_id : typing.Optional[str] + Collection ID to filter voices by. + + gender : typing.Optional[str] + Gender used for filtering, based on the voice's 'gender' label. + + age : typing.Optional[str] + Age used for filtering, based on the voice's 'age' label. + + language : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Languages used for filtering, based on the voice's 'language' label. Voices matching any of the given languages are returned. + + accent : typing.Optional[str] + Accent used for filtering, based on the voice's 'accent' label. + + use_cases : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Use cases used for filtering, based on the voice's 'use_case' label. Voices matching any of the given use cases are returned. + + min_notice_period_days : typing.Optional[int] + Filter to voices whose sharing notice period is at least the given number of days. + + include_custom_rates : typing.Optional[bool] + Whether to include voices that have a custom sharing rate. Defaults to including them. + + include_live_moderated : typing.Optional[bool] + Whether to include voices that have live moderation enabled. Defaults to including them. + + high_quality : typing.Optional[bool] + When true, only return studio-quality voices (those whose category is 'high_quality'). + + include_total_count : typing.Optional[bool] + Whether to include the total count of voices found in the response. NOTE: The total_count value is a live snapshot and may change between requests as users create, modify, or delete voices. For pagination, rely on the has_more flag instead. Only enable this when you actually need the total count (e.g., for display purposes), as it incurs a performance cost. + + voice_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Voice IDs to lookup by. Maximum 100 voice IDs. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetVoicesV2Response + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.search( + next_page_token="next_page_token", + page_size=1, + search="search", + sort="sort", + sort_direction="sort_direction", + voice_type="voice_type", + category="category", + fine_tuning_state="fine_tuning_state", + collection_id="collection_id", + gender="gender", + age="age", + language=["language"], + accent="accent", + use_cases=["use_cases"], + min_notice_period_days=1, + include_custom_rates=True, + include_live_moderated=True, + high_quality=True, + include_total_count=True, + voice_ids=["voice_ids"], + ) + """ + _response = self._raw_client.search( + next_page_token=next_page_token, + page_size=page_size, + search=search, + sort=sort, + sort_direction=sort_direction, + voice_type=voice_type, + category=category, + fine_tuning_state=fine_tuning_state, + collection_id=collection_id, + gender=gender, + age=age, + language=language, + accent=accent, + use_cases=use_cases, + min_notice_period_days=min_notice_period_days, + include_custom_rates=include_custom_rates, + include_live_moderated=include_live_moderated, + high_quality=high_quality, + include_total_count=include_total_count, + voice_ids=voice_ids, + request_options=request_options, + ) + return _response.data + + def replicate_to_isolated_environment( + self, + voice_id: str, + *, + target_workspace_id: str, + preserve_voice_id: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ReplicateVoiceToIsolatedEnvironmentResponseModel: + """ + Replicates an Instant Voice Clone or Voice Design voice to a workspace in a different data residency. The target workspace must belong to the same consolidated billing group. The user must have VOICES_WRITE in the source workspace, and be an admin on the source voice. Human users (i.e. not service accounts) must also have VOICES_WRITE in the target workspace. This endpoint is available on the central environment only. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + target_workspace_id : str + ID of the workspace to replicate the voice into. It must belong to the same consolidated billing group as the calling workspace; the target's data residency is derived from that link. + + preserve_voice_id : typing.Optional[bool] + When true (default) the replicated voice keeps the same voice ID in the target residency; set to false to assign a new voice ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ReplicateVoiceToIsolatedEnvironmentResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.replicate_to_isolated_environment( + voice_id="21m00Tcm4TlvDq8ikWAM", + target_workspace_id="target_workspace_id", + ) + """ + _response = self._raw_client.replicate_to_isolated_environment( + voice_id, + target_workspace_id=target_workspace_id, + preserve_voice_id=preserve_voice_id, + request_options=request_options, + ) + return _response.data + + def share( + self, + public_user_id: str, + voice_id: str, + *, + new_name: str, + bookmarked: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Add a shared voice to your collection of Voices + + Parameters + ---------- + public_user_id : str + Public user ID used to publicly identify ElevenLabs users. + + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + new_name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + bookmarked : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.share( + public_user_id="63e06b7e7cafdc46be4d2e0b3f045940231ae058d508589653d74d1265a574ca", + voice_id="21m00Tcm4TlvDq8ikWAM", + new_name="John Smith", + ) + """ + _response = self._raw_client.share( + public_user_id, voice_id, new_name=new_name, bookmarked=bookmarked, request_options=request_options + ) + return _response.data + + def find_similar_voices( + self, + *, + audio_file: typing.Optional[core.File] = OMIT, + similarity_threshold: typing.Optional[float] = OMIT, + top_k: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetLibraryVoicesResponse: + """ + Returns a list of shared voices similar to the provided audio sample. If neither similarity_threshold nor top_k is provided, we will apply default values. + + Parameters + ---------- + audio_file : typing.Optional[core.File] + See core.File for more documentation + + similarity_threshold : typing.Optional[float] + Threshold for voice similarity between provided sample and library voices. Values range from 0 to 2. The smaller the value the more similar voices will be returned. + + top_k : typing.Optional[int] + Number of most similar voices to return. If similarity_threshold is provided, less than this number of voices may be returned. Values range from 1 to 100. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetLibraryVoicesResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.find_similar_voices() + """ + _response = self._raw_client.find_similar_voices( + audio_file=audio_file, + similarity_threshold=similarity_threshold, + top_k=top_k, + request_options=request_options, + ) + return _response.data + + def get_shared( + self, + *, + page_size: typing.Optional[int] = None, + category: typing.Optional[VoicesGetSharedRequestCategory] = None, + gender: typing.Optional[str] = None, + age: typing.Optional[str] = None, + accent: typing.Optional[str] = None, + language: typing.Optional[str] = None, + locale: typing.Optional[str] = None, + search: typing.Optional[str] = None, + use_cases: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + descriptives: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + featured: typing.Optional[bool] = None, + min_notice_period_days: typing.Optional[int] = None, + include_custom_rates: typing.Optional[bool] = None, + include_live_moderated: typing.Optional[bool] = None, + reader_app_enabled: typing.Optional[bool] = None, + owner_id: typing.Optional[str] = None, + sort: typing.Optional[VoicesGetSharedRequestSort] = None, + page: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetLibraryVoicesResponse: + """ + Retrieves a list of shared voices. + + Parameters + ---------- + page_size : typing.Optional[int] + How many shared voices to return at maximum. Can not exceed 100, defaults to 30. + + category : typing.Optional[VoicesGetSharedRequestCategory] + Voice category used for filtering + + gender : typing.Optional[str] + Gender used for filtering + + age : typing.Optional[str] + Age used for filtering + + accent : typing.Optional[str] + Accent used for filtering + + language : typing.Optional[str] + Language used for filtering + + locale : typing.Optional[str] + Locale used for filtering + + search : typing.Optional[str] + Search term used for filtering + + use_cases : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Use-case used for filtering + + descriptives : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Search term used for filtering + + featured : typing.Optional[bool] + Filter featured voices + + min_notice_period_days : typing.Optional[int] + Filter voices with a minimum notice period of the given number of days. + + include_custom_rates : typing.Optional[bool] + Include/exclude voices with custom rates + + include_live_moderated : typing.Optional[bool] + Include/exclude voices that are live moderated + + reader_app_enabled : typing.Optional[bool] + Filter voices that are enabled for the reader app + + owner_id : typing.Optional[str] + Filter voices by public owner ID + + sort : typing.Optional[VoicesGetSharedRequestSort] + Sort criteria. Must be one of: created_date, usage_character_count_1y, trending, cloned_by_count. + + page : typing.Optional[int] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetLibraryVoicesResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.get_shared( + page_size=1, + category="professional", + gender="gender", + age="age", + accent="accent", + language="language", + locale="locale", + search="search", + use_cases=["use_cases"], + descriptives=["descriptives"], + featured=True, + min_notice_period_days=1, + include_custom_rates=True, + include_live_moderated=True, + reader_app_enabled=True, + owner_id="owner_id", + sort="created_date", + page=1, + ) + """ + _response = self._raw_client.get_shared( + page_size=page_size, + category=category, + gender=gender, + age=age, + accent=accent, + language=language, + locale=locale, + search=search, + use_cases=use_cases, + descriptives=descriptives, + featured=featured, + min_notice_period_days=min_notice_period_days, + include_custom_rates=include_custom_rates, + include_live_moderated=include_live_moderated, + reader_app_enabled=reader_app_enabled, + owner_id=owner_id, + sort=sort, + page=page, + request_options=request_options, + ) + return _response.data + + @property + def collections(self): + if self._collections is None: + from .collections.client import CollectionsClient # noqa: E402 + + self._collections = CollectionsClient(client_wrapper=self._client_wrapper) + return self._collections + + @property + def settings(self): + if self._settings is None: + from .settings.client import SettingsClient # noqa: E402 + + self._settings = SettingsClient(client_wrapper=self._client_wrapper) + return self._settings + + @property + def accents(self): + if self._accents is None: + from .accents.client import AccentsClient # noqa: E402 + + self._accents = AccentsClient(client_wrapper=self._client_wrapper) + return self._accents + + @property + def ivc(self): + if self._ivc is None: + from .ivc.client import IvcClient # noqa: E402 + + self._ivc = IvcClient(client_wrapper=self._client_wrapper) + return self._ivc + + @property + def pvc(self): + if self._pvc is None: + from .pvc.client import PvcClient # noqa: E402 + + self._pvc = PvcClient(client_wrapper=self._client_wrapper) + return self._pvc + + @property + def samples(self): + if self._samples is None: + from .samples.client import SamplesClient # noqa: E402 + + self._samples = SamplesClient(client_wrapper=self._client_wrapper) + return self._samples + + +class AsyncVoicesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawVoicesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._collections: typing.Optional[AsyncCollectionsClient] = None + self._settings: typing.Optional[AsyncSettingsClient] = None + self._accents: typing.Optional[AsyncAccentsClient] = None + self._ivc: typing.Optional[AsyncIvcClient] = None + self._pvc: typing.Optional[AsyncPvcClient] = None + self._samples: typing.Optional[AsyncSamplesClient] = None + + @property + def with_raw_response(self) -> AsyncRawVoicesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawVoicesClient + """ + return self._raw_client + + async def get_all( + self, *, show_legacy: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> GetVoicesResponse: + """ + Returns a list of all available voices for a user. Stops working once the user's workspace exceeds 500 voices. + + Parameters + ---------- + show_legacy : typing.Optional[bool] + If set to true, legacy premade voices will be included in responses from /v1/voices + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetVoicesResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.get_all( + show_legacy=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_all(show_legacy=show_legacy, request_options=request_options) + return _response.data + + async def get( + self, + voice_id: str, + *, + with_settings: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> Voice: + """ + Returns metadata about a specific voice. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + with_settings : typing.Optional[bool] + This parameter is now deprecated. It is ignored and will be removed in a future version. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Voice + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + with_settings=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(voice_id, with_settings=with_settings, request_options=request_options) + return _response.data + + async def delete( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteVoiceResponseModel: + """ + Deletes a voice by its ID. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteVoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(voice_id, request_options=request_options) + return _response.data + + async def update( + self, + voice_id: str, + *, + name: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[EditVoiceRequestLabels] = OMIT, + moderate_metadata: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> EditVoiceResponseModel: + """ + Edit a voice created by you. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + description : typing.Optional[str] + A description of the voice. + + labels : typing.Optional[EditVoiceRequestLabels] + Labels for the voice. Keys can be language, accent, gender, or age. + + moderate_metadata : typing.Optional[bool] + Run synchronous LLM moderation over the voice name and description when they change. Has no effect unless the voice_library_metadata_moderation feature flag is enabled for the user. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditVoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + voice_id, + name=name, + files=files, + remove_background_noise=remove_background_noise, + description=description, + labels=labels, + moderate_metadata=moderate_metadata, + request_options=request_options, + ) + return _response.data + + async def search( + self, + *, + next_page_token: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + sort: typing.Optional[str] = None, + sort_direction: typing.Optional[str] = None, + voice_type: typing.Optional[str] = None, + category: typing.Optional[str] = None, + fine_tuning_state: typing.Optional[str] = None, + collection_id: typing.Optional[str] = None, + gender: typing.Optional[str] = None, + age: typing.Optional[str] = None, + language: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + accent: typing.Optional[str] = None, + use_cases: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + min_notice_period_days: typing.Optional[int] = None, + include_custom_rates: typing.Optional[bool] = None, + include_live_moderated: typing.Optional[bool] = None, + high_quality: typing.Optional[bool] = None, + include_total_count: typing.Optional[bool] = None, + voice_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetVoicesV2Response: + """ + Gets a list of all available voices for a user with search, filtering and pagination. + + Parameters + ---------- + next_page_token : typing.Optional[str] + The next page token to use for pagination. Returned from the previous request. Use this in combination with the has_more flag for reliable pagination. + + page_size : typing.Optional[int] + How many voices to return at maximum. Can not exceed 100, defaults to 10. Page 0 may include more voices due to default voices being included. + + search : typing.Optional[str] + Search term to filter voices by. Searches in name, description, labels, category. + + sort : typing.Optional[str] + Which field to sort by, one of 'created_at_unix' or 'name'. 'created_at_unix' may not be available for older voices. + + sort_direction : typing.Optional[str] + Which direction to sort the voices in. 'asc' or 'desc'. + + voice_type : typing.Optional[str] + Type of the voice to filter by. One of 'personal', 'community', 'default', 'workspace', 'non-default', 'non-community', 'saved'. 'non-default' is equal to all but 'default'. 'non-community' is equal to 'personal' and 'workspace' combined (excludes library copies). 'saved' is equal to non-default, but includes default voices if they have been added to a collection. + + category : typing.Optional[str] + Category of the voice to filter by. One of 'premade', 'cloned', 'generated', 'professional' + + fine_tuning_state : typing.Optional[str] + State of the voice's fine tuning to filter by. Applicable only to professional voices clones. One of 'draft', 'not_verified', 'not_started', 'queued', 'fine_tuning', 'fine_tuned', 'failed', 'delayed' + + collection_id : typing.Optional[str] + Collection ID to filter voices by. + + gender : typing.Optional[str] + Gender used for filtering, based on the voice's 'gender' label. + + age : typing.Optional[str] + Age used for filtering, based on the voice's 'age' label. + + language : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Languages used for filtering, based on the voice's 'language' label. Voices matching any of the given languages are returned. + + accent : typing.Optional[str] + Accent used for filtering, based on the voice's 'accent' label. + + use_cases : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Use cases used for filtering, based on the voice's 'use_case' label. Voices matching any of the given use cases are returned. + + min_notice_period_days : typing.Optional[int] + Filter to voices whose sharing notice period is at least the given number of days. + + include_custom_rates : typing.Optional[bool] + Whether to include voices that have a custom sharing rate. Defaults to including them. + + include_live_moderated : typing.Optional[bool] + Whether to include voices that have live moderation enabled. Defaults to including them. + + high_quality : typing.Optional[bool] + When true, only return studio-quality voices (those whose category is 'high_quality'). + + include_total_count : typing.Optional[bool] + Whether to include the total count of voices found in the response. NOTE: The total_count value is a live snapshot and may change between requests as users create, modify, or delete voices. For pagination, rely on the has_more flag instead. Only enable this when you actually need the total count (e.g., for display purposes), as it incurs a performance cost. + + voice_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Voice IDs to lookup by. Maximum 100 voice IDs. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetVoicesV2Response + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.search( + next_page_token="next_page_token", + page_size=1, + search="search", + sort="sort", + sort_direction="sort_direction", + voice_type="voice_type", + category="category", + fine_tuning_state="fine_tuning_state", + collection_id="collection_id", + gender="gender", + age="age", + language=["language"], + accent="accent", + use_cases=["use_cases"], + min_notice_period_days=1, + include_custom_rates=True, + include_live_moderated=True, + high_quality=True, + include_total_count=True, + voice_ids=["voice_ids"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.search( + next_page_token=next_page_token, + page_size=page_size, + search=search, + sort=sort, + sort_direction=sort_direction, + voice_type=voice_type, + category=category, + fine_tuning_state=fine_tuning_state, + collection_id=collection_id, + gender=gender, + age=age, + language=language, + accent=accent, + use_cases=use_cases, + min_notice_period_days=min_notice_period_days, + include_custom_rates=include_custom_rates, + include_live_moderated=include_live_moderated, + high_quality=high_quality, + include_total_count=include_total_count, + voice_ids=voice_ids, + request_options=request_options, + ) + return _response.data + + async def replicate_to_isolated_environment( + self, + voice_id: str, + *, + target_workspace_id: str, + preserve_voice_id: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ReplicateVoiceToIsolatedEnvironmentResponseModel: + """ + Replicates an Instant Voice Clone or Voice Design voice to a workspace in a different data residency. The target workspace must belong to the same consolidated billing group. The user must have VOICES_WRITE in the source workspace, and be an admin on the source voice. Human users (i.e. not service accounts) must also have VOICES_WRITE in the target workspace. This endpoint is available on the central environment only. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + target_workspace_id : str + ID of the workspace to replicate the voice into. It must belong to the same consolidated billing group as the calling workspace; the target's data residency is derived from that link. + + preserve_voice_id : typing.Optional[bool] + When true (default) the replicated voice keeps the same voice ID in the target residency; set to false to assign a new voice ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ReplicateVoiceToIsolatedEnvironmentResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.replicate_to_isolated_environment( + voice_id="21m00Tcm4TlvDq8ikWAM", + target_workspace_id="target_workspace_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.replicate_to_isolated_environment( + voice_id, + target_workspace_id=target_workspace_id, + preserve_voice_id=preserve_voice_id, + request_options=request_options, + ) + return _response.data + + async def share( + self, + public_user_id: str, + voice_id: str, + *, + new_name: str, + bookmarked: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Add a shared voice to your collection of Voices + + Parameters + ---------- + public_user_id : str + Public user ID used to publicly identify ElevenLabs users. + + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + new_name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + bookmarked : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.share( + public_user_id="63e06b7e7cafdc46be4d2e0b3f045940231ae058d508589653d74d1265a574ca", + voice_id="21m00Tcm4TlvDq8ikWAM", + new_name="John Smith", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.share( + public_user_id, voice_id, new_name=new_name, bookmarked=bookmarked, request_options=request_options + ) + return _response.data + + async def find_similar_voices( + self, + *, + audio_file: typing.Optional[core.File] = OMIT, + similarity_threshold: typing.Optional[float] = OMIT, + top_k: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetLibraryVoicesResponse: + """ + Returns a list of shared voices similar to the provided audio sample. If neither similarity_threshold nor top_k is provided, we will apply default values. + + Parameters + ---------- + audio_file : typing.Optional[core.File] + See core.File for more documentation + + similarity_threshold : typing.Optional[float] + Threshold for voice similarity between provided sample and library voices. Values range from 0 to 2. The smaller the value the more similar voices will be returned. + + top_k : typing.Optional[int] + Number of most similar voices to return. If similarity_threshold is provided, less than this number of voices may be returned. Values range from 1 to 100. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetLibraryVoicesResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.find_similar_voices() + + + asyncio.run(main()) + """ + _response = await self._raw_client.find_similar_voices( + audio_file=audio_file, + similarity_threshold=similarity_threshold, + top_k=top_k, + request_options=request_options, + ) + return _response.data + + async def get_shared( + self, + *, + page_size: typing.Optional[int] = None, + category: typing.Optional[VoicesGetSharedRequestCategory] = None, + gender: typing.Optional[str] = None, + age: typing.Optional[str] = None, + accent: typing.Optional[str] = None, + language: typing.Optional[str] = None, + locale: typing.Optional[str] = None, + search: typing.Optional[str] = None, + use_cases: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + descriptives: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + featured: typing.Optional[bool] = None, + min_notice_period_days: typing.Optional[int] = None, + include_custom_rates: typing.Optional[bool] = None, + include_live_moderated: typing.Optional[bool] = None, + reader_app_enabled: typing.Optional[bool] = None, + owner_id: typing.Optional[str] = None, + sort: typing.Optional[VoicesGetSharedRequestSort] = None, + page: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> GetLibraryVoicesResponse: + """ + Retrieves a list of shared voices. + + Parameters + ---------- + page_size : typing.Optional[int] + How many shared voices to return at maximum. Can not exceed 100, defaults to 30. + + category : typing.Optional[VoicesGetSharedRequestCategory] + Voice category used for filtering + + gender : typing.Optional[str] + Gender used for filtering + + age : typing.Optional[str] + Age used for filtering + + accent : typing.Optional[str] + Accent used for filtering + + language : typing.Optional[str] + Language used for filtering + + locale : typing.Optional[str] + Locale used for filtering + + search : typing.Optional[str] + Search term used for filtering + + use_cases : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Use-case used for filtering + + descriptives : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Search term used for filtering + + featured : typing.Optional[bool] + Filter featured voices + + min_notice_period_days : typing.Optional[int] + Filter voices with a minimum notice period of the given number of days. + + include_custom_rates : typing.Optional[bool] + Include/exclude voices with custom rates + + include_live_moderated : typing.Optional[bool] + Include/exclude voices that are live moderated + + reader_app_enabled : typing.Optional[bool] + Filter voices that are enabled for the reader app + + owner_id : typing.Optional[str] + Filter voices by public owner ID + + sort : typing.Optional[VoicesGetSharedRequestSort] + Sort criteria. Must be one of: created_date, usage_character_count_1y, trending, cloned_by_count. + + page : typing.Optional[int] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetLibraryVoicesResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.get_shared( + page_size=1, + category="professional", + gender="gender", + age="age", + accent="accent", + language="language", + locale="locale", + search="search", + use_cases=["use_cases"], + descriptives=["descriptives"], + featured=True, + min_notice_period_days=1, + include_custom_rates=True, + include_live_moderated=True, + reader_app_enabled=True, + owner_id="owner_id", + sort="created_date", + page=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_shared( + page_size=page_size, + category=category, + gender=gender, + age=age, + accent=accent, + language=language, + locale=locale, + search=search, + use_cases=use_cases, + descriptives=descriptives, + featured=featured, + min_notice_period_days=min_notice_period_days, + include_custom_rates=include_custom_rates, + include_live_moderated=include_live_moderated, + reader_app_enabled=reader_app_enabled, + owner_id=owner_id, + sort=sort, + page=page, + request_options=request_options, + ) + return _response.data + + @property + def collections(self): + if self._collections is None: + from .collections.client import AsyncCollectionsClient # noqa: E402 + + self._collections = AsyncCollectionsClient(client_wrapper=self._client_wrapper) + return self._collections + + @property + def settings(self): + if self._settings is None: + from .settings.client import AsyncSettingsClient # noqa: E402 + + self._settings = AsyncSettingsClient(client_wrapper=self._client_wrapper) + return self._settings + + @property + def accents(self): + if self._accents is None: + from .accents.client import AsyncAccentsClient # noqa: E402 + + self._accents = AsyncAccentsClient(client_wrapper=self._client_wrapper) + return self._accents + + @property + def ivc(self): + if self._ivc is None: + from .ivc.client import AsyncIvcClient # noqa: E402 + + self._ivc = AsyncIvcClient(client_wrapper=self._client_wrapper) + return self._ivc + + @property + def pvc(self): + if self._pvc is None: + from .pvc.client import AsyncPvcClient # noqa: E402 + + self._pvc = AsyncPvcClient(client_wrapper=self._client_wrapper) + return self._pvc + + @property + def samples(self): + if self._samples is None: + from .samples.client import AsyncSamplesClient # noqa: E402 + + self._samples = AsyncSamplesClient(client_wrapper=self._client_wrapper) + return self._samples diff --git a/data/src/elevenlabs/voices/collections/__init__.py b/data/src/elevenlabs/voices/collections/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/voices/collections/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/voices/collections/client.py b/data/src/elevenlabs/voices/collections/client.py new file mode 100644 index 0000000000000000000000000000000000000000..aa8950b6f2542fca386f00d8953ed9b079611ae3 --- /dev/null +++ b/data/src/elevenlabs/voices/collections/client.py @@ -0,0 +1,603 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.add_voice_to_user_voice_collection_response_model import AddVoiceToUserVoiceCollectionResponseModel +from ...types.delete_user_voice_collection_response_model import DeleteUserVoiceCollectionResponseModel +from ...types.get_user_voice_collections_response_model import GetUserVoiceCollectionsResponseModel +from ...types.remove_voice_from_user_voice_collection_response_model import ( + RemoveVoiceFromUserVoiceCollectionResponseModel, +) +from ...types.user_voice_collection_response_model import UserVoiceCollectionResponseModel +from .raw_client import AsyncRawCollectionsClient, RawCollectionsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class CollectionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawCollectionsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawCollectionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawCollectionsClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> GetUserVoiceCollectionsResponseModel: + """ + Returns all the voice collections the user has access to, sorted by title. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetUserVoiceCollectionsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.collections.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def create( + self, *, title: str, icon: str, request_options: typing.Optional[RequestOptions] = None + ) -> UserVoiceCollectionResponseModel: + """ + Creates a new voice collection. The caller becomes its admin. + + Parameters + ---------- + title : str + Title of the collection to create/update. + + icon : str + Icon of the collection to create/update. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.collections.create( + title="title", + icon="icon", + ) + """ + _response = self._raw_client.create(title=title, icon=icon, request_options=request_options) + return _response.data + + def get( + self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> UserVoiceCollectionResponseModel: + """ + Returns a voice collection the user has access to. + + Parameters + ---------- + collection_id : str + Collection ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.collections.get( + collection_id="collection_id", + ) + """ + _response = self._raw_client.get(collection_id, request_options=request_options) + return _response.data + + def delete( + self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteUserVoiceCollectionResponseModel: + """ + Deletes a voice collection. The voices in it are not deleted. Requires admin access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteUserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.collections.delete( + collection_id="collection_id", + ) + """ + _response = self._raw_client.delete(collection_id, request_options=request_options) + return _response.data + + def update( + self, + collection_id: str, + *, + title: typing.Optional[str] = OMIT, + icon: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserVoiceCollectionResponseModel: + """ + Updates the title and icon of a voice collection. Fields that are omitted are left unchanged. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + title : typing.Optional[str] + Title of the collection to create/update. + + icon : typing.Optional[str] + Icon of the collection to create/update. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.collections.update( + collection_id="collection_id", + ) + """ + _response = self._raw_client.update(collection_id, title=title, icon=icon, request_options=request_options) + return _response.data + + def add_voice( + self, collection_id: str, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AddVoiceToUserVoiceCollectionResponseModel: + """ + Adds a voice to a voice collection. Adding a voice that is already in the collection succeeds without changes. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceToUserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.collections.add_voice( + collection_id="collection_id", + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.add_voice(collection_id, voice_id, request_options=request_options) + return _response.data + + def remove_voice( + self, collection_id: str, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> RemoveVoiceFromUserVoiceCollectionResponseModel: + """ + Removes a voice from a voice collection. The voice itself is not deleted. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RemoveVoiceFromUserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.collections.remove_voice( + collection_id="collection_id", + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.remove_voice(collection_id, voice_id, request_options=request_options) + return _response.data + + +class AsyncCollectionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawCollectionsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawCollectionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawCollectionsClient + """ + return self._raw_client + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> GetUserVoiceCollectionsResponseModel: + """ + Returns all the voice collections the user has access to, sorted by title. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetUserVoiceCollectionsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.collections.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, *, title: str, icon: str, request_options: typing.Optional[RequestOptions] = None + ) -> UserVoiceCollectionResponseModel: + """ + Creates a new voice collection. The caller becomes its admin. + + Parameters + ---------- + title : str + Title of the collection to create/update. + + icon : str + Icon of the collection to create/update. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.collections.create( + title="title", + icon="icon", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(title=title, icon=icon, request_options=request_options) + return _response.data + + async def get( + self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> UserVoiceCollectionResponseModel: + """ + Returns a voice collection the user has access to. + + Parameters + ---------- + collection_id : str + Collection ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.collections.get( + collection_id="collection_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(collection_id, request_options=request_options) + return _response.data + + async def delete( + self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteUserVoiceCollectionResponseModel: + """ + Deletes a voice collection. The voices in it are not deleted. Requires admin access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteUserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.collections.delete( + collection_id="collection_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(collection_id, request_options=request_options) + return _response.data + + async def update( + self, + collection_id: str, + *, + title: typing.Optional[str] = OMIT, + icon: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UserVoiceCollectionResponseModel: + """ + Updates the title and icon of a voice collection. Fields that are omitted are left unchanged. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + title : typing.Optional[str] + Title of the collection to create/update. + + icon : typing.Optional[str] + Icon of the collection to create/update. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.collections.update( + collection_id="collection_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + collection_id, title=title, icon=icon, request_options=request_options + ) + return _response.data + + async def add_voice( + self, collection_id: str, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AddVoiceToUserVoiceCollectionResponseModel: + """ + Adds a voice to a voice collection. Adding a voice that is already in the collection succeeds without changes. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceToUserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.collections.add_voice( + collection_id="collection_id", + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add_voice(collection_id, voice_id, request_options=request_options) + return _response.data + + async def remove_voice( + self, collection_id: str, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> RemoveVoiceFromUserVoiceCollectionResponseModel: + """ + Removes a voice from a voice collection. The voice itself is not deleted. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RemoveVoiceFromUserVoiceCollectionResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.collections.remove_voice( + collection_id="collection_id", + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.remove_voice(collection_id, voice_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/voices/collections/raw_client.py b/data/src/elevenlabs/voices/collections/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c88a8fdbf6315057fb9f91095775685afaad09b2 --- /dev/null +++ b/data/src/elevenlabs/voices/collections/raw_client.py @@ -0,0 +1,856 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.add_voice_to_user_voice_collection_response_model import AddVoiceToUserVoiceCollectionResponseModel +from ...types.delete_user_voice_collection_response_model import DeleteUserVoiceCollectionResponseModel +from ...types.get_user_voice_collections_response_model import GetUserVoiceCollectionsResponseModel +from ...types.remove_voice_from_user_voice_collection_response_model import ( + RemoveVoiceFromUserVoiceCollectionResponseModel, +) +from ...types.user_voice_collection_response_model import UserVoiceCollectionResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawCollectionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetUserVoiceCollectionsResponseModel]: + """ + Returns all the voice collections the user has access to, sorted by title. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetUserVoiceCollectionsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/collections", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetUserVoiceCollectionsResponseModel, + construct_type( + type_=GetUserVoiceCollectionsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, title: str, icon: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[UserVoiceCollectionResponseModel]: + """ + Creates a new voice collection. The caller becomes its admin. + + Parameters + ---------- + title : str + Title of the collection to create/update. + + icon : str + Icon of the collection to create/update. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserVoiceCollectionResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/collections", + method="POST", + json={ + "title": title, + "icon": icon, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserVoiceCollectionResponseModel, + construct_type( + type_=UserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[UserVoiceCollectionResponseModel]: + """ + Returns a voice collection the user has access to. + + Parameters + ---------- + collection_id : str + Collection ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserVoiceCollectionResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserVoiceCollectionResponseModel, + construct_type( + type_=UserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteUserVoiceCollectionResponseModel]: + """ + Deletes a voice collection. The voices in it are not deleted. Requires admin access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteUserVoiceCollectionResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteUserVoiceCollectionResponseModel, + construct_type( + type_=DeleteUserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + collection_id: str, + *, + title: typing.Optional[str] = OMIT, + icon: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UserVoiceCollectionResponseModel]: + """ + Updates the title and icon of a voice collection. Fields that are omitted are left unchanged. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + title : typing.Optional[str] + Title of the collection to create/update. + + icon : typing.Optional[str] + Icon of the collection to create/update. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UserVoiceCollectionResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}", + method="PATCH", + json={ + "title": title, + "icon": icon, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserVoiceCollectionResponseModel, + construct_type( + type_=UserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def add_voice( + self, collection_id: str, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AddVoiceToUserVoiceCollectionResponseModel]: + """ + Adds a voice to a voice collection. Adding a voice that is already in the collection succeeds without changes. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddVoiceToUserVoiceCollectionResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}/voice/{jsonable_encoder(voice_id)}", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceToUserVoiceCollectionResponseModel, + construct_type( + type_=AddVoiceToUserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def remove_voice( + self, collection_id: str, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[RemoveVoiceFromUserVoiceCollectionResponseModel]: + """ + Removes a voice from a voice collection. The voice itself is not deleted. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[RemoveVoiceFromUserVoiceCollectionResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}/voice/{jsonable_encoder(voice_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RemoveVoiceFromUserVoiceCollectionResponseModel, + construct_type( + type_=RemoveVoiceFromUserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawCollectionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetUserVoiceCollectionsResponseModel]: + """ + Returns all the voice collections the user has access to, sorted by title. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetUserVoiceCollectionsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/collections", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetUserVoiceCollectionsResponseModel, + construct_type( + type_=GetUserVoiceCollectionsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, title: str, icon: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[UserVoiceCollectionResponseModel]: + """ + Creates a new voice collection. The caller becomes its admin. + + Parameters + ---------- + title : str + Title of the collection to create/update. + + icon : str + Icon of the collection to create/update. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserVoiceCollectionResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/collections", + method="POST", + json={ + "title": title, + "icon": icon, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserVoiceCollectionResponseModel, + construct_type( + type_=UserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[UserVoiceCollectionResponseModel]: + """ + Returns a voice collection the user has access to. + + Parameters + ---------- + collection_id : str + Collection ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserVoiceCollectionResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserVoiceCollectionResponseModel, + construct_type( + type_=UserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, collection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteUserVoiceCollectionResponseModel]: + """ + Deletes a voice collection. The voices in it are not deleted. Requires admin access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteUserVoiceCollectionResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteUserVoiceCollectionResponseModel, + construct_type( + type_=DeleteUserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + collection_id: str, + *, + title: typing.Optional[str] = OMIT, + icon: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UserVoiceCollectionResponseModel]: + """ + Updates the title and icon of a voice collection. Fields that are omitted are left unchanged. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + title : typing.Optional[str] + Title of the collection to create/update. + + icon : typing.Optional[str] + Icon of the collection to create/update. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UserVoiceCollectionResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}", + method="PATCH", + json={ + "title": title, + "icon": icon, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UserVoiceCollectionResponseModel, + construct_type( + type_=UserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def add_voice( + self, collection_id: str, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AddVoiceToUserVoiceCollectionResponseModel]: + """ + Adds a voice to a voice collection. Adding a voice that is already in the collection succeeds without changes. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddVoiceToUserVoiceCollectionResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}/voice/{jsonable_encoder(voice_id)}", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceToUserVoiceCollectionResponseModel, + construct_type( + type_=AddVoiceToUserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def remove_voice( + self, collection_id: str, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[RemoveVoiceFromUserVoiceCollectionResponseModel]: + """ + Removes a voice from a voice collection. The voice itself is not deleted. Requires editor access to the collection. + + Parameters + ---------- + collection_id : str + Collection ID. + + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RemoveVoiceFromUserVoiceCollectionResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/collections/{jsonable_encoder(collection_id)}/voice/{jsonable_encoder(voice_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RemoveVoiceFromUserVoiceCollectionResponseModel, + construct_type( + type_=RemoveVoiceFromUserVoiceCollectionResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/ivc/__init__.py b/data/src/elevenlabs/voices/ivc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ec1efb4266d818e85204632f56e0a932849973fa --- /dev/null +++ b/data/src/elevenlabs/voices/ivc/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import AddVoiceRequestLabels +_dynamic_imports: typing.Dict[str, str] = {"AddVoiceRequestLabels": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["AddVoiceRequestLabels"] diff --git a/data/src/elevenlabs/voices/ivc/client.py b/data/src/elevenlabs/voices/ivc/client.py new file mode 100644 index 0000000000000000000000000000000000000000..6c1b56e94fa3dfc80857f2934d2ecbe6c075442c --- /dev/null +++ b/data/src/elevenlabs/voices/ivc/client.py @@ -0,0 +1,171 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ... import core +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.add_voice_ivc_response_model import AddVoiceIvcResponseModel +from .raw_client import AsyncRawIvcClient, RawIvcClient +from .types.add_voice_request_labels import AddVoiceRequestLabels + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class IvcClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawIvcClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawIvcClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawIvcClient + """ + return self._raw_client + + def create( + self, + *, + name: str, + files: typing.List[core.File], + remove_background_noise: typing.Optional[bool] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[AddVoiceRequestLabels] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceIvcResponseModel: + """ + Create a voice clone and add it to your Voices + + Parameters + ---------- + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + files : typing.List[core.File] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + description : typing.Optional[str] + A description of the voice. + + labels : typing.Optional[AddVoiceRequestLabels] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceIvcResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.ivc.create( + name="name", + ) + """ + _response = self._raw_client.create( + name=name, + files=files, + remove_background_noise=remove_background_noise, + description=description, + labels=labels, + request_options=request_options, + ) + return _response.data + + +class AsyncIvcClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawIvcClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawIvcClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawIvcClient + """ + return self._raw_client + + async def create( + self, + *, + name: str, + files: typing.List[core.File], + remove_background_noise: typing.Optional[bool] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[AddVoiceRequestLabels] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceIvcResponseModel: + """ + Create a voice clone and add it to your Voices + + Parameters + ---------- + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + files : typing.List[core.File] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + description : typing.Optional[str] + A description of the voice. + + labels : typing.Optional[AddVoiceRequestLabels] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceIvcResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.ivc.create( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + name=name, + files=files, + remove_background_noise=remove_background_noise, + description=description, + labels=labels, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/voices/ivc/raw_client.py b/data/src/elevenlabs/voices/ivc/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..fec015dd7457d55af84e2dc68f344013cd65b258 --- /dev/null +++ b/data/src/elevenlabs/voices/ivc/raw_client.py @@ -0,0 +1,199 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +import typing +from json.decoder import JSONDecodeError + +from ... import core +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.add_voice_ivc_response_model import AddVoiceIvcResponseModel +from .types.add_voice_request_labels import AddVoiceRequestLabels +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawIvcClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + name: str, + files: typing.List[core.File], + remove_background_noise: typing.Optional[bool] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[AddVoiceRequestLabels] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddVoiceIvcResponseModel]: + """ + Create a voice clone and add it to your Voices + + Parameters + ---------- + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + files : typing.List[core.File] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + description : typing.Optional[str] + A description of the voice. + + labels : typing.Optional[AddVoiceRequestLabels] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddVoiceIvcResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/add", + method="POST", + data={ + "name": name, + "remove_background_noise": remove_background_noise, + "description": description, + "labels": json.dumps(jsonable_encoder(labels)), + }, + files={ + "files": files, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceIvcResponseModel, + construct_type( + type_=AddVoiceIvcResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawIvcClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + name: str, + files: typing.List[core.File], + remove_background_noise: typing.Optional[bool] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[AddVoiceRequestLabels] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddVoiceIvcResponseModel]: + """ + Create a voice clone and add it to your Voices + + Parameters + ---------- + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + files : typing.List[core.File] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + description : typing.Optional[str] + A description of the voice. + + labels : typing.Optional[AddVoiceRequestLabels] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddVoiceIvcResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/add", + method="POST", + data={ + "name": name, + "remove_background_noise": remove_background_noise, + "description": description, + "labels": json.dumps(jsonable_encoder(labels)), + }, + files={ + "files": files, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceIvcResponseModel, + construct_type( + type_=AddVoiceIvcResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/ivc/types/__init__.py b/data/src/elevenlabs/voices/ivc/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4949f8b65d236899132a2f753f3fb02bb5aa7e01 --- /dev/null +++ b/data/src/elevenlabs/voices/ivc/types/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .add_voice_request_labels import AddVoiceRequestLabels +_dynamic_imports: typing.Dict[str, str] = {"AddVoiceRequestLabels": ".add_voice_request_labels"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["AddVoiceRequestLabels"] diff --git a/data/src/elevenlabs/voices/ivc/types/add_voice_request_labels.py b/data/src/elevenlabs/voices/ivc/types/add_voice_request_labels.py new file mode 100644 index 0000000000000000000000000000000000000000..07bb9fa6039b48053df0c451aab07c097795543a --- /dev/null +++ b/data/src/elevenlabs/voices/ivc/types/add_voice_request_labels.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +AddVoiceRequestLabels = typing.Union[typing.Dict[str, str], str] diff --git a/data/src/elevenlabs/voices/pvc/__init__.py b/data/src/elevenlabs/voices/pvc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2c889c3fc33ecc3f855ea52f695a64e6a086e8d1 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import samples, verification +_dynamic_imports: typing.Dict[str, str] = {"samples": ".samples", "verification": ".verification"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["samples", "verification"] diff --git a/data/src/elevenlabs/voices/pvc/client.py b/data/src/elevenlabs/voices/pvc/client.py new file mode 100644 index 0000000000000000000000000000000000000000..626c0b7c5ac0aa4d39375100bf242fa127e7b02f --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/client.py @@ -0,0 +1,411 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.add_voice_response_model import AddVoiceResponseModel +from ...types.start_pvc_voice_training_response_model import StartPvcVoiceTrainingResponseModel +from .raw_client import AsyncRawPvcClient, RawPvcClient + +if typing.TYPE_CHECKING: + from .samples.client import AsyncSamplesClient, SamplesClient + from .verification.client import AsyncVerificationClient, VerificationClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class PvcClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawPvcClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._samples: typing.Optional[SamplesClient] = None + self._verification: typing.Optional[VerificationClient] = None + + @property + def with_raw_response(self) -> RawPvcClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawPvcClient + """ + return self._raw_client + + def create( + self, + *, + name: str, + language: str, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Creates a new PVC voice with metadata but no samples + + Parameters + ---------- + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + language : str + Language used in the samples. + + description : typing.Optional[str] + Description to use for the created voice. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.create( + name="John Smith", + language="en", + ) + """ + _response = self._raw_client.create( + name=name, language=language, description=description, labels=labels, request_options=request_options + ) + return _response.data + + def update( + self, + voice_id: str, + *, + name: typing.Optional[str] = OMIT, + language: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Edit PVC voice metadata + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + name : typing.Optional[str] + The name that identifies this voice. This will be displayed in the dropdown of the website. + + language : typing.Optional[str] + Language used in the samples. + + description : typing.Optional[str] + Description to use for the created voice. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.update( + voice_id, + name=name, + language=language, + description=description, + labels=labels, + request_options=request_options, + ) + return _response.data + + def train( + self, + voice_id: str, + *, + model_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> StartPvcVoiceTrainingResponseModel: + """ + Start PVC training process for a voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + model_id : typing.Optional[str] + The model ID to use for the conversion. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + StartPvcVoiceTrainingResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.train( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.train(voice_id, model_id=model_id, request_options=request_options) + return _response.data + + @property + def samples(self): + if self._samples is None: + from .samples.client import SamplesClient # noqa: E402 + + self._samples = SamplesClient(client_wrapper=self._client_wrapper) + return self._samples + + @property + def verification(self): + if self._verification is None: + from .verification.client import VerificationClient # noqa: E402 + + self._verification = VerificationClient(client_wrapper=self._client_wrapper) + return self._verification + + +class AsyncPvcClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawPvcClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._samples: typing.Optional[AsyncSamplesClient] = None + self._verification: typing.Optional[AsyncVerificationClient] = None + + @property + def with_raw_response(self) -> AsyncRawPvcClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawPvcClient + """ + return self._raw_client + + async def create( + self, + *, + name: str, + language: str, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Creates a new PVC voice with metadata but no samples + + Parameters + ---------- + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + language : str + Language used in the samples. + + description : typing.Optional[str] + Description to use for the created voice. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.create( + name="John Smith", + language="en", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + name=name, language=language, description=description, labels=labels, request_options=request_options + ) + return _response.data + + async def update( + self, + voice_id: str, + *, + name: typing.Optional[str] = OMIT, + language: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Edit PVC voice metadata + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + name : typing.Optional[str] + The name that identifies this voice. This will be displayed in the dropdown of the website. + + language : typing.Optional[str] + Language used in the samples. + + description : typing.Optional[str] + Description to use for the created voice. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + voice_id, + name=name, + language=language, + description=description, + labels=labels, + request_options=request_options, + ) + return _response.data + + async def train( + self, + voice_id: str, + *, + model_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> StartPvcVoiceTrainingResponseModel: + """ + Start PVC training process for a voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + model_id : typing.Optional[str] + The model ID to use for the conversion. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + StartPvcVoiceTrainingResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.train( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.train(voice_id, model_id=model_id, request_options=request_options) + return _response.data + + @property + def samples(self): + if self._samples is None: + from .samples.client import AsyncSamplesClient # noqa: E402 + + self._samples = AsyncSamplesClient(client_wrapper=self._client_wrapper) + return self._samples + + @property + def verification(self): + if self._verification is None: + from .verification.client import AsyncVerificationClient # noqa: E402 + + self._verification = AsyncVerificationClient(client_wrapper=self._client_wrapper) + return self._verification diff --git a/data/src/elevenlabs/voices/pvc/raw_client.py b/data/src/elevenlabs/voices/pvc/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8de7624ab25a6ca4ec1bb0d10b0427ad286b10ff --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/raw_client.py @@ -0,0 +1,489 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.add_voice_response_model import AddVoiceResponseModel +from ...types.start_pvc_voice_training_response_model import StartPvcVoiceTrainingResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawPvcClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + name: str, + language: str, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddVoiceResponseModel]: + """ + Creates a new PVC voice with metadata but no samples + + Parameters + ---------- + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + language : str + Language used in the samples. + + description : typing.Optional[str] + Description to use for the created voice. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddVoiceResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/pvc", + method="POST", + json={ + "name": name, + "language": language, + "description": description, + "labels": labels, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceResponseModel, + construct_type( + type_=AddVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + voice_id: str, + *, + name: typing.Optional[str] = OMIT, + language: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddVoiceResponseModel]: + """ + Edit PVC voice metadata + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + name : typing.Optional[str] + The name that identifies this voice. This will be displayed in the dropdown of the website. + + language : typing.Optional[str] + Language used in the samples. + + description : typing.Optional[str] + Description to use for the created voice. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddVoiceResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}", + method="POST", + json={ + "name": name, + "language": language, + "description": description, + "labels": labels, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceResponseModel, + construct_type( + type_=AddVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def train( + self, + voice_id: str, + *, + model_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[StartPvcVoiceTrainingResponseModel]: + """ + Start PVC training process for a voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + model_id : typing.Optional[str] + The model ID to use for the conversion. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[StartPvcVoiceTrainingResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/train", + method="POST", + json={ + "model_id": model_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + StartPvcVoiceTrainingResponseModel, + construct_type( + type_=StartPvcVoiceTrainingResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawPvcClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + name: str, + language: str, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddVoiceResponseModel]: + """ + Creates a new PVC voice with metadata but no samples + + Parameters + ---------- + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + language : str + Language used in the samples. + + description : typing.Optional[str] + Description to use for the created voice. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddVoiceResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/pvc", + method="POST", + json={ + "name": name, + "language": language, + "description": description, + "labels": labels, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceResponseModel, + construct_type( + type_=AddVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + voice_id: str, + *, + name: typing.Optional[str] = OMIT, + language: typing.Optional[str] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddVoiceResponseModel]: + """ + Edit PVC voice metadata + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + name : typing.Optional[str] + The name that identifies this voice. This will be displayed in the dropdown of the website. + + language : typing.Optional[str] + Language used in the samples. + + description : typing.Optional[str] + Description to use for the created voice. + + labels : typing.Optional[typing.Dict[str, typing.Optional[str]]] + Labels for the voice. Keys can be language, accent, gender, or age. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddVoiceResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}", + method="POST", + json={ + "name": name, + "language": language, + "description": description, + "labels": labels, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceResponseModel, + construct_type( + type_=AddVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def train( + self, + voice_id: str, + *, + model_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[StartPvcVoiceTrainingResponseModel]: + """ + Start PVC training process for a voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + model_id : typing.Optional[str] + The model ID to use for the conversion. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[StartPvcVoiceTrainingResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/train", + method="POST", + json={ + "model_id": model_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + StartPvcVoiceTrainingResponseModel, + construct_type( + type_=StartPvcVoiceTrainingResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/pvc/samples/__init__.py b/data/src/elevenlabs/voices/pvc/samples/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..865981c91ccd3e6059c7b47d02b1d4e32f471a20 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import audio, speakers, waveform +_dynamic_imports: typing.Dict[str, str] = {"audio": ".audio", "speakers": ".speakers", "waveform": ".waveform"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["audio", "speakers", "waveform"] diff --git a/data/src/elevenlabs/voices/pvc/samples/audio/__init__.py b/data/src/elevenlabs/voices/pvc/samples/audio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/audio/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/voices/pvc/samples/audio/client.py b/data/src/elevenlabs/voices/pvc/samples/audio/client.py new file mode 100644 index 0000000000000000000000000000000000000000..d13f9371ba4e2a5951069ec4ae2d5934690656a7 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/audio/client.py @@ -0,0 +1,144 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.voice_sample_preview_response_model import VoiceSamplePreviewResponseModel +from .raw_client import AsyncRawAudioClient, RawAudioClient + + +class AudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAudioClient + """ + return self._raw_client + + def get( + self, + voice_id: str, + sample_id: str, + *, + remove_background_noise: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceSamplePreviewResponseModel: + """ + Retrieve the first 30 seconds of voice sample audio with or without noise removal. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceSamplePreviewResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.samples.audio.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + remove_background_noise=True, + ) + """ + _response = self._raw_client.get( + voice_id, sample_id, remove_background_noise=remove_background_noise, request_options=request_options + ) + return _response.data + + +class AsyncAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAudioClient + """ + return self._raw_client + + async def get( + self, + voice_id: str, + sample_id: str, + *, + remove_background_noise: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> VoiceSamplePreviewResponseModel: + """ + Retrieve the first 30 seconds of voice sample audio with or without noise removal. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceSamplePreviewResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.samples.audio.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + remove_background_noise=True, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + voice_id, sample_id, remove_background_noise=remove_background_noise, request_options=request_options + ) + return _response.data diff --git a/data/src/elevenlabs/voices/pvc/samples/audio/raw_client.py b/data/src/elevenlabs/voices/pvc/samples/audio/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..51a572ff4bffa70bebbce81184aabafd3016d9c1 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/audio/raw_client.py @@ -0,0 +1,161 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.voice_sample_preview_response_model import VoiceSamplePreviewResponseModel +from pydantic import ValidationError + + +class RawAudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + voice_id: str, + sample_id: str, + *, + remove_background_noise: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[VoiceSamplePreviewResponseModel]: + """ + Retrieve the first 30 seconds of voice sample audio with or without noise removal. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[VoiceSamplePreviewResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/audio", + method="GET", + params={ + "remove_background_noise": remove_background_noise, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceSamplePreviewResponseModel, + construct_type( + type_=VoiceSamplePreviewResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + voice_id: str, + sample_id: str, + *, + remove_background_noise: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[VoiceSamplePreviewResponseModel]: + """ + Retrieve the first 30 seconds of voice sample audio with or without noise removal. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[VoiceSamplePreviewResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/audio", + method="GET", + params={ + "remove_background_noise": remove_background_noise, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceSamplePreviewResponseModel, + construct_type( + type_=VoiceSamplePreviewResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/pvc/samples/client.py b/data/src/elevenlabs/voices/pvc/samples/client.py new file mode 100644 index 0000000000000000000000000000000000000000..79d6b72513b9d5a823d9cc8f1cff9a7d64e4a0a1 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/client.py @@ -0,0 +1,438 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .... import core +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.add_voice_response_model import AddVoiceResponseModel +from ....types.delete_voice_sample_response_model import DeleteVoiceSampleResponseModel +from ....types.voice_sample import VoiceSample +from .raw_client import AsyncRawSamplesClient, RawSamplesClient + +if typing.TYPE_CHECKING: + from .audio.client import AsyncAudioClient, AudioClient + from .speakers.client import AsyncSpeakersClient, SpeakersClient + from .waveform.client import AsyncWaveformClient, WaveformClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SamplesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSamplesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audio: typing.Optional[AudioClient] = None + self._waveform: typing.Optional[WaveformClient] = None + self._speakers: typing.Optional[SpeakersClient] = None + + @property + def with_raw_response(self) -> RawSamplesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSamplesClient + """ + return self._raw_client + + def create( + self, + voice_id: str, + *, + files: typing.List[core.File], + remove_background_noise: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.List[VoiceSample]: + """ + Add audio samples to a PVC voice + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + files : typing.List[core.File] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[VoiceSample] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.samples.create( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.create( + voice_id, files=files, remove_background_noise=remove_background_noise, request_options=request_options + ) + return _response.data + + def update( + self, + voice_id: str, + sample_id: str, + *, + remove_background_noise: typing.Optional[bool] = OMIT, + selected_speaker_ids: typing.Optional[typing.Sequence[str]] = OMIT, + trim_start_time: typing.Optional[int] = OMIT, + trim_end_time: typing.Optional[int] = OMIT, + file_name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Update a PVC voice sample - apply noise removal, select speaker, change trim times or file name. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + selected_speaker_ids : typing.Optional[typing.Sequence[str]] + Speaker IDs to be used for PVC training. Make sure you send all the speaker IDs you want to use for PVC training in one request because the last request will override the previous ones. + + trim_start_time : typing.Optional[int] + The start time of the audio to be used for PVC training. Time should be in milliseconds + + trim_end_time : typing.Optional[int] + The end time of the audio to be used for PVC training. Time should be in milliseconds + + file_name : typing.Optional[str] + The name of the audio file to be used for PVC training. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.samples.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.update( + voice_id, + sample_id, + remove_background_noise=remove_background_noise, + selected_speaker_ids=selected_speaker_ids, + trim_start_time=trim_start_time, + trim_end_time=trim_end_time, + file_name=file_name, + request_options=request_options, + ) + return _response.data + + def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteVoiceSampleResponseModel: + """ + Delete a sample from a PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteVoiceSampleResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.samples.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.delete(voice_id, sample_id, request_options=request_options) + return _response.data + + @property + def audio(self): + if self._audio is None: + from .audio.client import AudioClient # noqa: E402 + + self._audio = AudioClient(client_wrapper=self._client_wrapper) + return self._audio + + @property + def waveform(self): + if self._waveform is None: + from .waveform.client import WaveformClient # noqa: E402 + + self._waveform = WaveformClient(client_wrapper=self._client_wrapper) + return self._waveform + + @property + def speakers(self): + if self._speakers is None: + from .speakers.client import SpeakersClient # noqa: E402 + + self._speakers = SpeakersClient(client_wrapper=self._client_wrapper) + return self._speakers + + +class AsyncSamplesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSamplesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audio: typing.Optional[AsyncAudioClient] = None + self._waveform: typing.Optional[AsyncWaveformClient] = None + self._speakers: typing.Optional[AsyncSpeakersClient] = None + + @property + def with_raw_response(self) -> AsyncRawSamplesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSamplesClient + """ + return self._raw_client + + async def create( + self, + voice_id: str, + *, + files: typing.List[core.File], + remove_background_noise: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.List[VoiceSample]: + """ + Add audio samples to a PVC voice + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + files : typing.List[core.File] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[VoiceSample] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.samples.create( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + voice_id, files=files, remove_background_noise=remove_background_noise, request_options=request_options + ) + return _response.data + + async def update( + self, + voice_id: str, + sample_id: str, + *, + remove_background_noise: typing.Optional[bool] = OMIT, + selected_speaker_ids: typing.Optional[typing.Sequence[str]] = OMIT, + trim_start_time: typing.Optional[int] = OMIT, + trim_end_time: typing.Optional[int] = OMIT, + file_name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddVoiceResponseModel: + """ + Update a PVC voice sample - apply noise removal, select speaker, change trim times or file name. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + selected_speaker_ids : typing.Optional[typing.Sequence[str]] + Speaker IDs to be used for PVC training. Make sure you send all the speaker IDs you want to use for PVC training in one request because the last request will override the previous ones. + + trim_start_time : typing.Optional[int] + The start time of the audio to be used for PVC training. Time should be in milliseconds + + trim_end_time : typing.Optional[int] + The end time of the audio to be used for PVC training. Time should be in milliseconds + + file_name : typing.Optional[str] + The name of the audio file to be used for PVC training. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddVoiceResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.samples.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + voice_id, + sample_id, + remove_background_noise=remove_background_noise, + selected_speaker_ids=selected_speaker_ids, + trim_start_time=trim_start_time, + trim_end_time=trim_end_time, + file_name=file_name, + request_options=request_options, + ) + return _response.data + + async def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteVoiceSampleResponseModel: + """ + Delete a sample from a PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteVoiceSampleResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.samples.delete( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(voice_id, sample_id, request_options=request_options) + return _response.data + + @property + def audio(self): + if self._audio is None: + from .audio.client import AsyncAudioClient # noqa: E402 + + self._audio = AsyncAudioClient(client_wrapper=self._client_wrapper) + return self._audio + + @property + def waveform(self): + if self._waveform is None: + from .waveform.client import AsyncWaveformClient # noqa: E402 + + self._waveform = AsyncWaveformClient(client_wrapper=self._client_wrapper) + return self._waveform + + @property + def speakers(self): + if self._speakers is None: + from .speakers.client import AsyncSpeakersClient # noqa: E402 + + self._speakers = AsyncSpeakersClient(client_wrapper=self._client_wrapper) + return self._speakers diff --git a/data/src/elevenlabs/voices/pvc/samples/raw_client.py b/data/src/elevenlabs/voices/pvc/samples/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..db6a8a30334cb087a15c91ef23bca4011e1950d3 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/raw_client.py @@ -0,0 +1,475 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .... import core +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.add_voice_response_model import AddVoiceResponseModel +from ....types.delete_voice_sample_response_model import DeleteVoiceSampleResponseModel +from ....types.voice_sample import VoiceSample +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSamplesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + voice_id: str, + *, + files: typing.List[core.File], + remove_background_noise: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.List[VoiceSample]]: + """ + Add audio samples to a PVC voice + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + files : typing.List[core.File] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.List[VoiceSample]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples", + method="POST", + data={ + "remove_background_noise": remove_background_noise, + }, + files={ + "files": files, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[VoiceSample], + construct_type( + type_=typing.List[VoiceSample], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + voice_id: str, + sample_id: str, + *, + remove_background_noise: typing.Optional[bool] = OMIT, + selected_speaker_ids: typing.Optional[typing.Sequence[str]] = OMIT, + trim_start_time: typing.Optional[int] = OMIT, + trim_end_time: typing.Optional[int] = OMIT, + file_name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddVoiceResponseModel]: + """ + Update a PVC voice sample - apply noise removal, select speaker, change trim times or file name. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + selected_speaker_ids : typing.Optional[typing.Sequence[str]] + Speaker IDs to be used for PVC training. Make sure you send all the speaker IDs you want to use for PVC training in one request because the last request will override the previous ones. + + trim_start_time : typing.Optional[int] + The start time of the audio to be used for PVC training. Time should be in milliseconds + + trim_end_time : typing.Optional[int] + The end time of the audio to be used for PVC training. Time should be in milliseconds + + file_name : typing.Optional[str] + The name of the audio file to be used for PVC training. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddVoiceResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}", + method="POST", + json={ + "remove_background_noise": remove_background_noise, + "selected_speaker_ids": selected_speaker_ids, + "trim_start_time": trim_start_time, + "trim_end_time": trim_end_time, + "file_name": file_name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceResponseModel, + construct_type( + type_=AddVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteVoiceSampleResponseModel]: + """ + Delete a sample from a PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteVoiceSampleResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteVoiceSampleResponseModel, + construct_type( + type_=DeleteVoiceSampleResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSamplesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + voice_id: str, + *, + files: typing.List[core.File], + remove_background_noise: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.List[VoiceSample]]: + """ + Add audio samples to a PVC voice + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + files : typing.List[core.File] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.List[VoiceSample]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples", + method="POST", + data={ + "remove_background_noise": remove_background_noise, + }, + files={ + "files": files, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[VoiceSample], + construct_type( + type_=typing.List[VoiceSample], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + voice_id: str, + sample_id: str, + *, + remove_background_noise: typing.Optional[bool] = OMIT, + selected_speaker_ids: typing.Optional[typing.Sequence[str]] = OMIT, + trim_start_time: typing.Optional[int] = OMIT, + trim_end_time: typing.Optional[int] = OMIT, + file_name: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddVoiceResponseModel]: + """ + Update a PVC voice sample - apply noise removal, select speaker, change trim times or file name. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + selected_speaker_ids : typing.Optional[typing.Sequence[str]] + Speaker IDs to be used for PVC training. Make sure you send all the speaker IDs you want to use for PVC training in one request because the last request will override the previous ones. + + trim_start_time : typing.Optional[int] + The start time of the audio to be used for PVC training. Time should be in milliseconds + + trim_end_time : typing.Optional[int] + The end time of the audio to be used for PVC training. Time should be in milliseconds + + file_name : typing.Optional[str] + The name of the audio file to be used for PVC training. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddVoiceResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}", + method="POST", + json={ + "remove_background_noise": remove_background_noise, + "selected_speaker_ids": selected_speaker_ids, + "trim_start_time": trim_start_time, + "trim_end_time": trim_end_time, + "file_name": file_name, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceResponseModel, + construct_type( + type_=AddVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteVoiceSampleResponseModel]: + """ + Delete a sample from a PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteVoiceSampleResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteVoiceSampleResponseModel, + construct_type( + type_=DeleteVoiceSampleResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/pvc/samples/speakers/__init__.py b/data/src/elevenlabs/voices/pvc/samples/speakers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6ac40397b5dbaec362dedeb20f4fb0cf9100c85d --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/speakers/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import audio +_dynamic_imports: typing.Dict[str, str] = {"audio": ".audio"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["audio"] diff --git a/data/src/elevenlabs/voices/pvc/samples/speakers/audio/__init__.py b/data/src/elevenlabs/voices/pvc/samples/speakers/audio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/speakers/audio/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/voices/pvc/samples/speakers/audio/client.py b/data/src/elevenlabs/voices/pvc/samples/speakers/audio/client.py new file mode 100644 index 0000000000000000000000000000000000000000..ce0e75e4b44a9ec2027749550831faf6788702c9 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/speakers/audio/client.py @@ -0,0 +1,130 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ......core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ......core.request_options import RequestOptions +from ......types.speaker_audio_response_model import SpeakerAudioResponseModel +from .raw_client import AsyncRawAudioClient, RawAudioClient + + +class AudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAudioClient + """ + return self._raw_client + + def get( + self, voice_id: str, sample_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SpeakerAudioResponseModel: + """ + Retrieve the separated audio for a specific speaker. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + speaker_id : str + Speaker ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id}/samples/{sample_id}/speakers to list all the available speakers for a sample. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeakerAudioResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.samples.speakers.audio.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + speaker_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.get(voice_id, sample_id, speaker_id, request_options=request_options) + return _response.data + + +class AsyncAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAudioClient + """ + return self._raw_client + + async def get( + self, voice_id: str, sample_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SpeakerAudioResponseModel: + """ + Retrieve the separated audio for a specific speaker. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + speaker_id : str + Speaker ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id}/samples/{sample_id}/speakers to list all the available speakers for a sample. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeakerAudioResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.samples.speakers.audio.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + speaker_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(voice_id, sample_id, speaker_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/voices/pvc/samples/speakers/audio/raw_client.py b/data/src/elevenlabs/voices/pvc/samples/speakers/audio/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..9390fb3926feeba55133f4674bcb96ba70170909 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/speakers/audio/raw_client.py @@ -0,0 +1,145 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ......core.api_error import ApiError +from ......core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ......core.http_response import AsyncHttpResponse, HttpResponse +from ......core.jsonable_encoder import jsonable_encoder +from ......core.parse_error import ParsingError +from ......core.request_options import RequestOptions +from ......core.unchecked_base_model import construct_type +from ......errors.unprocessable_entity_error import UnprocessableEntityError +from ......types.speaker_audio_response_model import SpeakerAudioResponseModel +from pydantic import ValidationError + + +class RawAudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, voice_id: str, sample_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SpeakerAudioResponseModel]: + """ + Retrieve the separated audio for a specific speaker. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + speaker_id : str + Speaker ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id}/samples/{sample_id}/speakers to list all the available speakers for a sample. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeakerAudioResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/speakers/{jsonable_encoder(speaker_id)}/audio", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeakerAudioResponseModel, + construct_type( + type_=SpeakerAudioResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, voice_id: str, sample_id: str, speaker_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SpeakerAudioResponseModel]: + """ + Retrieve the separated audio for a specific speaker. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + speaker_id : str + Speaker ID to be used, you can use GET https://api.elevenlabs.io/v1/voices/{voice_id}/samples/{sample_id}/speakers to list all the available speakers for a sample. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeakerAudioResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/speakers/{jsonable_encoder(speaker_id)}/audio", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeakerAudioResponseModel, + construct_type( + type_=SpeakerAudioResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/pvc/samples/speakers/client.py b/data/src/elevenlabs/voices/pvc/samples/speakers/client.py new file mode 100644 index 0000000000000000000000000000000000000000..5695bb72b7251f44e1feaf2c008559730cd5b1ba --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/speakers/client.py @@ -0,0 +1,230 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.speaker_separation_response_model import SpeakerSeparationResponseModel +from .....types.start_speaker_separation_response_model import StartSpeakerSeparationResponseModel +from .raw_client import AsyncRawSpeakersClient, RawSpeakersClient + +if typing.TYPE_CHECKING: + from .audio.client import AsyncAudioClient, AudioClient + + +class SpeakersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSpeakersClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audio: typing.Optional[AudioClient] = None + + @property + def with_raw_response(self) -> RawSpeakersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSpeakersClient + """ + return self._raw_client + + def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SpeakerSeparationResponseModel: + """ + Retrieve the status of the speaker separation process and the list of detected speakers if complete. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeakerSeparationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.samples.speakers.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.get(voice_id, sample_id, request_options=request_options) + return _response.data + + def separate( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> StartSpeakerSeparationResponseModel: + """ + Start speaker separation process for a sample + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + StartSpeakerSeparationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.samples.speakers.separate( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.separate(voice_id, sample_id, request_options=request_options) + return _response.data + + @property + def audio(self): + if self._audio is None: + from .audio.client import AudioClient # noqa: E402 + + self._audio = AudioClient(client_wrapper=self._client_wrapper) + return self._audio + + +class AsyncSpeakersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSpeakersClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audio: typing.Optional[AsyncAudioClient] = None + + @property + def with_raw_response(self) -> AsyncRawSpeakersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSpeakersClient + """ + return self._raw_client + + async def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> SpeakerSeparationResponseModel: + """ + Retrieve the status of the speaker separation process and the list of detected speakers if complete. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SpeakerSeparationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.samples.speakers.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(voice_id, sample_id, request_options=request_options) + return _response.data + + async def separate( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> StartSpeakerSeparationResponseModel: + """ + Start speaker separation process for a sample + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + StartSpeakerSeparationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.samples.speakers.separate( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.separate(voice_id, sample_id, request_options=request_options) + return _response.data + + @property + def audio(self): + if self._audio is None: + from .audio.client import AsyncAudioClient # noqa: E402 + + self._audio = AsyncAudioClient(client_wrapper=self._client_wrapper) + return self._audio diff --git a/data/src/elevenlabs/voices/pvc/samples/speakers/raw_client.py b/data/src/elevenlabs/voices/pvc/samples/speakers/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..8492fe8d939835609a2580a3a9676c148f33a124 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/speakers/raw_client.py @@ -0,0 +1,254 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.speaker_separation_response_model import SpeakerSeparationResponseModel +from .....types.start_speaker_separation_response_model import StartSpeakerSeparationResponseModel +from pydantic import ValidationError + + +class RawSpeakersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[SpeakerSeparationResponseModel]: + """ + Retrieve the status of the speaker separation process and the list of detected speakers if complete. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[SpeakerSeparationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/speakers", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeakerSeparationResponseModel, + construct_type( + type_=SpeakerSeparationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def separate( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[StartSpeakerSeparationResponseModel]: + """ + Start speaker separation process for a sample + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[StartSpeakerSeparationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/separate-speakers", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + StartSpeakerSeparationResponseModel, + construct_type( + type_=StartSpeakerSeparationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSpeakersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[SpeakerSeparationResponseModel]: + """ + Retrieve the status of the speaker separation process and the list of detected speakers if complete. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[SpeakerSeparationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/speakers", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + SpeakerSeparationResponseModel, + construct_type( + type_=SpeakerSeparationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def separate( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[StartSpeakerSeparationResponseModel]: + """ + Start speaker separation process for a sample + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[StartSpeakerSeparationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/separate-speakers", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + StartSpeakerSeparationResponseModel, + construct_type( + type_=StartSpeakerSeparationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/pvc/samples/waveform/__init__.py b/data/src/elevenlabs/voices/pvc/samples/waveform/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/waveform/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/voices/pvc/samples/waveform/client.py b/data/src/elevenlabs/voices/pvc/samples/waveform/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a649ecdf3753068bf83ca3e90b522385b43b55e3 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/waveform/client.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.voice_sample_visual_waveform_response_model import VoiceSampleVisualWaveformResponseModel +from .raw_client import AsyncRawWaveformClient, RawWaveformClient + + +class WaveformClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawWaveformClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawWaveformClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawWaveformClient + """ + return self._raw_client + + def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> VoiceSampleVisualWaveformResponseModel: + """ + Retrieve the visual waveform of a voice sample. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceSampleVisualWaveformResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.samples.waveform.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + """ + _response = self._raw_client.get(voice_id, sample_id, request_options=request_options) + return _response.data + + +class AsyncWaveformClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawWaveformClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawWaveformClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawWaveformClient + """ + return self._raw_client + + async def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> VoiceSampleVisualWaveformResponseModel: + """ + Retrieve the visual waveform of a voice sample. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceSampleVisualWaveformResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.samples.waveform.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + sample_id="VW7YKqPnjY4h39yTbx2L", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(voice_id, sample_id, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/voices/pvc/samples/waveform/raw_client.py b/data/src/elevenlabs/voices/pvc/samples/waveform/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..221e48240583cde0a873d5cccab60e98a19429af --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/samples/waveform/raw_client.py @@ -0,0 +1,139 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.voice_sample_visual_waveform_response_model import VoiceSampleVisualWaveformResponseModel +from pydantic import ValidationError + + +class RawWaveformClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[VoiceSampleVisualWaveformResponseModel]: + """ + Retrieve the visual waveform of a voice sample. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[VoiceSampleVisualWaveformResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/waveform", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceSampleVisualWaveformResponseModel, + construct_type( + type_=VoiceSampleVisualWaveformResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawWaveformClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[VoiceSampleVisualWaveformResponseModel]: + """ + Retrieve the visual waveform of a voice sample. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + sample_id : str + Sample ID to be used + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[VoiceSampleVisualWaveformResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/waveform", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceSampleVisualWaveformResponseModel, + construct_type( + type_=VoiceSampleVisualWaveformResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/pvc/verification/__init__.py b/data/src/elevenlabs/voices/pvc/verification/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ae4b58d09a5bd1c9bb6900adb76576acc43bd66e --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/verification/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import captcha +_dynamic_imports: typing.Dict[str, str] = {"captcha": ".captcha"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["captcha"] diff --git a/data/src/elevenlabs/voices/pvc/verification/captcha/__init__.py b/data/src/elevenlabs/voices/pvc/verification/captcha/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/verification/captcha/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/voices/pvc/verification/captcha/client.py b/data/src/elevenlabs/voices/pvc/verification/captcha/client.py new file mode 100644 index 0000000000000000000000000000000000000000..ab56689cc9fd817545e14b9b3c7c1dee43afdb31 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/verification/captcha/client.py @@ -0,0 +1,192 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..... import core +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.request_options import RequestOptions +from .....types.verify_pvc_voice_captcha_response_model import VerifyPvcVoiceCaptchaResponseModel +from .raw_client import AsyncRawCaptchaClient, RawCaptchaClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class CaptchaClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawCaptchaClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawCaptchaClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawCaptchaClient + """ + return self._raw_client + + def get(self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Get captcha for PVC voice verification. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.verification.captcha.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get(voice_id, request_options=request_options) + return _response.data + + def verify( + self, voice_id: str, *, recording: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> VerifyPvcVoiceCaptchaResponseModel: + """ + Submit captcha verification for PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + recording : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VerifyPvcVoiceCaptchaResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.verification.captcha.verify( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.verify(voice_id, recording=recording, request_options=request_options) + return _response.data + + +class AsyncCaptchaClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawCaptchaClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawCaptchaClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawCaptchaClient + """ + return self._raw_client + + async def get(self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: + """ + Get captcha for PVC voice verification. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.verification.captcha.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(voice_id, request_options=request_options) + return _response.data + + async def verify( + self, voice_id: str, *, recording: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> VerifyPvcVoiceCaptchaResponseModel: + """ + Submit captcha verification for PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + recording : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VerifyPvcVoiceCaptchaResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.verification.captcha.verify( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.verify(voice_id, recording=recording, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/voices/pvc/verification/captcha/raw_client.py b/data/src/elevenlabs/voices/pvc/verification/captcha/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..03fe7020470be3612225792a4ba7022f371d8b32 --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/verification/captcha/raw_client.py @@ -0,0 +1,245 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..... import core +from .....core.api_error import ApiError +from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.http_response import AsyncHttpResponse, HttpResponse +from .....core.jsonable_encoder import jsonable_encoder +from .....core.parse_error import ParsingError +from .....core.request_options import RequestOptions +from .....core.unchecked_base_model import construct_type +from .....errors.unprocessable_entity_error import UnprocessableEntityError +from .....types.verify_pvc_voice_captcha_response_model import VerifyPvcVoiceCaptchaResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawCaptchaClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get(self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: + """ + Get captcha for PVC voice verification. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[None] + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/captcha", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return HttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def verify( + self, voice_id: str, *, recording: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[VerifyPvcVoiceCaptchaResponseModel]: + """ + Submit captcha verification for PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + recording : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[VerifyPvcVoiceCaptchaResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/captcha", + method="POST", + data={}, + files={ + "recording": recording, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VerifyPvcVoiceCaptchaResponseModel, + construct_type( + type_=VerifyPvcVoiceCaptchaResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawCaptchaClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: + """ + Get captcha for PVC voice verification. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[None] + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/captcha", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return AsyncHttpResponse(response=_response, data=None) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def verify( + self, voice_id: str, *, recording: core.File, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[VerifyPvcVoiceCaptchaResponseModel]: + """ + Submit captcha verification for PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + recording : core.File + See core.File for more documentation + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[VerifyPvcVoiceCaptchaResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/captcha", + method="POST", + data={}, + files={ + "recording": recording, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VerifyPvcVoiceCaptchaResponseModel, + construct_type( + type_=VerifyPvcVoiceCaptchaResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/pvc/verification/client.py b/data/src/elevenlabs/voices/pvc/verification/client.py new file mode 100644 index 0000000000000000000000000000000000000000..193f55df7e09c63170410aa39675dac0272e4aaa --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/verification/client.py @@ -0,0 +1,168 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from .... import core +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.request_pvc_manual_verification_response_model import RequestPvcManualVerificationResponseModel +from .raw_client import AsyncRawVerificationClient, RawVerificationClient + +if typing.TYPE_CHECKING: + from .captcha.client import AsyncCaptchaClient, CaptchaClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class VerificationClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawVerificationClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._captcha: typing.Optional[CaptchaClient] = None + + @property + def with_raw_response(self) -> RawVerificationClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawVerificationClient + """ + return self._raw_client + + def request( + self, + voice_id: str, + *, + files: typing.List[core.File], + extra_text: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> RequestPvcManualVerificationResponseModel: + """ + Request manual verification for a PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + files : typing.List[core.File] + See core.File for more documentation + + extra_text : typing.Optional[str] + Extra text to be used in the manual verification process. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RequestPvcManualVerificationResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.pvc.verification.request( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.request( + voice_id, files=files, extra_text=extra_text, request_options=request_options + ) + return _response.data + + @property + def captcha(self): + if self._captcha is None: + from .captcha.client import CaptchaClient # noqa: E402 + + self._captcha = CaptchaClient(client_wrapper=self._client_wrapper) + return self._captcha + + +class AsyncVerificationClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawVerificationClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._captcha: typing.Optional[AsyncCaptchaClient] = None + + @property + def with_raw_response(self) -> AsyncRawVerificationClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawVerificationClient + """ + return self._raw_client + + async def request( + self, + voice_id: str, + *, + files: typing.List[core.File], + extra_text: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> RequestPvcManualVerificationResponseModel: + """ + Request manual verification for a PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + files : typing.List[core.File] + See core.File for more documentation + + extra_text : typing.Optional[str] + Extra text to be used in the manual verification process. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + RequestPvcManualVerificationResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.pvc.verification.request( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.request( + voice_id, files=files, extra_text=extra_text, request_options=request_options + ) + return _response.data + + @property + def captcha(self): + if self._captcha is None: + from .captcha.client import AsyncCaptchaClient # noqa: E402 + + self._captcha = AsyncCaptchaClient(client_wrapper=self._client_wrapper) + return self._captcha diff --git a/data/src/elevenlabs/voices/pvc/verification/raw_client.py b/data/src/elevenlabs/voices/pvc/verification/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..6108e805e5cd0dccddb474395ba33916fac50e4e --- /dev/null +++ b/data/src/elevenlabs/voices/pvc/verification/raw_client.py @@ -0,0 +1,175 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from .... import core +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.request_pvc_manual_verification_response_model import RequestPvcManualVerificationResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawVerificationClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def request( + self, + voice_id: str, + *, + files: typing.List[core.File], + extra_text: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[RequestPvcManualVerificationResponseModel]: + """ + Request manual verification for a PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + files : typing.List[core.File] + See core.File for more documentation + + extra_text : typing.Optional[str] + Extra text to be used in the manual verification process. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[RequestPvcManualVerificationResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/verification", + method="POST", + data={ + "extra_text": extra_text, + }, + files={ + "files": files, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RequestPvcManualVerificationResponseModel, + construct_type( + type_=RequestPvcManualVerificationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawVerificationClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def request( + self, + voice_id: str, + *, + files: typing.List[core.File], + extra_text: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[RequestPvcManualVerificationResponseModel]: + """ + Request manual verification for a PVC voice. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + files : typing.List[core.File] + See core.File for more documentation + + extra_text : typing.Optional[str] + Extra text to be used in the manual verification process. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[RequestPvcManualVerificationResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/pvc/{jsonable_encoder(voice_id)}/verification", + method="POST", + data={ + "extra_text": extra_text, + }, + files={ + "files": files, + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + RequestPvcManualVerificationResponseModel, + construct_type( + type_=RequestPvcManualVerificationResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/raw_client.py b/data/src/elevenlabs/voices/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b5fb189fa36f54bf0adaebb123bebd392ed9f47b --- /dev/null +++ b/data/src/elevenlabs/voices/raw_client.py @@ -0,0 +1,1622 @@ +# This file was auto-generated by Fern from our API Definition. + +import json +import typing +from json.decoder import JSONDecodeError + +from .. import core +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.add_voice_response_model import AddVoiceResponseModel +from ..types.delete_voice_response_model import DeleteVoiceResponseModel +from ..types.edit_voice_response_model import EditVoiceResponseModel +from ..types.get_library_voices_response import GetLibraryVoicesResponse +from ..types.get_voices_response import GetVoicesResponse +from ..types.get_voices_v_2_response import GetVoicesV2Response +from ..types.replicate_voice_to_isolated_environment_response_model import ( + ReplicateVoiceToIsolatedEnvironmentResponseModel, +) +from ..types.voice import Voice +from .types.edit_voice_request_labels import EditVoiceRequestLabels +from .types.voices_get_shared_request_category import VoicesGetSharedRequestCategory +from .types.voices_get_shared_request_sort import VoicesGetSharedRequestSort +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawVoicesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_all( + self, *, show_legacy: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[GetVoicesResponse]: + """ + Returns a list of all available voices for a user. Stops working once the user's workspace exceeds 500 voices. + + Parameters + ---------- + show_legacy : typing.Optional[bool] + If set to true, legacy premade voices will be included in responses from /v1/voices + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetVoicesResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices", + method="GET", + params={ + "show_legacy": show_legacy, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetVoicesResponse, + construct_type( + type_=GetVoicesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, + voice_id: str, + *, + with_settings: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[Voice]: + """ + Returns metadata about a specific voice. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + with_settings : typing.Optional[bool] + This parameter is now deprecated. It is ignored and will be removed in a future version. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[Voice] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}", + method="GET", + params={ + "with_settings": with_settings, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Voice, + construct_type( + type_=Voice, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteVoiceResponseModel]: + """ + Deletes a voice by its ID. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteVoiceResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteVoiceResponseModel, + construct_type( + type_=DeleteVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + voice_id: str, + *, + name: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[EditVoiceRequestLabels] = OMIT, + moderate_metadata: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[EditVoiceResponseModel]: + """ + Edit a voice created by you. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + description : typing.Optional[str] + A description of the voice. + + labels : typing.Optional[EditVoiceRequestLabels] + Labels for the voice. Keys can be language, accent, gender, or age. + + moderate_metadata : typing.Optional[bool] + Run synchronous LLM moderation over the voice name and description when they change. Has no effect unless the voice_library_metadata_moderation feature flag is enabled for the user. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EditVoiceResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/edit", + method="POST", + data={ + "name": name, + "remove_background_noise": remove_background_noise, + "description": description, + "labels": json.dumps(jsonable_encoder(labels)), + "moderate_metadata": moderate_metadata, + }, + files={ + **({"files": files} if files is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditVoiceResponseModel, + construct_type( + type_=EditVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def search( + self, + *, + next_page_token: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + sort: typing.Optional[str] = None, + sort_direction: typing.Optional[str] = None, + voice_type: typing.Optional[str] = None, + category: typing.Optional[str] = None, + fine_tuning_state: typing.Optional[str] = None, + collection_id: typing.Optional[str] = None, + gender: typing.Optional[str] = None, + age: typing.Optional[str] = None, + language: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + accent: typing.Optional[str] = None, + use_cases: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + min_notice_period_days: typing.Optional[int] = None, + include_custom_rates: typing.Optional[bool] = None, + include_live_moderated: typing.Optional[bool] = None, + high_quality: typing.Optional[bool] = None, + include_total_count: typing.Optional[bool] = None, + voice_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetVoicesV2Response]: + """ + Gets a list of all available voices for a user with search, filtering and pagination. + + Parameters + ---------- + next_page_token : typing.Optional[str] + The next page token to use for pagination. Returned from the previous request. Use this in combination with the has_more flag for reliable pagination. + + page_size : typing.Optional[int] + How many voices to return at maximum. Can not exceed 100, defaults to 10. Page 0 may include more voices due to default voices being included. + + search : typing.Optional[str] + Search term to filter voices by. Searches in name, description, labels, category. + + sort : typing.Optional[str] + Which field to sort by, one of 'created_at_unix' or 'name'. 'created_at_unix' may not be available for older voices. + + sort_direction : typing.Optional[str] + Which direction to sort the voices in. 'asc' or 'desc'. + + voice_type : typing.Optional[str] + Type of the voice to filter by. One of 'personal', 'community', 'default', 'workspace', 'non-default', 'non-community', 'saved'. 'non-default' is equal to all but 'default'. 'non-community' is equal to 'personal' and 'workspace' combined (excludes library copies). 'saved' is equal to non-default, but includes default voices if they have been added to a collection. + + category : typing.Optional[str] + Category of the voice to filter by. One of 'premade', 'cloned', 'generated', 'professional' + + fine_tuning_state : typing.Optional[str] + State of the voice's fine tuning to filter by. Applicable only to professional voices clones. One of 'draft', 'not_verified', 'not_started', 'queued', 'fine_tuning', 'fine_tuned', 'failed', 'delayed' + + collection_id : typing.Optional[str] + Collection ID to filter voices by. + + gender : typing.Optional[str] + Gender used for filtering, based on the voice's 'gender' label. + + age : typing.Optional[str] + Age used for filtering, based on the voice's 'age' label. + + language : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Languages used for filtering, based on the voice's 'language' label. Voices matching any of the given languages are returned. + + accent : typing.Optional[str] + Accent used for filtering, based on the voice's 'accent' label. + + use_cases : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Use cases used for filtering, based on the voice's 'use_case' label. Voices matching any of the given use cases are returned. + + min_notice_period_days : typing.Optional[int] + Filter to voices whose sharing notice period is at least the given number of days. + + include_custom_rates : typing.Optional[bool] + Whether to include voices that have a custom sharing rate. Defaults to including them. + + include_live_moderated : typing.Optional[bool] + Whether to include voices that have live moderation enabled. Defaults to including them. + + high_quality : typing.Optional[bool] + When true, only return studio-quality voices (those whose category is 'high_quality'). + + include_total_count : typing.Optional[bool] + Whether to include the total count of voices found in the response. NOTE: The total_count value is a live snapshot and may change between requests as users create, modify, or delete voices. For pagination, rely on the has_more flag instead. Only enable this when you actually need the total count (e.g., for display purposes), as it incurs a performance cost. + + voice_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Voice IDs to lookup by. Maximum 100 voice IDs. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetVoicesV2Response] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v2/voices", + method="GET", + params={ + "next_page_token": next_page_token, + "page_size": page_size, + "search": search, + "sort": sort, + "sort_direction": sort_direction, + "voice_type": voice_type, + "category": category, + "fine_tuning_state": fine_tuning_state, + "collection_id": collection_id, + "gender": gender, + "age": age, + "language": language, + "accent": accent, + "use_cases": use_cases, + "min_notice_period_days": min_notice_period_days, + "include_custom_rates": include_custom_rates, + "include_live_moderated": include_live_moderated, + "high_quality": high_quality, + "include_total_count": include_total_count, + "voice_ids": voice_ids, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetVoicesV2Response, + construct_type( + type_=GetVoicesV2Response, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def replicate_to_isolated_environment( + self, + voice_id: str, + *, + target_workspace_id: str, + preserve_voice_id: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ReplicateVoiceToIsolatedEnvironmentResponseModel]: + """ + Replicates an Instant Voice Clone or Voice Design voice to a workspace in a different data residency. The target workspace must belong to the same consolidated billing group. The user must have VOICES_WRITE in the source workspace, and be an admin on the source voice. Human users (i.e. not service accounts) must also have VOICES_WRITE in the target workspace. This endpoint is available on the central environment only. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + target_workspace_id : str + ID of the workspace to replicate the voice into. It must belong to the same consolidated billing group as the calling workspace; the target's data residency is derived from that link. + + preserve_voice_id : typing.Optional[bool] + When true (default) the replicated voice keeps the same voice ID in the target residency; set to false to assign a new voice ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ReplicateVoiceToIsolatedEnvironmentResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/replicate-to-isolated-environment", + method="POST", + json={ + "target_workspace_id": target_workspace_id, + "preserve_voice_id": preserve_voice_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ReplicateVoiceToIsolatedEnvironmentResponseModel, + construct_type( + type_=ReplicateVoiceToIsolatedEnvironmentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def share( + self, + public_user_id: str, + voice_id: str, + *, + new_name: str, + bookmarked: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddVoiceResponseModel]: + """ + Add a shared voice to your collection of Voices + + Parameters + ---------- + public_user_id : str + Public user ID used to publicly identify ElevenLabs users. + + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + new_name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + bookmarked : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddVoiceResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/add/{jsonable_encoder(public_user_id)}/{jsonable_encoder(voice_id)}", + method="POST", + json={ + "new_name": new_name, + "bookmarked": bookmarked, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceResponseModel, + construct_type( + type_=AddVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def find_similar_voices( + self, + *, + audio_file: typing.Optional[core.File] = OMIT, + similarity_threshold: typing.Optional[float] = OMIT, + top_k: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetLibraryVoicesResponse]: + """ + Returns a list of shared voices similar to the provided audio sample. If neither similarity_threshold nor top_k is provided, we will apply default values. + + Parameters + ---------- + audio_file : typing.Optional[core.File] + See core.File for more documentation + + similarity_threshold : typing.Optional[float] + Threshold for voice similarity between provided sample and library voices. Values range from 0 to 2. The smaller the value the more similar voices will be returned. + + top_k : typing.Optional[int] + Number of most similar voices to return. If similarity_threshold is provided, less than this number of voices may be returned. Values range from 1 to 100. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetLibraryVoicesResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/similar-voices", + method="POST", + data={ + "similarity_threshold": similarity_threshold, + "top_k": top_k, + }, + files={ + **({"audio_file": audio_file} if audio_file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetLibraryVoicesResponse, + construct_type( + type_=GetLibraryVoicesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get_shared( + self, + *, + page_size: typing.Optional[int] = None, + category: typing.Optional[VoicesGetSharedRequestCategory] = None, + gender: typing.Optional[str] = None, + age: typing.Optional[str] = None, + accent: typing.Optional[str] = None, + language: typing.Optional[str] = None, + locale: typing.Optional[str] = None, + search: typing.Optional[str] = None, + use_cases: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + descriptives: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + featured: typing.Optional[bool] = None, + min_notice_period_days: typing.Optional[int] = None, + include_custom_rates: typing.Optional[bool] = None, + include_live_moderated: typing.Optional[bool] = None, + reader_app_enabled: typing.Optional[bool] = None, + owner_id: typing.Optional[str] = None, + sort: typing.Optional[VoicesGetSharedRequestSort] = None, + page: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[GetLibraryVoicesResponse]: + """ + Retrieves a list of shared voices. + + Parameters + ---------- + page_size : typing.Optional[int] + How many shared voices to return at maximum. Can not exceed 100, defaults to 30. + + category : typing.Optional[VoicesGetSharedRequestCategory] + Voice category used for filtering + + gender : typing.Optional[str] + Gender used for filtering + + age : typing.Optional[str] + Age used for filtering + + accent : typing.Optional[str] + Accent used for filtering + + language : typing.Optional[str] + Language used for filtering + + locale : typing.Optional[str] + Locale used for filtering + + search : typing.Optional[str] + Search term used for filtering + + use_cases : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Use-case used for filtering + + descriptives : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Search term used for filtering + + featured : typing.Optional[bool] + Filter featured voices + + min_notice_period_days : typing.Optional[int] + Filter voices with a minimum notice period of the given number of days. + + include_custom_rates : typing.Optional[bool] + Include/exclude voices with custom rates + + include_live_moderated : typing.Optional[bool] + Include/exclude voices that are live moderated + + reader_app_enabled : typing.Optional[bool] + Filter voices that are enabled for the reader app + + owner_id : typing.Optional[str] + Filter voices by public owner ID + + sort : typing.Optional[VoicesGetSharedRequestSort] + Sort criteria. Must be one of: created_date, usage_character_count_1y, trending, cloned_by_count. + + page : typing.Optional[int] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[GetLibraryVoicesResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/shared-voices", + method="GET", + params={ + "page_size": page_size, + "category": category, + "gender": gender, + "age": age, + "accent": accent, + "language": language, + "locale": locale, + "search": search, + "use_cases": use_cases, + "descriptives": descriptives, + "featured": featured, + "min_notice_period_days": min_notice_period_days, + "include_custom_rates": include_custom_rates, + "include_live_moderated": include_live_moderated, + "reader_app_enabled": reader_app_enabled, + "owner_id": owner_id, + "sort": sort, + "page": page, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetLibraryVoicesResponse, + construct_type( + type_=GetLibraryVoicesResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawVoicesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_all( + self, *, show_legacy: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[GetVoicesResponse]: + """ + Returns a list of all available voices for a user. Stops working once the user's workspace exceeds 500 voices. + + Parameters + ---------- + show_legacy : typing.Optional[bool] + If set to true, legacy premade voices will be included in responses from /v1/voices + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetVoicesResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices", + method="GET", + params={ + "show_legacy": show_legacy, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetVoicesResponse, + construct_type( + type_=GetVoicesResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, + voice_id: str, + *, + with_settings: typing.Optional[bool] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[Voice]: + """ + Returns metadata about a specific voice. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + with_settings : typing.Optional[bool] + This parameter is now deprecated. It is ignored and will be removed in a future version. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[Voice] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}", + method="GET", + params={ + "with_settings": with_settings, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + Voice, + construct_type( + type_=Voice, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteVoiceResponseModel]: + """ + Deletes a voice by its ID. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteVoiceResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteVoiceResponseModel, + construct_type( + type_=DeleteVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + voice_id: str, + *, + name: str, + files: typing.Optional[typing.List[core.File]] = OMIT, + remove_background_noise: typing.Optional[bool] = OMIT, + description: typing.Optional[str] = OMIT, + labels: typing.Optional[EditVoiceRequestLabels] = OMIT, + moderate_metadata: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[EditVoiceResponseModel]: + """ + Edit a voice created by you. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + files : typing.Optional[typing.List[core.File]] + See core.File for more documentation + + remove_background_noise : typing.Optional[bool] + If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse. + + description : typing.Optional[str] + A description of the voice. + + labels : typing.Optional[EditVoiceRequestLabels] + Labels for the voice. Keys can be language, accent, gender, or age. + + moderate_metadata : typing.Optional[bool] + Run synchronous LLM moderation over the voice name and description when they change. Has no effect unless the voice_library_metadata_moderation feature flag is enabled for the user. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EditVoiceResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/edit", + method="POST", + data={ + "name": name, + "remove_background_noise": remove_background_noise, + "description": description, + "labels": json.dumps(jsonable_encoder(labels)), + "moderate_metadata": moderate_metadata, + }, + files={ + **({"files": files} if files is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditVoiceResponseModel, + construct_type( + type_=EditVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def search( + self, + *, + next_page_token: typing.Optional[str] = None, + page_size: typing.Optional[int] = None, + search: typing.Optional[str] = None, + sort: typing.Optional[str] = None, + sort_direction: typing.Optional[str] = None, + voice_type: typing.Optional[str] = None, + category: typing.Optional[str] = None, + fine_tuning_state: typing.Optional[str] = None, + collection_id: typing.Optional[str] = None, + gender: typing.Optional[str] = None, + age: typing.Optional[str] = None, + language: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + accent: typing.Optional[str] = None, + use_cases: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + min_notice_period_days: typing.Optional[int] = None, + include_custom_rates: typing.Optional[bool] = None, + include_live_moderated: typing.Optional[bool] = None, + high_quality: typing.Optional[bool] = None, + include_total_count: typing.Optional[bool] = None, + voice_ids: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetVoicesV2Response]: + """ + Gets a list of all available voices for a user with search, filtering and pagination. + + Parameters + ---------- + next_page_token : typing.Optional[str] + The next page token to use for pagination. Returned from the previous request. Use this in combination with the has_more flag for reliable pagination. + + page_size : typing.Optional[int] + How many voices to return at maximum. Can not exceed 100, defaults to 10. Page 0 may include more voices due to default voices being included. + + search : typing.Optional[str] + Search term to filter voices by. Searches in name, description, labels, category. + + sort : typing.Optional[str] + Which field to sort by, one of 'created_at_unix' or 'name'. 'created_at_unix' may not be available for older voices. + + sort_direction : typing.Optional[str] + Which direction to sort the voices in. 'asc' or 'desc'. + + voice_type : typing.Optional[str] + Type of the voice to filter by. One of 'personal', 'community', 'default', 'workspace', 'non-default', 'non-community', 'saved'. 'non-default' is equal to all but 'default'. 'non-community' is equal to 'personal' and 'workspace' combined (excludes library copies). 'saved' is equal to non-default, but includes default voices if they have been added to a collection. + + category : typing.Optional[str] + Category of the voice to filter by. One of 'premade', 'cloned', 'generated', 'professional' + + fine_tuning_state : typing.Optional[str] + State of the voice's fine tuning to filter by. Applicable only to professional voices clones. One of 'draft', 'not_verified', 'not_started', 'queued', 'fine_tuning', 'fine_tuned', 'failed', 'delayed' + + collection_id : typing.Optional[str] + Collection ID to filter voices by. + + gender : typing.Optional[str] + Gender used for filtering, based on the voice's 'gender' label. + + age : typing.Optional[str] + Age used for filtering, based on the voice's 'age' label. + + language : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Languages used for filtering, based on the voice's 'language' label. Voices matching any of the given languages are returned. + + accent : typing.Optional[str] + Accent used for filtering, based on the voice's 'accent' label. + + use_cases : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Use cases used for filtering, based on the voice's 'use_case' label. Voices matching any of the given use cases are returned. + + min_notice_period_days : typing.Optional[int] + Filter to voices whose sharing notice period is at least the given number of days. + + include_custom_rates : typing.Optional[bool] + Whether to include voices that have a custom sharing rate. Defaults to including them. + + include_live_moderated : typing.Optional[bool] + Whether to include voices that have live moderation enabled. Defaults to including them. + + high_quality : typing.Optional[bool] + When true, only return studio-quality voices (those whose category is 'high_quality'). + + include_total_count : typing.Optional[bool] + Whether to include the total count of voices found in the response. NOTE: The total_count value is a live snapshot and may change between requests as users create, modify, or delete voices. For pagination, rely on the has_more flag instead. Only enable this when you actually need the total count (e.g., for display purposes), as it incurs a performance cost. + + voice_ids : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Voice IDs to lookup by. Maximum 100 voice IDs. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetVoicesV2Response] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v2/voices", + method="GET", + params={ + "next_page_token": next_page_token, + "page_size": page_size, + "search": search, + "sort": sort, + "sort_direction": sort_direction, + "voice_type": voice_type, + "category": category, + "fine_tuning_state": fine_tuning_state, + "collection_id": collection_id, + "gender": gender, + "age": age, + "language": language, + "accent": accent, + "use_cases": use_cases, + "min_notice_period_days": min_notice_period_days, + "include_custom_rates": include_custom_rates, + "include_live_moderated": include_live_moderated, + "high_quality": high_quality, + "include_total_count": include_total_count, + "voice_ids": voice_ids, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetVoicesV2Response, + construct_type( + type_=GetVoicesV2Response, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def replicate_to_isolated_environment( + self, + voice_id: str, + *, + target_workspace_id: str, + preserve_voice_id: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ReplicateVoiceToIsolatedEnvironmentResponseModel]: + """ + Replicates an Instant Voice Clone or Voice Design voice to a workspace in a different data residency. The target workspace must belong to the same consolidated billing group. The user must have VOICES_WRITE in the source workspace, and be an admin on the source voice. Human users (i.e. not service accounts) must also have VOICES_WRITE in the target workspace. This endpoint is available on the central environment only. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + target_workspace_id : str + ID of the workspace to replicate the voice into. It must belong to the same consolidated billing group as the calling workspace; the target's data residency is derived from that link. + + preserve_voice_id : typing.Optional[bool] + When true (default) the replicated voice keeps the same voice ID in the target residency; set to false to assign a new voice ID. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ReplicateVoiceToIsolatedEnvironmentResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/replicate-to-isolated-environment", + method="POST", + json={ + "target_workspace_id": target_workspace_id, + "preserve_voice_id": preserve_voice_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ReplicateVoiceToIsolatedEnvironmentResponseModel, + construct_type( + type_=ReplicateVoiceToIsolatedEnvironmentResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def share( + self, + public_user_id: str, + voice_id: str, + *, + new_name: str, + bookmarked: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddVoiceResponseModel]: + """ + Add a shared voice to your collection of Voices + + Parameters + ---------- + public_user_id : str + Public user ID used to publicly identify ElevenLabs users. + + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + new_name : str + The name that identifies this voice. This will be displayed in the dropdown of the website. + + bookmarked : typing.Optional[bool] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddVoiceResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/add/{jsonable_encoder(public_user_id)}/{jsonable_encoder(voice_id)}", + method="POST", + json={ + "new_name": new_name, + "bookmarked": bookmarked, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddVoiceResponseModel, + construct_type( + type_=AddVoiceResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def find_similar_voices( + self, + *, + audio_file: typing.Optional[core.File] = OMIT, + similarity_threshold: typing.Optional[float] = OMIT, + top_k: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetLibraryVoicesResponse]: + """ + Returns a list of shared voices similar to the provided audio sample. If neither similarity_threshold nor top_k is provided, we will apply default values. + + Parameters + ---------- + audio_file : typing.Optional[core.File] + See core.File for more documentation + + similarity_threshold : typing.Optional[float] + Threshold for voice similarity between provided sample and library voices. Values range from 0 to 2. The smaller the value the more similar voices will be returned. + + top_k : typing.Optional[int] + Number of most similar voices to return. If similarity_threshold is provided, less than this number of voices may be returned. Values range from 1 to 100. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetLibraryVoicesResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/similar-voices", + method="POST", + data={ + "similarity_threshold": similarity_threshold, + "top_k": top_k, + }, + files={ + **({"audio_file": audio_file} if audio_file is not None else {}), + }, + request_options=request_options, + omit=OMIT, + force_multipart=True, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetLibraryVoicesResponse, + construct_type( + type_=GetLibraryVoicesResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get_shared( + self, + *, + page_size: typing.Optional[int] = None, + category: typing.Optional[VoicesGetSharedRequestCategory] = None, + gender: typing.Optional[str] = None, + age: typing.Optional[str] = None, + accent: typing.Optional[str] = None, + language: typing.Optional[str] = None, + locale: typing.Optional[str] = None, + search: typing.Optional[str] = None, + use_cases: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + descriptives: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None, + featured: typing.Optional[bool] = None, + min_notice_period_days: typing.Optional[int] = None, + include_custom_rates: typing.Optional[bool] = None, + include_live_moderated: typing.Optional[bool] = None, + reader_app_enabled: typing.Optional[bool] = None, + owner_id: typing.Optional[str] = None, + sort: typing.Optional[VoicesGetSharedRequestSort] = None, + page: typing.Optional[int] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[GetLibraryVoicesResponse]: + """ + Retrieves a list of shared voices. + + Parameters + ---------- + page_size : typing.Optional[int] + How many shared voices to return at maximum. Can not exceed 100, defaults to 30. + + category : typing.Optional[VoicesGetSharedRequestCategory] + Voice category used for filtering + + gender : typing.Optional[str] + Gender used for filtering + + age : typing.Optional[str] + Age used for filtering + + accent : typing.Optional[str] + Accent used for filtering + + language : typing.Optional[str] + Language used for filtering + + locale : typing.Optional[str] + Locale used for filtering + + search : typing.Optional[str] + Search term used for filtering + + use_cases : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Use-case used for filtering + + descriptives : typing.Optional[typing.Union[str, typing.Sequence[str]]] + Search term used for filtering + + featured : typing.Optional[bool] + Filter featured voices + + min_notice_period_days : typing.Optional[int] + Filter voices with a minimum notice period of the given number of days. + + include_custom_rates : typing.Optional[bool] + Include/exclude voices with custom rates + + include_live_moderated : typing.Optional[bool] + Include/exclude voices that are live moderated + + reader_app_enabled : typing.Optional[bool] + Filter voices that are enabled for the reader app + + owner_id : typing.Optional[str] + Filter voices by public owner ID + + sort : typing.Optional[VoicesGetSharedRequestSort] + Sort criteria. Must be one of: created_date, usage_character_count_1y, trending, cloned_by_count. + + page : typing.Optional[int] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[GetLibraryVoicesResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/shared-voices", + method="GET", + params={ + "page_size": page_size, + "category": category, + "gender": gender, + "age": age, + "accent": accent, + "language": language, + "locale": locale, + "search": search, + "use_cases": use_cases, + "descriptives": descriptives, + "featured": featured, + "min_notice_period_days": min_notice_period_days, + "include_custom_rates": include_custom_rates, + "include_live_moderated": include_live_moderated, + "reader_app_enabled": reader_app_enabled, + "owner_id": owner_id, + "sort": sort, + "page": page, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + GetLibraryVoicesResponse, + construct_type( + type_=GetLibraryVoicesResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/samples/__init__.py b/data/src/elevenlabs/voices/samples/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6ac40397b5dbaec362dedeb20f4fb0cf9100c85d --- /dev/null +++ b/data/src/elevenlabs/voices/samples/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import audio +_dynamic_imports: typing.Dict[str, str] = {"audio": ".audio"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["audio"] diff --git a/data/src/elevenlabs/voices/samples/audio/__init__.py b/data/src/elevenlabs/voices/samples/audio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/voices/samples/audio/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/voices/samples/audio/client.py b/data/src/elevenlabs/voices/samples/audio/client.py new file mode 100644 index 0000000000000000000000000000000000000000..ef285dd3526749785ff7fe441c12f2a4a8f08e78 --- /dev/null +++ b/data/src/elevenlabs/voices/samples/audio/client.py @@ -0,0 +1,122 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from .raw_client import AsyncRawAudioClient, RawAudioClient + + +class AudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAudioClient + """ + return self._raw_client + + def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[bytes]: + """ + Returns the audio corresponding to a sample attached to a voice. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + sample_id : str + ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[bytes] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.samples.audio.get( + voice_id="voice_id", + sample_id="sample_id", + ) + """ + with self._raw_client.get(voice_id, sample_id, request_options=request_options) as r: + yield from r.data + + +class AsyncAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAudioClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAudioClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAudioClient + """ + return self._raw_client + + async def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[bytes]: + """ + Returns the audio corresponding to a sample attached to a voice. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + sample_id : str + ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[bytes] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.samples.audio.get( + voice_id="voice_id", + sample_id="sample_id", + ) + + + asyncio.run(main()) + """ + async with self._raw_client.get(voice_id, sample_id, request_options=request_options) as r: + async for _chunk in r.data: + yield _chunk diff --git a/data/src/elevenlabs/voices/samples/audio/raw_client.py b/data/src/elevenlabs/voices/samples/audio/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..02972bae62f46d81c4dfb6a9e7e254d2df319949 --- /dev/null +++ b/data/src/elevenlabs/voices/samples/audio/raw_client.py @@ -0,0 +1,154 @@ +# This file was auto-generated by Fern from our API Definition. + +import contextlib +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from pydantic import ValidationError + + +class RawAudioClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.contextmanager + def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Iterator[HttpResponse[typing.Iterator[bytes]]]: + """ + Returns the audio corresponding to a sample attached to a voice. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + sample_id : str + ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.Iterator[HttpResponse[typing.Iterator[bytes]]] + Successful Response + """ + with self._client_wrapper.httpx_client.stream( + f"v1/voices/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/audio", + method="GET", + request_options=request_options, + ) as _response: + + def _stream() -> HttpResponse[typing.Iterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return HttpResponse( + response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size)) + ) + _response.read() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield _stream() + + +class AsyncRawAudioClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + @contextlib.asynccontextmanager + async def get( + self, voice_id: str, sample_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]]: + """ + Returns the audio corresponding to a sample attached to a voice. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + sample_id : str + ID of the sample to be used. You can use the [Get voices](/docs/api-reference/voices/get) endpoint list all the available samples for a voice. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response. + + Returns + ------- + typing.AsyncIterator[AsyncHttpResponse[typing.AsyncIterator[bytes]]] + Successful Response + """ + async with self._client_wrapper.httpx_client.stream( + f"v1/voices/{jsonable_encoder(voice_id)}/samples/{jsonable_encoder(sample_id)}/audio", + method="GET", + request_options=request_options, + ) as _response: + + async def _stream() -> AsyncHttpResponse[typing.AsyncIterator[bytes]]: + try: + if 200 <= _response.status_code < 300: + _chunk_size = request_options.get("chunk_size", 1024) if request_options is not None else 1024 + return AsyncHttpResponse( + response=_response, + data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)), + ) + await _response.aread() + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.text + ) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, + headers=dict(_response.headers), + body=_response.json(), + cause=e, + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + yield await _stream() diff --git a/data/src/elevenlabs/voices/samples/client.py b/data/src/elevenlabs/voices/samples/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a43675dc01474d2b0fb32f18cb9d7ae10058c7c2 --- /dev/null +++ b/data/src/elevenlabs/voices/samples/client.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .raw_client import AsyncRawSamplesClient, RawSamplesClient + +if typing.TYPE_CHECKING: + from .audio.client import AsyncAudioClient, AudioClient + + +class SamplesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSamplesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audio: typing.Optional[AudioClient] = None + + @property + def with_raw_response(self) -> RawSamplesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSamplesClient + """ + return self._raw_client + + @property + def audio(self): + if self._audio is None: + from .audio.client import AudioClient # noqa: E402 + + self._audio = AudioClient(client_wrapper=self._client_wrapper) + return self._audio + + +class AsyncSamplesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSamplesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audio: typing.Optional[AsyncAudioClient] = None + + @property + def with_raw_response(self) -> AsyncRawSamplesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSamplesClient + """ + return self._raw_client + + @property + def audio(self): + if self._audio is None: + from .audio.client import AsyncAudioClient # noqa: E402 + + self._audio = AsyncAudioClient(client_wrapper=self._client_wrapper) + return self._audio diff --git a/data/src/elevenlabs/voices/samples/raw_client.py b/data/src/elevenlabs/voices/samples/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..0e04d98f8a0fa9db9453fa297300aeb1ce4677ec --- /dev/null +++ b/data/src/elevenlabs/voices/samples/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawSamplesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawSamplesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/data/src/elevenlabs/voices/settings/__init__.py b/data/src/elevenlabs/voices/settings/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/voices/settings/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/voices/settings/client.py b/data/src/elevenlabs/voices/settings/client.py new file mode 100644 index 0000000000000000000000000000000000000000..453408fa9e62accc19ee4c8a96afca47e780b1c1 --- /dev/null +++ b/data/src/elevenlabs/voices/settings/client.py @@ -0,0 +1,266 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.edit_voice_settings_response_model import EditVoiceSettingsResponseModel +from ...types.voice_settings import VoiceSettings +from .raw_client import AsyncRawSettingsClient, RawSettingsClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class SettingsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawSettingsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawSettingsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawSettingsClient + """ + return self._raw_client + + def get_default(self, *, request_options: typing.Optional[RequestOptions] = None) -> VoiceSettings: + """ + Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceSettings + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.settings.get_default() + """ + _response = self._raw_client.get_default(request_options=request_options) + return _response.data + + def get(self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> VoiceSettings: + """ + Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceSettings + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.settings.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + """ + _response = self._raw_client.get(voice_id, request_options=request_options) + return _response.data + + def update( + self, voice_id: str, *, request: VoiceSettings, request_options: typing.Optional[RequestOptions] = None + ) -> EditVoiceSettingsResponseModel: + """ + Edit your settings for a specific voice. "similarity_boost" corresponds to "Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + request : VoiceSettings + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditVoiceSettingsResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, VoiceSettings + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.voices.settings.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + request=VoiceSettings( + stability=1.0, + use_speaker_boost=True, + similarity_boost=1.0, + style=0.0, + speed=1.0, + ), + ) + """ + _response = self._raw_client.update(voice_id, request=request, request_options=request_options) + return _response.data + + +class AsyncSettingsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawSettingsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawSettingsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawSettingsClient + """ + return self._raw_client + + async def get_default(self, *, request_options: typing.Optional[RequestOptions] = None) -> VoiceSettings: + """ + Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceSettings + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.settings.get_default() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_default(request_options=request_options) + return _response.data + + async def get(self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> VoiceSettings: + """ + Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + VoiceSettings + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.settings.get( + voice_id="21m00Tcm4TlvDq8ikWAM", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get(voice_id, request_options=request_options) + return _response.data + + async def update( + self, voice_id: str, *, request: VoiceSettings, request_options: typing.Optional[RequestOptions] = None + ) -> EditVoiceSettingsResponseModel: + """ + Edit your settings for a specific voice. "similarity_boost" corresponds to "Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + request : VoiceSettings + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + EditVoiceSettingsResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, VoiceSettings + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.voices.settings.update( + voice_id="21m00Tcm4TlvDq8ikWAM", + request=VoiceSettings( + stability=1.0, + use_speaker_boost=True, + similarity_boost=1.0, + style=0.0, + speed=1.0, + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(voice_id, request=request, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/voices/settings/raw_client.py b/data/src/elevenlabs/voices/settings/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..9aa78e5cd8bcbc011f347cc296b27bce918086f2 --- /dev/null +++ b/data/src/elevenlabs/voices/settings/raw_client.py @@ -0,0 +1,338 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.edit_voice_settings_response_model import EditVoiceSettingsResponseModel +from ...types.voice_settings import VoiceSettings +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawSettingsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_default(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[VoiceSettings]: + """ + Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[VoiceSettings] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/voices/settings/default", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceSettings, + construct_type( + type_=VoiceSettings, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def get( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[VoiceSettings]: + """ + Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[VoiceSettings] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceSettings, + construct_type( + type_=VoiceSettings, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, voice_id: str, *, request: VoiceSettings, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[EditVoiceSettingsResponseModel]: + """ + Edit your settings for a specific voice. "similarity_boost" corresponds to "Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + request : VoiceSettings + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[EditVoiceSettingsResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/settings/edit", + method="POST", + json=convert_and_respect_annotation_metadata(object_=request, annotation=VoiceSettings, direction="write"), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditVoiceSettingsResponseModel, + construct_type( + type_=EditVoiceSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawSettingsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_default( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[VoiceSettings]: + """ + Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[VoiceSettings] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/voices/settings/default", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceSettings, + construct_type( + type_=VoiceSettings, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def get( + self, voice_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[VoiceSettings]: + """ + Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + voice_id : str + Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[VoiceSettings] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/settings", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + VoiceSettings, + construct_type( + type_=VoiceSettings, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, voice_id: str, *, request: VoiceSettings, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[EditVoiceSettingsResponseModel]: + """ + Edit your settings for a specific voice. "similarity_boost" corresponds to "Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app. + + Parameters + ---------- + voice_id : str + ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices. + + request : VoiceSettings + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[EditVoiceSettingsResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/voices/{jsonable_encoder(voice_id)}/settings/edit", + method="POST", + json=convert_and_respect_annotation_metadata(object_=request, annotation=VoiceSettings, direction="write"), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + EditVoiceSettingsResponseModel, + construct_type( + type_=EditVoiceSettingsResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/voices/types/__init__.py b/data/src/elevenlabs/voices/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7f42c6cbc6c84fa1c6fa7f5f702f464aaae79b54 --- /dev/null +++ b/data/src/elevenlabs/voices/types/__init__.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .edit_voice_request_labels import EditVoiceRequestLabels + from .voices_get_shared_request_category import VoicesGetSharedRequestCategory + from .voices_get_shared_request_sort import VoicesGetSharedRequestSort +_dynamic_imports: typing.Dict[str, str] = { + "EditVoiceRequestLabels": ".edit_voice_request_labels", + "VoicesGetSharedRequestCategory": ".voices_get_shared_request_category", + "VoicesGetSharedRequestSort": ".voices_get_shared_request_sort", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["EditVoiceRequestLabels", "VoicesGetSharedRequestCategory", "VoicesGetSharedRequestSort"] diff --git a/data/src/elevenlabs/voices/types/edit_voice_request_labels.py b/data/src/elevenlabs/voices/types/edit_voice_request_labels.py new file mode 100644 index 0000000000000000000000000000000000000000..e8bdf1cb9adb5e3c1b14444f0e25ab5817fe2cc5 --- /dev/null +++ b/data/src/elevenlabs/voices/types/edit_voice_request_labels.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +EditVoiceRequestLabels = typing.Union[typing.Dict[str, str], str] diff --git a/data/src/elevenlabs/voices/types/voices_get_shared_request_category.py b/data/src/elevenlabs/voices/types/voices_get_shared_request_category.py new file mode 100644 index 0000000000000000000000000000000000000000..b4b501f3cfce0aaf967f4c7bc2d47b0a2177964f --- /dev/null +++ b/data/src/elevenlabs/voices/types/voices_get_shared_request_category.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoicesGetSharedRequestCategory = typing.Union[typing.Literal["professional", "famous", "high_quality"], typing.Any] diff --git a/data/src/elevenlabs/voices/types/voices_get_shared_request_sort.py b/data/src/elevenlabs/voices/types/voices_get_shared_request_sort.py new file mode 100644 index 0000000000000000000000000000000000000000..84ed7441dd135975e9200802c16475533e339beb --- /dev/null +++ b/data/src/elevenlabs/voices/types/voices_get_shared_request_sort.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +VoicesGetSharedRequestSort = typing.Union[ + typing.Literal["created_date", "usage_character_count_1y", "trending", "cloned_by_count"], typing.Any +] diff --git a/data/src/elevenlabs/webhooks/__init__.py b/data/src/elevenlabs/webhooks/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/webhooks/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/webhooks/client.py b/data/src/elevenlabs/webhooks/client.py new file mode 100644 index 0000000000000000000000000000000000000000..d842f79286b6e8079e310003e33dce53944048f8 --- /dev/null +++ b/data/src/elevenlabs/webhooks/client.py @@ -0,0 +1,416 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from ..types.delete_workspace_webhook_response_model import DeleteWorkspaceWebhookResponseModel +from ..types.patch_workspace_webhook_response_model import PatchWorkspaceWebhookResponseModel +from ..types.webhook_hmac_settings import WebhookHmacSettings +from ..types.workspace_create_webhook_response_model import WorkspaceCreateWebhookResponseModel +from ..types.workspace_webhook_event_type import WorkspaceWebhookEventType +from ..types.workspace_webhook_list_response_model import WorkspaceWebhookListResponseModel +from .raw_client import AsyncRawWebhooksClient, RawWebhooksClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class WebhooksClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawWebhooksClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawWebhooksClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawWebhooksClient + """ + return self._raw_client + + def list( + self, *, include_usages: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> WorkspaceWebhookListResponseModel: + """ + List all webhooks for a workspace + + Parameters + ---------- + include_usages : typing.Optional[bool] + Whether to include active usages of the webhook, only usable by admins + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceWebhookListResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.webhooks.list( + include_usages=False, + ) + """ + _response = self._raw_client.list(include_usages=include_usages, request_options=request_options) + return _response.data + + def create( + self, *, settings: WebhookHmacSettings, request_options: typing.Optional[RequestOptions] = None + ) -> WorkspaceCreateWebhookResponseModel: + """ + Create a new webhook for the workspace with the specified authentication type. + + Parameters + ---------- + settings : WebhookHmacSettings + Webhook settings object containing auth_type and corresponding configuration + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceCreateWebhookResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs, WebhookHmacSettings + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.webhooks.create( + settings=WebhookHmacSettings( + name="name", + webhook_url="webhook_url", + ), + ) + """ + _response = self._raw_client.create(settings=settings, request_options=request_options) + return _response.data + + def delete( + self, webhook_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteWorkspaceWebhookResponseModel: + """ + Delete the specified workspace webhook + + Parameters + ---------- + webhook_id : str + The unique ID for the webhook + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteWorkspaceWebhookResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.webhooks.delete( + webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K", + ) + """ + _response = self._raw_client.delete(webhook_id, request_options=request_options) + return _response.data + + def update( + self, + webhook_id: str, + *, + is_disabled: bool, + name: str, + retry_enabled: typing.Optional[bool] = OMIT, + request_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + events: typing.Optional[typing.Sequence[WorkspaceWebhookEventType]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PatchWorkspaceWebhookResponseModel: + """ + Update the specified workspace webhook + + Parameters + ---------- + webhook_id : str + The unique ID for the webhook + + is_disabled : bool + Whether to disable or enable the webhook + + name : str + The display name of the webhook (used for display purposes only). + + retry_enabled : typing.Optional[bool] + Whether to enable automatic retries for transient failures (5xx, 429, timeout) + + request_headers : typing.Optional[typing.Dict[str, typing.Optional[str]]] + A list of request headers to include with the webhook delivery (optional) + + events : typing.Optional[typing.Sequence[WorkspaceWebhookEventType]] + The complete set of workspace-level events this webhook should be subscribed to. The webhook is added to the events in the list and removed from any not in the list. Omit to leave the current event subscriptions unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PatchWorkspaceWebhookResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.webhooks.update( + webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K", + is_disabled=True, + name="My Callback Webhook", + ) + """ + _response = self._raw_client.update( + webhook_id, + is_disabled=is_disabled, + name=name, + retry_enabled=retry_enabled, + request_headers=request_headers, + events=events, + request_options=request_options, + ) + return _response.data + + +class AsyncWebhooksClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawWebhooksClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawWebhooksClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawWebhooksClient + """ + return self._raw_client + + async def list( + self, *, include_usages: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> WorkspaceWebhookListResponseModel: + """ + List all webhooks for a workspace + + Parameters + ---------- + include_usages : typing.Optional[bool] + Whether to include active usages of the webhook, only usable by admins + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceWebhookListResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.webhooks.list( + include_usages=False, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(include_usages=include_usages, request_options=request_options) + return _response.data + + async def create( + self, *, settings: WebhookHmacSettings, request_options: typing.Optional[RequestOptions] = None + ) -> WorkspaceCreateWebhookResponseModel: + """ + Create a new webhook for the workspace with the specified authentication type. + + Parameters + ---------- + settings : WebhookHmacSettings + Webhook settings object containing auth_type and corresponding configuration + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceCreateWebhookResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs, WebhookHmacSettings + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.webhooks.create( + settings=WebhookHmacSettings( + name="name", + webhook_url="webhook_url", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(settings=settings, request_options=request_options) + return _response.data + + async def delete( + self, webhook_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteWorkspaceWebhookResponseModel: + """ + Delete the specified workspace webhook + + Parameters + ---------- + webhook_id : str + The unique ID for the webhook + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteWorkspaceWebhookResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.webhooks.delete( + webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(webhook_id, request_options=request_options) + return _response.data + + async def update( + self, + webhook_id: str, + *, + is_disabled: bool, + name: str, + retry_enabled: typing.Optional[bool] = OMIT, + request_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + events: typing.Optional[typing.Sequence[WorkspaceWebhookEventType]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> PatchWorkspaceWebhookResponseModel: + """ + Update the specified workspace webhook + + Parameters + ---------- + webhook_id : str + The unique ID for the webhook + + is_disabled : bool + Whether to disable or enable the webhook + + name : str + The display name of the webhook (used for display purposes only). + + retry_enabled : typing.Optional[bool] + Whether to enable automatic retries for transient failures (5xx, 429, timeout) + + request_headers : typing.Optional[typing.Dict[str, typing.Optional[str]]] + A list of request headers to include with the webhook delivery (optional) + + events : typing.Optional[typing.Sequence[WorkspaceWebhookEventType]] + The complete set of workspace-level events this webhook should be subscribed to. The webhook is added to the events in the list and removed from any not in the list. Omit to leave the current event subscriptions unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + PatchWorkspaceWebhookResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.webhooks.update( + webhook_id="G007vmtq9uWYl7SUW9zGS8GZZa1K", + is_disabled=True, + name="My Callback Webhook", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + webhook_id, + is_disabled=is_disabled, + name=name, + retry_enabled=retry_enabled, + request_headers=request_headers, + events=events, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/webhooks/raw_client.py b/data/src/elevenlabs/webhooks/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..67e476eb14db30315e6fb3c86c7e38768f06b073 --- /dev/null +++ b/data/src/elevenlabs/webhooks/raw_client.py @@ -0,0 +1,558 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.jsonable_encoder import jsonable_encoder +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.serialization import convert_and_respect_annotation_metadata +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from ..types.delete_workspace_webhook_response_model import DeleteWorkspaceWebhookResponseModel +from ..types.patch_workspace_webhook_response_model import PatchWorkspaceWebhookResponseModel +from ..types.webhook_hmac_settings import WebhookHmacSettings +from ..types.workspace_create_webhook_response_model import WorkspaceCreateWebhookResponseModel +from ..types.workspace_webhook_event_type import WorkspaceWebhookEventType +from ..types.workspace_webhook_list_response_model import WorkspaceWebhookListResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawWebhooksClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, include_usages: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[WorkspaceWebhookListResponseModel]: + """ + List all webhooks for a workspace + + Parameters + ---------- + include_usages : typing.Optional[bool] + Whether to include active usages of the webhook, only usable by admins + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceWebhookListResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/webhooks", + method="GET", + params={ + "include_usages": include_usages, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceWebhookListResponseModel, + construct_type( + type_=WorkspaceWebhookListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, settings: WebhookHmacSettings, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[WorkspaceCreateWebhookResponseModel]: + """ + Create a new webhook for the workspace with the specified authentication type. + + Parameters + ---------- + settings : WebhookHmacSettings + Webhook settings object containing auth_type and corresponding configuration + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceCreateWebhookResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/webhooks", + method="POST", + json={ + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=WebhookHmacSettings, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceCreateWebhookResponseModel, + construct_type( + type_=WorkspaceCreateWebhookResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, webhook_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteWorkspaceWebhookResponseModel]: + """ + Delete the specified workspace webhook + + Parameters + ---------- + webhook_id : str + The unique ID for the webhook + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteWorkspaceWebhookResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/webhooks/{jsonable_encoder(webhook_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteWorkspaceWebhookResponseModel, + construct_type( + type_=DeleteWorkspaceWebhookResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + webhook_id: str, + *, + is_disabled: bool, + name: str, + retry_enabled: typing.Optional[bool] = OMIT, + request_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + events: typing.Optional[typing.Sequence[WorkspaceWebhookEventType]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[PatchWorkspaceWebhookResponseModel]: + """ + Update the specified workspace webhook + + Parameters + ---------- + webhook_id : str + The unique ID for the webhook + + is_disabled : bool + Whether to disable or enable the webhook + + name : str + The display name of the webhook (used for display purposes only). + + retry_enabled : typing.Optional[bool] + Whether to enable automatic retries for transient failures (5xx, 429, timeout) + + request_headers : typing.Optional[typing.Dict[str, typing.Optional[str]]] + A list of request headers to include with the webhook delivery (optional) + + events : typing.Optional[typing.Sequence[WorkspaceWebhookEventType]] + The complete set of workspace-level events this webhook should be subscribed to. The webhook is added to the events in the list and removed from any not in the list. Omit to leave the current event subscriptions unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[PatchWorkspaceWebhookResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/webhooks/{jsonable_encoder(webhook_id)}", + method="PATCH", + json={ + "is_disabled": is_disabled, + "name": name, + "retry_enabled": retry_enabled, + "request_headers": request_headers, + "events": events, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PatchWorkspaceWebhookResponseModel, + construct_type( + type_=PatchWorkspaceWebhookResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawWebhooksClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, include_usages: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[WorkspaceWebhookListResponseModel]: + """ + List all webhooks for a workspace + + Parameters + ---------- + include_usages : typing.Optional[bool] + Whether to include active usages of the webhook, only usable by admins + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceWebhookListResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/webhooks", + method="GET", + params={ + "include_usages": include_usages, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceWebhookListResponseModel, + construct_type( + type_=WorkspaceWebhookListResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, settings: WebhookHmacSettings, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[WorkspaceCreateWebhookResponseModel]: + """ + Create a new webhook for the workspace with the specified authentication type. + + Parameters + ---------- + settings : WebhookHmacSettings + Webhook settings object containing auth_type and corresponding configuration + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceCreateWebhookResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/webhooks", + method="POST", + json={ + "settings": convert_and_respect_annotation_metadata( + object_=settings, annotation=WebhookHmacSettings, direction="write" + ), + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceCreateWebhookResponseModel, + construct_type( + type_=WorkspaceCreateWebhookResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, webhook_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteWorkspaceWebhookResponseModel]: + """ + Delete the specified workspace webhook + + Parameters + ---------- + webhook_id : str + The unique ID for the webhook + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteWorkspaceWebhookResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/webhooks/{jsonable_encoder(webhook_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteWorkspaceWebhookResponseModel, + construct_type( + type_=DeleteWorkspaceWebhookResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + webhook_id: str, + *, + is_disabled: bool, + name: str, + retry_enabled: typing.Optional[bool] = OMIT, + request_headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT, + events: typing.Optional[typing.Sequence[WorkspaceWebhookEventType]] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[PatchWorkspaceWebhookResponseModel]: + """ + Update the specified workspace webhook + + Parameters + ---------- + webhook_id : str + The unique ID for the webhook + + is_disabled : bool + Whether to disable or enable the webhook + + name : str + The display name of the webhook (used for display purposes only). + + retry_enabled : typing.Optional[bool] + Whether to enable automatic retries for transient failures (5xx, 429, timeout) + + request_headers : typing.Optional[typing.Dict[str, typing.Optional[str]]] + A list of request headers to include with the webhook delivery (optional) + + events : typing.Optional[typing.Sequence[WorkspaceWebhookEventType]] + The complete set of workspace-level events this webhook should be subscribed to. The webhook is added to the events in the list and removed from any not in the list. Omit to leave the current event subscriptions unchanged. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[PatchWorkspaceWebhookResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/webhooks/{jsonable_encoder(webhook_id)}", + method="PATCH", + json={ + "is_disabled": is_disabled, + "name": name, + "retry_enabled": retry_enabled, + "request_headers": request_headers, + "events": events, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + PatchWorkspaceWebhookResponseModel, + construct_type( + type_=PatchWorkspaceWebhookResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/webhooks_custom.py b/data/src/elevenlabs/webhooks_custom.py new file mode 100644 index 0000000000000000000000000000000000000000..868cbe99dcdf4d38befdef568b9c0966e31350c3 --- /dev/null +++ b/data/src/elevenlabs/webhooks_custom.py @@ -0,0 +1,137 @@ +import json +import hmac +import hashlib +import time +from typing import Any, Dict +from .types.bad_request_error_body import BadRequestErrorBody +from .errors import BadRequestError +from .webhooks.client import WebhooksClient as AutogeneratedWebhooksClient, AsyncWebhooksClient as AutogeneratedAsyncWebhooksClient + + +class WebhooksClient(AutogeneratedWebhooksClient): + """ + A client to handle ElevenLabs webhook-related functionality + Extends the autogenerated client to include custom webhook methods + """ + + def construct_event(self, rawBody: str, sig_header: str, secret: str) -> Dict: + """ + Constructs a webhook event object from a payload and signature. + Verifies the webhook signature to ensure the event came from ElevenLabs. + + Args: + rawBody: The webhook request body. Must be the raw body, not a JSON object + sig_header: The signature header from the request + secret: Your webhook secret + + Returns: + The verified webhook event + + Raises: + BadRequestError: If the signature is invalid or missing + """ + + if not sig_header: + raise BadRequestError(body=BadRequestErrorBody(error="Missing signature header")) + + if not secret: + raise BadRequestError(body=BadRequestErrorBody(error="Webhook secret not configured")) + + headers = sig_header.split(',') + timestamp = None + signature = None + + for header in headers: + if header.startswith('t='): + timestamp = header[2:] + elif header.startswith('v0='): + signature = header + + if not timestamp or not signature: + raise BadRequestError(body=BadRequestErrorBody(error="No signature hash found with expected scheme v0")) + + # Validate timestamp + req_timestamp = int(timestamp) * 1000 + tolerance = int(time.time() * 1000) - 30 * 60 * 1000 + if req_timestamp < tolerance: + raise BadRequestError(body=BadRequestErrorBody(error="Timestamp outside the tolerance zone")) + + # Validate hash + message = f"{timestamp}.{rawBody}" + + digest = "v0=" + hmac.new( + secret.encode('utf-8'), + message.encode('utf-8'), + hashlib.sha256 + ).hexdigest() + + if signature != digest: + raise BadRequestError( + body=BadRequestErrorBody(error="Signature hash does not match the expected signature hash for payload") + ) + + return json.loads(rawBody) + + +class AsyncWebhooksClient(AutogeneratedAsyncWebhooksClient): + """ + Async version of WebhooksClient that extends the autogenerated async client + """ + + def construct_event(self, rawBody: str, sig_header: str, secret: str) -> Dict: + """ + Constructs a webhook event object from a payload and signature. + Verifies the webhook signature to ensure the event came from ElevenLabs. + + Args: + rawBody: The webhook request body. Must be the raw body, not a JSON object + sig_header: The signature header from the request + secret: Your webhook secret + + Returns: + The verified webhook event + + Raises: + BadRequestError: If the signature is invalid or missing + """ + + if not sig_header: + raise BadRequestError(body=BadRequestErrorBody(error="Missing signature header")) + + if not secret: + raise BadRequestError(body=BadRequestErrorBody(error="Webhook secret not configured")) + + headers = sig_header.split(',') + timestamp = None + signature = None + + for header in headers: + if header.startswith('t='): + timestamp = header[2:] + elif header.startswith('v0='): + signature = header + + if not timestamp or not signature: + raise BadRequestError(body=BadRequestErrorBody(error="No signature hash found with expected scheme v0")) + + # Validate timestamp + req_timestamp = int(timestamp) * 1000 + tolerance = int(time.time() * 1000) - 30 * 60 * 1000 + if req_timestamp < tolerance: + raise BadRequestError(body=BadRequestErrorBody(error="Timestamp outside the tolerance zone")) + + # Validate hash + message = f"{timestamp}.{rawBody}" + + digest = "v0=" + hmac.new( + secret.encode('utf-8'), + message.encode('utf-8'), + hashlib.sha256 + ).hexdigest() + + if signature != digest: + raise BadRequestError( + body=BadRequestErrorBody(error="Signature hash does not match the expected signature hash for payload") + ) + + return json.loads(rawBody) diff --git a/data/src/elevenlabs/workspace/__init__.py b/data/src/elevenlabs/workspace/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4e309a945d13b4da4c8ec2fe4e71913056079fb9 --- /dev/null +++ b/data/src/elevenlabs/workspace/__init__.py @@ -0,0 +1,183 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .resources import BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole + from . import analytics, audit_logs, auth_connections, groups, invites, members, resources, usage + from .auth_connections import ( + AuthConnectionsCreateRequestBody, + AuthConnectionsCreateRequestBody_BasicAuth, + AuthConnectionsCreateRequestBody_BearerAuth, + AuthConnectionsCreateRequestBody_CustomHeaderAuth, + AuthConnectionsCreateRequestBody_Mtls, + AuthConnectionsCreateRequestBody_Oauth2ClientCredentials, + AuthConnectionsCreateRequestBody_Oauth2Jwt, + AuthConnectionsCreateRequestBody_PrivateKeyJwt, + AuthConnectionsCreateResponse, + AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode, + AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp, + AuthConnectionsCreateResponse_BasicAuth, + AuthConnectionsCreateResponse_BearerAuth, + AuthConnectionsCreateResponse_CustomHeaderAuth, + AuthConnectionsCreateResponse_Mtls, + AuthConnectionsCreateResponse_Oauth2ClientCredentials, + AuthConnectionsCreateResponse_Oauth2Jwt, + AuthConnectionsCreateResponse_PrivateKeyJwt, + AuthConnectionsCreateResponse_RefreshTokenAuth, + AuthConnectionsCreateResponse_SlackBotAuth, + AuthConnectionsCreateResponse_UrlSecret, + AuthConnectionsCreateResponse_WhatsappAuth, + AuthConnectionsUpdateRequestBody, + AuthConnectionsUpdateRequestBody_BasicAuth, + AuthConnectionsUpdateRequestBody_BearerAuth, + AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials, + AuthConnectionsUpdateRequestBody_Oauth2Jwt, + AuthConnectionsUpdateResponse, + AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode, + AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp, + AuthConnectionsUpdateResponse_BasicAuth, + AuthConnectionsUpdateResponse_BearerAuth, + AuthConnectionsUpdateResponse_CustomHeaderAuth, + AuthConnectionsUpdateResponse_Mtls, + AuthConnectionsUpdateResponse_Oauth2ClientCredentials, + AuthConnectionsUpdateResponse_Oauth2Jwt, + AuthConnectionsUpdateResponse_PrivateKeyJwt, + AuthConnectionsUpdateResponse_RefreshTokenAuth, + AuthConnectionsUpdateResponse_SlackBotAuth, + AuthConnectionsUpdateResponse_UrlSecret, + AuthConnectionsUpdateResponse_WhatsappAuth, + ) + from .usage import BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem +_dynamic_imports: typing.Dict[str, str] = { + "AuthConnectionsCreateRequestBody": ".auth_connections", + "AuthConnectionsCreateRequestBody_BasicAuth": ".auth_connections", + "AuthConnectionsCreateRequestBody_BearerAuth": ".auth_connections", + "AuthConnectionsCreateRequestBody_CustomHeaderAuth": ".auth_connections", + "AuthConnectionsCreateRequestBody_Mtls": ".auth_connections", + "AuthConnectionsCreateRequestBody_Oauth2ClientCredentials": ".auth_connections", + "AuthConnectionsCreateRequestBody_Oauth2Jwt": ".auth_connections", + "AuthConnectionsCreateRequestBody_PrivateKeyJwt": ".auth_connections", + "AuthConnectionsCreateResponse": ".auth_connections", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode": ".auth_connections", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp": ".auth_connections", + "AuthConnectionsCreateResponse_BasicAuth": ".auth_connections", + "AuthConnectionsCreateResponse_BearerAuth": ".auth_connections", + "AuthConnectionsCreateResponse_CustomHeaderAuth": ".auth_connections", + "AuthConnectionsCreateResponse_Mtls": ".auth_connections", + "AuthConnectionsCreateResponse_Oauth2ClientCredentials": ".auth_connections", + "AuthConnectionsCreateResponse_Oauth2Jwt": ".auth_connections", + "AuthConnectionsCreateResponse_PrivateKeyJwt": ".auth_connections", + "AuthConnectionsCreateResponse_RefreshTokenAuth": ".auth_connections", + "AuthConnectionsCreateResponse_SlackBotAuth": ".auth_connections", + "AuthConnectionsCreateResponse_UrlSecret": ".auth_connections", + "AuthConnectionsCreateResponse_WhatsappAuth": ".auth_connections", + "AuthConnectionsUpdateRequestBody": ".auth_connections", + "AuthConnectionsUpdateRequestBody_BasicAuth": ".auth_connections", + "AuthConnectionsUpdateRequestBody_BearerAuth": ".auth_connections", + "AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials": ".auth_connections", + "AuthConnectionsUpdateRequestBody_Oauth2Jwt": ".auth_connections", + "AuthConnectionsUpdateResponse": ".auth_connections", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode": ".auth_connections", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp": ".auth_connections", + "AuthConnectionsUpdateResponse_BasicAuth": ".auth_connections", + "AuthConnectionsUpdateResponse_BearerAuth": ".auth_connections", + "AuthConnectionsUpdateResponse_CustomHeaderAuth": ".auth_connections", + "AuthConnectionsUpdateResponse_Mtls": ".auth_connections", + "AuthConnectionsUpdateResponse_Oauth2ClientCredentials": ".auth_connections", + "AuthConnectionsUpdateResponse_Oauth2Jwt": ".auth_connections", + "AuthConnectionsUpdateResponse_PrivateKeyJwt": ".auth_connections", + "AuthConnectionsUpdateResponse_RefreshTokenAuth": ".auth_connections", + "AuthConnectionsUpdateResponse_SlackBotAuth": ".auth_connections", + "AuthConnectionsUpdateResponse_UrlSecret": ".auth_connections", + "AuthConnectionsUpdateResponse_WhatsappAuth": ".auth_connections", + "BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem": ".usage", + "BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole": ".resources", + "analytics": ".analytics", + "audit_logs": ".audit_logs", + "auth_connections": ".auth_connections", + "groups": ".groups", + "invites": ".invites", + "members": ".members", + "resources": ".resources", + "usage": ".usage", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AuthConnectionsCreateRequestBody", + "AuthConnectionsCreateRequestBody_BasicAuth", + "AuthConnectionsCreateRequestBody_BearerAuth", + "AuthConnectionsCreateRequestBody_CustomHeaderAuth", + "AuthConnectionsCreateRequestBody_Mtls", + "AuthConnectionsCreateRequestBody_Oauth2ClientCredentials", + "AuthConnectionsCreateRequestBody_Oauth2Jwt", + "AuthConnectionsCreateRequestBody_PrivateKeyJwt", + "AuthConnectionsCreateResponse", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp", + "AuthConnectionsCreateResponse_BasicAuth", + "AuthConnectionsCreateResponse_BearerAuth", + "AuthConnectionsCreateResponse_CustomHeaderAuth", + "AuthConnectionsCreateResponse_Mtls", + "AuthConnectionsCreateResponse_Oauth2ClientCredentials", + "AuthConnectionsCreateResponse_Oauth2Jwt", + "AuthConnectionsCreateResponse_PrivateKeyJwt", + "AuthConnectionsCreateResponse_RefreshTokenAuth", + "AuthConnectionsCreateResponse_SlackBotAuth", + "AuthConnectionsCreateResponse_UrlSecret", + "AuthConnectionsCreateResponse_WhatsappAuth", + "AuthConnectionsUpdateRequestBody", + "AuthConnectionsUpdateRequestBody_BasicAuth", + "AuthConnectionsUpdateRequestBody_BearerAuth", + "AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials", + "AuthConnectionsUpdateRequestBody_Oauth2Jwt", + "AuthConnectionsUpdateResponse", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp", + "AuthConnectionsUpdateResponse_BasicAuth", + "AuthConnectionsUpdateResponse_BearerAuth", + "AuthConnectionsUpdateResponse_CustomHeaderAuth", + "AuthConnectionsUpdateResponse_Mtls", + "AuthConnectionsUpdateResponse_Oauth2ClientCredentials", + "AuthConnectionsUpdateResponse_Oauth2Jwt", + "AuthConnectionsUpdateResponse_PrivateKeyJwt", + "AuthConnectionsUpdateResponse_RefreshTokenAuth", + "AuthConnectionsUpdateResponse_SlackBotAuth", + "AuthConnectionsUpdateResponse_UrlSecret", + "AuthConnectionsUpdateResponse_WhatsappAuth", + "BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem", + "BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole", + "analytics", + "audit_logs", + "auth_connections", + "groups", + "invites", + "members", + "resources", + "usage", +] diff --git a/data/src/elevenlabs/workspace/analytics/__init__.py b/data/src/elevenlabs/workspace/analytics/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d4fa27fe5b8a436c00b26a01cf70f9f41b139928 --- /dev/null +++ b/data/src/elevenlabs/workspace/analytics/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import requests + from .requests import BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort +_dynamic_imports: typing.Dict[str, str] = { + "BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort": ".requests", + "requests": ".requests", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort", "requests"] diff --git a/data/src/elevenlabs/workspace/analytics/client.py b/data/src/elevenlabs/workspace/analytics/client.py new file mode 100644 index 0000000000000000000000000000000000000000..8fc832ee221f6f00706e7c05084b6ab0929cdd50 --- /dev/null +++ b/data/src/elevenlabs/workspace/analytics/client.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .raw_client import AsyncRawAnalyticsClient, RawAnalyticsClient + +if typing.TYPE_CHECKING: + from .requests.client import AsyncRequestsClient, RequestsClient + + +class AnalyticsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAnalyticsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._requests: typing.Optional[RequestsClient] = None + + @property + def with_raw_response(self) -> RawAnalyticsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAnalyticsClient + """ + return self._raw_client + + @property + def requests(self): + if self._requests is None: + from .requests.client import RequestsClient # noqa: E402 + + self._requests = RequestsClient(client_wrapper=self._client_wrapper) + return self._requests + + +class AsyncAnalyticsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAnalyticsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._requests: typing.Optional[AsyncRequestsClient] = None + + @property + def with_raw_response(self) -> AsyncRawAnalyticsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAnalyticsClient + """ + return self._raw_client + + @property + def requests(self): + if self._requests is None: + from .requests.client import AsyncRequestsClient # noqa: E402 + + self._requests = AsyncRequestsClient(client_wrapper=self._client_wrapper) + return self._requests diff --git a/data/src/elevenlabs/workspace/analytics/raw_client.py b/data/src/elevenlabs/workspace/analytics/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..fd9456724531c129704eb0bffcabb6fd520344dd --- /dev/null +++ b/data/src/elevenlabs/workspace/analytics/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawAnalyticsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawAnalyticsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/data/src/elevenlabs/workspace/analytics/requests/__init__.py b/data/src/elevenlabs/workspace/analytics/requests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9fb05902847a9f71e3a1429a7ddad8ced1d5e2ed --- /dev/null +++ b/data/src/elevenlabs/workspace/analytics/requests/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort +_dynamic_imports: typing.Dict[str, str] = {"BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort": ".types"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort"] diff --git a/data/src/elevenlabs/workspace/analytics/requests/client.py b/data/src/elevenlabs/workspace/analytics/requests/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7c347cbea944aeeca5f9db1c4360956533203a49 --- /dev/null +++ b/data/src/elevenlabs/workspace/analytics/requests/client.py @@ -0,0 +1,173 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.column_filter import ColumnFilter +from ....types.workspace_analytics_query_response_model import WorkspaceAnalyticsQueryResponseModel +from .raw_client import AsyncRawRequestsClient, RawRequestsClient +from .types.body_list_api_requests_v_1_workspace_analytics_requests_post_sort import ( + BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort, +) + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RequestsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawRequestsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawRequestsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawRequestsClient + """ + return self._raw_client + + def get( + self, + *, + start_time: typing.Optional[int] = OMIT, + end_time: typing.Optional[int] = OMIT, + limit: typing.Optional[int] = OMIT, + sort: typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort] = OMIT, + filters: typing.Optional[typing.Sequence[ColumnFilter]] = OMIT, + search: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceAnalyticsQueryResponseModel: + """ + Returns a list of API requests. Supports filtering by time range, column filters, and search terms. At least one of start_time or end_time must be provided. An optional sort parameter controls timestamp ordering. Results are ordered by timestamp. Descending if end_time is used, ascending if start_time is used. The response is a tabular structure with columns, column_types, column_units, and rows. + + Parameters + ---------- + start_time : typing.Optional[int] + Start of the time range as a Unix timestamp in milliseconds. + + end_time : typing.Optional[int] + End of the time range as a Unix timestamp in milliseconds. + + limit : typing.Optional[int] + + sort : typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort] + Optional timestamp sort direction. If omitted, defaults to desc when end_time is provided, otherwise asc. + + filters : typing.Optional[typing.Sequence[ColumnFilter]] + + search : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceAnalyticsQueryResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.analytics.requests.get() + """ + _response = self._raw_client.get( + start_time=start_time, + end_time=end_time, + limit=limit, + sort=sort, + filters=filters, + search=search, + request_options=request_options, + ) + return _response.data + + +class AsyncRequestsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawRequestsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawRequestsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawRequestsClient + """ + return self._raw_client + + async def get( + self, + *, + start_time: typing.Optional[int] = OMIT, + end_time: typing.Optional[int] = OMIT, + limit: typing.Optional[int] = OMIT, + sort: typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort] = OMIT, + filters: typing.Optional[typing.Sequence[ColumnFilter]] = OMIT, + search: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceAnalyticsQueryResponseModel: + """ + Returns a list of API requests. Supports filtering by time range, column filters, and search terms. At least one of start_time or end_time must be provided. An optional sort parameter controls timestamp ordering. Results are ordered by timestamp. Descending if end_time is used, ascending if start_time is used. The response is a tabular structure with columns, column_types, column_units, and rows. + + Parameters + ---------- + start_time : typing.Optional[int] + Start of the time range as a Unix timestamp in milliseconds. + + end_time : typing.Optional[int] + End of the time range as a Unix timestamp in milliseconds. + + limit : typing.Optional[int] + + sort : typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort] + Optional timestamp sort direction. If omitted, defaults to desc when end_time is provided, otherwise asc. + + filters : typing.Optional[typing.Sequence[ColumnFilter]] + + search : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceAnalyticsQueryResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.analytics.requests.get() + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + start_time=start_time, + end_time=end_time, + limit=limit, + sort=sort, + filters=filters, + search=search, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/workspace/analytics/requests/raw_client.py b/data/src/elevenlabs/workspace/analytics/requests/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..d0b272a491345be6ac7cee5f35d2a2ad6fd0fa91 --- /dev/null +++ b/data/src/elevenlabs/workspace/analytics/requests/raw_client.py @@ -0,0 +1,208 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.serialization import convert_and_respect_annotation_metadata +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.column_filter import ColumnFilter +from ....types.workspace_analytics_query_response_model import WorkspaceAnalyticsQueryResponseModel +from .types.body_list_api_requests_v_1_workspace_analytics_requests_post_sort import ( + BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawRequestsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + *, + start_time: typing.Optional[int] = OMIT, + end_time: typing.Optional[int] = OMIT, + limit: typing.Optional[int] = OMIT, + sort: typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort] = OMIT, + filters: typing.Optional[typing.Sequence[ColumnFilter]] = OMIT, + search: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[WorkspaceAnalyticsQueryResponseModel]: + """ + Returns a list of API requests. Supports filtering by time range, column filters, and search terms. At least one of start_time or end_time must be provided. An optional sort parameter controls timestamp ordering. Results are ordered by timestamp. Descending if end_time is used, ascending if start_time is used. The response is a tabular structure with columns, column_types, column_units, and rows. + + Parameters + ---------- + start_time : typing.Optional[int] + Start of the time range as a Unix timestamp in milliseconds. + + end_time : typing.Optional[int] + End of the time range as a Unix timestamp in milliseconds. + + limit : typing.Optional[int] + + sort : typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort] + Optional timestamp sort direction. If omitted, defaults to desc when end_time is provided, otherwise asc. + + filters : typing.Optional[typing.Sequence[ColumnFilter]] + + search : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceAnalyticsQueryResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/analytics/requests", + method="POST", + json={ + "start_time": start_time, + "end_time": end_time, + "limit": limit, + "sort": sort, + "filters": convert_and_respect_annotation_metadata( + object_=filters, annotation=typing.Sequence[ColumnFilter], direction="write" + ), + "search": search, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceAnalyticsQueryResponseModel, + construct_type( + type_=WorkspaceAnalyticsQueryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawRequestsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + *, + start_time: typing.Optional[int] = OMIT, + end_time: typing.Optional[int] = OMIT, + limit: typing.Optional[int] = OMIT, + sort: typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort] = OMIT, + filters: typing.Optional[typing.Sequence[ColumnFilter]] = OMIT, + search: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[WorkspaceAnalyticsQueryResponseModel]: + """ + Returns a list of API requests. Supports filtering by time range, column filters, and search terms. At least one of start_time or end_time must be provided. An optional sort parameter controls timestamp ordering. Results are ordered by timestamp. Descending if end_time is used, ascending if start_time is used. The response is a tabular structure with columns, column_types, column_units, and rows. + + Parameters + ---------- + start_time : typing.Optional[int] + Start of the time range as a Unix timestamp in milliseconds. + + end_time : typing.Optional[int] + End of the time range as a Unix timestamp in milliseconds. + + limit : typing.Optional[int] + + sort : typing.Optional[BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort] + Optional timestamp sort direction. If omitted, defaults to desc when end_time is provided, otherwise asc. + + filters : typing.Optional[typing.Sequence[ColumnFilter]] + + search : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceAnalyticsQueryResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/analytics/requests", + method="POST", + json={ + "start_time": start_time, + "end_time": end_time, + "limit": limit, + "sort": sort, + "filters": convert_and_respect_annotation_metadata( + object_=filters, annotation=typing.Sequence[ColumnFilter], direction="write" + ), + "search": search, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceAnalyticsQueryResponseModel, + construct_type( + type_=WorkspaceAnalyticsQueryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/analytics/requests/types/__init__.py b/data/src/elevenlabs/workspace/analytics/requests/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7cbea0b6f8d1b19aa5e689be3e810c4f4896f59e --- /dev/null +++ b/data/src/elevenlabs/workspace/analytics/requests/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_list_api_requests_v_1_workspace_analytics_requests_post_sort import ( + BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort": ".body_list_api_requests_v_1_workspace_analytics_requests_post_sort" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort"] diff --git a/data/src/elevenlabs/workspace/analytics/requests/types/body_list_api_requests_v_1_workspace_analytics_requests_post_sort.py b/data/src/elevenlabs/workspace/analytics/requests/types/body_list_api_requests_v_1_workspace_analytics_requests_post_sort.py new file mode 100644 index 0000000000000000000000000000000000000000..fe87e7d982cd9ca86a5246e657f2e3b3309c0864 --- /dev/null +++ b/data/src/elevenlabs/workspace/analytics/requests/types/body_list_api_requests_v_1_workspace_analytics_requests_post_sort.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort = typing.Union[typing.Literal["asc", "desc"], typing.Any] diff --git a/data/src/elevenlabs/workspace/audit_logs/__init__.py b/data/src/elevenlabs/workspace/audit_logs/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/workspace/audit_logs/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/workspace/audit_logs/client.py b/data/src/elevenlabs/workspace/audit_logs/client.py new file mode 100644 index 0000000000000000000000000000000000000000..8bb7bc766e52f6e936cef01b9e33ba2afd366c26 --- /dev/null +++ b/data/src/elevenlabs/workspace/audit_logs/client.py @@ -0,0 +1,198 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.workspace_audit_logs_page_response import WorkspaceAuditLogsPageResponse +from .raw_client import AsyncRawAuditLogsClient, RawAuditLogsClient + + +class AuditLogsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAuditLogsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAuditLogsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAuditLogsClient + """ + return self._raw_client + + def list( + self, + *, + limit: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + time_from_unix_ms: typing.Optional[int] = None, + time_to_unix_ms: typing.Optional[int] = None, + actor_uid: typing.Optional[str] = None, + class_name: typing.Optional[str] = None, + activity_name: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceAuditLogsPageResponse: + """ + Returns the audit log for the workspace. Requires enterprise tier and the audit_log_read permission. + + Parameters + ---------- + limit : typing.Optional[int] + Maximum number of entries per page + + cursor : typing.Optional[str] + Cursor for the next page (from previous response) + + time_from_unix_ms : typing.Optional[int] + Only include entries at or after this time (ms since epoch) + + time_to_unix_ms : typing.Optional[int] + Only include entries at or before this time (ms since epoch) + + actor_uid : typing.Optional[str] + Filter by actor user ID + + class_name : typing.Optional[str] + Filter by OCSF event class name (e.g. Account Change) + + activity_name : typing.Optional[str] + Filter by audit activity name (e.g. Subscription Creation) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceAuditLogsPageResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.audit_logs.list( + limit=1, + cursor="cursor", + time_from_unix_ms=1, + time_to_unix_ms=1, + actor_uid="actor_uid", + class_name="class_name", + activity_name="activity_name", + ) + """ + _response = self._raw_client.list( + limit=limit, + cursor=cursor, + time_from_unix_ms=time_from_unix_ms, + time_to_unix_ms=time_to_unix_ms, + actor_uid=actor_uid, + class_name=class_name, + activity_name=activity_name, + request_options=request_options, + ) + return _response.data + + +class AsyncAuditLogsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAuditLogsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAuditLogsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAuditLogsClient + """ + return self._raw_client + + async def list( + self, + *, + limit: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + time_from_unix_ms: typing.Optional[int] = None, + time_to_unix_ms: typing.Optional[int] = None, + actor_uid: typing.Optional[str] = None, + class_name: typing.Optional[str] = None, + activity_name: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceAuditLogsPageResponse: + """ + Returns the audit log for the workspace. Requires enterprise tier and the audit_log_read permission. + + Parameters + ---------- + limit : typing.Optional[int] + Maximum number of entries per page + + cursor : typing.Optional[str] + Cursor for the next page (from previous response) + + time_from_unix_ms : typing.Optional[int] + Only include entries at or after this time (ms since epoch) + + time_to_unix_ms : typing.Optional[int] + Only include entries at or before this time (ms since epoch) + + actor_uid : typing.Optional[str] + Filter by actor user ID + + class_name : typing.Optional[str] + Filter by OCSF event class name (e.g. Account Change) + + activity_name : typing.Optional[str] + Filter by audit activity name (e.g. Subscription Creation) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceAuditLogsPageResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.audit_logs.list( + limit=1, + cursor="cursor", + time_from_unix_ms=1, + time_to_unix_ms=1, + actor_uid="actor_uid", + class_name="class_name", + activity_name="activity_name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.list( + limit=limit, + cursor=cursor, + time_from_unix_ms=time_from_unix_ms, + time_to_unix_ms=time_to_unix_ms, + actor_uid=actor_uid, + class_name=class_name, + activity_name=activity_name, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/workspace/audit_logs/raw_client.py b/data/src/elevenlabs/workspace/audit_logs/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..1ae2cdd93aba5910d3c5e93a3da45e57fc7a2400 --- /dev/null +++ b/data/src/elevenlabs/workspace/audit_logs/raw_client.py @@ -0,0 +1,204 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.workspace_audit_logs_page_response import WorkspaceAuditLogsPageResponse +from pydantic import ValidationError + + +class RawAuditLogsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, + *, + limit: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + time_from_unix_ms: typing.Optional[int] = None, + time_to_unix_ms: typing.Optional[int] = None, + actor_uid: typing.Optional[str] = None, + class_name: typing.Optional[str] = None, + activity_name: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[WorkspaceAuditLogsPageResponse]: + """ + Returns the audit log for the workspace. Requires enterprise tier and the audit_log_read permission. + + Parameters + ---------- + limit : typing.Optional[int] + Maximum number of entries per page + + cursor : typing.Optional[str] + Cursor for the next page (from previous response) + + time_from_unix_ms : typing.Optional[int] + Only include entries at or after this time (ms since epoch) + + time_to_unix_ms : typing.Optional[int] + Only include entries at or before this time (ms since epoch) + + actor_uid : typing.Optional[str] + Filter by actor user ID + + class_name : typing.Optional[str] + Filter by OCSF event class name (e.g. Account Change) + + activity_name : typing.Optional[str] + Filter by audit activity name (e.g. Subscription Creation) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceAuditLogsPageResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/audit-logs", + method="GET", + params={ + "limit": limit, + "cursor": cursor, + "time_from_unix_ms": time_from_unix_ms, + "time_to_unix_ms": time_to_unix_ms, + "actor_uid": actor_uid, + "class_name": class_name, + "activity_name": activity_name, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceAuditLogsPageResponse, + construct_type( + type_=WorkspaceAuditLogsPageResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAuditLogsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, + *, + limit: typing.Optional[int] = None, + cursor: typing.Optional[str] = None, + time_from_unix_ms: typing.Optional[int] = None, + time_to_unix_ms: typing.Optional[int] = None, + actor_uid: typing.Optional[str] = None, + class_name: typing.Optional[str] = None, + activity_name: typing.Optional[str] = None, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[WorkspaceAuditLogsPageResponse]: + """ + Returns the audit log for the workspace. Requires enterprise tier and the audit_log_read permission. + + Parameters + ---------- + limit : typing.Optional[int] + Maximum number of entries per page + + cursor : typing.Optional[str] + Cursor for the next page (from previous response) + + time_from_unix_ms : typing.Optional[int] + Only include entries at or after this time (ms since epoch) + + time_to_unix_ms : typing.Optional[int] + Only include entries at or before this time (ms since epoch) + + actor_uid : typing.Optional[str] + Filter by actor user ID + + class_name : typing.Optional[str] + Filter by OCSF event class name (e.g. Account Change) + + activity_name : typing.Optional[str] + Filter by audit activity name (e.g. Subscription Creation) + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceAuditLogsPageResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/audit-logs", + method="GET", + params={ + "limit": limit, + "cursor": cursor, + "time_from_unix_ms": time_from_unix_ms, + "time_to_unix_ms": time_to_unix_ms, + "actor_uid": actor_uid, + "class_name": class_name, + "activity_name": activity_name, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceAuditLogsPageResponse, + construct_type( + type_=WorkspaceAuditLogsPageResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/auth_connections/__init__.py b/data/src/elevenlabs/workspace/auth_connections/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4ef88efbb2ca66bf0c2ce9c0494d0c924613f9ac --- /dev/null +++ b/data/src/elevenlabs/workspace/auth_connections/__init__.py @@ -0,0 +1,160 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import ( + AuthConnectionsCreateRequestBody, + AuthConnectionsCreateRequestBody_BasicAuth, + AuthConnectionsCreateRequestBody_BearerAuth, + AuthConnectionsCreateRequestBody_CustomHeaderAuth, + AuthConnectionsCreateRequestBody_Mtls, + AuthConnectionsCreateRequestBody_Oauth2ClientCredentials, + AuthConnectionsCreateRequestBody_Oauth2Jwt, + AuthConnectionsCreateRequestBody_PrivateKeyJwt, + AuthConnectionsCreateResponse, + AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode, + AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp, + AuthConnectionsCreateResponse_BasicAuth, + AuthConnectionsCreateResponse_BearerAuth, + AuthConnectionsCreateResponse_CustomHeaderAuth, + AuthConnectionsCreateResponse_Mtls, + AuthConnectionsCreateResponse_Oauth2ClientCredentials, + AuthConnectionsCreateResponse_Oauth2Jwt, + AuthConnectionsCreateResponse_PrivateKeyJwt, + AuthConnectionsCreateResponse_RefreshTokenAuth, + AuthConnectionsCreateResponse_SlackBotAuth, + AuthConnectionsCreateResponse_UrlSecret, + AuthConnectionsCreateResponse_WhatsappAuth, + AuthConnectionsUpdateRequestBody, + AuthConnectionsUpdateRequestBody_BasicAuth, + AuthConnectionsUpdateRequestBody_BearerAuth, + AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials, + AuthConnectionsUpdateRequestBody_Oauth2Jwt, + AuthConnectionsUpdateResponse, + AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode, + AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp, + AuthConnectionsUpdateResponse_BasicAuth, + AuthConnectionsUpdateResponse_BearerAuth, + AuthConnectionsUpdateResponse_CustomHeaderAuth, + AuthConnectionsUpdateResponse_Mtls, + AuthConnectionsUpdateResponse_Oauth2ClientCredentials, + AuthConnectionsUpdateResponse_Oauth2Jwt, + AuthConnectionsUpdateResponse_PrivateKeyJwt, + AuthConnectionsUpdateResponse_RefreshTokenAuth, + AuthConnectionsUpdateResponse_SlackBotAuth, + AuthConnectionsUpdateResponse_UrlSecret, + AuthConnectionsUpdateResponse_WhatsappAuth, + ) +_dynamic_imports: typing.Dict[str, str] = { + "AuthConnectionsCreateRequestBody": ".types", + "AuthConnectionsCreateRequestBody_BasicAuth": ".types", + "AuthConnectionsCreateRequestBody_BearerAuth": ".types", + "AuthConnectionsCreateRequestBody_CustomHeaderAuth": ".types", + "AuthConnectionsCreateRequestBody_Mtls": ".types", + "AuthConnectionsCreateRequestBody_Oauth2ClientCredentials": ".types", + "AuthConnectionsCreateRequestBody_Oauth2Jwt": ".types", + "AuthConnectionsCreateRequestBody_PrivateKeyJwt": ".types", + "AuthConnectionsCreateResponse": ".types", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode": ".types", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp": ".types", + "AuthConnectionsCreateResponse_BasicAuth": ".types", + "AuthConnectionsCreateResponse_BearerAuth": ".types", + "AuthConnectionsCreateResponse_CustomHeaderAuth": ".types", + "AuthConnectionsCreateResponse_Mtls": ".types", + "AuthConnectionsCreateResponse_Oauth2ClientCredentials": ".types", + "AuthConnectionsCreateResponse_Oauth2Jwt": ".types", + "AuthConnectionsCreateResponse_PrivateKeyJwt": ".types", + "AuthConnectionsCreateResponse_RefreshTokenAuth": ".types", + "AuthConnectionsCreateResponse_SlackBotAuth": ".types", + "AuthConnectionsCreateResponse_UrlSecret": ".types", + "AuthConnectionsCreateResponse_WhatsappAuth": ".types", + "AuthConnectionsUpdateRequestBody": ".types", + "AuthConnectionsUpdateRequestBody_BasicAuth": ".types", + "AuthConnectionsUpdateRequestBody_BearerAuth": ".types", + "AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials": ".types", + "AuthConnectionsUpdateRequestBody_Oauth2Jwt": ".types", + "AuthConnectionsUpdateResponse": ".types", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode": ".types", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp": ".types", + "AuthConnectionsUpdateResponse_BasicAuth": ".types", + "AuthConnectionsUpdateResponse_BearerAuth": ".types", + "AuthConnectionsUpdateResponse_CustomHeaderAuth": ".types", + "AuthConnectionsUpdateResponse_Mtls": ".types", + "AuthConnectionsUpdateResponse_Oauth2ClientCredentials": ".types", + "AuthConnectionsUpdateResponse_Oauth2Jwt": ".types", + "AuthConnectionsUpdateResponse_PrivateKeyJwt": ".types", + "AuthConnectionsUpdateResponse_RefreshTokenAuth": ".types", + "AuthConnectionsUpdateResponse_SlackBotAuth": ".types", + "AuthConnectionsUpdateResponse_UrlSecret": ".types", + "AuthConnectionsUpdateResponse_WhatsappAuth": ".types", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AuthConnectionsCreateRequestBody", + "AuthConnectionsCreateRequestBody_BasicAuth", + "AuthConnectionsCreateRequestBody_BearerAuth", + "AuthConnectionsCreateRequestBody_CustomHeaderAuth", + "AuthConnectionsCreateRequestBody_Mtls", + "AuthConnectionsCreateRequestBody_Oauth2ClientCredentials", + "AuthConnectionsCreateRequestBody_Oauth2Jwt", + "AuthConnectionsCreateRequestBody_PrivateKeyJwt", + "AuthConnectionsCreateResponse", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp", + "AuthConnectionsCreateResponse_BasicAuth", + "AuthConnectionsCreateResponse_BearerAuth", + "AuthConnectionsCreateResponse_CustomHeaderAuth", + "AuthConnectionsCreateResponse_Mtls", + "AuthConnectionsCreateResponse_Oauth2ClientCredentials", + "AuthConnectionsCreateResponse_Oauth2Jwt", + "AuthConnectionsCreateResponse_PrivateKeyJwt", + "AuthConnectionsCreateResponse_RefreshTokenAuth", + "AuthConnectionsCreateResponse_SlackBotAuth", + "AuthConnectionsCreateResponse_UrlSecret", + "AuthConnectionsCreateResponse_WhatsappAuth", + "AuthConnectionsUpdateRequestBody", + "AuthConnectionsUpdateRequestBody_BasicAuth", + "AuthConnectionsUpdateRequestBody_BearerAuth", + "AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials", + "AuthConnectionsUpdateRequestBody_Oauth2Jwt", + "AuthConnectionsUpdateResponse", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp", + "AuthConnectionsUpdateResponse_BasicAuth", + "AuthConnectionsUpdateResponse_BearerAuth", + "AuthConnectionsUpdateResponse_CustomHeaderAuth", + "AuthConnectionsUpdateResponse_Mtls", + "AuthConnectionsUpdateResponse_Oauth2ClientCredentials", + "AuthConnectionsUpdateResponse_Oauth2Jwt", + "AuthConnectionsUpdateResponse_PrivateKeyJwt", + "AuthConnectionsUpdateResponse_RefreshTokenAuth", + "AuthConnectionsUpdateResponse_SlackBotAuth", + "AuthConnectionsUpdateResponse_UrlSecret", + "AuthConnectionsUpdateResponse_WhatsappAuth", +] diff --git a/data/src/elevenlabs/workspace/auth_connections/client.py b/data/src/elevenlabs/workspace/auth_connections/client.py new file mode 100644 index 0000000000000000000000000000000000000000..61a7d58fd5d8b5da8412eaa55c995e8458c04773 --- /dev/null +++ b/data/src/elevenlabs/workspace/auth_connections/client.py @@ -0,0 +1,359 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.list_auth_connections_response import ListAuthConnectionsResponse +from .raw_client import AsyncRawAuthConnectionsClient, RawAuthConnectionsClient +from .types.auth_connections_create_request_body import AuthConnectionsCreateRequestBody +from .types.auth_connections_create_response import AuthConnectionsCreateResponse +from .types.auth_connections_update_request_body import AuthConnectionsUpdateRequestBody +from .types.auth_connections_update_response import AuthConnectionsUpdateResponse + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class AuthConnectionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawAuthConnectionsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawAuthConnectionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawAuthConnectionsClient + """ + return self._raw_client + + def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListAuthConnectionsResponse: + """ + Get all auth connections for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListAuthConnectionsResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.auth_connections.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def create( + self, *, request: AuthConnectionsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AuthConnectionsCreateResponse: + """ + Create a new OAuth2 auth connection for the workspace + + Parameters + ---------- + request : AuthConnectionsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AuthConnectionsCreateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.workspace.auth_connections import ( + AuthConnectionsCreateRequestBody_Oauth2ClientCredentials, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.auth_connections.create( + request=AuthConnectionsCreateRequestBody_Oauth2ClientCredentials( + name="name", + provider="provider", + client_id="client_id", + token_url="token_url", + client_secret="client_secret", + ), + ) + """ + _response = self._raw_client.create(request=request, request_options=request_options) + return _response.data + + def delete(self, auth_connection_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Delete an auth connection + + Parameters + ---------- + auth_connection_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.auth_connections.delete( + auth_connection_id="auth_connection_id", + ) + """ + _response = self._raw_client.delete(auth_connection_id, request_options=request_options) + return _response.data + + def update( + self, + auth_connection_id: str, + *, + request: AuthConnectionsUpdateRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> AuthConnectionsUpdateResponse: + """ + Update an auth connection + + Parameters + ---------- + auth_connection_id : str + + request : AuthConnectionsUpdateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AuthConnectionsUpdateResponse + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + from elevenlabs.workspace.auth_connections import ( + AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials, + ) + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.auth_connections.update( + auth_connection_id="auth_connection_id", + request=AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials(), + ) + """ + _response = self._raw_client.update(auth_connection_id, request=request, request_options=request_options) + return _response.data + + +class AsyncAuthConnectionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawAuthConnectionsClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawAuthConnectionsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawAuthConnectionsClient + """ + return self._raw_client + + async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> ListAuthConnectionsResponse: + """ + Get all auth connections for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListAuthConnectionsResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.auth_connections.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def create( + self, *, request: AuthConnectionsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AuthConnectionsCreateResponse: + """ + Create a new OAuth2 auth connection for the workspace + + Parameters + ---------- + request : AuthConnectionsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AuthConnectionsCreateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.workspace.auth_connections import ( + AuthConnectionsCreateRequestBody_Oauth2ClientCredentials, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.auth_connections.create( + request=AuthConnectionsCreateRequestBody_Oauth2ClientCredentials( + name="name", + provider="provider", + client_id="client_id", + token_url="token_url", + client_secret="client_secret", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create(request=request, request_options=request_options) + return _response.data + + async def delete( + self, auth_connection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Delete an auth connection + + Parameters + ---------- + auth_connection_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.auth_connections.delete( + auth_connection_id="auth_connection_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(auth_connection_id, request_options=request_options) + return _response.data + + async def update( + self, + auth_connection_id: str, + *, + request: AuthConnectionsUpdateRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> AuthConnectionsUpdateResponse: + """ + Update an auth connection + + Parameters + ---------- + auth_connection_id : str + + request : AuthConnectionsUpdateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AuthConnectionsUpdateResponse + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + from elevenlabs.workspace.auth_connections import ( + AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials, + ) + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.auth_connections.update( + auth_connection_id="auth_connection_id", + request=AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials(), + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update(auth_connection_id, request=request, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/workspace/auth_connections/raw_client.py b/data/src/elevenlabs/workspace/auth_connections/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..41e81e4e0d603c9e395013ba0f7e8e071bfe3ba1 --- /dev/null +++ b/data/src/elevenlabs/workspace/auth_connections/raw_client.py @@ -0,0 +1,497 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.list_auth_connections_response import ListAuthConnectionsResponse +from .types.auth_connections_create_request_body import AuthConnectionsCreateRequestBody +from .types.auth_connections_create_response import AuthConnectionsCreateResponse +from .types.auth_connections_update_request_body import AuthConnectionsUpdateRequestBody +from .types.auth_connections_update_response import AuthConnectionsUpdateResponse +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawAuthConnectionsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[ListAuthConnectionsResponse]: + """ + Get all auth connections for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ListAuthConnectionsResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/auth-connections", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListAuthConnectionsResponse, + construct_type( + type_=ListAuthConnectionsResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create( + self, *, request: AuthConnectionsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AuthConnectionsCreateResponse]: + """ + Create a new OAuth2 auth connection for the workspace + + Parameters + ---------- + request : AuthConnectionsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AuthConnectionsCreateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/auth-connections", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=AuthConnectionsCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AuthConnectionsCreateResponse, + construct_type( + type_=AuthConnectionsCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, auth_connection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Delete an auth connection + + Parameters + ---------- + auth_connection_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/auth-connections/{jsonable_encoder(auth_connection_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + auth_connection_id: str, + *, + request: AuthConnectionsUpdateRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AuthConnectionsUpdateResponse]: + """ + Update an auth connection + + Parameters + ---------- + auth_connection_id : str + + request : AuthConnectionsUpdateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AuthConnectionsUpdateResponse] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/auth-connections/{jsonable_encoder(auth_connection_id)}", + method="PATCH", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=AuthConnectionsUpdateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AuthConnectionsUpdateResponse, + construct_type( + type_=AuthConnectionsUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawAuthConnectionsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[ListAuthConnectionsResponse]: + """ + Get all auth connections for the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ListAuthConnectionsResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/auth-connections", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ListAuthConnectionsResponse, + construct_type( + type_=ListAuthConnectionsResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create( + self, *, request: AuthConnectionsCreateRequestBody, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AuthConnectionsCreateResponse]: + """ + Create a new OAuth2 auth connection for the workspace + + Parameters + ---------- + request : AuthConnectionsCreateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AuthConnectionsCreateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/auth-connections", + method="POST", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=AuthConnectionsCreateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AuthConnectionsCreateResponse, + construct_type( + type_=AuthConnectionsCreateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, auth_connection_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Delete an auth connection + + Parameters + ---------- + auth_connection_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/auth-connections/{jsonable_encoder(auth_connection_id)}", + method="DELETE", + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + auth_connection_id: str, + *, + request: AuthConnectionsUpdateRequestBody, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AuthConnectionsUpdateResponse]: + """ + Update an auth connection + + Parameters + ---------- + auth_connection_id : str + + request : AuthConnectionsUpdateRequestBody + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AuthConnectionsUpdateResponse] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/auth-connections/{jsonable_encoder(auth_connection_id)}", + method="PATCH", + json=convert_and_respect_annotation_metadata( + object_=request, annotation=AuthConnectionsUpdateRequestBody, direction="write" + ), + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AuthConnectionsUpdateResponse, + construct_type( + type_=AuthConnectionsUpdateResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/auth_connections/types/__init__.py b/data/src/elevenlabs/workspace/auth_connections/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..69fd30a9c1917f64a2790c0dbffbc8a8181fff03 --- /dev/null +++ b/data/src/elevenlabs/workspace/auth_connections/types/__init__.py @@ -0,0 +1,166 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .auth_connections_create_request_body import ( + AuthConnectionsCreateRequestBody, + AuthConnectionsCreateRequestBody_BasicAuth, + AuthConnectionsCreateRequestBody_BearerAuth, + AuthConnectionsCreateRequestBody_CustomHeaderAuth, + AuthConnectionsCreateRequestBody_Mtls, + AuthConnectionsCreateRequestBody_Oauth2ClientCredentials, + AuthConnectionsCreateRequestBody_Oauth2Jwt, + AuthConnectionsCreateRequestBody_PrivateKeyJwt, + ) + from .auth_connections_create_response import ( + AuthConnectionsCreateResponse, + AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode, + AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp, + AuthConnectionsCreateResponse_BasicAuth, + AuthConnectionsCreateResponse_BearerAuth, + AuthConnectionsCreateResponse_CustomHeaderAuth, + AuthConnectionsCreateResponse_Mtls, + AuthConnectionsCreateResponse_Oauth2ClientCredentials, + AuthConnectionsCreateResponse_Oauth2Jwt, + AuthConnectionsCreateResponse_PrivateKeyJwt, + AuthConnectionsCreateResponse_RefreshTokenAuth, + AuthConnectionsCreateResponse_SlackBotAuth, + AuthConnectionsCreateResponse_UrlSecret, + AuthConnectionsCreateResponse_WhatsappAuth, + ) + from .auth_connections_update_request_body import ( + AuthConnectionsUpdateRequestBody, + AuthConnectionsUpdateRequestBody_BasicAuth, + AuthConnectionsUpdateRequestBody_BearerAuth, + AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials, + AuthConnectionsUpdateRequestBody_Oauth2Jwt, + ) + from .auth_connections_update_response import ( + AuthConnectionsUpdateResponse, + AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode, + AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp, + AuthConnectionsUpdateResponse_BasicAuth, + AuthConnectionsUpdateResponse_BearerAuth, + AuthConnectionsUpdateResponse_CustomHeaderAuth, + AuthConnectionsUpdateResponse_Mtls, + AuthConnectionsUpdateResponse_Oauth2ClientCredentials, + AuthConnectionsUpdateResponse_Oauth2Jwt, + AuthConnectionsUpdateResponse_PrivateKeyJwt, + AuthConnectionsUpdateResponse_RefreshTokenAuth, + AuthConnectionsUpdateResponse_SlackBotAuth, + AuthConnectionsUpdateResponse_UrlSecret, + AuthConnectionsUpdateResponse_WhatsappAuth, + ) +_dynamic_imports: typing.Dict[str, str] = { + "AuthConnectionsCreateRequestBody": ".auth_connections_create_request_body", + "AuthConnectionsCreateRequestBody_BasicAuth": ".auth_connections_create_request_body", + "AuthConnectionsCreateRequestBody_BearerAuth": ".auth_connections_create_request_body", + "AuthConnectionsCreateRequestBody_CustomHeaderAuth": ".auth_connections_create_request_body", + "AuthConnectionsCreateRequestBody_Mtls": ".auth_connections_create_request_body", + "AuthConnectionsCreateRequestBody_Oauth2ClientCredentials": ".auth_connections_create_request_body", + "AuthConnectionsCreateRequestBody_Oauth2Jwt": ".auth_connections_create_request_body", + "AuthConnectionsCreateRequestBody_PrivateKeyJwt": ".auth_connections_create_request_body", + "AuthConnectionsCreateResponse": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_BasicAuth": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_BearerAuth": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_CustomHeaderAuth": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_Mtls": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_Oauth2ClientCredentials": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_Oauth2Jwt": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_PrivateKeyJwt": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_RefreshTokenAuth": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_SlackBotAuth": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_UrlSecret": ".auth_connections_create_response", + "AuthConnectionsCreateResponse_WhatsappAuth": ".auth_connections_create_response", + "AuthConnectionsUpdateRequestBody": ".auth_connections_update_request_body", + "AuthConnectionsUpdateRequestBody_BasicAuth": ".auth_connections_update_request_body", + "AuthConnectionsUpdateRequestBody_BearerAuth": ".auth_connections_update_request_body", + "AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials": ".auth_connections_update_request_body", + "AuthConnectionsUpdateRequestBody_Oauth2Jwt": ".auth_connections_update_request_body", + "AuthConnectionsUpdateResponse": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_BasicAuth": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_BearerAuth": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_CustomHeaderAuth": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_Mtls": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_Oauth2ClientCredentials": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_Oauth2Jwt": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_PrivateKeyJwt": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_RefreshTokenAuth": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_SlackBotAuth": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_UrlSecret": ".auth_connections_update_response", + "AuthConnectionsUpdateResponse_WhatsappAuth": ".auth_connections_update_response", +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = [ + "AuthConnectionsCreateRequestBody", + "AuthConnectionsCreateRequestBody_BasicAuth", + "AuthConnectionsCreateRequestBody_BearerAuth", + "AuthConnectionsCreateRequestBody_CustomHeaderAuth", + "AuthConnectionsCreateRequestBody_Mtls", + "AuthConnectionsCreateRequestBody_Oauth2ClientCredentials", + "AuthConnectionsCreateRequestBody_Oauth2Jwt", + "AuthConnectionsCreateRequestBody_PrivateKeyJwt", + "AuthConnectionsCreateResponse", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode", + "AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp", + "AuthConnectionsCreateResponse_BasicAuth", + "AuthConnectionsCreateResponse_BearerAuth", + "AuthConnectionsCreateResponse_CustomHeaderAuth", + "AuthConnectionsCreateResponse_Mtls", + "AuthConnectionsCreateResponse_Oauth2ClientCredentials", + "AuthConnectionsCreateResponse_Oauth2Jwt", + "AuthConnectionsCreateResponse_PrivateKeyJwt", + "AuthConnectionsCreateResponse_RefreshTokenAuth", + "AuthConnectionsCreateResponse_SlackBotAuth", + "AuthConnectionsCreateResponse_UrlSecret", + "AuthConnectionsCreateResponse_WhatsappAuth", + "AuthConnectionsUpdateRequestBody", + "AuthConnectionsUpdateRequestBody_BasicAuth", + "AuthConnectionsUpdateRequestBody_BearerAuth", + "AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials", + "AuthConnectionsUpdateRequestBody_Oauth2Jwt", + "AuthConnectionsUpdateResponse", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode", + "AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp", + "AuthConnectionsUpdateResponse_BasicAuth", + "AuthConnectionsUpdateResponse_BearerAuth", + "AuthConnectionsUpdateResponse_CustomHeaderAuth", + "AuthConnectionsUpdateResponse_Mtls", + "AuthConnectionsUpdateResponse_Oauth2ClientCredentials", + "AuthConnectionsUpdateResponse_Oauth2Jwt", + "AuthConnectionsUpdateResponse_PrivateKeyJwt", + "AuthConnectionsUpdateResponse_RefreshTokenAuth", + "AuthConnectionsUpdateResponse_SlackBotAuth", + "AuthConnectionsUpdateResponse_UrlSecret", + "AuthConnectionsUpdateResponse_WhatsappAuth", +] diff --git a/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_create_request_body.py b/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_create_request_body.py new file mode 100644 index 0000000000000000000000000000000000000000..082b883b5014c7190c7f018ea48c704c5c1e5209 --- /dev/null +++ b/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_create_request_body.py @@ -0,0 +1,195 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.create_o_auth_2_jwt_request_algorithm import CreateOAuth2JwtRequestAlgorithm +from ....types.create_o_auth_2_jwt_request_token_response_field import CreateOAuth2JwtRequestTokenResponseField +from ....types.create_private_key_jwt_request_algorithm import CreatePrivateKeyJwtRequestAlgorithm + + +class AuthConnectionsCreateRequestBody_Oauth2ClientCredentials(UncheckedBaseModel): + """ + Auth connection to create + """ + + auth_type: typing.Literal["oauth2_client_credentials"] = "oauth2_client_credentials" + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + basic_auth_in_header: typing.Optional[bool] = None + client_secret: str + custom_headers: typing.Optional[typing.Dict[str, 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 + + +class AuthConnectionsCreateRequestBody_CustomHeaderAuth(UncheckedBaseModel): + """ + Auth connection to create + """ + + auth_type: typing.Literal["custom_header_auth"] = "custom_header_auth" + name: str + provider: str + header_name: str + token: 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 + + +class AuthConnectionsCreateRequestBody_BasicAuth(UncheckedBaseModel): + """ + Auth connection to create + """ + + auth_type: typing.Literal["basic_auth"] = "basic_auth" + name: str + provider: str + username: str + password: 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 + + +class AuthConnectionsCreateRequestBody_BearerAuth(UncheckedBaseModel): + """ + Auth connection to create + """ + + auth_type: typing.Literal["bearer_auth"] = "bearer_auth" + name: str + provider: str + token: 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 + + +class AuthConnectionsCreateRequestBody_Oauth2Jwt(UncheckedBaseModel): + """ + Auth connection to create + """ + + auth_type: typing.Literal["oauth2_jwt"] = "oauth2_jwt" + name: str + provider: str + algorithm: typing.Optional[CreateOAuth2JwtRequestAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: str + audience: str + subject: str + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + token_url: str + scopes: typing.Optional[typing.List[str]] = None + token_response_field: typing.Optional[CreateOAuth2JwtRequestTokenResponseField] = None + secret_key: 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 + + +class AuthConnectionsCreateRequestBody_PrivateKeyJwt(UncheckedBaseModel): + """ + Auth connection to create + """ + + auth_type: typing.Literal["private_key_jwt"] = "private_key_jwt" + name: str + provider: str + algorithm: typing.Optional[CreatePrivateKeyJwtRequestAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: str + audience: str + subject: str + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + secret_key: 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 + + +class AuthConnectionsCreateRequestBody_Mtls(UncheckedBaseModel): + """ + Auth connection to create + """ + + auth_type: typing.Literal["mtls"] = "mtls" + name: str + provider: str + client_certificate: str + client_key: str + ca_certificate: typing.Optional[str] = None + key_passphrase: 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 + + +AuthConnectionsCreateRequestBody = typing_extensions.Annotated[ + typing.Union[ + AuthConnectionsCreateRequestBody_Oauth2ClientCredentials, + AuthConnectionsCreateRequestBody_CustomHeaderAuth, + AuthConnectionsCreateRequestBody_BasicAuth, + AuthConnectionsCreateRequestBody_BearerAuth, + AuthConnectionsCreateRequestBody_Oauth2Jwt, + AuthConnectionsCreateRequestBody_PrivateKeyJwt, + AuthConnectionsCreateRequestBody_Mtls, + ], + UnionMetadata(discriminant="auth_type"), +] diff --git a/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_create_response.py b/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_create_response.py new file mode 100644 index 0000000000000000000000000000000000000000..63f9d3c9e9233753c151bf0df7c5d7f6fa4d40ba --- /dev/null +++ b/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_create_response.py @@ -0,0 +1,396 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.api_integration_o_auth_2_auth_code_response_scope_separator import ( + ApiIntegrationOAuth2AuthCodeResponseScopeSeparator, +) +from ....types.api_integration_o_auth_2_custom_app_response_scope_separator import ( + ApiIntegrationOAuth2CustomAppResponseScopeSeparator, +) +from ....types.auth_connection_dependencies import AuthConnectionDependencies +from ....types.auth_connection_status import AuthConnectionStatus +from ....types.o_auth_2_jwt_response_algorithm import OAuth2JwtResponseAlgorithm +from ....types.o_auth_2_jwt_response_token_response_field import OAuth2JwtResponseTokenResponseField +from ....types.private_key_jwt_response_algorithm import PrivateKeyJwtResponseAlgorithm + + +class AuthConnectionsCreateResponse_Oauth2ClientCredentials(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["oauth2_client_credentials"] = "oauth2_client_credentials" + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + basic_auth_in_header: typing.Optional[bool] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: typing.Optional[str] = None + custom_headers: typing.Optional[typing.Dict[str, 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 + + +class AuthConnectionsCreateResponse_RefreshTokenAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["refresh_token_auth"] = "refresh_token_auth" + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_BasicAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["basic_auth"] = "basic_auth" + name: str + provider: str + username: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_BearerAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["bearer_auth"] = "bearer_auth" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_Oauth2Jwt(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["oauth2_jwt"] = "oauth2_jwt" + name: str + provider: str + algorithm: typing.Optional[OAuth2JwtResponseAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: str + audience: str + subject: str + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + token_url: str + scopes: typing.Optional[typing.List[str]] = None + token_response_field: typing.Optional[OAuth2JwtResponseTokenResponseField] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_PrivateKeyJwt(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["private_key_jwt"] = "private_key_jwt" + name: str + provider: str + algorithm: typing.Optional[PrivateKeyJwtResponseAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: str + audience: str + subject: str + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_Mtls(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["mtls"] = "mtls" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_CustomHeaderAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["custom_header_auth"] = "custom_header_auth" + name: str + provider: str + header_name: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["api_integration_oauth2_auth_code"] = "api_integration_oauth2_auth_code" + name: str + provider: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + scope_separator: typing.Optional[ApiIntegrationOAuth2AuthCodeResponseScopeSeparator] = None + expires_at: str + integration_id: str + credential_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["api_integration_oauth2_custom_app"] = "api_integration_oauth2_custom_app" + name: str + provider: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + scope_separator: typing.Optional[ApiIntegrationOAuth2CustomAppResponseScopeSeparator] = None + expires_at: str + integration_id: str + credential_id: str + client_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_WhatsappAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["whatsapp_auth"] = "whatsapp_auth" + name: str + provider: typing.Optional[typing.Literal["whatsapp"]] = None + phone_number_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_SlackBotAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["slack_bot_auth"] = "slack_bot_auth" + name: str + provider: typing.Optional[typing.Literal["Slack"]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsCreateResponse_UrlSecret(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["url_secret"] = "url_secret" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +AuthConnectionsCreateResponse = typing_extensions.Annotated[ + typing.Union[ + AuthConnectionsCreateResponse_Oauth2ClientCredentials, + AuthConnectionsCreateResponse_RefreshTokenAuth, + AuthConnectionsCreateResponse_BasicAuth, + AuthConnectionsCreateResponse_BearerAuth, + AuthConnectionsCreateResponse_Oauth2Jwt, + AuthConnectionsCreateResponse_PrivateKeyJwt, + AuthConnectionsCreateResponse_Mtls, + AuthConnectionsCreateResponse_CustomHeaderAuth, + AuthConnectionsCreateResponse_ApiIntegrationOauth2AuthCode, + AuthConnectionsCreateResponse_ApiIntegrationOauth2CustomApp, + AuthConnectionsCreateResponse_WhatsappAuth, + AuthConnectionsCreateResponse_SlackBotAuth, + AuthConnectionsCreateResponse_UrlSecret, + ], + UnionMetadata(discriminant="auth_type"), +] diff --git a/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_update_request_body.py b/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_update_request_body.py new file mode 100644 index 0000000000000000000000000000000000000000..15bbe5147683ba4d4ba6e3e3b121e9de37bfa77c --- /dev/null +++ b/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_update_request_body.py @@ -0,0 +1,114 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.update_o_auth_2_jwt_request_algorithm import UpdateOAuth2JwtRequestAlgorithm +from ....types.update_o_auth_2_jwt_request_token_response_field import UpdateOAuth2JwtRequestTokenResponseField + + +class AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials(UncheckedBaseModel): + """ + Updated auth connection fields + """ + + auth_type: typing.Literal["oauth2_client_credentials"] = "oauth2_client_credentials" + provider: typing.Optional[str] = None + client_id: typing.Optional[str] = None + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None + basic_auth_in_header: typing.Optional[bool] = None + client_secret: typing.Optional[str] = None + custom_headers: 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 + + +class AuthConnectionsUpdateRequestBody_BasicAuth(UncheckedBaseModel): + """ + Updated auth connection fields + """ + + auth_type: typing.Literal["basic_auth"] = "basic_auth" + provider: typing.Optional[str] = None + username: typing.Optional[str] = None + password: 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 + + +class AuthConnectionsUpdateRequestBody_BearerAuth(UncheckedBaseModel): + """ + Updated auth connection fields + """ + + auth_type: typing.Literal["bearer_auth"] = "bearer_auth" + provider: typing.Optional[str] = None + token: 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 + + +class AuthConnectionsUpdateRequestBody_Oauth2Jwt(UncheckedBaseModel): + """ + Updated auth connection fields + """ + + auth_type: typing.Literal["oauth2_jwt"] = "oauth2_jwt" + provider: typing.Optional[str] = None + algorithm: typing.Optional[UpdateOAuth2JwtRequestAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: typing.Optional[str] = None + audience: typing.Optional[str] = None + subject: typing.Optional[str] = None + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None + scopes: typing.Optional[typing.List[str]] = None + token_response_field: typing.Optional[UpdateOAuth2JwtRequestTokenResponseField] = None + secret_key: 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 + + +AuthConnectionsUpdateRequestBody = typing_extensions.Annotated[ + typing.Union[ + AuthConnectionsUpdateRequestBody_Oauth2ClientCredentials, + AuthConnectionsUpdateRequestBody_BasicAuth, + AuthConnectionsUpdateRequestBody_BearerAuth, + AuthConnectionsUpdateRequestBody_Oauth2Jwt, + ], + UnionMetadata(discriminant="auth_type"), +] diff --git a/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_update_response.py b/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_update_response.py new file mode 100644 index 0000000000000000000000000000000000000000..04c9470854c3e63ea4beaf8c627b7934bfef7233 --- /dev/null +++ b/data/src/elevenlabs/workspace/auth_connections/types/auth_connections_update_response.py @@ -0,0 +1,396 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions +from ....core.pydantic_utilities import IS_PYDANTIC_V2 +from ....core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from ....types.api_integration_o_auth_2_auth_code_response_scope_separator import ( + ApiIntegrationOAuth2AuthCodeResponseScopeSeparator, +) +from ....types.api_integration_o_auth_2_custom_app_response_scope_separator import ( + ApiIntegrationOAuth2CustomAppResponseScopeSeparator, +) +from ....types.auth_connection_dependencies import AuthConnectionDependencies +from ....types.auth_connection_status import AuthConnectionStatus +from ....types.o_auth_2_jwt_response_algorithm import OAuth2JwtResponseAlgorithm +from ....types.o_auth_2_jwt_response_token_response_field import OAuth2JwtResponseTokenResponseField +from ....types.private_key_jwt_response_algorithm import PrivateKeyJwtResponseAlgorithm + + +class AuthConnectionsUpdateResponse_Oauth2ClientCredentials(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["oauth2_client_credentials"] = "oauth2_client_credentials" + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + basic_auth_in_header: typing.Optional[bool] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: typing.Optional[str] = None + custom_headers: typing.Optional[typing.Dict[str, 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 + + +class AuthConnectionsUpdateResponse_RefreshTokenAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["refresh_token_auth"] = "refresh_token_auth" + name: str + provider: str + client_id: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_BasicAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["basic_auth"] = "basic_auth" + name: str + provider: str + username: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_BearerAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["bearer_auth"] = "bearer_auth" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_Oauth2Jwt(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["oauth2_jwt"] = "oauth2_jwt" + name: str + provider: str + algorithm: typing.Optional[OAuth2JwtResponseAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: str + audience: str + subject: str + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + token_url: str + scopes: typing.Optional[typing.List[str]] = None + token_response_field: typing.Optional[OAuth2JwtResponseTokenResponseField] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_PrivateKeyJwt(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["private_key_jwt"] = "private_key_jwt" + name: str + provider: str + algorithm: typing.Optional[PrivateKeyJwtResponseAlgorithm] = None + key_id: typing.Optional[str] = None + issuer: str + audience: str + subject: str + expiration_seconds: typing.Optional[int] = None + extra_params: typing.Optional[typing.Dict[str, str]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_Mtls(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["mtls"] = "mtls" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_CustomHeaderAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["custom_header_auth"] = "custom_header_auth" + name: str + provider: str + header_name: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["api_integration_oauth2_auth_code"] = "api_integration_oauth2_auth_code" + name: str + provider: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + scope_separator: typing.Optional[ApiIntegrationOAuth2AuthCodeResponseScopeSeparator] = None + expires_at: str + integration_id: str + credential_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["api_integration_oauth2_custom_app"] = "api_integration_oauth2_custom_app" + name: str + provider: str + token_url: str + scopes: typing.Optional[typing.List[str]] = None + scope_separator: typing.Optional[ApiIntegrationOAuth2CustomAppResponseScopeSeparator] = None + expires_at: str + integration_id: str + credential_id: str + client_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_WhatsappAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["whatsapp_auth"] = "whatsapp_auth" + name: str + provider: typing.Optional[typing.Literal["whatsapp"]] = None + phone_number_id: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_SlackBotAuth(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["slack_bot_auth"] = "slack_bot_auth" + name: str + provider: typing.Optional[typing.Literal["Slack"]] = None + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +class AuthConnectionsUpdateResponse_UrlSecret(UncheckedBaseModel): + """ + The type of auth connection config + """ + + auth_type: typing.Literal["url_secret"] = "url_secret" + name: str + provider: str + id: str + used_by: typing.Optional[AuthConnectionDependencies] = None + status: typing.Optional[AuthConnectionStatus] = None + status_detail: typing.Optional[str] = None + status_updated_at: 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 + + +AuthConnectionsUpdateResponse = typing_extensions.Annotated[ + typing.Union[ + AuthConnectionsUpdateResponse_Oauth2ClientCredentials, + AuthConnectionsUpdateResponse_RefreshTokenAuth, + AuthConnectionsUpdateResponse_BasicAuth, + AuthConnectionsUpdateResponse_BearerAuth, + AuthConnectionsUpdateResponse_Oauth2Jwt, + AuthConnectionsUpdateResponse_PrivateKeyJwt, + AuthConnectionsUpdateResponse_Mtls, + AuthConnectionsUpdateResponse_CustomHeaderAuth, + AuthConnectionsUpdateResponse_ApiIntegrationOauth2AuthCode, + AuthConnectionsUpdateResponse_ApiIntegrationOauth2CustomApp, + AuthConnectionsUpdateResponse_WhatsappAuth, + AuthConnectionsUpdateResponse_SlackBotAuth, + AuthConnectionsUpdateResponse_UrlSecret, + ], + UnionMetadata(discriminant="auth_type"), +] diff --git a/data/src/elevenlabs/workspace/client.py b/data/src/elevenlabs/workspace/client.py new file mode 100644 index 0000000000000000000000000000000000000000..524709374284287b54e508ff326170a11f017b21 --- /dev/null +++ b/data/src/elevenlabs/workspace/client.py @@ -0,0 +1,279 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions +from .raw_client import AsyncRawWorkspaceClient, RawWorkspaceClient + +if typing.TYPE_CHECKING: + from .analytics.client import AnalyticsClient, AsyncAnalyticsClient + from .audit_logs.client import AsyncAuditLogsClient, AuditLogsClient + from .auth_connections.client import AsyncAuthConnectionsClient, AuthConnectionsClient + from .groups.client import AsyncGroupsClient, GroupsClient + from .invites.client import AsyncInvitesClient, InvitesClient + from .members.client import AsyncMembersClient, MembersClient + from .resources.client import AsyncResourcesClient, ResourcesClient + from .usage.client import AsyncUsageClient, UsageClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class WorkspaceClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawWorkspaceClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audit_logs: typing.Optional[AuditLogsClient] = None + self._auth_connections: typing.Optional[AuthConnectionsClient] = None + self._groups: typing.Optional[GroupsClient] = None + self._invites: typing.Optional[InvitesClient] = None + self._members: typing.Optional[MembersClient] = None + self._resources: typing.Optional[ResourcesClient] = None + self._usage: typing.Optional[UsageClient] = None + self._analytics: typing.Optional[AnalyticsClient] = None + + @property + def with_raw_response(self) -> RawWorkspaceClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawWorkspaceClient + """ + return self._raw_client + + def set_third_party_disabling_policy( + self, + *, + third_party_disable_allowed: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Set the workspace-wide Third-Party Disabling policy. When set, it forces, for every API key in the workspace, whether the holder of a key (potentially a third party who found it) may disable it via the self-disable endpoint or when it leaks publicly — overriding each key's own setting. Pass `true` to allow it for all keys, `false` to forbid it for all keys, or `null` to clear the override so per-key values and the plan default apply again. Workspace admins only. + + Parameters + ---------- + third_party_disable_allowed : typing.Optional[bool] + `true` forces every key in the workspace to be disable-able by its holder; `false` forbids it for every key; `null` clears the override (per-key values and the plan default apply). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.set_third_party_disabling_policy() + """ + _response = self._raw_client.set_third_party_disabling_policy( + third_party_disable_allowed=third_party_disable_allowed, request_options=request_options + ) + return _response.data + + @property + def audit_logs(self): + if self._audit_logs is None: + from .audit_logs.client import AuditLogsClient # noqa: E402 + + self._audit_logs = AuditLogsClient(client_wrapper=self._client_wrapper) + return self._audit_logs + + @property + def auth_connections(self): + if self._auth_connections is None: + from .auth_connections.client import AuthConnectionsClient # noqa: E402 + + self._auth_connections = AuthConnectionsClient(client_wrapper=self._client_wrapper) + return self._auth_connections + + @property + def groups(self): + if self._groups is None: + from .groups.client import GroupsClient # noqa: E402 + + self._groups = GroupsClient(client_wrapper=self._client_wrapper) + return self._groups + + @property + def invites(self): + if self._invites is None: + from .invites.client import InvitesClient # noqa: E402 + + self._invites = InvitesClient(client_wrapper=self._client_wrapper) + return self._invites + + @property + def members(self): + if self._members is None: + from .members.client import MembersClient # noqa: E402 + + self._members = MembersClient(client_wrapper=self._client_wrapper) + return self._members + + @property + def resources(self): + if self._resources is None: + from .resources.client import ResourcesClient # noqa: E402 + + self._resources = ResourcesClient(client_wrapper=self._client_wrapper) + return self._resources + + @property + def usage(self): + if self._usage is None: + from .usage.client import UsageClient # noqa: E402 + + self._usage = UsageClient(client_wrapper=self._client_wrapper) + return self._usage + + @property + def analytics(self): + if self._analytics is None: + from .analytics.client import AnalyticsClient # noqa: E402 + + self._analytics = AnalyticsClient(client_wrapper=self._client_wrapper) + return self._analytics + + +class AsyncWorkspaceClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawWorkspaceClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._audit_logs: typing.Optional[AsyncAuditLogsClient] = None + self._auth_connections: typing.Optional[AsyncAuthConnectionsClient] = None + self._groups: typing.Optional[AsyncGroupsClient] = None + self._invites: typing.Optional[AsyncInvitesClient] = None + self._members: typing.Optional[AsyncMembersClient] = None + self._resources: typing.Optional[AsyncResourcesClient] = None + self._usage: typing.Optional[AsyncUsageClient] = None + self._analytics: typing.Optional[AsyncAnalyticsClient] = None + + @property + def with_raw_response(self) -> AsyncRawWorkspaceClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawWorkspaceClient + """ + return self._raw_client + + async def set_third_party_disabling_policy( + self, + *, + third_party_disable_allowed: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Set the workspace-wide Third-Party Disabling policy. When set, it forces, for every API key in the workspace, whether the holder of a key (potentially a third party who found it) may disable it via the self-disable endpoint or when it leaks publicly — overriding each key's own setting. Pass `true` to allow it for all keys, `false` to forbid it for all keys, or `null` to clear the override so per-key values and the plan default apply again. Workspace admins only. + + Parameters + ---------- + third_party_disable_allowed : typing.Optional[bool] + `true` forces every key in the workspace to be disable-able by its holder; `false` forbids it for every key; `null` clears the override (per-key values and the plan default apply). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.set_third_party_disabling_policy() + + + asyncio.run(main()) + """ + _response = await self._raw_client.set_third_party_disabling_policy( + third_party_disable_allowed=third_party_disable_allowed, request_options=request_options + ) + return _response.data + + @property + def audit_logs(self): + if self._audit_logs is None: + from .audit_logs.client import AsyncAuditLogsClient # noqa: E402 + + self._audit_logs = AsyncAuditLogsClient(client_wrapper=self._client_wrapper) + return self._audit_logs + + @property + def auth_connections(self): + if self._auth_connections is None: + from .auth_connections.client import AsyncAuthConnectionsClient # noqa: E402 + + self._auth_connections = AsyncAuthConnectionsClient(client_wrapper=self._client_wrapper) + return self._auth_connections + + @property + def groups(self): + if self._groups is None: + from .groups.client import AsyncGroupsClient # noqa: E402 + + self._groups = AsyncGroupsClient(client_wrapper=self._client_wrapper) + return self._groups + + @property + def invites(self): + if self._invites is None: + from .invites.client import AsyncInvitesClient # noqa: E402 + + self._invites = AsyncInvitesClient(client_wrapper=self._client_wrapper) + return self._invites + + @property + def members(self): + if self._members is None: + from .members.client import AsyncMembersClient # noqa: E402 + + self._members = AsyncMembersClient(client_wrapper=self._client_wrapper) + return self._members + + @property + def resources(self): + if self._resources is None: + from .resources.client import AsyncResourcesClient # noqa: E402 + + self._resources = AsyncResourcesClient(client_wrapper=self._client_wrapper) + return self._resources + + @property + def usage(self): + if self._usage is None: + from .usage.client import AsyncUsageClient # noqa: E402 + + self._usage = AsyncUsageClient(client_wrapper=self._client_wrapper) + return self._usage + + @property + def analytics(self): + if self._analytics is None: + from .analytics.client import AsyncAnalyticsClient # noqa: E402 + + self._analytics = AsyncAnalyticsClient(client_wrapper=self._client_wrapper) + return self._analytics diff --git a/data/src/elevenlabs/workspace/groups/__init__.py b/data/src/elevenlabs/workspace/groups/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6184be4a48c836d699cac5b83b1d39af1dc28214 --- /dev/null +++ b/data/src/elevenlabs/workspace/groups/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import members +_dynamic_imports: typing.Dict[str, str] = {"members": ".members"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["members"] diff --git a/data/src/elevenlabs/workspace/groups/client.py b/data/src/elevenlabs/workspace/groups/client.py new file mode 100644 index 0000000000000000000000000000000000000000..4ce24f0166a590b28da8dc2ac298598f28680152 --- /dev/null +++ b/data/src/elevenlabs/workspace/groups/client.py @@ -0,0 +1,204 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.workspace_group_by_name_response_model import WorkspaceGroupByNameResponseModel +from ...types.workspace_group_response_model import WorkspaceGroupResponseModel +from .raw_client import AsyncRawGroupsClient, RawGroupsClient + +if typing.TYPE_CHECKING: + from .members.client import AsyncMembersClient, MembersClient + + +class GroupsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawGroupsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._members: typing.Optional[MembersClient] = None + + @property + def with_raw_response(self) -> RawGroupsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawGroupsClient + """ + return self._raw_client + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Dict[str, WorkspaceGroupResponseModel]: + """ + Get all groups in the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, WorkspaceGroupResponseModel] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.groups.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def search( + self, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[WorkspaceGroupByNameResponseModel]: + """ + Searches for user groups in the workspace. Multiple or no groups may be returned. + + Parameters + ---------- + name : str + Name of the target group. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[WorkspaceGroupByNameResponseModel] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.groups.search( + name="name", + ) + """ + _response = self._raw_client.search(name=name, request_options=request_options) + return _response.data + + @property + def members(self): + if self._members is None: + from .members.client import MembersClient # noqa: E402 + + self._members = MembersClient(client_wrapper=self._client_wrapper) + return self._members + + +class AsyncGroupsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawGroupsClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._members: typing.Optional[AsyncMembersClient] = None + + @property + def with_raw_response(self) -> AsyncRawGroupsClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawGroupsClient + """ + return self._raw_client + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Dict[str, WorkspaceGroupResponseModel]: + """ + Get all groups in the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, WorkspaceGroupResponseModel] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.groups.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def search( + self, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[WorkspaceGroupByNameResponseModel]: + """ + Searches for user groups in the workspace. Multiple or no groups may be returned. + + Parameters + ---------- + name : str + Name of the target group. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[WorkspaceGroupByNameResponseModel] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.groups.search( + name="name", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.search(name=name, request_options=request_options) + return _response.data + + @property + def members(self): + if self._members is None: + from .members.client import AsyncMembersClient # noqa: E402 + + self._members = AsyncMembersClient(client_wrapper=self._client_wrapper) + return self._members diff --git a/data/src/elevenlabs/workspace/groups/members/__init__.py b/data/src/elevenlabs/workspace/groups/members/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/workspace/groups/members/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/workspace/groups/members/client.py b/data/src/elevenlabs/workspace/groups/members/client.py new file mode 100644 index 0000000000000000000000000000000000000000..f90bd25a1d7a1e0b18d8b883797d06530f3fb7be --- /dev/null +++ b/data/src/elevenlabs/workspace/groups/members/client.py @@ -0,0 +1,208 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.request_options import RequestOptions +from ....types.add_workspace_group_member_response_model import AddWorkspaceGroupMemberResponseModel +from ....types.delete_workspace_group_member_response_model import DeleteWorkspaceGroupMemberResponseModel +from .raw_client import AsyncRawMembersClient, RawMembersClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class MembersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawMembersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawMembersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawMembersClient + """ + return self._raw_client + + def remove( + self, group_id: str, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteWorkspaceGroupMemberResponseModel: + """ + Removes a member from the specified group. Requires `group_members_manage` permission. + + Parameters + ---------- + group_id : str + The ID of the target group. + + email : str + The email of the target workspace member. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteWorkspaceGroupMemberResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.groups.members.remove( + group_id="group_id", + email="email", + ) + """ + _response = self._raw_client.remove(group_id, email=email, request_options=request_options) + return _response.data + + def add( + self, group_id: str, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> AddWorkspaceGroupMemberResponseModel: + """ + Adds a member of your workspace to the specified group. Requires `group_members_manage` permission. + + Parameters + ---------- + group_id : str + The ID of the target group. + + email : str + The email of the target workspace member. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddWorkspaceGroupMemberResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.groups.members.add( + group_id="group_id", + email="email", + ) + """ + _response = self._raw_client.add(group_id, email=email, request_options=request_options) + return _response.data + + +class AsyncMembersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawMembersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawMembersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawMembersClient + """ + return self._raw_client + + async def remove( + self, group_id: str, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteWorkspaceGroupMemberResponseModel: + """ + Removes a member from the specified group. Requires `group_members_manage` permission. + + Parameters + ---------- + group_id : str + The ID of the target group. + + email : str + The email of the target workspace member. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteWorkspaceGroupMemberResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.groups.members.remove( + group_id="group_id", + email="email", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.remove(group_id, email=email, request_options=request_options) + return _response.data + + async def add( + self, group_id: str, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> AddWorkspaceGroupMemberResponseModel: + """ + Adds a member of your workspace to the specified group. Requires `group_members_manage` permission. + + Parameters + ---------- + group_id : str + The ID of the target group. + + email : str + The email of the target workspace member. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddWorkspaceGroupMemberResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.groups.members.add( + group_id="group_id", + email="email", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.add(group_id, email=email, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/workspace/groups/members/raw_client.py b/data/src/elevenlabs/workspace/groups/members/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..99c581358990e6edb1f49e923537b87d62033019 --- /dev/null +++ b/data/src/elevenlabs/workspace/groups/members/raw_client.py @@ -0,0 +1,285 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ....core.api_error import ApiError +from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ....core.http_response import AsyncHttpResponse, HttpResponse +from ....core.jsonable_encoder import jsonable_encoder +from ....core.parse_error import ParsingError +from ....core.request_options import RequestOptions +from ....core.unchecked_base_model import construct_type +from ....errors.unprocessable_entity_error import UnprocessableEntityError +from ....types.add_workspace_group_member_response_model import AddWorkspaceGroupMemberResponseModel +from ....types.delete_workspace_group_member_response_model import DeleteWorkspaceGroupMemberResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawMembersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def remove( + self, group_id: str, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteWorkspaceGroupMemberResponseModel]: + """ + Removes a member from the specified group. Requires `group_members_manage` permission. + + Parameters + ---------- + group_id : str + The ID of the target group. + + email : str + The email of the target workspace member. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteWorkspaceGroupMemberResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/groups/{jsonable_encoder(group_id)}/members/remove", + method="POST", + json={ + "email": email, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteWorkspaceGroupMemberResponseModel, + construct_type( + type_=DeleteWorkspaceGroupMemberResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def add( + self, group_id: str, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[AddWorkspaceGroupMemberResponseModel]: + """ + Adds a member of your workspace to the specified group. Requires `group_members_manage` permission. + + Parameters + ---------- + group_id : str + The ID of the target group. + + email : str + The email of the target workspace member. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddWorkspaceGroupMemberResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/groups/{jsonable_encoder(group_id)}/members", + method="POST", + json={ + "email": email, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddWorkspaceGroupMemberResponseModel, + construct_type( + type_=AddWorkspaceGroupMemberResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawMembersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def remove( + self, group_id: str, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteWorkspaceGroupMemberResponseModel]: + """ + Removes a member from the specified group. Requires `group_members_manage` permission. + + Parameters + ---------- + group_id : str + The ID of the target group. + + email : str + The email of the target workspace member. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteWorkspaceGroupMemberResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/groups/{jsonable_encoder(group_id)}/members/remove", + method="POST", + json={ + "email": email, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteWorkspaceGroupMemberResponseModel, + construct_type( + type_=DeleteWorkspaceGroupMemberResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def add( + self, group_id: str, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[AddWorkspaceGroupMemberResponseModel]: + """ + Adds a member of your workspace to the specified group. Requires `group_members_manage` permission. + + Parameters + ---------- + group_id : str + The ID of the target group. + + email : str + The email of the target workspace member. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddWorkspaceGroupMemberResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/groups/{jsonable_encoder(group_id)}/members", + method="POST", + json={ + "email": email, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddWorkspaceGroupMemberResponseModel, + construct_type( + type_=AddWorkspaceGroupMemberResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/groups/raw_client.py b/data/src/elevenlabs/workspace/groups/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..10eb4e1be03c48ec7ab147efe26a763cd2966394 --- /dev/null +++ b/data/src/elevenlabs/workspace/groups/raw_client.py @@ -0,0 +1,241 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.workspace_group_by_name_response_model import WorkspaceGroupByNameResponseModel +from ...types.workspace_group_response_model import WorkspaceGroupResponseModel +from pydantic import ValidationError + + +class RawGroupsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Dict[str, WorkspaceGroupResponseModel]]: + """ + Get all groups in the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Dict[str, WorkspaceGroupResponseModel]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/groups", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, WorkspaceGroupResponseModel], + construct_type( + type_=typing.Dict[str, WorkspaceGroupResponseModel], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def search( + self, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.List[WorkspaceGroupByNameResponseModel]]: + """ + Searches for user groups in the workspace. Multiple or no groups may be returned. + + Parameters + ---------- + name : str + Name of the target group. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.List[WorkspaceGroupByNameResponseModel]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/groups/search", + method="GET", + params={ + "name": name, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[WorkspaceGroupByNameResponseModel], + construct_type( + type_=typing.List[WorkspaceGroupByNameResponseModel], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawGroupsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Dict[str, WorkspaceGroupResponseModel]]: + """ + Get all groups in the workspace + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Dict[str, WorkspaceGroupResponseModel]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/groups", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Dict[str, WorkspaceGroupResponseModel], + construct_type( + type_=typing.Dict[str, WorkspaceGroupResponseModel], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def search( + self, *, name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.List[WorkspaceGroupByNameResponseModel]]: + """ + Searches for user groups in the workspace. Multiple or no groups may be returned. + + Parameters + ---------- + name : str + Name of the target group. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.List[WorkspaceGroupByNameResponseModel]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/groups/search", + method="GET", + params={ + "name": name, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[WorkspaceGroupByNameResponseModel], + construct_type( + type_=typing.List[WorkspaceGroupByNameResponseModel], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/invites/__init__.py b/data/src/elevenlabs/workspace/invites/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/workspace/invites/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/workspace/invites/client.py b/data/src/elevenlabs/workspace/invites/client.py new file mode 100644 index 0000000000000000000000000000000000000000..4c9f66621b1938bae687a8de3b17ccbbf884d520 --- /dev/null +++ b/data/src/elevenlabs/workspace/invites/client.py @@ -0,0 +1,361 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.add_workspace_invite_response_model import AddWorkspaceInviteResponseModel +from ...types.delete_workspace_invite_response_model import DeleteWorkspaceInviteResponseModel +from ...types.seat_type import SeatType +from .raw_client import AsyncRawInvitesClient, RawInvitesClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class InvitesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawInvitesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawInvitesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawInvitesClient + """ + return self._raw_client + + def create( + self, + *, + email: str, + workspace_permission: typing.Optional[str] = OMIT, + seat_type: typing.Optional[SeatType] = OMIT, + group_ids: typing.Optional[typing.Sequence[str]] = OMIT, + usage_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddWorkspaceInviteResponseModel: + """ + Sends an email invitation to join your workspace to the provided email. If the user doesn't have an account they will be prompted to create one. If the user accepts this invite they will be added as a user to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. If the user is already in the workspace a 400 error will be returned. + + Parameters + ---------- + email : str + The email of the customer + + workspace_permission : typing.Optional[str] + The workspace permission of the user. This is deprecated, use `seat_type` instead. + + seat_type : typing.Optional[SeatType] + The seat type of the user + + group_ids : typing.Optional[typing.Sequence[str]] + The group ids of the user + + usage_limit : typing.Optional[int] + Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddWorkspaceInviteResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.invites.create( + email="john.doe@testmail.com", + ) + """ + _response = self._raw_client.create( + email=email, + workspace_permission=workspace_permission, + seat_type=seat_type, + group_ids=group_ids, + usage_limit=usage_limit, + request_options=request_options, + ) + return _response.data + + def create_batch( + self, + *, + emails: typing.Sequence[str], + seat_type: typing.Optional[SeatType] = OMIT, + group_ids: typing.Optional[typing.Sequence[str]] = OMIT, + usage_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddWorkspaceInviteResponseModel: + """ + Sends email invitations to join your workspace to the provided emails. Requires all email addresses to be part of a verified domain. If the users don't have an account they will be prompted to create one. If the users accept these invites they will be added as users to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. + + Parameters + ---------- + emails : typing.Sequence[str] + The email of the customer + + seat_type : typing.Optional[SeatType] + The seat type of the user + + group_ids : typing.Optional[typing.Sequence[str]] + The group ids of the user + + usage_limit : typing.Optional[int] + Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddWorkspaceInviteResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.invites.create_batch( + emails=["emails"], + ) + """ + _response = self._raw_client.create_batch( + emails=emails, + seat_type=seat_type, + group_ids=group_ids, + usage_limit=usage_limit, + request_options=request_options, + ) + return _response.data + + def delete( + self, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteWorkspaceInviteResponseModel: + """ + Invalidates an existing email invitation. The invitation will still show up in the inbox it has been delivered to, but activating it to join the workspace won't work. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. + + Parameters + ---------- + email : str + The email of the customer + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteWorkspaceInviteResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.invites.delete( + email="john.doe@testmail.com", + ) + """ + _response = self._raw_client.delete(email=email, request_options=request_options) + return _response.data + + +class AsyncInvitesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawInvitesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawInvitesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawInvitesClient + """ + return self._raw_client + + async def create( + self, + *, + email: str, + workspace_permission: typing.Optional[str] = OMIT, + seat_type: typing.Optional[SeatType] = OMIT, + group_ids: typing.Optional[typing.Sequence[str]] = OMIT, + usage_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddWorkspaceInviteResponseModel: + """ + Sends an email invitation to join your workspace to the provided email. If the user doesn't have an account they will be prompted to create one. If the user accepts this invite they will be added as a user to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. If the user is already in the workspace a 400 error will be returned. + + Parameters + ---------- + email : str + The email of the customer + + workspace_permission : typing.Optional[str] + The workspace permission of the user. This is deprecated, use `seat_type` instead. + + seat_type : typing.Optional[SeatType] + The seat type of the user + + group_ids : typing.Optional[typing.Sequence[str]] + The group ids of the user + + usage_limit : typing.Optional[int] + Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddWorkspaceInviteResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.invites.create( + email="john.doe@testmail.com", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create( + email=email, + workspace_permission=workspace_permission, + seat_type=seat_type, + group_ids=group_ids, + usage_limit=usage_limit, + request_options=request_options, + ) + return _response.data + + async def create_batch( + self, + *, + emails: typing.Sequence[str], + seat_type: typing.Optional[SeatType] = OMIT, + group_ids: typing.Optional[typing.Sequence[str]] = OMIT, + usage_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AddWorkspaceInviteResponseModel: + """ + Sends email invitations to join your workspace to the provided emails. Requires all email addresses to be part of a verified domain. If the users don't have an account they will be prompted to create one. If the users accept these invites they will be added as users to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. + + Parameters + ---------- + emails : typing.Sequence[str] + The email of the customer + + seat_type : typing.Optional[SeatType] + The seat type of the user + + group_ids : typing.Optional[typing.Sequence[str]] + The group ids of the user + + usage_limit : typing.Optional[int] + Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AddWorkspaceInviteResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.invites.create_batch( + emails=["emails"], + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_batch( + emails=emails, + seat_type=seat_type, + group_ids=group_ids, + usage_limit=usage_limit, + request_options=request_options, + ) + return _response.data + + async def delete( + self, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> DeleteWorkspaceInviteResponseModel: + """ + Invalidates an existing email invitation. The invitation will still show up in the inbox it has been delivered to, but activating it to join the workspace won't work. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. + + Parameters + ---------- + email : str + The email of the customer + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteWorkspaceInviteResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.invites.delete( + email="john.doe@testmail.com", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.delete(email=email, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/workspace/invites/raw_client.py b/data/src/elevenlabs/workspace/invites/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..40af0230daa346dcf6aa346de0c588d2510f0aaa --- /dev/null +++ b/data/src/elevenlabs/workspace/invites/raw_client.py @@ -0,0 +1,477 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.add_workspace_invite_response_model import AddWorkspaceInviteResponseModel +from ...types.delete_workspace_invite_response_model import DeleteWorkspaceInviteResponseModel +from ...types.seat_type import SeatType +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawInvitesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def create( + self, + *, + email: str, + workspace_permission: typing.Optional[str] = OMIT, + seat_type: typing.Optional[SeatType] = OMIT, + group_ids: typing.Optional[typing.Sequence[str]] = OMIT, + usage_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddWorkspaceInviteResponseModel]: + """ + Sends an email invitation to join your workspace to the provided email. If the user doesn't have an account they will be prompted to create one. If the user accepts this invite they will be added as a user to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. If the user is already in the workspace a 400 error will be returned. + + Parameters + ---------- + email : str + The email of the customer + + workspace_permission : typing.Optional[str] + The workspace permission of the user. This is deprecated, use `seat_type` instead. + + seat_type : typing.Optional[SeatType] + The seat type of the user + + group_ids : typing.Optional[typing.Sequence[str]] + The group ids of the user + + usage_limit : typing.Optional[int] + Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddWorkspaceInviteResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/invites/add", + method="POST", + json={ + "email": email, + "workspace_permission": workspace_permission, + "seat_type": seat_type, + "group_ids": group_ids, + "usage_limit": usage_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddWorkspaceInviteResponseModel, + construct_type( + type_=AddWorkspaceInviteResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def create_batch( + self, + *, + emails: typing.Sequence[str], + seat_type: typing.Optional[SeatType] = OMIT, + group_ids: typing.Optional[typing.Sequence[str]] = OMIT, + usage_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[AddWorkspaceInviteResponseModel]: + """ + Sends email invitations to join your workspace to the provided emails. Requires all email addresses to be part of a verified domain. If the users don't have an account they will be prompted to create one. If the users accept these invites they will be added as users to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. + + Parameters + ---------- + emails : typing.Sequence[str] + The email of the customer + + seat_type : typing.Optional[SeatType] + The seat type of the user + + group_ids : typing.Optional[typing.Sequence[str]] + The group ids of the user + + usage_limit : typing.Optional[int] + Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[AddWorkspaceInviteResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/invites/add-bulk", + method="POST", + json={ + "emails": emails, + "seat_type": seat_type, + "group_ids": group_ids, + "usage_limit": usage_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddWorkspaceInviteResponseModel, + construct_type( + type_=AddWorkspaceInviteResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def delete( + self, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DeleteWorkspaceInviteResponseModel]: + """ + Invalidates an existing email invitation. The invitation will still show up in the inbox it has been delivered to, but activating it to join the workspace won't work. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. + + Parameters + ---------- + email : str + The email of the customer + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DeleteWorkspaceInviteResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/invites", + method="DELETE", + json={ + "email": email, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteWorkspaceInviteResponseModel, + construct_type( + type_=DeleteWorkspaceInviteResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawInvitesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def create( + self, + *, + email: str, + workspace_permission: typing.Optional[str] = OMIT, + seat_type: typing.Optional[SeatType] = OMIT, + group_ids: typing.Optional[typing.Sequence[str]] = OMIT, + usage_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddWorkspaceInviteResponseModel]: + """ + Sends an email invitation to join your workspace to the provided email. If the user doesn't have an account they will be prompted to create one. If the user accepts this invite they will be added as a user to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. If the user is already in the workspace a 400 error will be returned. + + Parameters + ---------- + email : str + The email of the customer + + workspace_permission : typing.Optional[str] + The workspace permission of the user. This is deprecated, use `seat_type` instead. + + seat_type : typing.Optional[SeatType] + The seat type of the user + + group_ids : typing.Optional[typing.Sequence[str]] + The group ids of the user + + usage_limit : typing.Optional[int] + Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddWorkspaceInviteResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/invites/add", + method="POST", + json={ + "email": email, + "workspace_permission": workspace_permission, + "seat_type": seat_type, + "group_ids": group_ids, + "usage_limit": usage_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddWorkspaceInviteResponseModel, + construct_type( + type_=AddWorkspaceInviteResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def create_batch( + self, + *, + emails: typing.Sequence[str], + seat_type: typing.Optional[SeatType] = OMIT, + group_ids: typing.Optional[typing.Sequence[str]] = OMIT, + usage_limit: typing.Optional[int] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[AddWorkspaceInviteResponseModel]: + """ + Sends email invitations to join your workspace to the provided emails. Requires all email addresses to be part of a verified domain. If the users don't have an account they will be prompted to create one. If the users accept these invites they will be added as users to your workspace and your subscription using one of your seats. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. + + Parameters + ---------- + emails : typing.Sequence[str] + The email of the customer + + seat_type : typing.Optional[SeatType] + The seat type of the user + + group_ids : typing.Optional[typing.Sequence[str]] + The group ids of the user + + usage_limit : typing.Optional[int] + Monthly credit usage limit for the invitee. Omit or set to null for no custom cap. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[AddWorkspaceInviteResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/invites/add-bulk", + method="POST", + json={ + "emails": emails, + "seat_type": seat_type, + "group_ids": group_ids, + "usage_limit": usage_limit, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + AddWorkspaceInviteResponseModel, + construct_type( + type_=AddWorkspaceInviteResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def delete( + self, *, email: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DeleteWorkspaceInviteResponseModel]: + """ + Invalidates an existing email invitation. The invitation will still show up in the inbox it has been delivered to, but activating it to join the workspace won't work. This endpoint may only be called by workspace members with the WORKSPACE_MEMBERS_INVITE permission. + + Parameters + ---------- + email : str + The email of the customer + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DeleteWorkspaceInviteResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/invites", + method="DELETE", + json={ + "email": email, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DeleteWorkspaceInviteResponseModel, + construct_type( + type_=DeleteWorkspaceInviteResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/members/__init__.py b/data/src/elevenlabs/workspace/members/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/workspace/members/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/workspace/members/client.py b/data/src/elevenlabs/workspace/members/client.py new file mode 100644 index 0000000000000000000000000000000000000000..d9796cc77bb21f90f65ce27873dac37e5b79b8b3 --- /dev/null +++ b/data/src/elevenlabs/workspace/members/client.py @@ -0,0 +1,235 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.seat_type import SeatType +from ...types.update_workspace_member_response_model import UpdateWorkspaceMemberResponseModel +from ...types.workspace_member_response_model import WorkspaceMemberResponseModel +from .raw_client import AsyncRawMembersClient, RawMembersClient + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class MembersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawMembersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawMembersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawMembersClient + """ + return self._raw_client + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[WorkspaceMemberResponseModel]: + """ + Gets a list of all members of the workspace, including locked members. Service accounts are excluded. Requires the workspace_members_read permission. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[WorkspaceMemberResponseModel] + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.members.list() + """ + _response = self._raw_client.list(request_options=request_options) + return _response.data + + def update( + self, + *, + email: str, + is_locked: typing.Optional[bool] = OMIT, + workspace_role: typing.Optional[SeatType] = OMIT, + workspace_seat_type: typing.Optional[SeatType] = OMIT, + allow_downgrade_to_basic_seat: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpdateWorkspaceMemberResponseModel: + """ + Updates attributes of a workspace member. Apart from the email identifier, all parameters will remain unchanged unless specified. This endpoint may only be called by workspace administrators. + + Parameters + ---------- + email : str + Email of the target user. + + is_locked : typing.Optional[bool] + Whether to lock or unlock the user account. + + workspace_role : typing.Optional[SeatType] + The workspace role of the user. This is deprecated, use `workspace_seat_type` instead. + + workspace_seat_type : typing.Optional[SeatType] + The workspace seat type + + allow_downgrade_to_basic_seat : typing.Optional[bool] + When unlocking a user whose original seat type has no seats available but a basic seat is available, downgrade the user to a basic seat instead of failing. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateWorkspaceMemberResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.members.update( + email="email", + ) + """ + _response = self._raw_client.update( + email=email, + is_locked=is_locked, + workspace_role=workspace_role, + workspace_seat_type=workspace_seat_type, + allow_downgrade_to_basic_seat=allow_downgrade_to_basic_seat, + request_options=request_options, + ) + return _response.data + + +class AsyncMembersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawMembersClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawMembersClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawMembersClient + """ + return self._raw_client + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[WorkspaceMemberResponseModel]: + """ + Gets a list of all members of the workspace, including locked members. Service accounts are excluded. Requires the workspace_members_read permission. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[WorkspaceMemberResponseModel] + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.members.list() + + + asyncio.run(main()) + """ + _response = await self._raw_client.list(request_options=request_options) + return _response.data + + async def update( + self, + *, + email: str, + is_locked: typing.Optional[bool] = OMIT, + workspace_role: typing.Optional[SeatType] = OMIT, + workspace_seat_type: typing.Optional[SeatType] = OMIT, + allow_downgrade_to_basic_seat: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> UpdateWorkspaceMemberResponseModel: + """ + Updates attributes of a workspace member. Apart from the email identifier, all parameters will remain unchanged unless specified. This endpoint may only be called by workspace administrators. + + Parameters + ---------- + email : str + Email of the target user. + + is_locked : typing.Optional[bool] + Whether to lock or unlock the user account. + + workspace_role : typing.Optional[SeatType] + The workspace role of the user. This is deprecated, use `workspace_seat_type` instead. + + workspace_seat_type : typing.Optional[SeatType] + The workspace seat type + + allow_downgrade_to_basic_seat : typing.Optional[bool] + When unlocking a user whose original seat type has no seats available but a basic seat is available, downgrade the user to a basic seat instead of failing. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UpdateWorkspaceMemberResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.members.update( + email="email", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.update( + email=email, + is_locked=is_locked, + workspace_role=workspace_role, + workspace_seat_type=workspace_seat_type, + allow_downgrade_to_basic_seat=allow_downgrade_to_basic_seat, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/workspace/members/raw_client.py b/data/src/elevenlabs/workspace/members/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..c7a4de0691c6a4dfd99afe5625a3fc3fe1893587 --- /dev/null +++ b/data/src/elevenlabs/workspace/members/raw_client.py @@ -0,0 +1,299 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.seat_type import SeatType +from ...types.update_workspace_member_response_model import UpdateWorkspaceMemberResponseModel +from ...types.workspace_member_response_model import WorkspaceMemberResponseModel +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawMembersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.List[WorkspaceMemberResponseModel]]: + """ + Gets a list of all members of the workspace, including locked members. Service accounts are excluded. Requires the workspace_members_read permission. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.List[WorkspaceMemberResponseModel]] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/members", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[WorkspaceMemberResponseModel], + construct_type( + type_=typing.List[WorkspaceMemberResponseModel], # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def update( + self, + *, + email: str, + is_locked: typing.Optional[bool] = OMIT, + workspace_role: typing.Optional[SeatType] = OMIT, + workspace_seat_type: typing.Optional[SeatType] = OMIT, + allow_downgrade_to_basic_seat: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[UpdateWorkspaceMemberResponseModel]: + """ + Updates attributes of a workspace member. Apart from the email identifier, all parameters will remain unchanged unless specified. This endpoint may only be called by workspace administrators. + + Parameters + ---------- + email : str + Email of the target user. + + is_locked : typing.Optional[bool] + Whether to lock or unlock the user account. + + workspace_role : typing.Optional[SeatType] + The workspace role of the user. This is deprecated, use `workspace_seat_type` instead. + + workspace_seat_type : typing.Optional[SeatType] + The workspace seat type + + allow_downgrade_to_basic_seat : typing.Optional[bool] + When unlocking a user whose original seat type has no seats available but a basic seat is available, downgrade the user to a basic seat instead of failing. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[UpdateWorkspaceMemberResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/members", + method="POST", + json={ + "email": email, + "is_locked": is_locked, + "workspace_role": workspace_role, + "workspace_seat_type": workspace_seat_type, + "allow_downgrade_to_basic_seat": allow_downgrade_to_basic_seat, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateWorkspaceMemberResponseModel, + construct_type( + type_=UpdateWorkspaceMemberResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawMembersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def list( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.List[WorkspaceMemberResponseModel]]: + """ + Gets a list of all members of the workspace, including locked members. Service accounts are excluded. Requires the workspace_members_read permission. + + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.List[WorkspaceMemberResponseModel]] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/members", + method="GET", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.List[WorkspaceMemberResponseModel], + construct_type( + type_=typing.List[WorkspaceMemberResponseModel], # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def update( + self, + *, + email: str, + is_locked: typing.Optional[bool] = OMIT, + workspace_role: typing.Optional[SeatType] = OMIT, + workspace_seat_type: typing.Optional[SeatType] = OMIT, + allow_downgrade_to_basic_seat: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[UpdateWorkspaceMemberResponseModel]: + """ + Updates attributes of a workspace member. Apart from the email identifier, all parameters will remain unchanged unless specified. This endpoint may only be called by workspace administrators. + + Parameters + ---------- + email : str + Email of the target user. + + is_locked : typing.Optional[bool] + Whether to lock or unlock the user account. + + workspace_role : typing.Optional[SeatType] + The workspace role of the user. This is deprecated, use `workspace_seat_type` instead. + + workspace_seat_type : typing.Optional[SeatType] + The workspace seat type + + allow_downgrade_to_basic_seat : typing.Optional[bool] + When unlocking a user whose original seat type has no seats available but a basic seat is available, downgrade the user to a basic seat instead of failing. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[UpdateWorkspaceMemberResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/members", + method="POST", + json={ + "email": email, + "is_locked": is_locked, + "workspace_role": workspace_role, + "workspace_seat_type": workspace_seat_type, + "allow_downgrade_to_basic_seat": allow_downgrade_to_basic_seat, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + UpdateWorkspaceMemberResponseModel, + construct_type( + type_=UpdateWorkspaceMemberResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/raw_client.py b/data/src/elevenlabs/workspace/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..b2ffdffd38dcc6eb2595187fee0cbd3d649ef56f --- /dev/null +++ b/data/src/elevenlabs/workspace/raw_client.py @@ -0,0 +1,158 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.http_response import AsyncHttpResponse, HttpResponse +from ..core.parse_error import ParsingError +from ..core.request_options import RequestOptions +from ..core.unchecked_base_model import construct_type +from ..errors.unprocessable_entity_error import UnprocessableEntityError +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawWorkspaceClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def set_third_party_disabling_policy( + self, + *, + third_party_disable_allowed: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Set the workspace-wide Third-Party Disabling policy. When set, it forces, for every API key in the workspace, whether the holder of a key (potentially a third party who found it) may disable it via the self-disable endpoint or when it leaks publicly — overriding each key's own setting. Pass `true` to allow it for all keys, `false` to forbid it for all keys, or `null` to clear the override so per-key values and the plan default apply again. Workspace admins only. + + Parameters + ---------- + third_party_disable_allowed : typing.Optional[bool] + `true` forces every key in the workspace to be disable-able by its holder; `false` forbids it for every key; `null` clears the override (per-key values and the plan default apply). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspaces/api-keys/third-party-disabling", + method="POST", + json={ + "third_party_disable_allowed": third_party_disable_allowed, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawWorkspaceClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def set_third_party_disabling_policy( + self, + *, + third_party_disable_allowed: typing.Optional[bool] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Set the workspace-wide Third-Party Disabling policy. When set, it forces, for every API key in the workspace, whether the holder of a key (potentially a third party who found it) may disable it via the self-disable endpoint or when it leaks publicly — overriding each key's own setting. Pass `true` to allow it for all keys, `false` to forbid it for all keys, or `null` to clear the override so per-key values and the plan default apply again. Workspace admins only. + + Parameters + ---------- + third_party_disable_allowed : typing.Optional[bool] + `true` forces every key in the workspace to be disable-able by its holder; `false` forbids it for every key; `null` clears the override (per-key values and the plan default apply). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspaces/api-keys/third-party-disabling", + method="POST", + json={ + "third_party_disable_allowed": third_party_disable_allowed, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/resources/__init__.py b/data/src/elevenlabs/workspace/resources/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..33f0b39d548c3ad96fb6ca172370a5be4f6c93a3 --- /dev/null +++ b/data/src/elevenlabs/workspace/resources/__init__.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole +_dynamic_imports: typing.Dict[str, str] = { + "BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole": ".types" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole"] diff --git a/data/src/elevenlabs/workspace/resources/client.py b/data/src/elevenlabs/workspace/resources/client.py new file mode 100644 index 0000000000000000000000000000000000000000..4ee3f0dd54c961c72ea3485f524e49d339477599 --- /dev/null +++ b/data/src/elevenlabs/workspace/resources/client.py @@ -0,0 +1,407 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.resource_metadata_response_model import ResourceMetadataResponseModel +from ...types.workspace_resource_type import WorkspaceResourceType +from .raw_client import AsyncRawResourcesClient, RawResourcesClient +from .types.body_share_workspace_resource_v_1_workspace_resources_resource_id_share_post_role import ( + BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole, +) + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ResourcesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawResourcesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawResourcesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawResourcesClient + """ + return self._raw_client + + def get( + self, + resource_id: str, + *, + resource_type: WorkspaceResourceType, + request_options: typing.Optional[RequestOptions] = None, + ) -> ResourceMetadataResponseModel: + """ + Gets the metadata of a resource by ID. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ResourceMetadataResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.resources.get( + resource_id="resource_id", + resource_type="voice", + ) + """ + _response = self._raw_client.get(resource_id, resource_type=resource_type, request_options=request_options) + return _response.data + + def share( + self, + resource_id: str, + *, + role: BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole, + resource_type: WorkspaceResourceType, + user_email: typing.Optional[str] = OMIT, + group_id: typing.Optional[str] = OMIT, + workspace_api_key_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Grants a role (one of 'admin', 'editor', 'commenter', or 'viewer') on a workspace resource to a user, group, or workspace (service account) API key. This overrides any existing role the target has on the resource. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be shared with the service account associated with that key. You must have admin access to the resource to share it. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + role : BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole + Role to grant to the target: one of 'admin', 'editor', 'commenter', or 'viewer'. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + user_email : typing.Optional[str] + The email of the user or service account. + + group_id : typing.Optional[str] + The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + + workspace_api_key_id : typing.Optional[str] + The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.resources.share( + resource_id="resource_id", + role="admin", + resource_type="voice", + ) + """ + _response = self._raw_client.share( + resource_id, + role=role, + resource_type=resource_type, + user_email=user_email, + group_id=group_id, + workspace_api_key_id=workspace_api_key_id, + request_options=request_options, + ) + return _response.data + + def unshare( + self, + resource_id: str, + *, + resource_type: WorkspaceResourceType, + user_email: typing.Optional[str] = OMIT, + group_id: typing.Optional[str] = OMIT, + workspace_api_key_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Removes any existing role on a workspace resource from a user, group, or workspace (service account) API key. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be unshared from the service account associated with that key. You must have admin access to the resource to unshare it. You cannot remove permissions from the user who created the resource. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + user_email : typing.Optional[str] + The email of the user or service account. + + group_id : typing.Optional[str] + The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + + workspace_api_key_id : typing.Optional[str] + The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.resources.unshare( + resource_id="resource_id", + resource_type="voice", + ) + """ + _response = self._raw_client.unshare( + resource_id, + resource_type=resource_type, + user_email=user_email, + group_id=group_id, + workspace_api_key_id=workspace_api_key_id, + request_options=request_options, + ) + return _response.data + + +class AsyncResourcesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawResourcesClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawResourcesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawResourcesClient + """ + return self._raw_client + + async def get( + self, + resource_id: str, + *, + resource_type: WorkspaceResourceType, + request_options: typing.Optional[RequestOptions] = None, + ) -> ResourceMetadataResponseModel: + """ + Gets the metadata of a resource by ID. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ResourceMetadataResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.resources.get( + resource_id="resource_id", + resource_type="voice", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get( + resource_id, resource_type=resource_type, request_options=request_options + ) + return _response.data + + async def share( + self, + resource_id: str, + *, + role: BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole, + resource_type: WorkspaceResourceType, + user_email: typing.Optional[str] = OMIT, + group_id: typing.Optional[str] = OMIT, + workspace_api_key_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Grants a role (one of 'admin', 'editor', 'commenter', or 'viewer') on a workspace resource to a user, group, or workspace (service account) API key. This overrides any existing role the target has on the resource. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be shared with the service account associated with that key. You must have admin access to the resource to share it. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + role : BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole + Role to grant to the target: one of 'admin', 'editor', 'commenter', or 'viewer'. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + user_email : typing.Optional[str] + The email of the user or service account. + + group_id : typing.Optional[str] + The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + + workspace_api_key_id : typing.Optional[str] + The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.resources.share( + resource_id="resource_id", + role="admin", + resource_type="voice", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.share( + resource_id, + role=role, + resource_type=resource_type, + user_email=user_email, + group_id=group_id, + workspace_api_key_id=workspace_api_key_id, + request_options=request_options, + ) + return _response.data + + async def unshare( + self, + resource_id: str, + *, + resource_type: WorkspaceResourceType, + user_email: typing.Optional[str] = OMIT, + group_id: typing.Optional[str] = OMIT, + workspace_api_key_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> typing.Any: + """ + Removes any existing role on a workspace resource from a user, group, or workspace (service account) API key. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be unshared from the service account associated with that key. You must have admin access to the resource to unshare it. You cannot remove permissions from the user who created the resource. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + user_email : typing.Optional[str] + The email of the user or service account. + + group_id : typing.Optional[str] + The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + + workspace_api_key_id : typing.Optional[str] + The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.resources.unshare( + resource_id="resource_id", + resource_type="voice", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.unshare( + resource_id, + resource_type=resource_type, + user_email=user_email, + group_id=group_id, + workspace_api_key_id=workspace_api_key_id, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/workspace/resources/raw_client.py b/data/src/elevenlabs/workspace/resources/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..25b9a48eec4a3be6f74ac30be0d0174d966786d3 --- /dev/null +++ b/data/src/elevenlabs/workspace/resources/raw_client.py @@ -0,0 +1,510 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.jsonable_encoder import jsonable_encoder +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.resource_metadata_response_model import ResourceMetadataResponseModel +from ...types.workspace_resource_type import WorkspaceResourceType +from .types.body_share_workspace_resource_v_1_workspace_resources_resource_id_share_post_role import ( + BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawResourcesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get( + self, + resource_id: str, + *, + resource_type: WorkspaceResourceType, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[ResourceMetadataResponseModel]: + """ + Gets the metadata of a resource by ID. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[ResourceMetadataResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/resources/{jsonable_encoder(resource_id)}", + method="GET", + params={ + "resource_type": resource_type, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ResourceMetadataResponseModel, + construct_type( + type_=ResourceMetadataResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def share( + self, + resource_id: str, + *, + role: BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole, + resource_type: WorkspaceResourceType, + user_email: typing.Optional[str] = OMIT, + group_id: typing.Optional[str] = OMIT, + workspace_api_key_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Grants a role (one of 'admin', 'editor', 'commenter', or 'viewer') on a workspace resource to a user, group, or workspace (service account) API key. This overrides any existing role the target has on the resource. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be shared with the service account associated with that key. You must have admin access to the resource to share it. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + role : BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole + Role to grant to the target: one of 'admin', 'editor', 'commenter', or 'viewer'. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + user_email : typing.Optional[str] + The email of the user or service account. + + group_id : typing.Optional[str] + The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + + workspace_api_key_id : typing.Optional[str] + The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/resources/{jsonable_encoder(resource_id)}/share", + method="POST", + json={ + "role": role, + "resource_type": resource_type, + "user_email": user_email, + "group_id": group_id, + "workspace_api_key_id": workspace_api_key_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + def unshare( + self, + resource_id: str, + *, + resource_type: WorkspaceResourceType, + user_email: typing.Optional[str] = OMIT, + group_id: typing.Optional[str] = OMIT, + workspace_api_key_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[typing.Any]: + """ + Removes any existing role on a workspace resource from a user, group, or workspace (service account) API key. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be unshared from the service account associated with that key. You must have admin access to the resource to unshare it. You cannot remove permissions from the user who created the resource. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + user_email : typing.Optional[str] + The email of the user or service account. + + group_id : typing.Optional[str] + The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + + workspace_api_key_id : typing.Optional[str] + The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + f"v1/workspace/resources/{jsonable_encoder(resource_id)}/unshare", + method="POST", + json={ + "resource_type": resource_type, + "user_email": user_email, + "group_id": group_id, + "workspace_api_key_id": workspace_api_key_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawResourcesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get( + self, + resource_id: str, + *, + resource_type: WorkspaceResourceType, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[ResourceMetadataResponseModel]: + """ + Gets the metadata of a resource by ID. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[ResourceMetadataResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/resources/{jsonable_encoder(resource_id)}", + method="GET", + params={ + "resource_type": resource_type, + }, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + ResourceMetadataResponseModel, + construct_type( + type_=ResourceMetadataResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def share( + self, + resource_id: str, + *, + role: BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole, + resource_type: WorkspaceResourceType, + user_email: typing.Optional[str] = OMIT, + group_id: typing.Optional[str] = OMIT, + workspace_api_key_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Grants a role (one of 'admin', 'editor', 'commenter', or 'viewer') on a workspace resource to a user, group, or workspace (service account) API key. This overrides any existing role the target has on the resource. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be shared with the service account associated with that key. You must have admin access to the resource to share it. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + role : BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole + Role to grant to the target: one of 'admin', 'editor', 'commenter', or 'viewer'. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + user_email : typing.Optional[str] + The email of the user or service account. + + group_id : typing.Optional[str] + The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + + workspace_api_key_id : typing.Optional[str] + The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/resources/{jsonable_encoder(resource_id)}/share", + method="POST", + json={ + "role": role, + "resource_type": resource_type, + "user_email": user_email, + "group_id": group_id, + "workspace_api_key_id": workspace_api_key_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def unshare( + self, + resource_id: str, + *, + resource_type: WorkspaceResourceType, + user_email: typing.Optional[str] = OMIT, + group_id: typing.Optional[str] = OMIT, + workspace_api_key_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[typing.Any]: + """ + Removes any existing role on a workspace resource from a user, group, or workspace (service account) API key. To target a user or service account, pass only the user email; the user must be in your workspace. To target a group, pass only the group id. To target a workspace (service account) API key, pass the api key id; the resource will be unshared from the service account associated with that key. You must have admin access to the resource to unshare it. You cannot remove permissions from the user who created the resource. + + Parameters + ---------- + resource_id : str + The ID of the target resource. + + resource_type : WorkspaceResourceType + Resource type of the target resource. + + user_email : typing.Optional[str] + The email of the user or service account. + + group_id : typing.Optional[str] + The ID of the target group. Use 'default' to set the resource's baseline role — every workspace member receives this role unless they hold a higher one through a direct user grant, group membership, or workspace (service account) API key. + + workspace_api_key_id : typing.Optional[str] + The ID of the target workspace (service account) API key. This is not the API key string itself that you pass in the header for authentication — it is the key's ID, which workspace admins can find under Developers → Service Accounts. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + f"v1/workspace/resources/{jsonable_encoder(resource_id)}/unshare", + method="POST", + json={ + "resource_type": resource_type, + "user_email": user_email, + "group_id": group_id, + "workspace_api_key_id": workspace_api_key_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/resources/types/__init__.py b/data/src/elevenlabs/workspace/resources/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..962328fd2399e30599be420e683e131fb80b0569 --- /dev/null +++ b/data/src/elevenlabs/workspace/resources/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_share_workspace_resource_v_1_workspace_resources_resource_id_share_post_role import ( + BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole": ".body_share_workspace_resource_v_1_workspace_resources_resource_id_share_post_role" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole"] diff --git a/data/src/elevenlabs/workspace/resources/types/body_share_workspace_resource_v_1_workspace_resources_resource_id_share_post_role.py b/data/src/elevenlabs/workspace/resources/types/body_share_workspace_resource_v_1_workspace_resources_resource_id_share_post_role.py new file mode 100644 index 0000000000000000000000000000000000000000..d8ba5ecc0ea1cd79fdf4f089f9e5485406b891e9 --- /dev/null +++ b/data/src/elevenlabs/workspace/resources/types/body_share_workspace_resource_v_1_workspace_resources_resource_id_share_post_role.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyShareWorkspaceResourceV1WorkspaceResourcesResourceIdSharePostRole = typing.Union[ + typing.Literal["admin", "editor", "commenter", "viewer"], typing.Any +] diff --git a/data/src/elevenlabs/workspace/usage/__init__.py b/data/src/elevenlabs/workspace/usage/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ad40aa292b42477923913fbb48310097db192b11 --- /dev/null +++ b/data/src/elevenlabs/workspace/usage/__init__.py @@ -0,0 +1,36 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .types import BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem +_dynamic_imports: typing.Dict[str, str] = { + "BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem": ".types" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem"] diff --git a/data/src/elevenlabs/workspace/usage/client.py b/data/src/elevenlabs/workspace/usage/client.py new file mode 100644 index 0000000000000000000000000000000000000000..ad6dd8e2386198e193725784547780cfed8a8f89 --- /dev/null +++ b/data/src/elevenlabs/workspace/usage/client.py @@ -0,0 +1,185 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from ...types.column_filter import ColumnFilter +from ...types.workspace_analytics_query_response_model import WorkspaceAnalyticsQueryResponseModel +from .raw_client import AsyncRawUsageClient, RawUsageClient +from .types.body_get_workspace_usage_v_1_workspace_analytics_query_usage_by_product_over_time_post_group_by_item import ( + BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem, +) + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class UsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawUsageClient + """ + return self._raw_client + + def get_usage_by_product_over_time( + self, + *, + start_time: int, + end_time: int, + interval_seconds: typing.Optional[int] = OMIT, + group_by: typing.Optional[ + typing.Sequence[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem] + ] = OMIT, + filters: typing.Optional[typing.Sequence[ColumnFilter]] = OMIT, + time_zone: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceAnalyticsQueryResponseModel: + """ + Returns credit usage broken down by product type over time. The response is a tabular structure with columns, column_types, column_units, and rows. Some id columns also get a display-name column, such as user_label or voice_name, appended after the existing columns. + + Parameters + ---------- + start_time : int + Start of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + + end_time : int + End of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + + interval_seconds : typing.Optional[int] + Bucket size in seconds. Each row in the response covers this many seconds of the selected time range. For example, pass 3600 for hourly buckets, 86400 for daily buckets, or 604800 for weekly buckets. Whether `time_zone` shifts bucket boundaries depends on this value: week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight; whole-day multiples that are not whole weeks (e.g. 86400) align to local midnight; whole-hour multiples up to 24 hours (e.g. 3600, 14400) align to local hour boundaries from midnight; sub-hour values and other sizes remain UTC-anchored regardless of `time_zone`. + + group_by : typing.Optional[typing.Sequence[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem]] + + filters : typing.Optional[typing.Sequence[ColumnFilter]] + + time_zone : typing.Optional[str] + IANA time zone identifier (e.g. 'America/New_York', 'Europe/London', 'UTC') used to align bucket boundaries for eligible `interval_seconds` values. Week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight. Whole-day multiples that are not whole weeks start at local midnight; whole-hour multiples up to 24 hours align to local hour boundaries from midnight. Sub-hour intervals and other bucket sizes remain UTC-anchored regardless of this setting. Defaults to UTC. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceAnalyticsQueryResponseModel + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspace.usage.get_usage_by_product_over_time( + start_time=1, + end_time=1, + ) + """ + _response = self._raw_client.get_usage_by_product_over_time( + start_time=start_time, + end_time=end_time, + interval_seconds=interval_seconds, + group_by=group_by, + filters=filters, + time_zone=time_zone, + request_options=request_options, + ) + return _response.data + + +class AsyncUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawUsageClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawUsageClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawUsageClient + """ + return self._raw_client + + async def get_usage_by_product_over_time( + self, + *, + start_time: int, + end_time: int, + interval_seconds: typing.Optional[int] = OMIT, + group_by: typing.Optional[ + typing.Sequence[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem] + ] = OMIT, + filters: typing.Optional[typing.Sequence[ColumnFilter]] = OMIT, + time_zone: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> WorkspaceAnalyticsQueryResponseModel: + """ + Returns credit usage broken down by product type over time. The response is a tabular structure with columns, column_types, column_units, and rows. Some id columns also get a display-name column, such as user_label or voice_name, appended after the existing columns. + + Parameters + ---------- + start_time : int + Start of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + + end_time : int + End of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + + interval_seconds : typing.Optional[int] + Bucket size in seconds. Each row in the response covers this many seconds of the selected time range. For example, pass 3600 for hourly buckets, 86400 for daily buckets, or 604800 for weekly buckets. Whether `time_zone` shifts bucket boundaries depends on this value: week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight; whole-day multiples that are not whole weeks (e.g. 86400) align to local midnight; whole-hour multiples up to 24 hours (e.g. 3600, 14400) align to local hour boundaries from midnight; sub-hour values and other sizes remain UTC-anchored regardless of `time_zone`. + + group_by : typing.Optional[typing.Sequence[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem]] + + filters : typing.Optional[typing.Sequence[ColumnFilter]] + + time_zone : typing.Optional[str] + IANA time zone identifier (e.g. 'America/New_York', 'Europe/London', 'UTC') used to align bucket boundaries for eligible `interval_seconds` values. Week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight. Whole-day multiples that are not whole weeks start at local midnight; whole-hour multiples up to 24 hours align to local hour boundaries from midnight. Sub-hour intervals and other bucket sizes remain UTC-anchored regardless of this setting. Defaults to UTC. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WorkspaceAnalyticsQueryResponseModel + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspace.usage.get_usage_by_product_over_time( + start_time=1, + end_time=1, + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.get_usage_by_product_over_time( + start_time=start_time, + end_time=end_time, + interval_seconds=interval_seconds, + group_by=group_by, + filters=filters, + time_zone=time_zone, + request_options=request_options, + ) + return _response.data diff --git a/data/src/elevenlabs/workspace/usage/raw_client.py b/data/src/elevenlabs/workspace/usage/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..a70cfd0ab10bc2c3ded37eb2c2f79fa4b2527daf --- /dev/null +++ b/data/src/elevenlabs/workspace/usage/raw_client.py @@ -0,0 +1,214 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.serialization import convert_and_respect_annotation_metadata +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from ...types.column_filter import ColumnFilter +from ...types.workspace_analytics_query_response_model import WorkspaceAnalyticsQueryResponseModel +from .types.body_get_workspace_usage_v_1_workspace_analytics_query_usage_by_product_over_time_post_group_by_item import ( + BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem, +) +from pydantic import ValidationError + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class RawUsageClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_usage_by_product_over_time( + self, + *, + start_time: int, + end_time: int, + interval_seconds: typing.Optional[int] = OMIT, + group_by: typing.Optional[ + typing.Sequence[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem] + ] = OMIT, + filters: typing.Optional[typing.Sequence[ColumnFilter]] = OMIT, + time_zone: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[WorkspaceAnalyticsQueryResponseModel]: + """ + Returns credit usage broken down by product type over time. The response is a tabular structure with columns, column_types, column_units, and rows. Some id columns also get a display-name column, such as user_label or voice_name, appended after the existing columns. + + Parameters + ---------- + start_time : int + Start of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + + end_time : int + End of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + + interval_seconds : typing.Optional[int] + Bucket size in seconds. Each row in the response covers this many seconds of the selected time range. For example, pass 3600 for hourly buckets, 86400 for daily buckets, or 604800 for weekly buckets. Whether `time_zone` shifts bucket boundaries depends on this value: week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight; whole-day multiples that are not whole weeks (e.g. 86400) align to local midnight; whole-hour multiples up to 24 hours (e.g. 3600, 14400) align to local hour boundaries from midnight; sub-hour values and other sizes remain UTC-anchored regardless of `time_zone`. + + group_by : typing.Optional[typing.Sequence[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem]] + + filters : typing.Optional[typing.Sequence[ColumnFilter]] + + time_zone : typing.Optional[str] + IANA time zone identifier (e.g. 'America/New_York', 'Europe/London', 'UTC') used to align bucket boundaries for eligible `interval_seconds` values. Week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight. Whole-day multiples that are not whole weeks start at local midnight; whole-hour multiples up to 24 hours align to local hour boundaries from midnight. Sub-hour intervals and other bucket sizes remain UTC-anchored regardless of this setting. Defaults to UTC. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[WorkspaceAnalyticsQueryResponseModel] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspace/analytics/query/usage-by-product-over-time", + method="POST", + json={ + "start_time": start_time, + "end_time": end_time, + "interval_seconds": interval_seconds, + "group_by": group_by, + "filters": convert_and_respect_annotation_metadata( + object_=filters, annotation=typing.Sequence[ColumnFilter], direction="write" + ), + "time_zone": time_zone, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceAnalyticsQueryResponseModel, + construct_type( + type_=WorkspaceAnalyticsQueryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawUsageClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_usage_by_product_over_time( + self, + *, + start_time: int, + end_time: int, + interval_seconds: typing.Optional[int] = OMIT, + group_by: typing.Optional[ + typing.Sequence[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem] + ] = OMIT, + filters: typing.Optional[typing.Sequence[ColumnFilter]] = OMIT, + time_zone: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[WorkspaceAnalyticsQueryResponseModel]: + """ + Returns credit usage broken down by product type over time. The response is a tabular structure with columns, column_types, column_units, and rows. Some id columns also get a display-name column, such as user_label or voice_name, appended after the existing columns. + + Parameters + ---------- + start_time : int + Start of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + + end_time : int + End of the time range as a Unix timestamp in milliseconds. Must be at least 2020-01-01. + + interval_seconds : typing.Optional[int] + Bucket size in seconds. Each row in the response covers this many seconds of the selected time range. For example, pass 3600 for hourly buckets, 86400 for daily buckets, or 604800 for weekly buckets. Whether `time_zone` shifts bucket boundaries depends on this value: week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight; whole-day multiples that are not whole weeks (e.g. 86400) align to local midnight; whole-hour multiples up to 24 hours (e.g. 3600, 14400) align to local hour boundaries from midnight; sub-hour values and other sizes remain UTC-anchored regardless of `time_zone`. + + group_by : typing.Optional[typing.Sequence[BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem]] + + filters : typing.Optional[typing.Sequence[ColumnFilter]] + + time_zone : typing.Optional[str] + IANA time zone identifier (e.g. 'America/New_York', 'Europe/London', 'UTC') used to align bucket boundaries for eligible `interval_seconds` values. Week multiples (e.g. 604800) are calendar weeks that start Monday at local midnight. Whole-day multiples that are not whole weeks start at local midnight; whole-hour multiples up to 24 hours align to local hour boundaries from midnight. Sub-hour intervals and other bucket sizes remain UTC-anchored regardless of this setting. Defaults to UTC. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[WorkspaceAnalyticsQueryResponseModel] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspace/analytics/query/usage-by-product-over-time", + method="POST", + json={ + "start_time": start_time, + "end_time": end_time, + "interval_seconds": interval_seconds, + "group_by": group_by, + "filters": convert_and_respect_annotation_metadata( + object_=filters, annotation=typing.Sequence[ColumnFilter], direction="write" + ), + "time_zone": time_zone, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + WorkspaceAnalyticsQueryResponseModel, + construct_type( + type_=WorkspaceAnalyticsQueryResponseModel, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspace/usage/types/__init__.py b/data/src/elevenlabs/workspace/usage/types/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..87081c05895435173183e0a9650293921372c815 --- /dev/null +++ b/data/src/elevenlabs/workspace/usage/types/__init__.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from .body_get_workspace_usage_v_1_workspace_analytics_query_usage_by_product_over_time_post_group_by_item import ( + BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem, + ) +_dynamic_imports: typing.Dict[str, str] = { + "BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem": ".body_get_workspace_usage_v_1_workspace_analytics_query_usage_by_product_over_time_post_group_by_item" +} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem"] diff --git a/data/src/elevenlabs/workspace/usage/types/body_get_workspace_usage_v_1_workspace_analytics_query_usage_by_product_over_time_post_group_by_item.py b/data/src/elevenlabs/workspace/usage/types/body_get_workspace_usage_v_1_workspace_analytics_query_usage_by_product_over_time_post_group_by_item.py new file mode 100644 index 0000000000000000000000000000000000000000..83f1d4657a87cc3ccae666aa633d4800c6496021 --- /dev/null +++ b/data/src/elevenlabs/workspace/usage/types/body_get_workspace_usage_v_1_workspace_analytics_query_usage_by_product_over_time_post_group_by_item.py @@ -0,0 +1,26 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +BodyGetWorkspaceUsageV1WorkspaceAnalyticsQueryUsageByProductOverTimePostGroupByItem = typing.Union[ + typing.Literal[ + "product_type", + "model", + "voice_id", + "user_id", + "fiat_currency", + "fiat_charge_type", + "region", + "reporting_workspace_id", + "request_source", + "resource_id", + "subresource_id", + "request_queue_type", + "voice_multiplier", + "hashed_xi_api_key", + "billing_group_id", + "surface", + "actor", + ], + typing.Any, +] diff --git a/data/src/elevenlabs/workspaces/__init__.py b/data/src/elevenlabs/workspaces/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e6675df49da113ecb01ada7c2fe94187251e8797 --- /dev/null +++ b/data/src/elevenlabs/workspaces/__init__.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + +import typing +from importlib import import_module + +if typing.TYPE_CHECKING: + from . import api_keys +_dynamic_imports: typing.Dict[str, str] = {"api_keys": ".api_keys"} + + +def __getattr__(attr_name: str) -> typing.Any: + module_name = _dynamic_imports.get(attr_name) + if module_name is None: + raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}") + try: + module = import_module(module_name, __package__) + if module_name == f".{attr_name}": + return module + else: + return getattr(module, attr_name) + except ImportError as e: + raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e + except AttributeError as e: + raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e + + +def __dir__(): + lazy_attrs = list(_dynamic_imports.keys()) + return sorted(lazy_attrs) + + +__all__ = ["api_keys"] diff --git a/data/src/elevenlabs/workspaces/api_keys/__init__.py b/data/src/elevenlabs/workspaces/api_keys/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5cde0202dcf357bdc706ddaddb2b07a9fe49fffa --- /dev/null +++ b/data/src/elevenlabs/workspaces/api_keys/__init__.py @@ -0,0 +1,4 @@ +# This file was auto-generated by Fern from our API Definition. + +# isort: skip_file + diff --git a/data/src/elevenlabs/workspaces/api_keys/client.py b/data/src/elevenlabs/workspaces/api_keys/client.py new file mode 100644 index 0000000000000000000000000000000000000000..7f8a6f0a50dda1b65db743fcab353add84fb055e --- /dev/null +++ b/data/src/elevenlabs/workspaces/api_keys/client.py @@ -0,0 +1,111 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.request_options import RequestOptions +from .raw_client import AsyncRawApiKeysClient, RawApiKeysClient + + +class ApiKeysClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawApiKeysClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> RawApiKeysClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawApiKeysClient + """ + return self._raw_client + + def disable(self, *, api_key_name: str, request_options: typing.Optional[RequestOptions] = None) -> typing.Any: + """ + Disable the API key used to authenticate this request. Requires the query parameter `api_key_name=self` as an explicit confirmation. + + Parameters + ---------- + api_key_name : str + Must be set to `self` to disable the API key used to authenticate this request. Required as an explicit confirmation to avoid accidentally disabling the wrong key. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + from elevenlabs import ElevenLabs + + client = ElevenLabs( + api_key="YOUR_API_KEY", + ) + client.workspaces.api_keys.disable( + api_key_name="self", + ) + """ + _response = self._raw_client.disable(api_key_name=api_key_name, request_options=request_options) + return _response.data + + +class AsyncApiKeysClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawApiKeysClient(client_wrapper=client_wrapper) + + @property + def with_raw_response(self) -> AsyncRawApiKeysClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawApiKeysClient + """ + return self._raw_client + + async def disable( + self, *, api_key_name: str, request_options: typing.Optional[RequestOptions] = None + ) -> typing.Any: + """ + Disable the API key used to authenticate this request. Requires the query parameter `api_key_name=self` as an explicit confirmation. + + Parameters + ---------- + api_key_name : str + Must be set to `self` to disable the API key used to authenticate this request. Required as an explicit confirmation to avoid accidentally disabling the wrong key. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Any + Successful Response + + Examples + -------- + import asyncio + + from elevenlabs import AsyncElevenLabs + + client = AsyncElevenLabs( + api_key="YOUR_API_KEY", + ) + + + async def main() -> None: + await client.workspaces.api_keys.disable( + api_key_name="self", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.disable(api_key_name=api_key_name, request_options=request_options) + return _response.data diff --git a/data/src/elevenlabs/workspaces/api_keys/raw_client.py b/data/src/elevenlabs/workspaces/api_keys/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..105ebe74cb4b6e94af2e9d69d9391f662df99766 --- /dev/null +++ b/data/src/elevenlabs/workspaces/api_keys/raw_client.py @@ -0,0 +1,141 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.http_response import AsyncHttpResponse, HttpResponse +from ...core.parse_error import ParsingError +from ...core.request_options import RequestOptions +from ...core.unchecked_base_model import construct_type +from ...errors.unprocessable_entity_error import UnprocessableEntityError +from pydantic import ValidationError + + +class RawApiKeysClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def disable( + self, *, api_key_name: str, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[typing.Any]: + """ + Disable the API key used to authenticate this request. Requires the query parameter `api_key_name=self` as an explicit confirmation. + + Parameters + ---------- + api_key_name : str + Must be set to `self` to disable the API key used to authenticate this request. Required as an explicit confirmation to avoid accidentally disabling the wrong key. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[typing.Any] + Successful Response + """ + _response = self._client_wrapper.httpx_client.request( + "v1/workspaces/api-keys/disable", + method="POST", + params={ + "api_key_name": api_key_name, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return HttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + +class AsyncRawApiKeysClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def disable( + self, *, api_key_name: str, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[typing.Any]: + """ + Disable the API key used to authenticate this request. Requires the query parameter `api_key_name=self` as an explicit confirmation. + + Parameters + ---------- + api_key_name : str + Must be set to `self` to disable the API key used to authenticate this request. Required as an explicit confirmation to avoid accidentally disabling the wrong key. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[typing.Any] + Successful Response + """ + _response = await self._client_wrapper.httpx_client.request( + "v1/workspaces/api-keys/disable", + method="POST", + params={ + "api_key_name": api_key_name, + }, + request_options=request_options, + ) + try: + if _response is None or not _response.text.strip(): + return AsyncHttpResponse(response=_response, data=None) + if 200 <= _response.status_code < 300: + _data = typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + if _response.status_code == 422: + raise UnprocessableEntityError( + headers=dict(_response.headers), + body=typing.cast( + typing.Any, + construct_type( + type_=typing.Any, # type: ignore + object_=_response.json(), + ), + ), + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + except ValidationError as e: + raise ParsingError( + status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e + ) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) diff --git a/data/src/elevenlabs/workspaces/client.py b/data/src/elevenlabs/workspaces/client.py new file mode 100644 index 0000000000000000000000000000000000000000..484573edb928fbb3a0d25a972998158ea4433932 --- /dev/null +++ b/data/src/elevenlabs/workspaces/client.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .raw_client import AsyncRawWorkspacesClient, RawWorkspacesClient + +if typing.TYPE_CHECKING: + from .api_keys.client import ApiKeysClient, AsyncApiKeysClient + + +class WorkspacesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._raw_client = RawWorkspacesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._api_keys: typing.Optional[ApiKeysClient] = None + + @property + def with_raw_response(self) -> RawWorkspacesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + RawWorkspacesClient + """ + return self._raw_client + + @property + def api_keys(self): + if self._api_keys is None: + from .api_keys.client import ApiKeysClient # noqa: E402 + + self._api_keys = ApiKeysClient(client_wrapper=self._client_wrapper) + return self._api_keys + + +class AsyncWorkspacesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._raw_client = AsyncRawWorkspacesClient(client_wrapper=client_wrapper) + self._client_wrapper = client_wrapper + self._api_keys: typing.Optional[AsyncApiKeysClient] = None + + @property + def with_raw_response(self) -> AsyncRawWorkspacesClient: + """ + Retrieves a raw implementation of this client that returns raw responses. + + Returns + ------- + AsyncRawWorkspacesClient + """ + return self._raw_client + + @property + def api_keys(self): + if self._api_keys is None: + from .api_keys.client import AsyncApiKeysClient # noqa: E402 + + self._api_keys = AsyncApiKeysClient(client_wrapper=self._client_wrapper) + return self._api_keys diff --git a/data/src/elevenlabs/workspaces/raw_client.py b/data/src/elevenlabs/workspaces/raw_client.py new file mode 100644 index 0000000000000000000000000000000000000000..2eb7821d35a8c316272dafa9da8873c7bc1be8d7 --- /dev/null +++ b/data/src/elevenlabs/workspaces/raw_client.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper + + +class RawWorkspacesClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + +class AsyncRawWorkspacesClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper diff --git a/data/tests/__init__.py b/data/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/tests/e2e_test_convai.py b/data/tests/e2e_test_convai.py new file mode 100644 index 0000000000000000000000000000000000000000..a0e62641359c3a83713daaffdacc8fa3dd476f5f --- /dev/null +++ b/data/tests/e2e_test_convai.py @@ -0,0 +1,79 @@ +import os +import time +import asyncio + +import pytest +from elevenlabs import ElevenLabs +from elevenlabs.conversational_ai.conversation import Conversation, ClientTools +from elevenlabs.conversational_ai.default_audio_interface import DefaultAudioInterface + + +@pytest.mark.skipif(os.getenv("CI") == "true", reason="Skip live conversation test in CI environment") +def test_live_conversation(): + """Test a live conversation with actual audio I/O""" + + api_key = os.getenv("ELEVENLABS_API_KEY") + if not api_key: + raise ValueError("ELEVENLABS_API_KEY environment variable missing.") + + agent_id = os.getenv("AGENT_ID") + if not api_key or not agent_id: + raise ValueError("AGENT_ID environment variable missing.") + + client = ElevenLabs(api_key=api_key) + + # Create conversation handlers + def on_agent_response(text: str): + print(f"Agent: {text}") + + def on_user_transcript(text: str): + print(f"You: {text}") + + def on_latency(ms: int): + print(f"Latency: {ms}ms") + + # Initialize client tools + client_tools = ClientTools() + + def test(parameters): + print("Sync tool called with parameters:", parameters) + return "Tool called successfully" + + async def test_async(parameters): + # Simulate some async work + await asyncio.sleep(10) + print("Async tool called with parameters:", parameters) + return "Tool called successfully" + + client_tools.register("test", test) + client_tools.register("test_async", test_async, is_async=True) + + # Initialize conversation + conversation = Conversation( + client=client, + agent_id=agent_id, + requires_auth=False, + audio_interface=DefaultAudioInterface(), + callback_agent_response=on_agent_response, + callback_user_transcript=on_user_transcript, + callback_latency_measurement=on_latency, + client_tools=client_tools, + ) + + # Start the conversation + conversation.start_session() + + # Let it run for 100 seconds + time.sleep(100) + + # End the conversation + conversation.end_session() + conversation.wait_for_session_end() + + # Get the conversation ID for reference + conversation_id = conversation._conversation_id + print(f"Conversation ID: {conversation_id}") + + +if __name__ == "__main__": + test_live_conversation() diff --git a/data/tests/fixtures/voice_sample.mp3 b/data/tests/fixtures/voice_sample.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..8c0cfabbbd685adbc0fe9c383b1d7d43c1c541c8 --- /dev/null +++ b/data/tests/fixtures/voice_sample.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94e9b18bc9eda59f1416e90c37c2ff6273b974e52dedc14e6fe45851284c906d +size 25040 diff --git a/data/tests/test_async_convai.py b/data/tests/test_async_convai.py new file mode 100644 index 0000000000000000000000000000000000000000..a95ec38adbf401b974a1385e21a1606371750ec8 --- /dev/null +++ b/data/tests/test_async_convai.py @@ -0,0 +1,467 @@ +import asyncio +import json +import threading +from unittest.mock import AsyncMock, MagicMock, patch + +import pytest + +from elevenlabs.conversational_ai.conversation import ( + AsyncAudioInterface, + AsyncConversation, + ConversationInitiationData, +) + + +class MockAsyncAudioInterface(AsyncAudioInterface): + async def start(self, input_callback): + print("Async audio interface started") + self.input_callback = input_callback + + async def stop(self): + print("Async audio interface stopped") + + async def output(self, audio): + print(f"Would play audio of length: {len(audio)} bytes") + + async def interrupt(self): + print("Async audio interrupted") + + +# Add test constants and helpers at module level +TEST_CONVERSATION_ID = "test123" +TEST_AGENT_ID = "test_agent" + + +def create_mock_async_websocket(messages=None): + """Helper to create a mock async websocket with predefined responses""" + mock_ws = AsyncMock() + + if messages is None: + messages = [ + { + "type": "conversation_initiation_metadata", + "conversation_initiation_metadata_event": {"conversation_id": TEST_CONVERSATION_ID}, + }, + {"type": "agent_response", "agent_response_event": {"agent_response": "Hello there!"}}, + ] + + # Convert messages to JSON strings + json_messages = [json.dumps(msg) for msg in messages] + + # Create an iterator + message_iter = iter(json_messages) + + async def mock_recv(): + try: + return next(message_iter) + except StopIteration: + # After all messages, simulate timeout by sleeping forever + # This will be caught by asyncio.wait_for timeout in the conversation + await asyncio.sleep(float("inf")) + + mock_ws.recv = mock_recv + return mock_ws + + +@pytest.mark.asyncio +async def test_async_conversation_basic_flow(): + # Mock setup + mock_ws = create_mock_async_websocket() + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + agent_response_callback = AsyncMock() + test_user_id = "test_user_123" + + # Setup the conversation with user_id passed directly to the constructor + conversation = AsyncConversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + user_id=test_user_id, + requires_auth=False, + audio_interface=MockAsyncAudioInterface(), + callback_agent_response=agent_response_callback, + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.websockets.connect") as mock_connect: + mock_connect.return_value.__aenter__.return_value = mock_ws + + await conversation.start_session() + + # Wait a bit for the callback to be called + await asyncio.sleep(0.1) + + await conversation.end_session() + await conversation.wait_for_session_end() + + # Assertions - check the call was made with the right structure + send_calls = [call[0][0] for call in mock_ws.send.call_args_list] + init_messages = [json.loads(call) for call in send_calls if "conversation_initiation_client_data" in call] + assert len(init_messages) == 1 + init_message = init_messages[0] + + assert init_message["type"] == "conversation_initiation_client_data" + assert init_message["custom_llm_extra_body"] == {} + assert init_message["conversation_config_override"] == {} + assert init_message["dynamic_variables"] == {} + assert init_message["source_info"]["source"] == "python_sdk" + assert "version" in init_message["source_info"] + assert init_message["user_id"] == test_user_id + agent_response_callback.assert_called_once_with("Hello there!") + assert conversation._conversation_id == TEST_CONVERSATION_ID + assert conversation.user_id == test_user_id + + +@pytest.mark.asyncio +async def test_async_conversation_with_auth(): + # Mock setup + mock_client = MagicMock() + mock_client.conversational_ai.conversations.get_signed_url.return_value.signed_url = "wss://signed.url" + mock_ws = create_mock_async_websocket( + [ + { + "type": "conversation_initiation_metadata", + "conversation_initiation_metadata_event": {"conversation_id": TEST_CONVERSATION_ID}, + } + ] + ) + + conversation = AsyncConversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=True, + audio_interface=MockAsyncAudioInterface(), + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.websockets.connect") as mock_connect: + mock_connect.return_value.__aenter__.return_value = mock_ws + + await conversation.start_session() + await conversation.end_session() + await conversation.wait_for_session_end() + + # Assertions + mock_client.conversational_ai.conversations.get_signed_url.assert_called_once_with(agent_id=TEST_AGENT_ID, environment=None) + + +@pytest.mark.asyncio +async def test_async_conversation_gets_signed_url_off_event_loop(): + conversation = AsyncConversation(client=MagicMock(), agent_id=TEST_AGENT_ID, requires_auth=True) + event_loop_thread = threading.get_ident() + + def get_signed_url(): + assert threading.get_ident() != event_loop_thread + return "wss://signed.url" + + with patch.object(conversation, "_get_signed_url", side_effect=get_signed_url), patch.object( + conversation, "_run", new=AsyncMock() + ): + await conversation.start_session() + await conversation.wait_for_session_end() + await conversation.end_session() + + +@pytest.mark.asyncio +async def test_async_conversation_with_dynamic_variables(): + # Mock setup + mock_ws = create_mock_async_websocket() + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + agent_response_callback = AsyncMock() + + dynamic_variables = {"name": "angelo"} + config = ConversationInitiationData(dynamic_variables=dynamic_variables) + + # Setup the conversation + conversation = AsyncConversation( + client=mock_client, + config=config, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAsyncAudioInterface(), + callback_agent_response=agent_response_callback, + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.websockets.connect") as mock_connect: + mock_connect.return_value.__aenter__.return_value = mock_ws + + await conversation.start_session() + + # Wait a bit for the callback to be called + await asyncio.sleep(0.1) + + await conversation.end_session() + await conversation.wait_for_session_end() + + # Assertions - check the call was made with the right structure + send_calls = [call[0][0] for call in mock_ws.send.call_args_list] + init_messages = [json.loads(call) for call in send_calls if "conversation_initiation_client_data" in call] + assert len(init_messages) == 1 + init_message = init_messages[0] + + assert init_message["type"] == "conversation_initiation_client_data" + assert init_message["custom_llm_extra_body"] == {} + assert init_message["conversation_config_override"] == {} + assert init_message["dynamic_variables"] == {"name": "angelo"} + assert init_message["source_info"]["source"] == "python_sdk" + assert "version" in init_message["source_info"] + agent_response_callback.assert_called_once_with("Hello there!") + assert conversation._conversation_id == TEST_CONVERSATION_ID + + +@pytest.mark.asyncio +async def test_async_conversation_with_contextual_update(): + # Mock setup + mock_ws = create_mock_async_websocket([]) + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + # Setup the conversation + conversation = AsyncConversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAsyncAudioInterface(), + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.websockets.connect") as mock_connect: + mock_connect.return_value.__aenter__.return_value = mock_ws + + await conversation.start_session() + await asyncio.sleep(0.1) + + await conversation.send_contextual_update("User appears to be looking at pricing page") + + # Teardown + await conversation.end_session() + await conversation.wait_for_session_end() + + # Assertions + expected = json.dumps({"type": "contextual_update", "text": "User appears to be looking at pricing page"}) + mock_ws.send.assert_any_call(expected) + + +@pytest.mark.asyncio +async def test_async_conversation_send_user_message(): + # Mock setup + mock_ws = create_mock_async_websocket([]) + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + # Setup the conversation + conversation = AsyncConversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAsyncAudioInterface(), + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.websockets.connect") as mock_connect: + mock_connect.return_value.__aenter__.return_value = mock_ws + + await conversation.start_session() + await asyncio.sleep(0.1) + + await conversation.send_user_message("Hello, how are you?") + + # Teardown + await conversation.end_session() + await conversation.wait_for_session_end() + + # Assertions + expected = json.dumps({"type": "user_message", "text": "Hello, how are you?"}) + mock_ws.send.assert_any_call(expected) + + +@pytest.mark.asyncio +async def test_async_conversation_register_user_activity(): + # Mock setup + mock_ws = create_mock_async_websocket([]) + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + # Setup the conversation + conversation = AsyncConversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAsyncAudioInterface(), + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.websockets.connect") as mock_connect: + mock_connect.return_value.__aenter__.return_value = mock_ws + + await conversation.start_session() + await asyncio.sleep(0.1) + + await conversation.register_user_activity() + + # Teardown + await conversation.end_session() + await conversation.wait_for_session_end() + + # Assertions + expected = json.dumps({"type": "user_activity"}) + mock_ws.send.assert_any_call(expected) + + +@pytest.mark.asyncio +async def test_async_conversation_callback_flows(): + # Mock setup for testing all callback types + messages = [ + { + "type": "conversation_initiation_metadata", + "conversation_initiation_metadata_event": {"conversation_id": TEST_CONVERSATION_ID}, + }, + {"type": "agent_response", "agent_response_event": {"agent_response": "Hello there!"}}, + { + "type": "agent_response_correction", + "agent_response_correction_event": { + "original_agent_response": "Hello ther!", + "corrected_agent_response": "Hello there!", + }, + }, + {"type": "user_transcript", "user_transcription_event": {"user_transcript": "Hi, how are you?"}}, + {"type": "ping", "ping_event": {"event_id": "123", "ping_ms": 50}}, + {"type": "interruption", "interruption_event": {"event_id": "456"}}, + { + "type": "audio", + "audio_event": {"event_id": "789", "audio_base_64": "dGVzdA=="}, # "test" in base64 + }, + ] + + mock_ws = create_mock_async_websocket(messages) + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + # Setup callbacks + agent_response_callback = AsyncMock() + agent_response_correction_callback = AsyncMock() + user_transcript_callback = AsyncMock() + latency_measurement_callback = AsyncMock() + end_session_callback = AsyncMock() + + # Setup the conversation + conversation = AsyncConversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAsyncAudioInterface(), + callback_agent_response=agent_response_callback, + callback_agent_response_correction=agent_response_correction_callback, + callback_user_transcript=user_transcript_callback, + callback_latency_measurement=latency_measurement_callback, + callback_end_session=end_session_callback, + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.websockets.connect") as mock_connect: + mock_connect.return_value.__aenter__.return_value = mock_ws + + await conversation.start_session() + + # Wait for callbacks to be processed + await asyncio.sleep(0.2) + + await conversation.end_session() + await conversation.wait_for_session_end() + + # Assertions + agent_response_callback.assert_called_with("Hello there!") + agent_response_correction_callback.assert_called_with("Hello ther!", "Hello there!") + user_transcript_callback.assert_called_with("Hi, how are you?") + latency_measurement_callback.assert_called_with(50) + end_session_callback.assert_called_once() + assert conversation._conversation_id == TEST_CONVERSATION_ID + assert conversation._last_interrupt_id == 456 + + +@pytest.mark.asyncio +async def test_async_conversation_wss_url_generation_without_get_environment(): + from elevenlabs.core.client_wrapper import SyncClientWrapper + + # Test with various base URL formats to ensure robustness + test_cases = [ + ("https://api.elevenlabs.io", "wss://api.elevenlabs.io"), + ("https://api.us.elevenlabs.io", "wss://api.us.elevenlabs.io"), + ("https://api.eu.residency.elevenlabs.io", "wss://api.eu.residency.elevenlabs.io"), + ("http://localhost:8000", "ws://localhost:8000"), + ] + + for base_url, expected_ws_base in test_cases: + # Create a real SyncClientWrapper to ensure it doesn't have get_environment method + mock_client = MagicMock() + mock_client._client_wrapper = SyncClientWrapper( + base_url=base_url, api_key="test_key", httpx_client=MagicMock(), timeout=30.0 + ) + + conversation = AsyncConversation( + client=mock_client, agent_id=TEST_AGENT_ID, requires_auth=False, audio_interface=MockAsyncAudioInterface() + ) + + try: + wss_url = conversation._get_wss_url() + + # Verify the URL is correctly generated + expected_url = ( + f"{expected_ws_base}/v1/convai/conversation?agent_id={TEST_AGENT_ID}&source=python_sdk&version=" + ) + assert wss_url.startswith(expected_url), f"URL should start with {expected_url}, got {wss_url}" + + # Verify the URL contains version parameter + assert "version=" in wss_url, f"URL should contain version parameter, got {wss_url}" + + except AttributeError as e: + if "get_environment" in str(e): + assert False + else: + raise # Re-raise if it's a different AttributeError + + except Exception as e: + assert False, f"Unexpected error generating WebSocket URL: {e}" + + +@pytest.mark.asyncio +async def test_async_websocket_url_construction_edge_cases(): + """Test WebSocket URL construction edge cases for async conversation, specifically for trailing slash handling.""" + from elevenlabs.conversational_ai.conversation import AsyncConversation + from elevenlabs.core.client_wrapper import SyncClientWrapper + + # Test cases with various base URL formats + test_cases = [ + # Base URLs without trailing slashes (the main edge case) + ("https://api.eu.residency.elevenlabs.io", "wss://api.eu.residency.elevenlabs.io"), + ("https://api.elevenlabs.io", "wss://api.elevenlabs.io"), + ("http://localhost:8000", "ws://localhost:8000"), + # Base URLs with trailing slashes (should still work) + ("https://api.eu.residency.elevenlabs.io/", "wss://api.eu.residency.elevenlabs.io"), + ("https://api.elevenlabs.io/", "wss://api.elevenlabs.io"), + ("http://localhost:8000/", "ws://localhost:8000"), + ] + + for base_url, expected_ws_base in test_cases: + # Test async conversation WebSocket URL construction + mock_client = MagicMock() + mock_client._client_wrapper = SyncClientWrapper( + base_url=base_url, api_key="test_key", httpx_client=MagicMock(), timeout=30.0 + ) + + conversation = AsyncConversation( + client=mock_client, agent_id=TEST_AGENT_ID, requires_auth=False, audio_interface=MockAsyncAudioInterface() + ) + + # Test conversation URL generation + conv_url = conversation._get_wss_url() + expected_conv_url = f"{expected_ws_base}/v1/convai/conversation" + assert ( + expected_conv_url in conv_url + ), f"Async conversation URL should contain {expected_conv_url}, got {conv_url}" + + # Ensure no double slashes in the path (except after the protocol) + url_path = conv_url.split("://", 1)[1] # Remove protocol + assert "//" not in url_path, f"Async conversation URL should not contain double slashes in path: {conv_url}" diff --git a/data/tests/test_audio_isolation.py b/data/tests/test_audio_isolation.py new file mode 100644 index 0000000000000000000000000000000000000000..b002a71dc86ce3c0a66cb6b7b32bf2eafbfb36ea --- /dev/null +++ b/data/tests/test_audio_isolation.py @@ -0,0 +1,32 @@ +from elevenlabs.play import play +from elevenlabs.client import ElevenLabs + +from .utils import IN_GITHUB, DEFAULT_VOICE_FILE + + +def test_audio_isolation() -> None: + """Test basic audio isolation.""" + client = ElevenLabs() + audio_file = open(DEFAULT_VOICE_FILE, "rb") + try: + audio_stream = client.audio_isolation.convert(audio=audio_file) + audio = b"".join(chunk for chunk in audio_stream) + assert isinstance(audio, bytes), "Combined audio should be bytes" + if not IN_GITHUB: + play(audio) + finally: + audio_file.close() + + +def test_audio_isolation_as_stream(): + """Test audio isolation with streaming.""" + client = ElevenLabs() + audio_file = open(DEFAULT_VOICE_FILE, "rb") + try: + audio_stream = client.audio_isolation.stream(audio=audio_file) + audio = b"".join(chunk for chunk in audio_stream) + assert isinstance(audio, bytes), "Combined audio should be bytes" + if not IN_GITHUB: + play(audio) + finally: + audio_file.close() diff --git a/data/tests/test_client_headers.py b/data/tests/test_client_headers.py new file mode 100644 index 0000000000000000000000000000000000000000..3d12778748a768cafaeee1dc9673b779f73a9ab3 --- /dev/null +++ b/data/tests/test_client_headers.py @@ -0,0 +1,106 @@ +"""Tests that the user-facing ElevenLabs / AsyncElevenLabs classes forward +the ``headers`` and ``follow_redirects`` kwargs through to the underlying +client wrapper / httpx client. + +Regression coverage for the case where ``ElevenLabs(headers={...})`` and +``ElevenLabs(follow_redirects=False)`` raised TypeError because the +subclass's hand-rolled ``__init__`` did not accept or forward kwargs that +``BaseElevenLabs`` supports. +""" + +import pytest + +from elevenlabs.client import AsyncElevenLabs, ElevenLabs + + +def test_sync_client_accepts_headers_kwarg(): + """ElevenLabs(headers=...) does not raise and stores the headers.""" + custom = {"x-trace-id": "abc-123", "x-tenant": "acme"} + client = ElevenLabs(api_key="sk-test", headers=custom) + assert client._client_wrapper.get_custom_headers() == custom + + +def test_sync_client_headers_default_is_none(): + """Omitting headers leaves the wrapper's custom headers unset (backward-compatible).""" + client = ElevenLabs(api_key="sk-test") + assert client._client_wrapper.get_custom_headers() is None + + +def test_sync_client_custom_headers_appear_in_merged_headers(): + """Headers from the constructor are merged into get_headers() output.""" + client = ElevenLabs(api_key="sk-test", headers={"x-trace-id": "abc-123"}) + merged = client._client_wrapper.get_headers() + assert merged.get("x-trace-id") == "abc-123" + + +async def test_async_client_accepts_headers_kwarg(): + """AsyncElevenLabs(headers=...) does not raise and stores the headers.""" + custom = {"x-trace-id": "abc-123"} + client = AsyncElevenLabs(api_key="sk-test", headers=custom) + assert client._client_wrapper.get_custom_headers() == custom + + +async def test_async_client_headers_default_is_none(): + """Omitting headers on AsyncElevenLabs leaves custom headers unset.""" + client = AsyncElevenLabs(api_key="sk-test") + assert client._client_wrapper.get_custom_headers() is None + + +def test_sync_constructor_signature_advertises_headers(): + """`headers` is a documented keyword-only parameter on ElevenLabs.__init__.""" + import inspect + + sig = inspect.signature(ElevenLabs.__init__) + assert "headers" in sig.parameters + assert sig.parameters["headers"].kind == inspect.Parameter.KEYWORD_ONLY + + +def test_async_constructor_signature_advertises_headers(): + """`headers` is a documented keyword-only parameter on AsyncElevenLabs.__init__.""" + import inspect + + sig = inspect.signature(AsyncElevenLabs.__init__) + assert "headers" in sig.parameters + assert sig.parameters["headers"].kind == inspect.Parameter.KEYWORD_ONLY + + +def test_sync_client_accepts_follow_redirects_false(): + """ElevenLabs(follow_redirects=False) propagates to the default httpx client.""" + client = ElevenLabs(api_key="sk-test", follow_redirects=False) + assert client._client_wrapper.httpx_client.httpx_client.follow_redirects is False + + +def test_sync_client_follow_redirects_default_is_true(): + """Omitting follow_redirects keeps the parent's default of True.""" + client = ElevenLabs(api_key="sk-test") + assert client._client_wrapper.httpx_client.httpx_client.follow_redirects is True + + +def test_async_client_accepts_follow_redirects_false(): + """AsyncElevenLabs(follow_redirects=False) propagates to the default httpx client.""" + client = AsyncElevenLabs(api_key="sk-test", follow_redirects=False) + assert client._client_wrapper.httpx_client.httpx_client.follow_redirects is False + + +def test_async_client_follow_redirects_default_is_true(): + """Omitting follow_redirects on AsyncElevenLabs keeps the parent's default of True.""" + client = AsyncElevenLabs(api_key="sk-test") + assert client._client_wrapper.httpx_client.httpx_client.follow_redirects is True + + +def test_sync_constructor_signature_advertises_follow_redirects(): + """`follow_redirects` is a documented keyword-only parameter on ElevenLabs.__init__.""" + import inspect + + sig = inspect.signature(ElevenLabs.__init__) + assert "follow_redirects" in sig.parameters + assert sig.parameters["follow_redirects"].kind == inspect.Parameter.KEYWORD_ONLY + + +def test_async_constructor_signature_advertises_follow_redirects(): + """`follow_redirects` is a documented keyword-only parameter on AsyncElevenLabs.__init__.""" + import inspect + + sig = inspect.signature(AsyncElevenLabs.__init__) + assert "follow_redirects" in sig.parameters + assert sig.parameters["follow_redirects"].kind == inspect.Parameter.KEYWORD_ONLY diff --git a/data/tests/test_client_tools.py b/data/tests/test_client_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..5df2efd139e30ef79c351784c717a61e7c064fb0 --- /dev/null +++ b/data/tests/test_client_tools.py @@ -0,0 +1,312 @@ +""" +Tests for ClientTools custom event loop functionality. +""" + +import asyncio +import pytest +import threading +import time +from elevenlabs.conversational_ai.conversation import ClientTools + + +class TestClientTools: + """Test suite for ClientTools functionality.""" + + def test_default_initialization(self): + """Test that ClientTools can be initialized without parameters (backwards compatibility).""" + client_tools = ClientTools() + assert client_tools._custom_loop is None + assert client_tools._loop is None + assert not client_tools._running.is_set() + + def test_custom_loop_initialization(self): + """Test that ClientTools can be initialized with a custom event loop.""" + loop = asyncio.new_event_loop() + try: + client_tools = ClientTools(loop=loop) + assert client_tools._custom_loop is loop + assert client_tools._loop is None + assert not client_tools._running.is_set() + finally: + loop.close() + + def test_start_with_default_loop(self): + """Test starting ClientTools with default behavior (creates own loop).""" + client_tools = ClientTools() + + try: + client_tools.start() + assert client_tools._running.is_set() + assert client_tools._loop is not None + assert client_tools._thread is not None + assert client_tools._thread.is_alive() + finally: + client_tools.stop() + + @pytest.mark.asyncio + async def test_start_with_custom_loop(self): + """Test starting ClientTools with a custom event loop.""" + custom_loop = asyncio.get_running_loop() + client_tools = ClientTools(loop=custom_loop) + + try: + client_tools.start() + assert client_tools._running.is_set() + assert client_tools._loop is custom_loop + assert client_tools._thread is None # No thread created for custom loop + finally: + client_tools.stop() + + def test_tool_registration(self): + """Test that tools can be registered correctly.""" + client_tools = ClientTools() + + def sync_tool(params): + return "sync result" + + async def async_tool(params): + return "async result" + + client_tools.register("sync_tool", sync_tool, is_async=False) + client_tools.register("async_tool", async_tool, is_async=True) + + assert "sync_tool" in client_tools.tools + assert "async_tool" in client_tools.tools + + sync_handler, sync_is_async = client_tools.tools["sync_tool"] + async_handler, async_is_async = client_tools.tools["async_tool"] + + assert sync_handler is sync_tool + assert not sync_is_async + assert async_handler is async_tool + assert async_is_async + + def test_duplicate_tool_registration(self): + """Test that registering a tool with the same name raises an error.""" + client_tools = ClientTools() + + def tool(params): + return "result" + + client_tools.register("test_tool", tool) + + with pytest.raises(ValueError, match="Tool 'test_tool' is already registered"): + client_tools.register("test_tool", tool) + + def test_invalid_handler_registration(self): + """Test that registering a non-callable handler raises an error.""" + client_tools = ClientTools() + + with pytest.raises(ValueError, match="Handler must be callable"): + client_tools.register("invalid_tool", "not_callable") + + @pytest.mark.asyncio + async def test_sync_tool_execution_with_custom_loop(self): + """Test executing a sync tool with a custom event loop.""" + custom_loop = asyncio.get_running_loop() + client_tools = ClientTools(loop=custom_loop) + + def sync_tool(params): + return f"sync result: {params.get('input', 'default')}" + + client_tools.register("sync_tool", sync_tool, is_async=False) + client_tools.start() + + try: + result = await client_tools.handle("sync_tool", {"input": "test"}) + assert result == "sync result: test" + finally: + client_tools.stop() + + @pytest.mark.asyncio + async def test_async_tool_execution_with_custom_loop(self): + """Test executing an async tool with a custom event loop.""" + custom_loop = asyncio.get_running_loop() + client_tools = ClientTools(loop=custom_loop) + + async def async_tool(params): + await asyncio.sleep(0.01) # Simulate async work + return f"async result: {params.get('input', 'default')}" + + client_tools.register("async_tool", async_tool, is_async=True) + client_tools.start() + + try: + result = await client_tools.handle("async_tool", {"input": "test"}) + assert result == "async result: test" + finally: + client_tools.stop() + + @pytest.mark.asyncio + async def test_tool_execution_with_callback_custom_loop(self): + """Test executing a tool via callback mechanism with custom event loop.""" + custom_loop = asyncio.get_running_loop() + client_tools = ClientTools(loop=custom_loop) + + def sync_tool(params): + return f"callback result: {params.get('data', 'none')}" + + client_tools.register("callback_tool", sync_tool, is_async=False) + client_tools.start() + + callback_results = [] + + def test_callback(response): + callback_results.append(response) + + try: + client_tools.execute_tool( + "callback_tool", + {"tool_call_id": "test123", "data": "callback_test"}, + test_callback + ) + + # Wait for callback to be executed + await asyncio.sleep(0.1) + + assert len(callback_results) == 1 + response = callback_results[0] + assert response["type"] == "client_tool_result" + assert response["tool_call_id"] == "test123" + assert "callback result: callback_test" in response["result"] + assert response["is_error"] is False + finally: + client_tools.stop() + + def test_sync_tool_execution_with_default_loop(self): + """Test executing a sync tool with default loop behavior.""" + client_tools = ClientTools() + + def sync_tool(params): + return f"default sync: {params.get('value', 'empty')}" + + client_tools.register("sync_tool", sync_tool, is_async=False) + client_tools.start() + + # Use asyncio.run to test from a fresh event loop + async def test(): + result = await client_tools.handle("sync_tool", {"value": "default_test"}) + return result + + try: + result = asyncio.run(test()) + assert result == "default sync: default_test" + finally: + client_tools.stop() + + @pytest.mark.asyncio + async def test_unregistered_tool_error(self): + """Test that calling an unregistered tool raises an error.""" + custom_loop = asyncio.get_running_loop() + client_tools = ClientTools(loop=custom_loop) + client_tools.start() + + try: + with pytest.raises(ValueError, match="Tool 'nonexistent' is not registered"): + await client_tools.handle("nonexistent", {}) + finally: + client_tools.stop() + + def test_execute_tool_without_start(self): + """Test that execute_tool raises error when not started.""" + client_tools = ClientTools() + + def callback(response): + pass + + with pytest.raises(RuntimeError, match="ClientTools event loop is not running"): + client_tools.execute_tool("any_tool", {}, callback) + + @pytest.mark.asyncio + async def test_tool_exception_handling(self): + """Test that tool exceptions are handled correctly.""" + custom_loop = asyncio.get_running_loop() + client_tools = ClientTools(loop=custom_loop) + + def failing_tool(params): + raise ValueError("Tool failed intentionally") + + client_tools.register("failing_tool", failing_tool, is_async=False) + client_tools.start() + + callback_results = [] + + def error_callback(response): + callback_results.append(response) + + try: + client_tools.execute_tool( + "failing_tool", + {"tool_call_id": "error_test"}, + error_callback + ) + + # Wait for callback + await asyncio.sleep(0.1) + + assert len(callback_results) == 1 + response = callback_results[0] + assert response["type"] == "client_tool_result" + assert response["tool_call_id"] == "error_test" + assert response["is_error"] is True + assert "Tool failed intentionally" in response["result"] + finally: + client_tools.stop() + + @pytest.mark.asyncio + async def test_event_loop_isolation(self): + """Test that custom loop prevents 'different event loop' errors.""" + # This test simulates the scenario mentioned in the GitHub issue + main_loop = asyncio.get_running_loop() + + # Create ClientTools with the current loop + client_tools = ClientTools(loop=main_loop) + + async def loop_aware_tool(params): + # This tool checks which loop it's running on + current_loop = asyncio.get_running_loop() + return f"Running on loop: {id(current_loop)}" + + client_tools.register("loop_tool", loop_aware_tool, is_async=True) + client_tools.start() + + try: + result = await client_tools.handle("loop_tool", {}) + # The result should indicate it's running on the same loop + expected_loop_id = str(id(main_loop)) + assert expected_loop_id in result + finally: + client_tools.stop() + + def test_stop_custom_loop_behavior(self): + """Test that stop() doesn't close custom loops.""" + custom_loop = asyncio.new_event_loop() + client_tools = ClientTools(loop=custom_loop) + + try: + client_tools.start() + assert client_tools._running.is_set() + + client_tools.stop() + assert not client_tools._running.is_set() + + # Custom loop should still be open and usable + assert not custom_loop.is_closed() + finally: + custom_loop.close() + + def test_stop_default_loop_behavior(self): + """Test that stop() properly cleans up default loops.""" + client_tools = ClientTools() + + client_tools.start() + assert client_tools._running.is_set() + assert client_tools._thread is not None + thread = client_tools._thread + + client_tools.stop() + assert not client_tools._running.is_set() + + # Wait for thread to finish + thread.join(timeout=1.0) + assert not thread.is_alive() \ No newline at end of file diff --git a/data/tests/test_client_types.py b/data/tests/test_client_types.py new file mode 100644 index 0000000000000000000000000000000000000000..ecc0e016b5dd2d93979320251bf58daa008b3777 --- /dev/null +++ b/data/tests/test_client_types.py @@ -0,0 +1,43 @@ +import typing + +import pytest + +from elevenlabs.client import AsyncElevenLabs, ElevenLabs +from elevenlabs.music_custom import AsyncMusicClient, MusicClient +from elevenlabs.realtime_tts import RealtimeTextToSpeechClient +from elevenlabs.speech_engine_custom import AsyncSpeechEngineClient, SpeechEngineClient +from elevenlabs.speech_to_text_custom import AsyncSpeechToTextClient, SpeechToTextClient +from elevenlabs.webhooks_custom import AsyncWebhooksClient, WebhooksClient + +# The base client's properties are typed as the autogenerated clients, so type checkers +# reject the custom methods (e.g. `client.webhooks.construct_event`) unless the wrapper +# re-declares each property with the custom client type. +SYNC_PROPERTIES = { + "text_to_speech": RealtimeTextToSpeechClient, + "webhooks": WebhooksClient, + "music": MusicClient, + "speech_to_text": SpeechToTextClient, + "speech_engine": SpeechEngineClient, +} +ASYNC_PROPERTIES = { + "webhooks": AsyncWebhooksClient, + "music": AsyncMusicClient, + "speech_to_text": AsyncSpeechToTextClient, + "speech_engine": AsyncSpeechEngineClient, +} + + +@pytest.mark.parametrize( + "client_cls, name, expected", + [(ElevenLabs, name, cls) for name, cls in SYNC_PROPERTIES.items()] + + [(AsyncElevenLabs, name, cls) for name, cls in ASYNC_PROPERTIES.items()], +) +def test_custom_client_property_is_typed(client_cls: typing.Any, name: str, expected: type) -> None: + prop = getattr(client_cls, name) + assert typing.get_type_hints(prop.fget)["return"] is expected + assert type(getattr(client_cls(api_key="test"), name)) is expected + + +def test_construct_event_is_accessible() -> None: + assert callable(ElevenLabs(api_key="test").webhooks.construct_event) + assert callable(AsyncElevenLabs(api_key="test").webhooks.construct_event) diff --git a/data/tests/test_convai.py b/data/tests/test_convai.py new file mode 100644 index 0000000000000000000000000000000000000000..10de765f3c51beae33c22118148d4211682cefd2 --- /dev/null +++ b/data/tests/test_convai.py @@ -0,0 +1,496 @@ +from unittest.mock import MagicMock, patch +from elevenlabs.conversational_ai.conversation import ( + Conversation, + AudioInterface, + ConversationInitiationData, + AgentChatResponsePartType, + MultimodalMessageClientToOrchestratorEvent, +) +import json +import time + +class MockAudioInterface(AudioInterface): + def start(self, input_callback): + print("Audio interface started") + self.input_callback = input_callback + + def stop(self): + print("Audio interface stopped") + + def output(self, audio): + print(f"Would play audio of length: {len(audio)} bytes") + + def interrupt(self): + print("Audio interrupted") + + +# Add test constants and helpers at module level +TEST_CONVERSATION_ID = "test123" +TEST_AGENT_ID = "test_agent" + + +def create_mock_websocket(messages=None): + """Helper to create a mock websocket with predefined responses""" + mock_ws = MagicMock() + + if messages is None: + messages = [ + { + "type": "conversation_initiation_metadata", + "conversation_initiation_metadata_event": {"conversation_id": TEST_CONVERSATION_ID}, + }, + {"type": "agent_response", "agent_response_event": {"agent_response": "Hello there!"}}, + ] + + def response_generator(): + for msg in messages: + yield json.dumps(msg) + while True: + yield '{"type": "keep_alive"}' + + mock_ws.recv = MagicMock(side_effect=response_generator()) + return mock_ws + + +def test_conversation_basic_flow(): + # Mock setup + mock_ws = create_mock_websocket() + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + agent_response_callback = MagicMock() + test_user_id = "test_user_123" + + # Setup the conversation with user_id passed directly to the constructor + conversation = Conversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + user_id=test_user_id, + requires_auth=False, + audio_interface=MockAudioInterface(), + callback_agent_response=agent_response_callback, + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.connect") as mock_connect: + mock_connect.return_value.__enter__.return_value = mock_ws + conversation.start_session() + + # Add a wait for the callback to be called + timeout = 5 # 5 seconds timeout + start_time = time.time() + while not agent_response_callback.called and time.time() - start_time < timeout: + time.sleep(0.1) + + conversation.end_session() + conversation.wait_for_session_end() + + # Assertions - check the call was made with the right structure + send_calls = [call[0][0] for call in mock_ws.send.call_args_list] + init_messages = [json.loads(call) for call in send_calls if 'conversation_initiation_client_data' in call] + assert len(init_messages) == 1 + init_message = init_messages[0] + + assert init_message["type"] == "conversation_initiation_client_data" + assert init_message["custom_llm_extra_body"] == {} + assert init_message["conversation_config_override"] == {} + assert init_message["dynamic_variables"] == {} + assert init_message["source_info"]["source"] == "python_sdk" + assert "version" in init_message["source_info"] + assert init_message["user_id"] == test_user_id + agent_response_callback.assert_called_once_with("Hello there!") + assert conversation._conversation_id == TEST_CONVERSATION_ID + assert conversation.user_id == test_user_id + + +def test_conversation_with_auth(): + # Mock setup + mock_client = MagicMock() + mock_client.conversational_ai.conversations.get_signed_url.return_value.signed_url = "wss://signed.url" + mock_ws = create_mock_websocket( + [ + { + "type": "conversation_initiation_metadata", + "conversation_initiation_metadata_event": {"conversation_id": TEST_CONVERSATION_ID}, + } + ] + ) + + conversation = Conversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=True, + audio_interface=MockAudioInterface(), + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.connect") as mock_connect: + mock_connect.return_value.__enter__.return_value = mock_ws + conversation.start_session() + conversation.end_session() + conversation.wait_for_session_end() + + # Assertions + mock_client.conversational_ai.conversations.get_signed_url.assert_called_once_with(agent_id=TEST_AGENT_ID, environment=None) + + +def test_conversation_with_dynamic_variables(): + # Mock setup + mock_ws = create_mock_websocket() + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + agent_response_callback = MagicMock() + + dynamic_variables = {"name": "angelo"} + config = ConversationInitiationData(dynamic_variables=dynamic_variables) + + # Setup the conversation + conversation = Conversation( + client=mock_client, + config=config, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAudioInterface(), + callback_agent_response=agent_response_callback, + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.connect") as mock_connect: + mock_connect.return_value.__enter__.return_value = mock_ws + conversation.start_session() + + # Add a wait for the callback to be called + timeout = 5 # 5 seconds timeout + start_time = time.time() + while not agent_response_callback.called and time.time() - start_time < timeout: + time.sleep(0.1) + + conversation.end_session() + conversation.wait_for_session_end() + + # Assertions - check the call was made with the right structure + send_calls = [call[0][0] for call in mock_ws.send.call_args_list] + init_messages = [json.loads(call) for call in send_calls if 'conversation_initiation_client_data' in call] + assert len(init_messages) == 1 + init_message = init_messages[0] + + assert init_message["type"] == "conversation_initiation_client_data" + assert init_message["custom_llm_extra_body"] == {} + assert init_message["conversation_config_override"] == {} + assert init_message["dynamic_variables"] == {"name": "angelo"} + assert init_message["source_info"]["source"] == "python_sdk" + assert "version" in init_message["source_info"] + agent_response_callback.assert_called_once_with("Hello there!") + assert conversation._conversation_id == TEST_CONVERSATION_ID + + +def test_conversation_with_contextual_update(): + # Mock setup + mock_ws = create_mock_websocket([]) + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + # Setup the conversation + conversation = Conversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAudioInterface(), + ) + + # Run the test + with patch("elevenlabs.conversational_ai.conversation.connect") as mock_connect: + mock_connect.return_value.__enter__.return_value = mock_ws + + conversation.start_session() + time.sleep(0.1) + + conversation.send_contextual_update("User appears to be looking at pricing page") + + # Teardown + conversation.end_session() + conversation.wait_for_session_end() + + # Assertions + expected = json.dumps({"type": "contextual_update", "text": "User appears to be looking at pricing page"}) + mock_ws.send.assert_any_call(expected) + + +def test_conversation_wss_url_generation_without_get_environment(): + + from elevenlabs.core.client_wrapper import SyncClientWrapper + + # Test with various base URL formats to ensure robustness + test_cases = [ + ("https://api.elevenlabs.io", "wss://api.elevenlabs.io"), + ("https://api.us.elevenlabs.io", "wss://api.us.elevenlabs.io"), + ("https://api.eu.residency.elevenlabs.io", "wss://api.eu.residency.elevenlabs.io"), + ("http://localhost:8000", "ws://localhost:8000"), + ] + + for base_url, expected_ws_base in test_cases: + # Create a real SyncClientWrapper to ensure it doesn't have get_environment method + mock_client = MagicMock() + mock_client._client_wrapper = SyncClientWrapper( + base_url=base_url, + api_key="test_key", + httpx_client=MagicMock(), + timeout=30.0 + ) + + # Create conversation with requires_auth=False + conversation = Conversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAudioInterface() + ) + + try: + wss_url = conversation._get_wss_url() + + # Verify the URL is correctly generated + expected_url = f"{expected_ws_base}/v1/convai/conversation?agent_id={TEST_AGENT_ID}&source=python_sdk&version=" + assert wss_url.startswith(expected_url), f"URL should start with {expected_url}, got {wss_url}" + + # Verify the URL contains version parameter + assert "version=" in wss_url, f"URL should contain version parameter, got {wss_url}" + + except AttributeError as e: + if "get_environment" in str(e): + assert False + else: + raise # Re-raise if it's a different AttributeError + + except Exception as e: + assert False, f"Unexpected error generating WebSocket URL: {e}" + + +def test_websocket_url_construction_edge_cases(): + """Test WebSocket URL construction edge cases, specifically for trailing slash handling.""" + from elevenlabs.core.client_wrapper import SyncClientWrapper + from elevenlabs.conversational_ai.conversation import Conversation + from elevenlabs.realtime_tts import RealtimeTextToSpeechClient + + # Test cases with various base URL formats + test_cases = [ + # Base URLs without trailing slashes (the main edge case) + ("https://api.eu.residency.elevenlabs.io", "wss://api.eu.residency.elevenlabs.io", "wss://api.eu.residency.elevenlabs.io"), + ("https://api.elevenlabs.io", "wss://api.elevenlabs.io", "wss://api.elevenlabs.io"), + ("http://localhost:8000", "ws://localhost:8000", "wss://localhost:8000"), + # Base URLs with trailing slashes (should still work) + ("https://api.eu.residency.elevenlabs.io/", "wss://api.eu.residency.elevenlabs.io", "wss://api.eu.residency.elevenlabs.io/"), + ("https://api.elevenlabs.io/", "wss://api.elevenlabs.io", "wss://api.elevenlabs.io/"), + ("http://localhost:8000/", "ws://localhost:8000", "wss://localhost:8000/"), + ] + + for base_url, expected_ws_base, expected_tts_ws_base in test_cases: + # Test conversation WebSocket URL construction + mock_client = MagicMock() + mock_client._client_wrapper = SyncClientWrapper( + base_url=base_url, + api_key="test_key", + httpx_client=MagicMock(), + timeout=30.0 + ) + + conversation = Conversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAudioInterface() + ) + + # Test conversation URL generation + conv_url = conversation._get_wss_url() + expected_conv_url = f"{expected_ws_base}/v1/convai/conversation" + assert expected_conv_url in conv_url, f"Conversation URL should contain {expected_conv_url}, got {conv_url}" + + # Ensure no double slashes in the path (except after the protocol) + url_path = conv_url.split("://", 1)[1] # Remove protocol + assert "//" not in url_path, f"URL should not contain double slashes in path: {conv_url}" + + # Test realtime TTS WebSocket URL construction + realtime_client = RealtimeTextToSpeechClient(client_wrapper=mock_client._client_wrapper) + + # Test the WebSocket base URL construction + # Note: realtime TTS always uses wss scheme, not ws + assert realtime_client._ws_base_url == expected_tts_ws_base, f"TTS WebSocket base URL should be {expected_tts_ws_base}, got {realtime_client._ws_base_url}" + + # Test full URL construction using urljoin (simulating the actual method) + import urllib.parse + test_voice_id = "test_voice_123" + test_model = "eleven_turbo_v2_5" + test_format = "mp3_44100_128" + relative_path = f"v1/text-to-speech/{test_voice_id}/stream-input?model_id={test_model}&output_format={test_format}" + + full_tts_url = urllib.parse.urljoin(realtime_client._ws_base_url, relative_path) + # For URLs with trailing slash, expect it to be preserved in the joined URL + expected_tts_url_base = expected_tts_ws_base.rstrip('/') + "/v1/text-to-speech/" + test_voice_id + "/stream-input" + assert expected_tts_url_base in full_tts_url, f"TTS URL should contain {expected_tts_url_base}, got {full_tts_url}" + + # Ensure no double slashes in the path + tts_url_path = full_tts_url.split("://", 1)[1] + assert "//" not in tts_url_path, f"TTS URL should not contain double slashes in path: {full_tts_url}" + + +def test_conversation_streaming_text_response(): + mock_ws = create_mock_websocket( + [ + { + "type": "conversation_initiation_metadata", + "conversation_initiation_metadata_event": {"conversation_id": TEST_CONVERSATION_ID}, + }, + { + "type": "agent_chat_response_part", + "text_response_part": {"text": "", "type": "start"}, + }, + { + "type": "agent_chat_response_part", + "text_response_part": {"text": "Hello", "type": "delta"}, + }, + { + "type": "agent_chat_response_part", + "text_response_part": {"text": " there", "type": "delta"}, + }, + { + "type": "agent_chat_response_part", + "text_response_part": {"text": "!", "type": "delta"}, + }, + { + "type": "agent_chat_response_part", + "text_response_part": {"text": "", "type": "stop"}, + }, + ] + ) + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + streaming_calls = [] + + def streaming_callback(text, part_type): + streaming_calls.append((text, part_type)) + + conversation = Conversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=MockAudioInterface(), + callback_agent_chat_response_part=streaming_callback, + ) + + with patch("elevenlabs.conversational_ai.conversation.connect") as mock_connect: + mock_connect.return_value.__enter__.return_value = mock_ws + conversation.start_session() + + timeout = 5 + start_time = time.time() + while len(streaming_calls) < 5 and time.time() - start_time < timeout: + time.sleep(0.1) + + conversation.end_session() + conversation.wait_for_session_end() + + assert len(streaming_calls) == 5, f"Expected 5 streaming calls, got {len(streaming_calls)}" + + assert streaming_calls[0] == ("", AgentChatResponsePartType.START) + + assert streaming_calls[1] == ("Hello", AgentChatResponsePartType.DELTA) + assert streaming_calls[2] == (" there", AgentChatResponsePartType.DELTA) + assert streaming_calls[3] == ("!", AgentChatResponsePartType.DELTA) + + assert streaming_calls[4] == ("", AgentChatResponsePartType.STOP) + + +def test_text_only_mode_auto_sets_config(): + """When audio_interface is None, text_only should be auto-set in config.""" + mock_ws = create_mock_websocket() + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + conversation = Conversation( + client=mock_client, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=None, + ) + + assert conversation.config.conversation_config_override.get("text_only") is True + + with patch("elevenlabs.conversational_ai.conversation.connect") as mock_connect: + mock_connect.return_value.__enter__.return_value = mock_ws + conversation.start_session() + conversation.end_session() + conversation.wait_for_session_end() + + send_calls = [call[0][0] for call in mock_ws.send.call_args_list] + init_messages = [json.loads(call) for call in send_calls if 'conversation_initiation_client_data' in call] + assert len(init_messages) == 1 + assert init_messages[0]["conversation_config_override"]["text_only"] is True + + +def test_text_only_mode_preserves_explicit_override(): + """When user explicitly sets text_only=False, the override should be preserved.""" + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + config = ConversationInitiationData(conversation_config_override={"text_only": False}) + conversation = Conversation( + client=mock_client, + config=config, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=None, + ) + + assert conversation.config.conversation_config_override["text_only"] is False + + +def test_text_only_mode_does_not_mutate_original_config(): + """Setting text_only should not mutate the caller's original config dict.""" + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + + original_override = {"some_setting": "value"} + config = ConversationInitiationData(conversation_config_override=original_override) + + Conversation( + client=mock_client, + config=config, + agent_id=TEST_AGENT_ID, + requires_auth=False, + audio_interface=None, + ) + + assert "text_only" not in original_override + # The ConversationInitiationData object itself should also be unmodified + assert "text_only" not in config.conversation_config_override + + +def test_multimodal_message_file_id_dual_sends_file_and_files(): + event = MultimodalMessageClientToOrchestratorEvent(text="hello", file_id="file_a") + assert event.to_dict() == { + "type": "multimodal_message", + "text": {"type": "user_message", "text": "hello"}, + "file": {"type": "file_input", "file_id": "file_a"}, + "files": [{"type": "file_input", "file_id": "file_a"}], + } + + +def test_multimodal_message_file_ids_wins_and_dual_sends(): + event = MultimodalMessageClientToOrchestratorEvent(file_id="ignored", file_ids=["file_a", "file_b"]) + assert event.to_dict() == { + "type": "multimodal_message", + "file": {"type": "file_input", "file_id": "file_a"}, + "files": [ + {"type": "file_input", "file_id": "file_a"}, + {"type": "file_input", "file_id": "file_b"}, + ], + } + + +def test_multimodal_message_text_only_omits_file_fields(): + event = MultimodalMessageClientToOrchestratorEvent(text="hello") + assert event.to_dict() == { + "type": "multimodal_message", + "text": {"type": "user_message", "text": "hello"}, + } diff --git a/data/tests/test_convai_imports.py b/data/tests/test_convai_imports.py new file mode 100644 index 0000000000000000000000000000000000000000..7cd9f0b898a1312ad7af128a6cc61d3e131cc1da --- /dev/null +++ b/data/tests/test_convai_imports.py @@ -0,0 +1,6 @@ +from elevenlabs import ElevenLabs + + +def test_convai_imports(): + client = ElevenLabs(api_key="") + client.conversational_ai.agents diff --git a/data/tests/test_convai_on_prem.py b/data/tests/test_convai_on_prem.py new file mode 100644 index 0000000000000000000000000000000000000000..fbd7e2bd9320bbb22f0a6bad3a56e99530238459 --- /dev/null +++ b/data/tests/test_convai_on_prem.py @@ -0,0 +1,164 @@ +import json +from unittest.mock import MagicMock + +import pytest + +from elevenlabs.conversational_ai.conversation import ( + AudioInterface, + Conversation, + OnPremInitiationData, + PostCallWebhookConfig, +) + + +class MockAudioInterface(AudioInterface): + def start(self, input_callback): + self.input_callback = input_callback + + def stop(self): + pass + + def output(self, audio): + pass + + def interrupt(self): + pass + + +def _make_conversation(on_prem_config: OnPremInitiationData) -> Conversation: + mock_client = MagicMock() + mock_client._client_wrapper.get_base_url.return_value = "https://api.elevenlabs.io" + return Conversation( + client=mock_client, + agent_id="", + requires_auth=False, + audio_interface=MockAudioInterface(), + # Mocked so the constructor's client_tools.start() does not spawn a real + # event-loop thread; these tests only exercise message serialization. + client_tools=MagicMock(), + on_prem_config=on_prem_config, + ) + + +def test_post_call_webhook_config_to_dict(): + assert PostCallWebhookConfig(url="https://example.com/hook").to_dict() == {"url": "https://example.com/hook"} + assert PostCallWebhookConfig(url="https://example.com/hook", hmac_secret="0123456789abcdef").to_dict() == { + "url": "https://example.com/hook", + "hmac_secret": "0123456789abcdef", + } + + +def test_on_prem_initiation_message_includes_typed_webhooks(): + conversation = _make_conversation( + OnPremInitiationData( + on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation", + post_call_transcription_webhook=PostCallWebhookConfig( + url="https://example.com/transcript", hmac_secret="0123456789abcdef" + ), + post_call_audio_webhook=PostCallWebhookConfig(url="https://example.com/audio"), + ) + ) + + message = json.loads(conversation._create_on_prem_initiation_message()) + + assert message["type"] == "enclave_setup_config" + assert message["post_call_transcription_webhook"] == { + "url": "https://example.com/transcript", + "hmac_secret": "0123456789abcdef", + } + assert message["post_call_audio_webhook"] == {"url": "https://example.com/audio"} + assert message["post_call_transcription_webhook_url"] is None + assert message["post_call_audio_webhook_url"] is None + + +def test_on_prem_initiation_message_omits_typed_webhooks_when_unset(): + conversation = _make_conversation( + OnPremInitiationData( + on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation", + post_call_transcription_webhook_url="https://example.com/transcript", + ) + ) + + message = json.loads(conversation._create_on_prem_initiation_message()) + + assert "post_call_transcription_webhook" not in message + assert "post_call_audio_webhook" not in message + assert message["post_call_transcription_webhook_url"] == "https://example.com/transcript" + + +def test_on_prem_initiation_data_rejects_legacy_and_typed_transcription_webhook(): + with pytest.raises(ValueError, match="not both"): + OnPremInitiationData( + on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation", + post_call_transcription_webhook_url="https://example.com/hook", + post_call_transcription_webhook=PostCallWebhookConfig(url="https://example.com/hook"), + ) + + +def test_on_prem_initiation_data_rejects_legacy_and_typed_audio_webhook(): + with pytest.raises(ValueError, match="not both"): + OnPremInitiationData( + on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation", + post_call_audio_webhook_url="https://example.com/hook", + post_call_audio_webhook=PostCallWebhookConfig(url="https://example.com/hook"), + ) + + +def test_on_prem_initiation_message_includes_bedrock_inference_profile(): + conversation = _make_conversation( + OnPremInitiationData( + on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation", + bedrock_inference_profile="global", + ) + ) + + message = json.loads(conversation._create_on_prem_initiation_message()) + + assert message["bedrock_inference_profile"] == "global" + + +def test_on_prem_initiation_message_omits_bedrock_inference_profile_when_unset(): + conversation = _make_conversation( + OnPremInitiationData(on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation") + ) + + message = json.loads(conversation._create_on_prem_initiation_message()) + + assert "bedrock_inference_profile" not in message + + +def test_on_prem_initiation_message_merges_extra_setup_config(): + conversation = _make_conversation( + OnPremInitiationData( + on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation", + prompt_knowledge_base=["kb entry"], + extra_setup_config={"some_future_field": {"nested": 1}, "another": "value"}, + ) + ) + + message = json.loads(conversation._create_on_prem_initiation_message()) + + assert message["some_future_field"] == {"nested": 1} + assert message["another"] == "value" + # Typed fields still serialize as before. + assert message["type"] == "enclave_setup_config" + assert message["prompt_knowledge_base"] == ["kb entry"] + + +def test_on_prem_initiation_data_rejects_reserved_keys_in_extra_setup_config(): + with pytest.raises(ValueError, match="prompt_knowledge_base"): + OnPremInitiationData( + on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation", + extra_setup_config={"prompt_knowledge_base": ["sneaky"]}, + ) + + +def test_on_prem_initiation_data_copies_extra_setup_config(): + extra = {"some_future_field": 1} + config = OnPremInitiationData( + on_prem_conversation_url="ws://localhost:8000/sagemaker/convai/conversation", + extra_setup_config=extra, + ) + extra["mutated_after_construction"] = True + + assert config.extra_setup_config == {"some_future_field": 1} diff --git a/data/tests/test_flows_create_and_wait.py b/data/tests/test_flows_create_and_wait.py new file mode 100644 index 0000000000000000000000000000000000000000..87ef55bf3d7c622849ecff348ecf4ff8cc4afc8f --- /dev/null +++ b/data/tests/test_flows_create_and_wait.py @@ -0,0 +1,333 @@ +"""Tests for the flows `create_and_wait` helpers in flows_custom.py.""" + +import inspect +import re +import typing +from unittest.mock import patch + +import httpx +import pytest + +from elevenlabs import AsyncElevenLabs, ElevenLabs, flows_custom +from elevenlabs.flows.image.client import AsyncImageClient as GeneratedAsyncImageClient +from elevenlabs.flows.image.client import ImageClient as GeneratedImageClient +from elevenlabs.flows.templates.runs.client import AsyncRunsClient as GeneratedAsyncRunsClient +from elevenlabs.flows.templates.runs.client import RunsClient as GeneratedRunsClient +from elevenlabs.flows.text_to_speech.client import AsyncTextToSpeechClient as GeneratedAsyncTextToSpeechClient +from elevenlabs.flows.text_to_speech.client import TextToSpeechClient as GeneratedTextToSpeechClient +from elevenlabs.flows.video.client import AsyncVideoClient as GeneratedAsyncVideoClient +from elevenlabs.flows.video.client import VideoClient as GeneratedVideoClient +from elevenlabs.flows_custom import FlowsWaitTimeoutError, _parse_retry_after, _poll_delay + +Reply = typing.Tuple[int, typing.Dict[str, typing.Any], typing.Dict[str, str]] + + +def _transport(replies: typing.List[Reply], seen: typing.List[httpx.Request]) -> httpx.MockTransport: + def handler(request: httpx.Request) -> httpx.Response: + seen.append(request) + status_code, body, headers = replies.pop(0) + return httpx.Response(status_code, json=body, headers=headers) + + return httpx.MockTransport(handler) + + +def _sync_client(replies: typing.List[Reply], seen: typing.List[httpx.Request]) -> ElevenLabs: + return ElevenLabs( + api_key="test", base_url="https://api.test", httpx_client=httpx.Client(transport=_transport(replies, seen)) + ) + + +def _async_client(replies: typing.List[Reply], seen: typing.List[httpx.Request]) -> AsyncElevenLabs: + return AsyncElevenLabs( + api_key="test", + base_url="https://api.test", + httpx_client=httpx.AsyncClient(transport=_transport(replies, seen)), + ) + + +def _run(status: str) -> typing.Dict[str, typing.Any]: + return {"id": "run_1", "template_id": "tpl_1", "version_id": "ver_1", "status": status, "outputs": {}} + + +COMPLETED_IMAGE = { + "id": "gen_1", + "status": "completed", + "content_url": "https://cdn.test/out.png", + "content_mime_type": "image/png", +} + +IMAGE_REQUEST = {"model_id": "bytedance-seedream-5-lite", "prompt": "a corgi"} + + +def test_poll_delay_uses_retry_after_with_jitter() -> None: + with patch("elevenlabs.flows_custom.random", return_value=0.5): + assert _poll_delay({"retry-after": "5"}, 1.0) == pytest.approx(5.5) + + +def test_poll_delay_falls_back_to_minimum() -> None: + with patch("elevenlabs.flows_custom.random", return_value=0.0): + assert _poll_delay({}, 2.0) == 2.0 + assert _poll_delay({"retry-after": "0"}, 2.0) == 2.0 + assert _poll_delay({"retry-after": "not-a-date"}, 2.0) == 2.0 + + +def test_retry_after_accepts_seconds_and_http_dates() -> None: + assert _parse_retry_after({"Retry-After": " 12 "}) == 12.0 + with patch("elevenlabs.flows_custom.time.time", return_value=1_000_000_000.0): + # 2001-09-09T01:46:50Z is 1_000_000_010 + assert _parse_retry_after({"retry-after": "Sun, 09 Sep 2001 01:46:50 GMT"}) == pytest.approx(10.0) + assert _parse_retry_after({"retry-after": "Sun, 09 Sep 2001 01:46:30 GMT"}) == 0.0 + with patch("elevenlabs.flows_custom.random", return_value=0.0): + # A future date sets the wait; a past one falls back to the minimum. + assert _poll_delay({"retry-after": "Sun, 09 Sep 2001 01:46:48 GMT"}, 3.0) == pytest.approx(8.0) + assert _poll_delay({"retry-after": "Sun, 09 Sep 2001 01:46:30 GMT"}, 3.0) == 3.0 + assert _parse_retry_after({"retry-after": "-5"}) is None + + +def test_image_create_and_wait_polls_until_completed() -> None: + seen: typing.List[httpx.Request] = [] + replies: typing.List[Reply] = [ + (200, {"id": "gen_1", "status": "pending"}, {"retry-after": "3"}), + (200, {"id": "gen_1", "status": "generating"}, {"retry-after": "7"}), + (200, COMPLETED_IMAGE, {}), + ] + client = _sync_client(replies, seen) + + with patch("elevenlabs.flows_custom.time.sleep") as sleep, patch( + "elevenlabs.flows_custom.random", return_value=0.0 + ): + result = client.flows.image.create_and_wait(request=IMAGE_REQUEST) # type: ignore[arg-type] + + assert result.status == "completed" + assert result.id == "gen_1" + assert [call.args[0] for call in sleep.call_args_list] == [3.0, 7.0] + assert [(r.method, r.url.path) for r in seen] == [ + ("POST", "/v1/flows/image"), + ("GET", "/v1/flows/image/gen_1"), + ("GET", "/v1/flows/image/gen_1"), + ] + + +def test_infinite_wait_timeout_polls_until_completed() -> None: + seen: typing.List[httpx.Request] = [] + replies: typing.List[Reply] = [ + (200, {"id": "gen_1", "status": "pending"}, {"retry-after": "3"}), + (200, COMPLETED_IMAGE, {}), + ] + client = _sync_client(replies, seen) + + with patch("elevenlabs.flows_custom.time.sleep") as sleep, patch( + "elevenlabs.flows_custom.random", return_value=0.0 + ): + result = client.flows.image.create_and_wait(request=IMAGE_REQUEST, wait_timeout_in_seconds=float("inf")) # type: ignore[arg-type] + + assert result.status == "completed" + assert [call.args[0] for call in sleep.call_args_list] == [3.0] + assert len(seen) == 2 + + +def test_failed_generation_is_returned_not_raised() -> None: + seen: typing.List[httpx.Request] = [] + replies: typing.List[Reply] = [ + (200, {"id": "gen_1", "status": "pending"}, {}), + ( + 200, + {"id": "gen_1", "status": "failed", "failure_reason": "content_moderation", "error_message": "nope"}, + {}, + ), + ] + client = _sync_client(replies, seen) + + with patch("elevenlabs.flows_custom.time.sleep") as sleep, patch( + "elevenlabs.flows_custom.random", return_value=0.0 + ): + result = client.flows.video.create_and_wait(request={"model_id": "bytedance-seedance-v2", "prompt": "a corgi"}) # type: ignore[arg-type] + + assert result.status == "failed" + assert [call.args[0] for call in sleep.call_args_list] == [3.0] + assert seen[1].url.path == "/v1/flows/video/gen_1" + + +def test_timeout_raises_with_generation_id() -> None: + seen: typing.List[httpx.Request] = [] + replies: typing.List[Reply] = [ + (200, {"id": "gen_1", "status": "pending"}, {"retry-after": "30"}), + (200, {"id": "gen_1", "status": "generating"}, {"retry-after": "30"}), + ] + client = _sync_client(replies, seen) + clock = iter([0.0, 0.0, 10.0]) + + with patch("elevenlabs.flows_custom.time.monotonic", side_effect=lambda: next(clock)), patch( + "elevenlabs.flows_custom.time.sleep" + ) as sleep: + with pytest.raises(FlowsWaitTimeoutError) as exc_info: + client.flows.text_to_speech.create_and_wait(request={"model_id": "eleven_flash_v2_5", "text": "hi", "voice": "JBFqnCBsd6RMkjVDRZzb"}, wait_timeout_in_seconds=10) # type: ignore[arg-type] + + # The last sleep is cut short to land on the deadline, then one final GET runs. + assert [call.args[0] for call in sleep.call_args_list] == [10.0] + assert exc_info.value.id == "gen_1" + assert exc_info.value.template_id is None + assert exc_info.value.last_response.status == "generating" + assert len(seen) == 2 + + +def test_template_run_create_and_wait() -> None: + seen: typing.List[httpx.Request] = [] + replies: typing.List[Reply] = [ + (200, _run("pending"), {"retry-after": "2"}), + (200, _run("completed"), {}), + ] + client = _sync_client(replies, seen) + + with patch("elevenlabs.flows_custom.time.sleep"): + result = client.flows.templates.runs.create_and_wait("tpl_1", inputs={}) + + assert result.status == "completed" + assert [(r.method, r.url.path) for r in seen] == [ + ("POST", "/v1/flows/templates/tpl_1/runs"), + ("GET", "/v1/flows/templates/tpl_1/runs/run_1"), + ] + + +def test_template_run_already_terminal_on_create_skips_polling() -> None: + seen: typing.List[httpx.Request] = [] + client = _sync_client([(200, _run("completed"), {})], seen) + + with patch("elevenlabs.flows_custom.time.sleep") as sleep: + result = client.flows.templates.runs.create_and_wait("tpl_1", inputs={}) + + assert result.status == "completed" + sleep.assert_not_called() + assert len(seen) == 1 + + +def test_template_run_timeout_carries_template_id() -> None: + seen: typing.List[httpx.Request] = [] + client = _sync_client([(200, _run("pending"), {})], seen) + + with pytest.raises(FlowsWaitTimeoutError) as exc_info: + client.flows.templates.runs.create_and_wait("tpl_1", inputs={}, wait_timeout_in_seconds=0) + + assert exc_info.value.id == "run_1" + assert exc_info.value.template_id == "tpl_1" + assert "of template tpl_1" in str(exc_info.value) + assert "`runs.get` with `template_id` and `id`" in str(exc_info.value) + + +async def test_async_image_create_and_wait() -> None: + seen: typing.List[httpx.Request] = [] + replies: typing.List[Reply] = [ + (200, {"id": "gen_1", "status": "pending"}, {"retry-after": "4"}), + (200, COMPLETED_IMAGE, {}), + ] + client = _async_client(replies, seen) + + with patch("elevenlabs.flows_custom.asyncio.sleep") as sleep, patch( + "elevenlabs.flows_custom.random", return_value=0.0 + ): + result = await client.flows.image.create_and_wait(request=IMAGE_REQUEST) # type: ignore[arg-type] + + assert result.status == "completed" + assert [call.args[0] for call in sleep.call_args_list] == [4.0] + + +async def test_async_template_run_create_and_wait() -> None: + seen: typing.List[httpx.Request] = [] + replies: typing.List[Reply] = [ + (200, _run("generating"), {}), + (200, _run("failed"), {}), + ] + client = _async_client(replies, seen) + + with patch("elevenlabs.flows_custom.asyncio.sleep"): + result = await client.flows.templates.runs.create_and_wait("tpl_1", inputs={}) + + assert result.status == "failed" + assert seen[1].url.path == "/v1/flows/templates/tpl_1/runs/run_1" + + +def test_min_poll_interval_below_floor_is_rejected_before_any_request() -> None: + seen: typing.List[httpx.Request] = [] + client = _sync_client([], seen) + + with pytest.raises(ValueError): + client.flows.image.create_and_wait(request=IMAGE_REQUEST, min_poll_interval_in_seconds=0) # type: ignore[arg-type] + + assert seen == [] + + +@pytest.mark.parametrize( + "options", + [ + {"min_poll_interval_in_seconds": float("nan")}, + {"min_poll_interval_in_seconds": float("inf")}, + {"wait_timeout_in_seconds": float("nan")}, + {"wait_timeout_in_seconds": -1.0}, + ], +) +def test_non_finite_wait_options_are_rejected_before_any_request(options: typing.Dict[str, float]) -> None: + seen: typing.List[httpx.Request] = [] + client = _sync_client([], seen) + + with pytest.raises(ValueError): + client.flows.image.create_and_wait(request=IMAGE_REQUEST, **options) # type: ignore[arg-type] + + assert seen == [] + + +def test_body_parameters_go_to_create_only() -> None: + seen: typing.List[httpx.Request] = [] + replies: typing.List[Reply] = [ + (200, {"id": "gen_1", "status": "pending"}, {}), + (200, COMPLETED_IMAGE, {}), + ] + client = _sync_client(replies, seen) + + with patch("elevenlabs.flows_custom.time.sleep"): + client.flows.image.create_and_wait( + request=IMAGE_REQUEST, # type: ignore[arg-type] + request_options={"additional_body_parameters": {"extra": 1}, "additional_headers": {"x-test": "1"}}, + ) + + assert b'"extra"' in seen[0].content + assert seen[1].content == b"" + assert all(r.headers["x-test"] == "1" for r in seen) + + +def _param_doc_entries(method: typing.Any) -> typing.List[str]: + """Each parameter's entry in a generated numpydoc docstring, except `request_options`, which the wrapper rewrites. + + Docstrings are dedented with `inspect.cleandoc` because Python 3.13+ strips their indentation at compile time. + """ + params = inspect.cleandoc(method.__doc__ or "").split("Parameters\n----------\n")[1].split("\nReturns\n")[0] + entries = re.split(r"\n(?=\w+ : )", params.strip("\n")) + return [e.rstrip() for e in entries if not e.lstrip().startswith("request_options :")] + + +@pytest.mark.parametrize( + "wrapper, generated", + [ + (flows_custom.ImageClient, GeneratedImageClient), + (flows_custom.AsyncImageClient, GeneratedAsyncImageClient), + (flows_custom.VideoClient, GeneratedVideoClient), + (flows_custom.AsyncVideoClient, GeneratedAsyncVideoClient), + (flows_custom.TextToSpeechClient, GeneratedTextToSpeechClient), + (flows_custom.AsyncTextToSpeechClient, GeneratedAsyncTextToSpeechClient), + (flows_custom.RunsClient, GeneratedRunsClient), + (flows_custom.AsyncRunsClient, GeneratedAsyncRunsClient), + ], +) +def test_create_and_wait_takes_every_create_parameter(wrapper: typing.Any, generated: typing.Any) -> None: + # Fails after a regeneration that adds or changes a `create` parameter, so the wrapper is updated with it. + create = inspect.signature(generated.create).parameters + wait = inspect.signature(wrapper.create_and_wait).parameters + for name, param in create.items(): + assert name in wait, f"{wrapper.__name__}.create_and_wait is missing `{name}` from `create`" + assert wait[name].kind == param.kind + assert wait[name].default == param.default + assert wait[name].annotation == param.annotation + # The docstrings are copied by hand so IDEs can show them; this catches a regeneration that changes one. + for entry in _param_doc_entries(generated.create): + assert entry in inspect.cleandoc(wrapper.create_and_wait.__doc__ or ""), ( + f"{wrapper.__name__}.create_and_wait doc is stale:\n{entry}" + ) diff --git a/data/tests/test_history.py b/data/tests/test_history.py new file mode 100644 index 0000000000000000000000000000000000000000..a54ade77d0f7c2a226ae7b45b618649dd57080c2 --- /dev/null +++ b/data/tests/test_history.py @@ -0,0 +1,8 @@ +from elevenlabs import GetSpeechHistoryResponse, ElevenLabs + + +def test_history(): + client = ElevenLabs() + page_size = 5 + history = client.history.list(page_size=page_size) + assert isinstance(history, GetSpeechHistoryResponse) diff --git a/data/tests/test_models.py b/data/tests/test_models.py new file mode 100644 index 0000000000000000000000000000000000000000..e27de822b18cf26bbb61cd063d2fa44dff85474b --- /dev/null +++ b/data/tests/test_models.py @@ -0,0 +1,9 @@ +from elevenlabs import Model +from elevenlabs.client import ElevenLabs + + +def test_models_get_all(): + client = ElevenLabs() + models = client.models.list() + assert len(models) > 0 + assert isinstance(models[0], Model) diff --git a/data/tests/test_music_multipart.py b/data/tests/test_music_multipart.py new file mode 100644 index 0000000000000000000000000000000000000000..10fa5ad2dbb9d3d5a7d918268cc1f5a53a7d790c --- /dev/null +++ b/data/tests/test_music_multipart.py @@ -0,0 +1,113 @@ +import json + +import pytest + +from elevenlabs.music_custom import MusicClient, _find_audio_start + +SAMPLE_JSON = {"compositionPlan": {"sections": []}, "songMetadata": {"title": "Test"}} +SAMPLE_AUDIO = bytes(range(256)) * 4 + + +def _build_multipart(line_ending: bytes) -> bytes: + """Build a realistic multipart response with the given line ending.""" + boundary = b"--boundary123" + nl = line_ending + + parts = [] + parts.append(boundary + nl) + parts.append(b"Content-Type: application/json" + nl) + parts.append(nl) + parts.append(json.dumps(SAMPLE_JSON).encode("utf-8") + nl) + parts.append(boundary + nl) + parts.append(b"Content-Type: audio/mpeg" + nl) + parts.append(b'Content-Disposition: attachment; filename="test_song.mp3"' + nl) + parts.append(nl) + parts.append(SAMPLE_AUDIO) + parts.append(nl + boundary + b"--" + nl) + + return b"".join(parts) + + +class TestFindAudioStart: + def test_crlf(self): + data = b"Header: value\r\n\r\naudio data here" + assert _find_audio_start(data, 0) == data.index(b"audio") + + def test_lf(self): + data = b"Header: value\n\naudio data here" + assert _find_audio_start(data, 0) == data.index(b"audio") + + def test_crlf_preferred_over_lf(self): + data = b"Header: value\r\n\r\naudio data here" + pos = _find_audio_start(data, 0) + assert data[pos : pos + 5] == b"audio" + + def test_raises_when_no_separator(self): + with pytest.raises(ValueError, match="header/body separator"): + _find_audio_start(b"no blank line here", 0) + + def test_start_offset_respected(self): + data = b"skip\n\nHeader: value\r\n\r\naudio" + pos = _find_audio_start(data, 6) + assert data[pos : pos + 5] == b"audio" + + +class TestParseMultipart: + @staticmethod + def _parse(data: bytes): + return MusicClient._parse_multipart(None, iter([data])) # type: ignore[arg-type] + + def test_crlf_line_endings(self): + data = _build_multipart(b"\r\n") + result = self._parse(data) + assert result.audio.startswith(SAMPLE_AUDIO) + assert result.json == SAMPLE_JSON + assert result.filename == "test_song.mp3" + + def test_lf_line_endings(self): + data = _build_multipart(b"\n") + result = self._parse(data) + assert result.audio.startswith(SAMPLE_AUDIO) + assert result.json == SAMPLE_JSON + assert result.filename == "test_song.mp3" + + def test_audio_bytes_not_corrupted(self): + for nl in [b"\r\n", b"\n"]: + data = _build_multipart(nl) + result = self._parse(data) + assert result.audio[:4] == SAMPLE_AUDIO[:4], ( + f"First 4 bytes mismatch with {nl!r} line endings — possible byte offset error" + ) + assert result.audio[: len(SAMPLE_AUDIO)] == SAMPLE_AUDIO + + +class TestComposeDetailedForwardsEnableLogging: + class _RawClient: + def __init__(self): + self.kwargs = None + + def compose_detailed(self, **kwargs): + self.kwargs = kwargs + raw = self + + class _Response: + data = iter([_build_multipart(b"\r\n")]) + headers = {} + + def __enter__(self): + return self + + def __exit__(self, *exc): + return False + + return _Response() + + def _client(self): + client = MusicClient.__new__(MusicClient) + client._raw_client = self._RawClient() # type: ignore[attr-defined] + return client + + def test_forwarded(self): + client = self._client() + client.compose_detailed(prompt="x", enable_logging=False) + assert client._raw_client.kwargs["enable_logging"] is False # type: ignore[attr-defined] diff --git a/data/tests/test_play.py b/data/tests/test_play.py new file mode 100644 index 0000000000000000000000000000000000000000..c91e849c5d08a769518877a550e9a422a231f2d1 --- /dev/null +++ b/data/tests/test_play.py @@ -0,0 +1,80 @@ +import subprocess +import sys + +import pytest + +from elevenlabs import play as play_module + + +def _fake_ffplay(monkeypatch, exit_code, stderr=""): + """Run a real subprocess in place of ffplay: it reads the audio from stdin, + writes ``stderr`` and exits with ``exit_code``.""" + received = {} + real_popen = subprocess.Popen + + def fake_popen(args, **kwargs): + received["args"] = args + script = ( + "import sys; data = sys.stdin.buffer.read(); " + f"sys.stderr.write({stderr!r}); " + f"sys.exit({exit_code})" + ) + return real_popen([sys.executable, "-c", script], **kwargs) + + monkeypatch.setattr(play_module, "is_installed", lambda name: True) + monkeypatch.setattr(play_module.subprocess, "Popen", fake_popen) + return received + + +def test_play_returns_when_ffplay_succeeds(monkeypatch): + received = _fake_ffplay(monkeypatch, exit_code=0) + + play_module.play(b"audio bytes") + + assert received["args"][0] == "ffplay" + + +def test_play_raises_when_ffplay_fails(monkeypatch): + _fake_ffplay(monkeypatch, exit_code=1, stderr="error while loading shared libraries: libavdevice.so.61") + + with pytest.raises(ValueError, match="ffplay exited with status 1") as excinfo: + play_module.play(b"audio bytes") + + assert "libavdevice.so.61" in str(excinfo.value) + + +def test_play_raises_without_error_output(monkeypatch): + _fake_ffplay(monkeypatch, exit_code=2) + + with pytest.raises(ValueError, match=r"ffplay exited with status 2 and did not play the audio\.$"): + play_module.play(b"audio bytes") + + +def test_play_joins_an_iterator_before_piping_it(monkeypatch): + _fake_ffplay(monkeypatch, exit_code=0) + + play_module.play(iter([b"audio ", b"bytes"])) + + +def test_play_joins_a_list_of_chunks(monkeypatch): + received = _fake_ffplay(monkeypatch, exit_code=0) + + play_module.play([b"audio ", b"bytes"]) + + assert received["args"][0] == "ffplay" + + +def test_save_joins_a_list_of_chunks(tmp_path): + target = tmp_path / "out.mp3" + + play_module.save([b"audio ", b"bytes"], str(target)) + + assert target.read_bytes() == b"audio bytes" + + +def test_save_writes_bytes_unchanged(tmp_path): + target = tmp_path / "out.mp3" + + play_module.save(b"audio bytes", str(target)) + + assert target.read_bytes() == b"audio bytes" diff --git a/data/tests/test_realtime_close_event.py b/data/tests/test_realtime_close_event.py new file mode 100644 index 0000000000000000000000000000000000000000..02391980898c55ed444aa2db31209e5d05f70c15 --- /dev/null +++ b/data/tests/test_realtime_close_event.py @@ -0,0 +1,62 @@ +"""Regression test for #854: RealtimeEvents.CLOSE must expose close code/reason.""" + +import asyncio + +from elevenlabs.realtime.connection import RealtimeConnection, RealtimeEvents + + +class FakeWebSocket: + """Immediately-closed stand-in for websockets' ClientConnection.""" + + close_code = 1000 + close_reason = "normal closure" + + def __aiter__(self): + async def _empty(): + return + yield + + return _empty() + + +def run(coro): + return asyncio.run(coro) + + +def test_close_handler_receives_code_and_reason(): + conn = RealtimeConnection(FakeWebSocket(), 16000) + received = [] + conn.on(RealtimeEvents.CLOSE, lambda info: received.append(info)) + run(conn._start_message_handler()) + assert received == [{"code": 1000, "reason": "normal closure"}] + + +def test_zero_arg_close_handler_still_works(): + conn = RealtimeConnection(FakeWebSocket(), 16000) + calls = [] + conn.on(RealtimeEvents.CLOSE, lambda: calls.append("closed")) + run(conn._start_message_handler()) + assert calls == ["closed"] + + +class FakeProtocol: + close_code = 1011 + close_reason = "server error" + + +class FakeWebSocket13: + """websockets 13.x asyncio Connection: close info lives only on .protocol.""" + + def __init__(self): + self.protocol = FakeProtocol() + + def __aiter__(self): + return FakeWebSocket().__aiter__() + + +def test_close_handler_reads_protocol_close_info_on_websockets_13(): + conn = RealtimeConnection(FakeWebSocket13(), 16000) + received = [] + conn.on(RealtimeEvents.CLOSE, lambda info: received.append(info)) + run(conn._start_message_handler()) + assert received == [{"code": 1011, "reason": "server error"}] diff --git a/data/tests/test_realtime_tts_params.py b/data/tests/test_realtime_tts_params.py new file mode 100644 index 0000000000000000000000000000000000000000..6bf1268f37559a1452559d5deea1fd7ff510ff32 --- /dev/null +++ b/data/tests/test_realtime_tts_params.py @@ -0,0 +1,67 @@ +"""convert_realtime must not leak the OMIT sentinel into the URL or the first frame.""" + +import base64 +import json +from unittest.mock import MagicMock, patch + +from elevenlabs.realtime_tts import RealtimeTextToSpeechClient +from elevenlabs.types.voice_settings import VoiceSettings + +AUDIO = b"audio chunk" + + +def _run(**kwargs): + """Drive convert_realtime to its first yield, returning the URL, the frames sent, and that chunk.""" + captured = {} + socket = MagicMock() + socket.__enter__.return_value = socket + socket.recv.return_value = json.dumps({"audio": base64.b64encode(AUDIO).decode()}) + + def connect(url, **_): + captured["url"] = url + return socket + + client = object.__new__(RealtimeTextToSpeechClient) + client._client_wrapper = MagicMock() + client._client_wrapper.get_headers.return_value = {} + client._ws_base_url = "wss://api.elevenlabs.io" + + with patch("elevenlabs.realtime_tts.connect", connect): + stream = client.convert_realtime("VOICE", text=iter(["hello there."]), **kwargs) + chunk = next(stream) + stream.close() + + frames = [json.loads(call.args[0]) for call in socket.send.call_args_list] + return captured["url"], frames, chunk + + +def test_omitted_model_id_is_not_sent(): + url, _, chunk = _run() + assert "model_id" not in url, "OMIT sentinel leaked into the URL: {}".format(url) + assert chunk == AUDIO + + +def test_omitted_voice_settings_serialize_to_null(): + _, frames, _ = _run() + assert frames[0]["voice_settings"] is None + + +def test_explicit_model_id_is_sent(): + url, _, _ = _run(model_id="eleven_flash_v2_5") + assert "model_id=eleven_flash_v2_5" in url + + +def test_explicit_voice_settings_are_sent(): + _, frames, _ = _run(voice_settings=VoiceSettings(stability=0.5, similarity_boost=0.75)) + assert frames[0]["voice_settings"]["stability"] == 0.5 + + +def test_output_format_still_sent(): + url, _, _ = _run() + assert "output_format=mp3_44100_128" in url + + +def test_omitted_model_id_with_explicit_voice_settings(): + """The URL defect on its own: voice_settings supplied, so nothing else fails first.""" + url, _, _ = _run(voice_settings=VoiceSettings(stability=0.5, similarity_boost=0.75)) + assert "model_id" not in url, "OMIT sentinel leaked into the URL: {}".format(url) diff --git a/data/tests/test_recursive_models.py b/data/tests/test_recursive_models.py new file mode 100644 index 0000000000000000000000000000000000000000..6174ed63fd2a1da1a5b6f9a4dcc8e970ec5b399f --- /dev/null +++ b/data/tests/test_recursive_models.py @@ -0,0 +1,11 @@ +from elevenlabs import AgentWorkflowRequestModel, ObjectJsonSchemaPropertyInput, ObjectJsonSchemaPropertyOutput + + +def test_recursive_models(): + # Should be able to import and use the recursive types without PydanticUserError + # ObjectJsonSchemaPropertyInput has no required fields, so it can be instantiated + ObjectJsonSchemaPropertyInput() + + ObjectJsonSchemaPropertyOutput() + + AgentWorkflowRequestModel() diff --git a/data/tests/test_speech_engine_auth.py b/data/tests/test_speech_engine_auth.py new file mode 100644 index 0000000000000000000000000000000000000000..ede38fbe4755b5b874dfade3967c2127e5469a16 --- /dev/null +++ b/data/tests/test_speech_engine_auth.py @@ -0,0 +1,347 @@ +"""Tests for Speech Engine JWT verification.""" + +import asyncio +import base64 +import hashlib +import hmac +import json +import time +import typing +import warnings + +import pytest +from websockets.asyncio.client import connect as ws_connect +from websockets.exceptions import InvalidStatus + +from elevenlabs.speech_engine import SpeechEngineServer +from elevenlabs.speech_engine.resource import ( + SpeechEngineResource, + verify_speech_engine_jwt, +) + +TEST_API_KEY = "test-key" +JWT_ISSUER = "https://api.elevenlabs.io/convai/speech-engine" +JWT_SUBJECT = "convai_speech_engine_upstream" + + +# --------------------------------------------------------------------------- +# JWT test helpers +# --------------------------------------------------------------------------- + + +def _base64url_encode(data: bytes) -> str: + return base64.urlsafe_b64encode(data).rstrip(b"=").decode("ascii") + + +def _create_test_jwt( + payload: typing.Dict[str, typing.Any], + api_key: str = TEST_API_KEY, +) -> str: + header = {"alg": "HS256", "typ": "JWT"} + header_b64 = _base64url_encode(json.dumps(header).encode()) + payload_b64 = _base64url_encode(json.dumps(payload).encode()) + secret = hashlib.sha256(api_key.encode("utf-8")).digest() + signature = hmac.new( + secret, f"{header_b64}.{payload_b64}".encode(), hashlib.sha256 + ).digest() + return f"{header_b64}.{payload_b64}.{_base64url_encode(signature)}" + + +def _valid_payload(**overrides: typing.Any) -> typing.Dict[str, typing.Any]: + now = int(time.time()) + return { + "iss": JWT_ISSUER, + "sub": JWT_SUBJECT, + "iat": now, + "exp": now + 300, + **overrides, + } + + +# --------------------------------------------------------------------------- +# verify_speech_engine_jwt +# --------------------------------------------------------------------------- + + +class TestVerifySpeechEngineJwt: + def test_valid_token(self) -> None: + token = _create_test_jwt(_valid_payload()) + payload = verify_speech_engine_jwt(token, TEST_API_KEY) + assert payload["iss"] == JWT_ISSUER + assert payload["sub"] == JWT_SUBJECT + + def test_accepts_bearer_prefix(self) -> None: + token = _create_test_jwt(_valid_payload()) + payload = verify_speech_engine_jwt(f"Bearer {token}", TEST_API_KEY) + assert payload["iss"] == JWT_ISSUER + + def test_rejects_wrong_key(self) -> None: + token = _create_test_jwt(_valid_payload(), api_key="other-key") + with pytest.raises(ValueError, match="signature mismatch"): + verify_speech_engine_jwt(token, TEST_API_KEY) + + def test_strips_residency_suffix_before_hashing(self) -> None: + # The API signs with the base key; the server may hold the full residency key. + token = _create_test_jwt(_valid_payload(), api_key="sk_abc123") + payload = verify_speech_engine_jwt(token, "sk_abc123_residency_in") + assert payload["iss"] == JWT_ISSUER + + def test_rejects_residency_key_with_wrong_base(self) -> None: + token = _create_test_jwt(_valid_payload(), api_key="sk_other") + with pytest.raises(ValueError, match="signature mismatch"): + verify_speech_engine_jwt(token, "sk_abc123_residency_eu") + + def test_rejects_wrong_issuer(self) -> None: + token = _create_test_jwt(_valid_payload(iss="https://evil.com")) + with pytest.raises(ValueError, match="expected issuer"): + verify_speech_engine_jwt(token, TEST_API_KEY) + + def test_rejects_wrong_subject(self) -> None: + token = _create_test_jwt(_valid_payload(sub="wrong_subject")) + with pytest.raises(ValueError, match="expected subject"): + verify_speech_engine_jwt(token, TEST_API_KEY) + + def test_rejects_expired_token_beyond_leeway(self) -> None: + now = int(time.time()) + token = _create_test_jwt( + _valid_payload(exp=now - 120, iat=now - 420) + ) + with pytest.raises(ValueError, match="expired"): + verify_speech_engine_jwt(token, TEST_API_KEY) + + def test_accepts_expired_within_leeway(self) -> None: + now = int(time.time()) + token = _create_test_jwt( + _valid_payload(exp=now - 30, iat=now - 330) + ) + payload = verify_speech_engine_jwt(token, TEST_API_KEY) + assert payload["iss"] == JWT_ISSUER + + def test_rejects_future_iat_beyond_leeway(self) -> None: + now = int(time.time()) + token = _create_test_jwt( + _valid_payload(iat=now + 120, exp=now + 420) + ) + with pytest.raises(ValueError, match="iat is in the future"): + verify_speech_engine_jwt(token, TEST_API_KEY) + + def test_accepts_future_iat_within_leeway(self) -> None: + now = int(time.time()) + token = _create_test_jwt( + _valid_payload(iat=now + 30, exp=now + 330) + ) + payload = verify_speech_engine_jwt(token, TEST_API_KEY) + assert payload["iss"] == JWT_ISSUER + + def test_rejects_malformed_token(self) -> None: + with pytest.raises(ValueError, match="expected 3 parts"): + verify_speech_engine_jwt("not.a.valid.jwt.token", TEST_API_KEY) + + def test_rejects_missing_exp(self) -> None: + payload = _valid_payload() + del payload["exp"] + token = _create_test_jwt(payload) + with pytest.raises(ValueError, match="missing exp"): + verify_speech_engine_jwt(token, TEST_API_KEY) + + def test_rejects_missing_iat(self) -> None: + payload = _valid_payload() + del payload["iat"] + token = _create_test_jwt(payload) + with pytest.raises(ValueError, match="missing iat"): + verify_speech_engine_jwt(token, TEST_API_KEY) + + +# --------------------------------------------------------------------------- +# SpeechEngineResource.verify_request +# --------------------------------------------------------------------------- + + +class _FakeClientWrapper: + def __init__(self, api_key: str) -> None: + self._api_key = api_key + + def get_headers(self) -> dict: + return {"xi-api-key": self._api_key} + + +class TestVerifyRequest: + def test_valid_header(self) -> None: + resource = SpeechEngineResource( + "seng_test", client_wrapper=_FakeClientWrapper(TEST_API_KEY) + ) + token = _create_test_jwt(_valid_payload()) + assert resource.verify_request( + {"x-elevenlabs-speech-engine-authorization": token} + ) + + def test_missing_header(self) -> None: + resource = SpeechEngineResource( + "seng_test", client_wrapper=_FakeClientWrapper(TEST_API_KEY) + ) + assert not resource.verify_request({}) + + def test_no_api_key(self) -> None: + resource = SpeechEngineResource("seng_test") + token = _create_test_jwt(_valid_payload()) + assert not resource.verify_request( + {"x-elevenlabs-speech-engine-authorization": token} + ) + + def test_invalid_token(self) -> None: + resource = SpeechEngineResource( + "seng_test", client_wrapper=_FakeClientWrapper(TEST_API_KEY) + ) + assert not resource.verify_request( + {"x-elevenlabs-speech-engine-authorization": "bad-token"} + ) + + +# --------------------------------------------------------------------------- +# SpeechEngineServer — api_key requirement +# --------------------------------------------------------------------------- + + +class TestServerApiKeyRequirement: + @pytest.mark.asyncio + async def test_raises_without_api_key(self, monkeypatch: pytest.MonkeyPatch) -> None: + monkeypatch.delenv("ELEVENLABS_API_KEY", raising=False) + from elevenlabs.speech_engine import SpeechEngineServer + + server = SpeechEngineServer(port=0) + with pytest.raises(RuntimeError, match="API key"): + await server.serve() + + +# --------------------------------------------------------------------------- +# SpeechEngineServer — disable_auth +# --------------------------------------------------------------------------- + + +async def _run_server_briefly(server: SpeechEngineServer) -> asyncio.Task: + """Start ``server`` in a background task and wait until it's listening.""" + task = asyncio.create_task(server.serve()) + # Give the server loop a moment to reach `await self._stop_event.wait()`. + for _ in range(50): + await asyncio.sleep(0.02) + if server._server is not None: + break + return task + + +def _server_port(server: SpeechEngineServer) -> int: + import socket as _socket + + # websockets.serve(host="") binds both IPv4 and IPv6; on macOS the first + # socket is often IPv6. Prefer an IPv4 socket so the client can connect + # via 127.0.0.1 reliably. + ipv4 = [ + s for s in server._server.sockets if s.family == _socket.AF_INET + ] + chosen = ipv4[0] if ipv4 else next(iter(server._server.sockets), None) + if chosen is None: + raise RuntimeError("server has no sockets") + return int(chosen.getsockname()[1]) + + +class TestServerDisableAuth: + @pytest.mark.asyncio + async def test_serves_without_api_key_when_disable_auth( + self, monkeypatch: pytest.MonkeyPatch + ) -> None: + monkeypatch.delenv("ELEVENLABS_API_KEY", raising=False) + server = SpeechEngineServer(port=0, disable_auth=True) + task = None + try: + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + task = await _run_server_briefly(server) + assert server._server is not None + finally: + await server.stop() + if task is not None: + await task + + @pytest.mark.asyncio + async def test_emits_warning_when_disable_auth( + self, monkeypatch: pytest.MonkeyPatch + ) -> None: + monkeypatch.delenv("ELEVENLABS_API_KEY", raising=False) + server = SpeechEngineServer(port=0, disable_auth=True) + task = None + try: + with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + task = await _run_server_briefly(server) + messages = [str(w.message) for w in caught] + assert any("authentication is disabled" in m for m in messages) + finally: + await server.stop() + if task is not None: + await task + + @pytest.mark.asyncio + async def test_accepts_unauthenticated_connection( + self, monkeypatch: pytest.MonkeyPatch + ) -> None: + monkeypatch.delenv("ELEVENLABS_API_KEY", raising=False) + + init_ids: typing.List[str] = [] + + async def on_init(conversation_id: str, session: typing.Any) -> None: + init_ids.append(conversation_id) + + server = SpeechEngineServer(port=0, disable_auth=True, on_init=on_init) + task = None + try: + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + task = await _run_server_briefly(server) + port = _server_port(server) + async with ws_connect(f"ws://127.0.0.1:{port}") as ws: + await ws.send( + json.dumps({"type": "init", "conversation_id": "conv_1"}) + ) + await asyncio.sleep(0.1) + assert init_ids == ["conv_1"] + finally: + await server.stop() + if task is not None: + await task + + @pytest.mark.asyncio + async def test_rejects_missing_header_when_auth_enabled(self) -> None: + server = SpeechEngineServer(port=0, api_key=TEST_API_KEY) + task = None + try: + task = await _run_server_briefly(server) + port = _server_port(server) + with pytest.raises(InvalidStatus) as exc: + async with ws_connect(f"ws://127.0.0.1:{port}"): + pass + assert exc.value.response.status_code == 401 + finally: + await server.stop() + if task is not None: + await task + + @pytest.mark.asyncio + async def test_rejects_invalid_jwt_when_auth_enabled(self) -> None: + server = SpeechEngineServer(port=0, api_key=TEST_API_KEY) + task = None + try: + task = await _run_server_briefly(server) + port = _server_port(server) + with pytest.raises(InvalidStatus) as exc: + async with ws_connect( + f"ws://127.0.0.1:{port}", + additional_headers={ + "X-Elevenlabs-Speech-Engine-Authorization": "not.a.jwt" + }, + ): + pass + assert exc.value.response.status_code == 401 + finally: + await server.stop() + if task is not None: + await task diff --git a/data/tests/test_speech_engine_custom.py b/data/tests/test_speech_engine_custom.py new file mode 100644 index 0000000000000000000000000000000000000000..48d86e72fd5107adf41c6a95bbfc83fd7d14bcb0 --- /dev/null +++ b/data/tests/test_speech_engine_custom.py @@ -0,0 +1,95 @@ +"""Tests for SpeechEngineClient and AsyncSpeechEngineClient wrapper methods.""" + +from unittest.mock import AsyncMock, MagicMock, patch + +import pytest + +from elevenlabs.speech_engine.client import AsyncSpeechEngineClient as AutogeneratedAsyncSpeechEngineClient +from elevenlabs.speech_engine.client import SpeechEngineClient as AutogeneratedSpeechEngineClient +from elevenlabs.speech_engine.resource import SpeechEngineResource +from elevenlabs.speech_engine_custom import AsyncSpeechEngineClient, SpeechEngineClient +from elevenlabs.types.speech_engine_config import SpeechEngineConfig +from elevenlabs.types.speech_engine_response import SpeechEngineResponse + + +def _make_sync_client() -> SpeechEngineClient: + return SpeechEngineClient(client_wrapper=MagicMock()) + + +def _make_async_client() -> AsyncSpeechEngineClient: + return AsyncSpeechEngineClient(client_wrapper=MagicMock()) + + +# --------------------------------------------------------------------------- +# Sync +# --------------------------------------------------------------------------- + + +def test_create_returns_resource() -> None: + client = _make_sync_client() + mock_response = MagicMock(spec=SpeechEngineResponse, speech_engine_id="seng_abc") + + with patch.object(AutogeneratedSpeechEngineClient, "create", return_value=mock_response): + result = client.create(speech_engine=SpeechEngineConfig(ws_url="wss://test")) + + assert isinstance(result, SpeechEngineResource) + assert result.engine_id == "seng_abc" + + +def test_get_returns_resource() -> None: + client = _make_sync_client() + + with patch.object(AutogeneratedSpeechEngineClient, "get", return_value=None): + result = client.get("seng_abc") + + assert isinstance(result, SpeechEngineResource) + assert result.engine_id == "seng_abc" + + +def test_update_returns_resource() -> None: + client = _make_sync_client() + + with patch.object(AutogeneratedSpeechEngineClient, "update", return_value=None): + result = client.update("seng_abc", name="Renamed") + + assert isinstance(result, SpeechEngineResource) + assert result.engine_id == "seng_abc" + + +# --------------------------------------------------------------------------- +# Async +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_async_create_returns_resource() -> None: + client = _make_async_client() + mock_response = MagicMock(spec=SpeechEngineResponse, speech_engine_id="seng_abc") + + with patch.object(AutogeneratedAsyncSpeechEngineClient, "create", new_callable=AsyncMock, return_value=mock_response): + result = await client.create(speech_engine=SpeechEngineConfig(ws_url="wss://test")) + + assert isinstance(result, SpeechEngineResource) + assert result.engine_id == "seng_abc" + + +@pytest.mark.asyncio +async def test_async_get_returns_resource() -> None: + client = _make_async_client() + + with patch.object(AutogeneratedAsyncSpeechEngineClient, "get", new_callable=AsyncMock, return_value=None): + result = await client.get("seng_abc") + + assert isinstance(result, SpeechEngineResource) + assert result.engine_id == "seng_abc" + + +@pytest.mark.asyncio +async def test_async_update_returns_resource() -> None: + client = _make_async_client() + + with patch.object(AutogeneratedAsyncSpeechEngineClient, "update", new_callable=AsyncMock, return_value=None): + result = await client.update("seng_abc", name="Renamed") + + assert isinstance(result, SpeechEngineResource) + assert result.engine_id == "seng_abc" diff --git a/data/tests/test_speech_engine_resource.py b/data/tests/test_speech_engine_resource.py new file mode 100644 index 0000000000000000000000000000000000000000..a3ee6aa2ff92e194da53180335d94229abae7e5c --- /dev/null +++ b/data/tests/test_speech_engine_resource.py @@ -0,0 +1,107 @@ +"""Tests for SpeechEngineResource — mirrors SpeechEngineResource.test.ts.""" + +import asyncio +import json +import typing + +import pytest + +from elevenlabs.speech_engine import SpeechEngineResource, SpeechEngineSession + + +# --------------------------------------------------------------------------- +# MockWebSocket (same as session tests) +# --------------------------------------------------------------------------- + +_CLOSE_SENTINEL = object() + + +class MockWebSocket: + def __init__(self) -> None: + self._inbox = asyncio.Queue() # type: asyncio.Queue[typing.Any] + self.sent = [] # type: typing.List[str] + self.closed = False + + async def recv(self) -> str: + msg = await self._inbox.get() + if msg is _CLOSE_SENTINEL: + raise ConnectionError("connection closed") + return msg + + async def send(self, data: str) -> None: + self.sent.append(data) + + async def close(self) -> None: + self.closed = True + + def receive_message(self, msg: typing.Dict[str, typing.Any]) -> None: + self._inbox.put_nowait(json.dumps(msg)) + + def simulate_disconnect(self) -> None: + self._inbox.put_nowait(_CLOSE_SENTINEL) + + +# --------------------------------------------------------------------------- +# create_session +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_create_session_returns_speech_engine_session() -> None: + resource = SpeechEngineResource("seng_test") + ws = MockWebSocket() + session = resource.create_session(ws) + assert isinstance(session, SpeechEngineSession) + + +@pytest.mark.asyncio +async def test_create_session_protocol_works() -> None: + """Full send/receive cycle through a session created by the resource.""" + resource = SpeechEngineResource("seng_test") + ws = MockWebSocket() + session = resource.create_session(ws, debug=False) + + async def handler(transcript: typing.Any) -> None: + last = transcript[-1] + await session.send_response("echo: {}".format(last.content)) + + session.on("user_transcript", handler) + + ws.receive_message( + { + "type": "user_transcript", + "user_transcript": [{"role": "user", "content": "hello"}], + "event_id": 1, + } + ) + ws.simulate_disconnect() + await session.run() + + sent = [json.loads(s) for s in ws.sent] + assert sent[0] == { + "type": "agent_response", + "content": "echo: hello", + "event_id": 1, + "is_final": False, + } + + +# --------------------------------------------------------------------------- +# client accessor stub +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_async_client_speech_engine_get() -> None: + """The AsyncElevenLabs.speech_engine.get() returns a SpeechEngineResource.""" + from unittest.mock import AsyncMock, patch + + from elevenlabs import AsyncElevenLabs + from elevenlabs.speech_engine.client import AsyncSpeechEngineClient as AutogeneratedAsyncSpeechEngineClient + + client = AsyncElevenLabs(api_key="test-key") + with patch.object(AutogeneratedAsyncSpeechEngineClient, "get", new_callable=AsyncMock, return_value=None): + resource = await client.speech_engine.get("seng_123") + + assert isinstance(resource, SpeechEngineResource) + assert resource.engine_id == "seng_123" diff --git a/data/tests/test_speech_engine_server.py b/data/tests/test_speech_engine_server.py new file mode 100644 index 0000000000000000000000000000000000000000..fb0dbff4eaeab1a84996198f17f00724bc0d6a05 --- /dev/null +++ b/data/tests/test_speech_engine_server.py @@ -0,0 +1,138 @@ +"""Tests for SpeechEngineServer — mirrors SpeechEngineServer.test.ts.""" + +import asyncio +import json +import typing + +import pytest +import websockets + +from elevenlabs.speech_engine import SpeechEngineServer + + +# --------------------------------------------------------------------------- +# Helpers +# --------------------------------------------------------------------------- + + +async def _connect_and_send( + port: int, + messages: typing.List[typing.Dict[str, typing.Any]], +) -> typing.List[typing.Dict[str, typing.Any]]: + """Open a client WS, send *messages*, and collect the first response.""" + uri = "ws://127.0.0.1:{}".format(port) + received = [] # type: typing.List[typing.Dict[str, typing.Any]] + async with websockets.connect(uri) as ws: # type: ignore[attr-defined] + for msg in messages: + await ws.send(json.dumps(msg)) + # Give the server a moment to process and respond. + try: + while True: + raw = await asyncio.wait_for(ws.recv(), timeout=0.2) + received.append(json.loads(raw)) + except (asyncio.TimeoutError, websockets.exceptions.ConnectionClosed): + pass + return received + + +# --------------------------------------------------------------------------- +# handleConnection +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_handle_connection_wraps_ws_and_calls_on_init() -> None: + init_ids = [] # type: typing.List[str] + + async def on_init(conversation_id: str, session: typing.Any) -> None: + init_ids.append(conversation_id) + + server = SpeechEngineServer(port=0, on_init=on_init) + + # Use port 0 to get an ephemeral port; start via websockets directly. + started = asyncio.Event() + actual_port = 0 + + async def _handler(ws: typing.Any, *_args: typing.Any) -> None: + session = server.handle_connection(ws) + await session.run() + + ws_server = await websockets.serve(_handler, "127.0.0.1", 0) # type: ignore[attr-defined] + for sock in ws_server.sockets: + actual_port = sock.getsockname()[1] + break + + try: + uri = "ws://127.0.0.1:{}".format(actual_port) + async with websockets.connect(uri) as client: # type: ignore[attr-defined] + await client.send( + json.dumps({"type": "init", "conversation_id": "conv_1"}) + ) + await asyncio.sleep(0.1) + finally: + ws_server.close() + await ws_server.wait_closed() + + assert init_ids == ["conv_1"] + + +# --------------------------------------------------------------------------- +# Session responses are received by the client +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_session_responses_received_by_client() -> None: + async def on_transcript( + transcript: typing.Any, session: typing.Any + ) -> None: + last = transcript[-1] + await session.send_response("echo: {}".format(last.content)) + + server = SpeechEngineServer(port=0, on_transcript=on_transcript) + + async def _handler(ws: typing.Any, *_args: typing.Any) -> None: + session = server.handle_connection(ws) + await session.run() + + ws_server = await websockets.serve(_handler, "127.0.0.1", 0) # type: ignore[attr-defined] + actual_port = 0 + for sock in ws_server.sockets: + actual_port = sock.getsockname()[1] + break + + try: + uri = "ws://127.0.0.1:{}".format(actual_port) + async with websockets.connect(uri) as client: # type: ignore[attr-defined] + await client.send( + json.dumps( + { + "type": "user_transcript", + "user_transcript": [{"role": "user", "content": "ping"}], + "event_id": 1, + } + ) + ) + raw = await asyncio.wait_for(client.recv(), timeout=1.0) + response = json.loads(raw) + finally: + ws_server.close() + await ws_server.wait_closed() + + assert response == { + "type": "agent_response", + "content": "echo: ping", + "event_id": 1, + "is_final": False, + } + + +# --------------------------------------------------------------------------- +# Lifecycle +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_stop_resolves_when_no_server_running() -> None: + server = SpeechEngineServer() + await server.stop() # Should not raise. diff --git a/data/tests/test_speech_engine_session.py b/data/tests/test_speech_engine_session.py new file mode 100644 index 0000000000000000000000000000000000000000..17ff322308cad71df5e3110d916b963a33ac34d1 --- /dev/null +++ b/data/tests/test_speech_engine_session.py @@ -0,0 +1,876 @@ +"""Tests for SpeechEngineSession — mirrors SpeechEngineSession.test.ts.""" + +import asyncio +import json +import typing + +import pytest + +from elevenlabs.speech_engine import ( + CLOSE, + DISCONNECTED, + ERROR, + INIT, + USER_TRANSCRIPT, + ConversationMessage, + SpeechEngineSession, +) + + +# --------------------------------------------------------------------------- +# MockWebSocket +# --------------------------------------------------------------------------- + + +class MockWebSocket: + """In-memory WebSocket stand-in backed by an asyncio.Queue.""" + + def __init__(self) -> None: + self._inbox = asyncio.Queue() # type: asyncio.Queue[typing.Any] + self.sent = [] # type: typing.List[str] + self.closed = False + + async def recv(self) -> str: + msg = await self._inbox.get() + if msg is _CLOSE_SENTINEL: + raise ConnectionError("connection closed") + return msg + + async def send(self, data: str) -> None: + self.sent.append(data) + + async def close(self) -> None: + self.closed = True + + # -- test helpers -- + + def receive_message(self, msg: typing.Dict[str, typing.Any]) -> None: + """Inject an incoming message from the "ElevenLabs API".""" + self._inbox.put_nowait(json.dumps(msg)) + + def receive_raw(self, data: str) -> None: + """Inject raw (possibly invalid) data.""" + self._inbox.put_nowait(data) + + def simulate_disconnect(self) -> None: + """Simulate a WebSocket disconnection.""" + self._inbox.put_nowait(_CLOSE_SENTINEL) + + +_CLOSE_SENTINEL = object() + + +# --------------------------------------------------------------------------- +# Fixtures +# --------------------------------------------------------------------------- + +TRANSCRIPT = [ + {"role": "agent", "content": "how can I help you today?"}, + {"role": "user", "content": "I need a pizza"}, +] + +TRANSCRIPT_2 = [ + {"role": "agent", "content": "how can I help you today?"}, + {"role": "user", "content": "I need a pizza"}, + {"role": "agent", "content": "what size?"}, + {"role": "user", "content": "large"}, +] + + +@pytest.fixture +def ws() -> MockWebSocket: + return MockWebSocket() + + +@pytest.fixture +def session(ws: MockWebSocket) -> SpeechEngineSession: + return SpeechEngineSession(ws) + + +# --------------------------------------------------------------------------- +# Helpers +# --------------------------------------------------------------------------- + + +def _parsed_sent(ws: MockWebSocket) -> typing.List[typing.Dict[str, typing.Any]]: + return [json.loads(s) for s in ws.sent] + + +async def _run_until_idle(session: SpeechEngineSession, ws: MockWebSocket) -> None: + """Drive the session run loop, then disconnect so it returns.""" + ws.simulate_disconnect() + await session.run() + + +# --------------------------------------------------------------------------- +# init event +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_emits_init_with_conversation_id( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + captured = [] # type: typing.List[str] + + async def handler(conversation_id: str) -> None: + captured.append(conversation_id) + + session.on(INIT, handler) + ws.receive_message({"type": "init", "conversation_id": "conv_42"}) + await _run_until_idle(session, ws) + + assert captured == ["conv_42"] + assert session.conversation_id == "conv_42" + + +# --------------------------------------------------------------------------- +# user_transcript events +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_emits_user_transcript_with_conversation_history( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + captured = [] # type: typing.List[typing.List[ConversationMessage]] + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + captured.append(transcript) + + session.on(USER_TRANSCRIPT, handler) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 1} + ) + await _run_until_idle(session, ws) + + assert len(captured) == 1 + assert len(captured[0]) == 2 + assert captured[0][0].role == "agent" + assert captured[0][0].content == "how can I help you today?" + assert captured[0][1].role == "user" + assert captured[0][1].content == "I need a pizza" + + +@pytest.mark.asyncio +async def test_cancels_previous_handler_on_new_transcript( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + """When a new transcript arrives the previous handler task is cancelled.""" + cancelled = asyncio.Event() + + async def slow_handler(transcript: typing.List[ConversationMessage]) -> None: + try: + await asyncio.sleep(10) + except asyncio.CancelledError: + cancelled.set() + raise + + session.on(USER_TRANSCRIPT, slow_handler) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 1} + ) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT_2, "event_id": 2} + ) + await _run_until_idle(session, ws) + + assert cancelled.is_set() + + +# --------------------------------------------------------------------------- +# ping / pong +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_auto_responds_to_ping( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message({"type": "ping"}) + await _run_until_idle(session, ws) + + assert len(ws.sent) == 1 + assert json.loads(ws.sent[0]) == {"type": "pong"} + + +# --------------------------------------------------------------------------- +# close event (protocol-level) +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_emits_close_and_cancels_handler_on_close_message( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + close_called = asyncio.Event() + cancelled = asyncio.Event() + + async def close_handler() -> None: + close_called.set() + + async def slow_handler(transcript: typing.List[ConversationMessage]) -> None: + try: + await asyncio.sleep(10) + except asyncio.CancelledError: + cancelled.set() + raise + + session.on(CLOSE, close_handler) + session.on(USER_TRANSCRIPT, slow_handler) + + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 1} + ) + ws.receive_message({"type": "close"}) + await _run_until_idle(session, ws) + + assert close_called.is_set() + assert cancelled.is_set() + + +# --------------------------------------------------------------------------- +# error event (protocol-level) +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_emits_error_on_protocol_error_message( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + errors = [] # type: typing.List[Exception] + + async def handler(err: Exception) -> None: + errors.append(err) + + session.on(ERROR, handler) + ws.receive_message({"type": "error", "message": "something went wrong"}) + await _run_until_idle(session, ws) + + assert len(errors) == 1 + assert isinstance(errors[0], Exception) + assert str(errors[0]) == "something went wrong" + + +# --------------------------------------------------------------------------- +# WebSocket-level events +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_emits_disconnected_when_websocket_closes( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + disconnected = asyncio.Event() + + async def handler() -> None: + disconnected.set() + + session.on(DISCONNECTED, handler) + ws.simulate_disconnect() + await session.run() + + assert disconnected.is_set() + assert not session.is_open + + +@pytest.mark.asyncio +async def test_cancels_handler_when_websocket_closes( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + cancelled = asyncio.Event() + + async def slow_handler(transcript: typing.List[ConversationMessage]) -> None: + try: + await asyncio.sleep(10) + except asyncio.CancelledError: + cancelled.set() + raise + + session.on(USER_TRANSCRIPT, slow_handler) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 1} + ) + # Give the handler task a moment to start before disconnecting. + await asyncio.sleep(0) + ws.simulate_disconnect() + await session.run() + + # The disconnect triggers _cancel_current in the finally block. + assert cancelled.is_set() + + +@pytest.mark.asyncio +async def test_emits_error_on_malformed_json( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + errors = [] # type: typing.List[Exception] + + async def handler(err: Exception) -> None: + errors.append(err) + + session.on(ERROR, handler) + ws.receive_raw("not json") + await _run_until_idle(session, ws) + + assert len(errors) == 1 + + +@pytest.mark.asyncio +async def test_ignores_unknown_message_types( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + errors = [] # type: typing.List[Exception] + + async def handler(err: Exception) -> None: + errors.append(err) + + session.on(ERROR, handler) + ws.receive_message({"type": "unknown_future_event", "data": 123}) + await _run_until_idle(session, ws) + + assert len(errors) == 0 + + +# --------------------------------------------------------------------------- +# sendResponse (string) +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_sends_string_response_with_event_id_and_is_final( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 5} + ) + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + await session.send_response("The answer is 42") + + session.on(USER_TRANSCRIPT, handler) + await _run_until_idle(session, ws) + + sent = _parsed_sent(ws) + assert len(sent) == 2 + assert sent[0] == { + "type": "agent_response", + "content": "The answer is 42", + "event_id": 5, + "is_final": False, + } + assert sent[1] == { + "type": "agent_response", + "content": "", + "event_id": 5, + "is_final": True, + } + + +@pytest.mark.asyncio +async def test_raises_when_sending_after_close( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + session.close() + with pytest.raises(RuntimeError, match="session is closed"): + await session.send_response("too late") + + +# --------------------------------------------------------------------------- +# sendResponse (streaming) +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_streams_chunks_with_is_final_false_then_terminator( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 3} + ) + + async def tokens(): # type: ignore[return] + yield "Hello" + yield " world" + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + await session.send_response(tokens()) + + session.on(USER_TRANSCRIPT, handler) + await _run_until_idle(session, ws) + + sent = _parsed_sent(ws) + assert len(sent) == 3 + assert sent[0] == { + "type": "agent_response", + "content": "Hello", + "event_id": 3, + "is_final": False, + } + assert sent[1] == { + "type": "agent_response", + "content": " world", + "event_id": 3, + "is_final": False, + } + assert sent[2] == { + "type": "agent_response", + "content": "", + "event_id": 3, + "is_final": True, + } + + +@pytest.mark.asyncio +async def test_stops_streaming_when_session_closed_mid_stream( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 7} + ) + + async def slow_tokens(): # type: ignore[return] + yield "first" + yield "second" + await asyncio.sleep(0.1) + yield "third" + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + await session.send_response(slow_tokens()) + + session.on(USER_TRANSCRIPT, handler) + + # Start the run loop in the background. + task = asyncio.create_task(session.run()) + # Let the handler task progress through the first two yields. + await asyncio.sleep(0.05) + session.close() + await asyncio.sleep(0.15) + task.cancel() + try: + await task + except asyncio.CancelledError: + pass + + sent = _parsed_sent(ws) + chunks = [m for m in sent if m.get("type") == "agent_response"] + # "first" and "second" are sent; session closes before "third". + assert len(chunks) == 2 + assert chunks[0] == { + "type": "agent_response", + "content": "first", + "event_id": 7, + "is_final": False, + } + assert chunks[1] == { + "type": "agent_response", + "content": "second", + "event_id": 7, + "is_final": False, + } + + +# --------------------------------------------------------------------------- +# sendResponse (LLM stream formats) +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_extracts_text_from_openai_responses_api( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 10} + ) + + async def openai_responses_stream(): # type: ignore[return] + yield {"type": "response.created", "response": {}} + yield {"type": "response.output_text.delta", "delta": "Hello"} + yield {"type": "response.output_text.delta", "delta": " world"} + yield {"type": "response.output_text.done", "text": "Hello world"} + yield {"type": "response.completed", "response": {}} + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + await session.send_response(openai_responses_stream()) + + session.on(USER_TRANSCRIPT, handler) + await _run_until_idle(session, ws) + + sent = _parsed_sent(ws) + assert len(sent) == 3 + assert sent[0] == { + "type": "agent_response", + "content": "Hello", + "event_id": 10, + "is_final": False, + } + assert sent[1] == { + "type": "agent_response", + "content": " world", + "event_id": 10, + "is_final": False, + } + assert sent[2] == { + "type": "agent_response", + "content": "", + "event_id": 10, + "is_final": True, + } + + +@pytest.mark.asyncio +async def test_extracts_text_from_openai_chat_completions_api( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 11} + ) + + async def openai_chat_stream(): # type: ignore[return] + yield {"choices": [{"delta": {"role": "assistant"}}]} + yield {"choices": [{"delta": {"content": "Hi"}}]} + yield {"choices": [{"delta": {"content": " there"}}]} + yield {"choices": [{"delta": {}}]} + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + await session.send_response(openai_chat_stream()) + + session.on(USER_TRANSCRIPT, handler) + await _run_until_idle(session, ws) + + sent = _parsed_sent(ws) + assert len(sent) == 3 + assert sent[0] == { + "type": "agent_response", + "content": "Hi", + "event_id": 11, + "is_final": False, + } + assert sent[1] == { + "type": "agent_response", + "content": " there", + "event_id": 11, + "is_final": False, + } + assert sent[2] == { + "type": "agent_response", + "content": "", + "event_id": 11, + "is_final": True, + } + + +@pytest.mark.asyncio +async def test_extracts_text_from_anthropic_messages_api( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 12} + ) + + async def anthropic_stream(): # type: ignore[return] + yield {"type": "message_start", "message": {}} + yield {"type": "content_block_start", "content_block": {"type": "text", "text": ""}} + yield {"type": "content_block_delta", "delta": {"type": "text_delta", "text": "Good"}} + yield {"type": "content_block_delta", "delta": {"type": "text_delta", "text": " morning"}} + yield {"type": "content_block_stop"} + yield {"type": "message_stop"} + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + await session.send_response(anthropic_stream()) + + session.on(USER_TRANSCRIPT, handler) + await _run_until_idle(session, ws) + + sent = _parsed_sent(ws) + assert len(sent) == 3 + assert sent[0] == { + "type": "agent_response", + "content": "Good", + "event_id": 12, + "is_final": False, + } + assert sent[1] == { + "type": "agent_response", + "content": " morning", + "event_id": 12, + "is_final": False, + } + assert sent[2] == { + "type": "agent_response", + "content": "", + "event_id": 12, + "is_final": True, + } + + +@pytest.mark.asyncio +async def test_extracts_text_from_gemini_api( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 13} + ) + + async def gemini_stream(): # type: ignore[return] + yield {"candidates": [{"content": {"parts": [{"text": "Hey"}], "role": "model"}}]} + yield {"candidates": [{"content": {"parts": [{"text": " buddy"}], "role": "model"}}]} + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + await session.send_response(gemini_stream()) + + session.on(USER_TRANSCRIPT, handler) + await _run_until_idle(session, ws) + + sent = _parsed_sent(ws) + assert len(sent) == 3 + assert sent[0] == { + "type": "agent_response", + "content": "Hey", + "event_id": 13, + "is_final": False, + } + assert sent[1] == { + "type": "agent_response", + "content": " buddy", + "event_id": 13, + "is_final": False, + } + assert sent[2] == { + "type": "agent_response", + "content": "", + "event_id": 13, + "is_final": True, + } + + +@pytest.mark.asyncio +async def test_skips_unrecognized_stream_events( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 14} + ) + + async def mixed_stream(): # type: ignore[return] + yield {"type": "unknown_event", "data": 123} + yield {"type": "response.output_text.delta", "delta": "text"} + yield 42 + yield None + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + await session.send_response(mixed_stream()) + + session.on(USER_TRANSCRIPT, handler) + await _run_until_idle(session, ws) + + sent = _parsed_sent(ws) + assert len(sent) == 2 + assert sent[0] == { + "type": "agent_response", + "content": "text", + "event_id": 14, + "is_final": False, + } + assert sent[1] == { + "type": "agent_response", + "content": "", + "event_id": 14, + "is_final": True, + } + + +# --------------------------------------------------------------------------- +# event_id tracking across interrupts +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_stamps_correct_event_id_after_interrupt( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 1} + ) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT_2, "event_id": 2} + ) + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + # Non-blocking so both handlers complete within the run loop. + await session.send_response("response") + + session.on(USER_TRANSCRIPT, handler) + await _run_until_idle(session, ws) + + sent = _parsed_sent(ws) + # Each sendResponse emits content + terminator = 2 messages. + # The first handler's task may or may not complete before cancellation; + # the second handler's response should use event_id 2. + # Filter to the final handler's messages (event_id=2): + id2 = [m for m in sent if m.get("event_id") == 2] + assert len(id2) == 2 + assert id2[0]["content"] == "response" + assert id2[0]["is_final"] is False + assert id2[1]["content"] == "" + assert id2[1]["is_final"] is True + + +# --------------------------------------------------------------------------- +# close() +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_close_is_idempotent( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + session.close() + session.close() + assert not session.is_open + + +# --------------------------------------------------------------------------- +# Event constants +# --------------------------------------------------------------------------- + + +def test_event_constants() -> None: + assert INIT == "init" + assert USER_TRANSCRIPT == "user_transcript" + assert CLOSE == "close" + assert ERROR == "error" + assert DISCONNECTED == "disconnected" + + +# --------------------------------------------------------------------------- +# on / off / once +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_off_removes_handler( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + calls = [] # type: typing.List[str] + + async def handler(conversation_id: str) -> None: + calls.append(conversation_id) + + session.on(INIT, handler) + session.off(INIT, handler) + + ws.receive_message({"type": "init", "conversation_id": "conv_1"}) + await _run_until_idle(session, ws) + + assert calls == [] + + +@pytest.mark.asyncio +async def test_once_fires_only_once( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + calls = [] # type: typing.List[str] + + async def handler(conversation_id: str) -> None: + calls.append(conversation_id) + + session.once(INIT, handler) + + ws.receive_message({"type": "init", "conversation_id": "conv_1"}) + ws.receive_message({"type": "init", "conversation_id": "conv_2"}) + await _run_until_idle(session, ws) + + assert calls == ["conv_1"] + + +# --------------------------------------------------------------------------- +# Transcript deduplication +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_skips_duplicate_event_id( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + """Duplicate transcripts with the same event_id are ignored.""" + call_count = 0 + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + nonlocal call_count + call_count += 1 + await asyncio.sleep(0.5) + + session.on(USER_TRANSCRIPT, handler) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 30} + ) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 30} + ) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 30} + ) + await _run_until_idle(session, ws) + + assert call_count == 1 + + +@pytest.mark.asyncio +async def test_does_not_skip_different_event_id( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + """Different event_ids are processed normally.""" + call_count = 0 + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + nonlocal call_count + call_count += 1 + + session.on(USER_TRANSCRIPT, handler) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT, "event_id": 1} + ) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT_2, "event_id": 2} + ) + await _run_until_idle(session, ws) + + assert call_count == 2 + + +@pytest.mark.asyncio +async def test_does_not_deduplicate_when_event_id_is_none( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + """Transcripts without event_id should never be deduplicated.""" + call_count = 0 + + async def handler(transcript: typing.List[ConversationMessage]) -> None: + nonlocal call_count + call_count += 1 + + session.on(USER_TRANSCRIPT, handler) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT} + ) + ws.receive_message( + {"type": "user_transcript", "user_transcript": TRANSCRIPT_2} + ) + await _run_until_idle(session, ws) + + assert call_count == 2 + + +# --------------------------------------------------------------------------- +# send_response outside on_transcript +# --------------------------------------------------------------------------- + + +@pytest.mark.asyncio +async def test_send_response_warns_outside_transcript( + ws: MockWebSocket, session: SpeechEngineSession +) -> None: + """send_response before any transcript should warn and not send.""" + await session.send_response("hello") + assert len(ws.sent) == 0 diff --git a/data/tests/test_sts.py b/data/tests/test_sts.py new file mode 100644 index 0000000000000000000000000000000000000000..935697a1d06c8104294083364fa3cd8153ebcdae --- /dev/null +++ b/data/tests/test_sts.py @@ -0,0 +1,31 @@ +from elevenlabs.play import play +from elevenlabs.client import ElevenLabs + +from .utils import IN_GITHUB, DEFAULT_VOICE, DEFAULT_VOICE_FILE + + +def test_sts() -> None: + """Test basic speech-to-speech generation.""" + client = ElevenLabs() + audio_file = open(DEFAULT_VOICE_FILE, "rb") + try: + audio_stream = client.speech_to_speech.convert(voice_id=DEFAULT_VOICE, audio=audio_file) + audio = b"".join(chunk for chunk in audio_stream) + assert isinstance(audio, bytes), "Combined audio should be bytes" + if not IN_GITHUB: + play(audio) + finally: + audio_file.close() + + +def test_sts_as_stream(): + client = ElevenLabs() + audio_file = open(DEFAULT_VOICE_FILE, "rb") + try: + audio_stream = client.speech_to_speech.stream(voice_id=DEFAULT_VOICE, audio=audio_file) + audio = b"".join(chunk for chunk in audio_stream) + assert isinstance(audio, bytes), "Combined audio should be bytes" + if not IN_GITHUB: + play(audio) + finally: + audio_file.close() diff --git a/data/tests/test_stt.py b/data/tests/test_stt.py new file mode 100644 index 0000000000000000000000000000000000000000..ef4c4b044d2c2e4a8e05a4a040a59cd46267b51f --- /dev/null +++ b/data/tests/test_stt.py @@ -0,0 +1,25 @@ +import pytest +from elevenlabs.client import AsyncElevenLabs, ElevenLabs + +from .utils import DEFAULT_VOICE_FILE + +DEFAULT_EXT_AUDIO = "https://storage.googleapis.com/eleven-public-cdn/audio/marketing/nicole.mp3" + + + +@pytest.mark.asyncio +async def test_stt_convert(): + """Test basic speech-to-text conversion.""" + client = ElevenLabs() + + audio_file = open(DEFAULT_VOICE_FILE, "rb") + + transcription = client.speech_to_text.convert( + file=audio_file, + model_id="scribe_v2" + ) + + assert isinstance(transcription.text, str) + assert len(transcription.text) > 0 + assert isinstance(transcription.words, list) + assert len(transcription.words) > 0 diff --git a/data/tests/test_stt_realtime.py b/data/tests/test_stt_realtime.py new file mode 100644 index 0000000000000000000000000000000000000000..6eafd8434d937491c4f05dc20e8420731c32c78b --- /dev/null +++ b/data/tests/test_stt_realtime.py @@ -0,0 +1,658 @@ +"""Tests for realtime speech-to-text (Scribe) functionality. + +These tests cover URL building, validation, and event handling behavior +that don't require an actual WebSocket connection. +""" + +import json +from unittest.mock import AsyncMock, MagicMock, patch +from urllib.parse import parse_qsl, urlparse + +import pytest + +from elevenlabs.realtime.connection import RealtimeConnection, RealtimeEvents +from elevenlabs.realtime.scribe import ( + AudioFormat, + CommitStrategy, + ScribeRealtime, +) + + +def query_params(url): + """Every query parameter on the URL, preserving repeats and their order.""" + return parse_qsl(urlparse(url).query, keep_blank_values=True) + + +class TestBuildWebsocketUrl: + """Tests for _build_websocket_url helper method""" + + def setup_method(self): + """Set up test fixtures""" + self.scribe = ScribeRealtime(api_key="test-api-key") + + def test_builds_url_with_all_parameters(self): + """Test URL construction with required and optional parameters""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="vad", + vad_silence_threshold_secs=0.5, + vad_threshold=0.3, + min_speech_duration_ms=100, + min_silence_duration_ms=200, + language_code="es", + include_timestamps=True + ) + + # Base URL structure + assert url.startswith("wss://api.elevenlabs.io/v1/speech-to-text/realtime?") + + # Required parameters + assert "model_id=scribe_v2_realtime" in url + assert "audio_format=pcm_16000" in url + assert "commit_strategy=vad" in url + + # Optional parameters + assert "vad_silence_threshold_secs=0.5" in url + assert "vad_threshold=0.3" in url + assert "min_speech_duration_ms=100" in url + assert "min_silence_duration_ms=200" in url + assert "language_code=es" in url + assert "include_timestamps=true" in url + + def test_optional_parameters_omitted_when_none(self): + """Test that None parameters are not included in URL""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual", + vad_silence_threshold_secs=None, + language_code=None + ) + + assert "vad_silence_threshold_secs" not in url + assert "language_code" not in url + + def test_url_converts_https_to_wss(self): + """Test that https base URLs are converted to wss""" + scribe = ScribeRealtime( + api_key="test-api-key", + base_url="https://api.elevenlabs.io" + ) + url = scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual" + ) + + assert url.startswith("wss://") + assert not url.startswith("wss://wss://") + + def test_url_converts_http_to_ws(self): + """Test that http base URLs are converted to ws""" + scribe = ScribeRealtime( + api_key="test-api-key", + base_url="http://localhost:8080" + ) + url = scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual" + ) + + assert url.startswith("ws://localhost:8080") + + def test_includes_keyterms_as_repeated_query_params(self): + """Test that keyterms are included as repeated query params""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual", + keyterms=["ElevenLabs", "Scribe"], + ) + + assert "keyterms=ElevenLabs" in url + assert "keyterms=Scribe" in url + + def test_includes_no_verbatim_true(self): + """Test that no_verbatim=true is included when set to True""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual", + no_verbatim=True, + ) + + assert "no_verbatim=true" in url + + def test_includes_no_verbatim_false(self): + """Test that no_verbatim=false is included when set to False""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual", + no_verbatim=False, + ) + + assert "no_verbatim=false" in url + + def test_omits_keyterms_and_no_verbatim_when_not_specified(self): + """Test that keyterms and no_verbatim are omitted when not specified""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual", + ) + + assert "keyterms" not in url + assert "no_verbatim" not in url + + def test_serializes_every_supported_option_to_its_parameter_name(self): + """Exhaustive check: a renamed, dropped or duplicated param fails here""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="vad", + vad_silence_threshold_secs=1.5, + vad_threshold=0.4, + min_speech_duration_ms=100, + min_silence_duration_ms=200, + language_code="en", + secondary_languages=["nl", "de"], + include_timestamps=False, + include_language_detection=True, + keyterms=["ElevenLabs", "Scribe"], + no_verbatim=True, + entity_detection=["pii", "email_address"], + transcript_edit="Write all dates in ISO 8601 format (YYYY-MM-DD)", + filter_background_audio=True, + enable_logging=False, + token="sutkn_1234567890", + ) + + assert sorted(query_params(url)) == sorted([ + ("model_id", "scribe_v2_realtime"), + ("audio_format", "pcm_16000"), + ("commit_strategy", "vad"), + ("vad_silence_threshold_secs", "1.5"), + ("vad_threshold", "0.4"), + ("min_speech_duration_ms", "100"), + ("min_silence_duration_ms", "200"), + ("language_code", "en"), + ("secondary_languages", "nl"), + ("secondary_languages", "de"), + ("include_timestamps", "false"), + ("include_language_detection", "true"), + ("keyterms", "ElevenLabs"), + ("keyterms", "Scribe"), + ("no_verbatim", "true"), + ("entity_detection", "pii"), + ("entity_detection", "email_address"), + ("transcript_edit", "Write all dates in ISO 8601 format (YYYY-MM-DD)"), + ("filter_background_audio", "true"), + ("enable_logging", "false"), + ("token", "sutkn_1234567890"), + ]) + + def test_sends_nothing_beyond_the_required_parameters(self): + """Exhaustive check that unset options do not leak into the URL""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual", + ) + + assert sorted(query_params(url)) == sorted([ + ("model_id", "scribe_v2_realtime"), + ("audio_format", "pcm_16000"), + ("commit_strategy", "manual"), + ]) + + def test_transmits_booleans_that_are_explicitly_false(self): + """False is meaningful: dropping it silently reverts to a server default""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual", + include_timestamps=False, + include_language_detection=False, + no_verbatim=False, + filter_background_audio=False, + enable_logging=False, + ) + + params = dict(query_params(url)) + assert params["include_timestamps"] == "false" + assert params["include_language_detection"] == "false" + assert params["no_verbatim"] == "false" + assert params["filter_background_audio"] == "false" + assert params["enable_logging"] == "false" + + def test_accepts_a_bare_string_for_entity_detection(self): + """A single entity_detection string is sent as one value, not exploded""" + url = self.scribe._build_websocket_url( + model_id="scribe_v2_realtime", + audio_format="pcm_16000", + commit_strategy="manual", + entity_detection="all", + ) + + assert [v for k, v in query_params(url) if k == "entity_detection"] == ["all"] + + +class TestConnectValidation: + """Tests for connect method validation""" + + def setup_method(self): + """Set up test fixtures""" + self.scribe = ScribeRealtime(api_key="test-api-key") + + @pytest.mark.asyncio + async def test_connect_requires_model_id(self): + """Test that connect raises error without model_id""" + with pytest.raises(ValueError, match="model_id is required"): + await self.scribe.connect({}) # type: ignore + + @pytest.mark.asyncio + async def test_connect_audio_mode_requires_format_and_sample_rate(self): + """Test that audio mode requires both audio_format and sample_rate""" + with pytest.raises(ValueError, match="audio_format and sample_rate are required"): + await self.scribe.connect({ + "model_id": "scribe_v2_realtime" + }) # type: ignore + + with pytest.raises(ValueError, match="audio_format and sample_rate are required"): + await self.scribe.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000 + # missing sample_rate + }) # type: ignore + + with pytest.raises(ValueError, match="audio_format and sample_rate are required"): + await self.scribe.connect({ + "model_id": "scribe_v2_realtime", + "sample_rate": 16000 + # missing audio_format + }) # type: ignore + + @pytest.mark.asyncio + @patch("elevenlabs.realtime.scribe.websocket_connect") + async def test_connect_url_mode_requires_url(self, mock_ws_connect): + """Test that URL mode requires non-empty url parameter""" + with pytest.raises(ValueError, match="url is required"): + await self.scribe.connect({ + "model_id": "scribe_v2_realtime", + "url": "" + }) # type: ignore + + +class TestConnectEnumHandling: + """Tests for correct enum value extraction when building WebSocket URLs. + + Regression tests to ensure AudioFormat and CommitStrategy enums are + converted to their string values (e.g., 'pcm_16000') rather than being + passed as enum objects (which would result in 'AudioFormat.PCM_16000'). + """ + + def setup_method(self): + """Set up test fixtures""" + self.scribe = ScribeRealtime(api_key="test-api-key") + + @pytest.mark.asyncio + @patch("elevenlabs.realtime.scribe.websocket_connect", new_callable=AsyncMock) + async def test_connect_audio_uses_enum_values_in_url(self, mock_ws_connect): + """Test that AudioFormat and CommitStrategy enum values are correctly extracted. + + This is a regression test: previously, if .value was not called on enums, + the URL would contain 'AudioFormat.PCM_16000' instead of 'pcm_16000'. + """ + mock_websocket = MagicMock() + mock_ws_connect.return_value = mock_websocket + # Mock the async iterator for the websocket (needed for message handler) + mock_websocket.__aiter__ = MagicMock(return_value=iter([])) + + await self.scribe.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000, + "commit_strategy": CommitStrategy.VAD + }) + + # Verify websocket_connect was called + mock_ws_connect.assert_awaited_once() + + # Extract the URL that was passed to websocket_connect + call_args = mock_ws_connect.call_args + url = call_args[0][0] # First positional argument + + # Verify the URL contains the string values, not enum representations + assert "audio_format=pcm_16000" in url, \ + f"URL should contain 'audio_format=pcm_16000', not enum repr. Got: {url}" + assert "AudioFormat" not in url, \ + f"URL should not contain 'AudioFormat' enum name. Got: {url}" + + assert "commit_strategy=vad" in url, \ + f"URL should contain 'commit_strategy=vad', not enum repr. Got: {url}" + assert "CommitStrategy" not in url, \ + f"URL should not contain 'CommitStrategy' enum name. Got: {url}" + + @pytest.mark.asyncio + @patch("elevenlabs.realtime.scribe.websocket_connect", new_callable=AsyncMock) + async def test_connect_audio_default_commit_strategy_is_manual(self, mock_ws_connect): + """Test that the default commit strategy is MANUAL when not specified.""" + mock_websocket = MagicMock() + mock_ws_connect.return_value = mock_websocket + mock_websocket.__aiter__ = MagicMock(return_value=iter([])) + + await self.scribe.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000 + # commit_strategy not specified + }) + + url = mock_ws_connect.call_args[0][0] + assert "commit_strategy=manual" in url + + @pytest.mark.asyncio + @patch("elevenlabs.realtime.scribe.websocket_connect", new_callable=AsyncMock) + async def test_connect_threads_every_option_into_url(self, mock_ws_connect): + """Exhaustive check of the option key to query parameter mapping. + + The URL builder is tested directly elsewhere, so this is the only cover + for _shared_url_kwargs: a typo there would drop an option silently. + """ + mock_websocket = MagicMock() + mock_ws_connect.return_value = mock_websocket + mock_websocket.__aiter__ = MagicMock(return_value=iter([])) + + await self.scribe.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000, + "commit_strategy": CommitStrategy.VAD, + "vad_silence_threshold_secs": 1.5, + "vad_threshold": 0.4, + "min_speech_duration_ms": 100, + "min_silence_duration_ms": 200, + "language_code": "en", + "secondary_languages": ["en", "nl"], + "include_timestamps": False, + "include_language_detection": True, + "keyterms": ["ElevenLabs"], + "no_verbatim": True, + "entity_detection": ["pii", "email_address"], + "transcript_edit": "Write all dates in ISO 8601 format (YYYY-MM-DD)", + "filter_background_audio": True, + "enable_logging": False, + "token": "sutkn_1234567890", + }) + + url = mock_ws_connect.call_args[0][0] + assert sorted(query_params(url)) == sorted([ + ("model_id", "scribe_v2_realtime"), + ("audio_format", "pcm_16000"), + ("commit_strategy", "vad"), + ("vad_silence_threshold_secs", "1.5"), + ("vad_threshold", "0.4"), + ("min_speech_duration_ms", "100"), + ("min_silence_duration_ms", "200"), + ("language_code", "en"), + ("secondary_languages", "en"), + ("secondary_languages", "nl"), + ("include_timestamps", "false"), + ("include_language_detection", "true"), + ("keyterms", "ElevenLabs"), + ("no_verbatim", "true"), + ("entity_detection", "pii"), + ("entity_detection", "email_address"), + ("transcript_edit", "Write all dates in ISO 8601 format (YYYY-MM-DD)"), + ("filter_background_audio", "true"), + ("enable_logging", "false"), + ("token", "sutkn_1234567890"), + ]) + + +class TestConnectAuthentication: + """Tests for API key vs single-use token authentication""" + + @pytest.mark.asyncio + @patch("elevenlabs.realtime.scribe.websocket_connect", new_callable=AsyncMock) + async def test_api_key_sent_as_header(self, mock_ws_connect): + """Test that a configured api_key is sent in the xi-api-key header""" + mock_websocket = MagicMock() + mock_ws_connect.return_value = mock_websocket + mock_websocket.__aiter__ = MagicMock(return_value=iter([])) + + scribe = ScribeRealtime(api_key="test-api-key") + await scribe.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000, + }) + + headers = mock_ws_connect.call_args.kwargs["additional_headers"] + assert headers == {"xi-api-key": "test-api-key"} + + @pytest.mark.asyncio + @patch("elevenlabs.realtime.scribe.websocket_connect", new_callable=AsyncMock) + async def test_token_only_omits_api_key_header(self, mock_ws_connect): + """Test that a token authenticates without sending an empty api key header""" + mock_websocket = MagicMock() + mock_ws_connect.return_value = mock_websocket + mock_websocket.__aiter__ = MagicMock(return_value=iter([])) + + scribe = ScribeRealtime(api_key="") + await scribe.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000, + "token": "sutkn_1234567890", + }) + + headers = mock_ws_connect.call_args.kwargs["additional_headers"] + assert headers == {} + assert "token=sutkn_1234567890" in mock_ws_connect.call_args[0][0] + + @pytest.mark.asyncio + @patch("elevenlabs.realtime.scribe.websocket_connect", new_callable=AsyncMock) + async def test_token_takes_precedence_over_configured_api_key(self, mock_ws_connect): + """The server authenticates the token and never falls back to the key, so + sending it would transmit a long-lived credential that cannot be used.""" + mock_websocket = MagicMock() + mock_ws_connect.return_value = mock_websocket + mock_websocket.__aiter__ = MagicMock(return_value=iter([])) + + scribe = ScribeRealtime(api_key="test-api-key") + await scribe.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000, + "token": "sutkn_1234567890", + }) + + headers = mock_ws_connect.call_args.kwargs["additional_headers"] + assert headers == {} + assert "token=sutkn_1234567890" in mock_ws_connect.call_args[0][0] + + @pytest.mark.asyncio + async def test_requires_api_key_or_token(self): + """Test that connecting without either credential raises""" + scribe = ScribeRealtime(api_key="") + with pytest.raises(ValueError, match="api_key or a single-use token is required"): + await scribe.connect({ + "model_id": "scribe_v2_realtime", + "audio_format": AudioFormat.PCM_16000, + "sample_rate": 16000, + }) + + +class TestRealtimeConnectionEventHandling: + """Tests for RealtimeConnection event handling behavior""" + + def setup_method(self): + """Set up test fixtures""" + self.mock_websocket = MagicMock() + self.connection = RealtimeConnection( + websocket=self.mock_websocket, + current_sample_rate=16000, + ffmpeg_process=None + ) + + def test_emit_calls_all_registered_handlers(self): + """Test that emitting an event calls all registered handlers in order""" + call_order = [] + + def handler1(data): + call_order.append(("handler1", data)) + + def handler2(data): + call_order.append(("handler2", data)) + + self.connection.on("test_event", handler1) + self.connection.on("test_event", handler2) + self.connection._emit("test_event", {"value": 42}) + + assert call_order == [ + ("handler1", {"value": 42}), + ("handler2", {"value": 42}) + ] + + def test_emit_isolates_handler_exceptions(self, capsys): + """Test that an exception in one handler doesn't prevent others from running""" + results = [] + + def bad_handler(data): + raise ValueError("Handler error") + + def good_handler(data): + results.append(data) + + self.connection.on("test_event", bad_handler) + self.connection.on("test_event", good_handler) + + # Should not raise, and good_handler should still be called + self.connection._emit("test_event", {"value": "test"}) + + assert results == [{"value": "test"}] + captured = capsys.readouterr() + assert "Error in event handler" in captured.out + + def test_emit_with_no_handlers_does_not_raise(self): + """Test that emitting to an event with no handlers is a no-op""" + # Should not raise + self.connection._emit("nonexistent_event", {"data": "test"}) + + def test_handlers_receive_correct_arguments(self): + """Test that handlers receive all emitted arguments""" + received_args = [] + + def handler(*args): + received_args.extend(args) + + self.connection.on(RealtimeEvents.PARTIAL_TRANSCRIPT, handler) + self.connection._emit(RealtimeEvents.PARTIAL_TRANSCRIPT, "arg1", "arg2", {"key": "value"}) + + assert received_args == ["arg1", "arg2", {"key": "value"}] + + +class _FakeWebsocket: + """Minimal async-iterable stand-in for a websocket connection.""" + + def __init__(self, messages): + self._messages = list(messages) + + def __aiter__(self): + return self + + async def __anext__(self): + if not self._messages: + raise StopAsyncIteration + return self._messages.pop(0) + + +class TestMessageDispatch: + """Tests that server message types are routed to the matching events""" + + async def _dispatch(self, *messages): + """Feed raw JSON messages through the connection's message handler""" + self.connection = RealtimeConnection( + websocket=_FakeWebsocket([json.dumps(m) for m in messages]), + current_sample_rate=16000, + ffmpeg_process=None, + ) + for event, sink in self._subscriptions: + self.connection.on(event, sink) + await self.connection._start_message_handler() + + def setup_method(self): + """Set up test fixtures""" + self._subscriptions = [] + + def subscribe(self, event): + """Register a sink for an event, returning the list it collects into""" + received = [] + self._subscriptions.append((event, received.append)) + return received + + @pytest.mark.asyncio + @pytest.mark.parametrize( + "message_type", + [ + "final_transcript", + "final_transcript_with_timestamps", + "committed_transcript_entities", + "edited_transcript", + ], + ) + async def test_dispatches_transcript_events(self, message_type): + """Test that transcript message types reach their handlers""" + received = self.subscribe(message_type) + + await self._dispatch({"message_type": message_type, "text": "hello"}) + + assert received == [{"message_type": message_type, "text": "hello"}] + + @pytest.mark.asyncio + async def test_edited_transcript_carries_committed_and_edited_text(self): + """The edit event pairs the committed text with its edited version""" + received = self.subscribe(RealtimeEvents.EDITED_TRANSCRIPT) + + payload = { + "message_type": "edited_transcript", + "text": "our next meeting is on the twelfth of July twenty twenty-six", + "edited_text": "our next meeting is on 2026-07-12", + } + await self._dispatch(payload) + + assert received == [payload] + + @pytest.mark.asyncio + async def test_invalid_request_emits_specific_and_generic_error(self): + """Parameter rejections arrive as a message before the socket closes; + dropping it leaves the caller with a closed connection and no reason why.""" + specific = self.subscribe(RealtimeEvents.INVALID_REQUEST) + generic = self.subscribe(RealtimeEvents.ERROR) + + payload = { + "message_type": "invalid_request", + "error": "Number of keyterms cannot exceed 50. You provided 51 keyterms.", + } + await self._dispatch(payload) + + assert specific == [payload] + assert generic == [payload] + + @pytest.mark.asyncio + async def test_unaccepted_terms_emits_both_event_names(self): + """Test that the server's unaccepted_terms also fires the older event name""" + new_name = self.subscribe(RealtimeEvents.UNACCEPTED_TERMS) + old_name = self.subscribe(RealtimeEvents.UNACCEPTED_TERMS_ERROR) + generic_error = self.subscribe(RealtimeEvents.ERROR) + + payload = {"message_type": "unaccepted_terms", "error": "terms not accepted"} + await self._dispatch(payload) + + assert new_name == [payload] + assert old_name == [payload] + assert generic_error == [payload] diff --git a/data/tests/test_tts.py b/data/tests/test_tts.py new file mode 100644 index 0000000000000000000000000000000000000000..4c7cd2e59b84a704d4c19e10465ade4568a5ad99 --- /dev/null +++ b/data/tests/test_tts.py @@ -0,0 +1,90 @@ +import asyncio + +from elevenlabs import VoiceSettings, Voice +from elevenlabs.play import play +from elevenlabs.client import AsyncElevenLabs, ElevenLabs + +from .utils import IN_GITHUB, DEFAULT_TEXT, DEFAULT_VOICE, DEFAULT_MODEL +import base64 + + +def test_tts_convert() -> None: + """Test basic text-to-speech generation.""" + client = ElevenLabs() + audio_generator = client.text_to_speech.convert(text=DEFAULT_TEXT, voice_id=DEFAULT_VOICE, model_id=DEFAULT_MODEL) + audio = b"".join(audio_generator) + assert isinstance(audio, bytes), "TTS should return bytes" + if not IN_GITHUB: + play(audio) + + +def test_tts_convert_with_voice_settings() -> None: + """Test TTS with custom voice settings.""" + client = ElevenLabs() + audio_generator = client.text_to_speech.convert( + text=DEFAULT_TEXT, + voice_id=DEFAULT_VOICE, + model_id=DEFAULT_MODEL, + voice_settings=VoiceSettings(stability=0.71, similarity_boost=0.5, style=0.0, use_speaker_boost=True), + ) + audio = b"".join(audio_generator) + assert isinstance(audio, bytes), "TTS with voice settings should return bytes" + if not IN_GITHUB: + play(audio) + + +def test_tts_convert_as_stream(): + async def main(): + async_client = AsyncElevenLabs() + results = async_client.text_to_speech.stream( + text=DEFAULT_TEXT, voice_id=DEFAULT_VOICE, model_id=DEFAULT_MODEL + ) + out = b"" + async for value in results: + assert isinstance(value, bytes), "Stream chunks should be bytes" + out += value + if not IN_GITHUB: + play(out) + + asyncio.run(main()) + + +def test_tts_convert_with_timestamps() -> None: + """Test TTS generation with timestamps.""" + client = ElevenLabs() + result = client.text_to_speech.convert_with_timestamps( + text=DEFAULT_TEXT, voice_id=DEFAULT_VOICE, model_id=DEFAULT_MODEL + ) + + # Check that the alignment data exists and has the expected structure + assert hasattr(result, 'alignment') + assert hasattr(result, 'audio_base_64') + + # Verify alignment contains timing data + assert result.alignment is not None + assert len(result.alignment.character_start_times_seconds) > 0 + assert len(result.alignment.character_end_times_seconds) > 0 + + if not IN_GITHUB: + audio_bytes = base64.b64decode(result.audio_base_64) + play(audio_bytes) + + +def test_tts_stream_with_timestamps(): + async def main(): + async_client = AsyncElevenLabs() + audio_data = b"" + async_stream = async_client.text_to_speech.stream_with_timestamps( + voice_id=DEFAULT_VOICE, + text=DEFAULT_TEXT, + model_id=DEFAULT_MODEL, + ) + async for chunk in async_stream: + if hasattr(chunk, "audio_base_64"): + audio_bytes = base64.b64decode(chunk.audio_base_64) + audio_data += audio_bytes + + if not IN_GITHUB: + play(audio_data) + + asyncio.run(main()) diff --git a/data/tests/test_ttsfx.py b/data/tests/test_ttsfx.py new file mode 100644 index 0000000000000000000000000000000000000000..e190cfae1d5c7c44f30e555140476a1cc88c9bba --- /dev/null +++ b/data/tests/test_ttsfx.py @@ -0,0 +1,17 @@ +from elevenlabs.play import play +from elevenlabs.client import ElevenLabs + +from .utils import IN_GITHUB + + +def test_text_to_sound_effects_convert() -> None: + """Test basic sound-effect generation.""" + client = ElevenLabs() + audio_generator = client.text_to_sound_effects.convert( + text="Hypnotic throbbing sound effect. Increases in imtensity.", + duration_seconds=2, + ) + audio = b"".join(audio_generator) + assert isinstance(audio, bytes), "TTS should return bytes" + if not IN_GITHUB: + play(audio) diff --git a/data/tests/test_ttv.py b/data/tests/test_ttv.py new file mode 100644 index 0000000000000000000000000000000000000000..5d08682bdcff1e47eb6d3f531200a35e21a5d433 --- /dev/null +++ b/data/tests/test_ttv.py @@ -0,0 +1,17 @@ +from elevenlabs.client import ElevenLabs + + +def test_voice_preview_generation(): + """Test generating voice previews from description.""" + client = ElevenLabs() + + # Test parameters + description = "A warm and friendly female voice with a slight British accent, speaking clearly and professionally" + sample_text = "This is a test message that needs to be at least one hundred characters long to meet the API requirements. Here it is." + + previews = client.text_to_voice.create_previews(voice_description=description, text=sample_text) + + assert hasattr(previews, "previews"), "Response should have 'previews' attribute" + assert len(previews.previews) > 0, "Should receive at least one preview" + assert hasattr(previews.previews[0], "generated_voice_id"), "Preview should contain generated_voice_id" + assert hasattr(previews.previews[0], "audio_base_64"), "Preview should contain audio_base_64" diff --git a/data/tests/test_url_utils.py b/data/tests/test_url_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..a5e8638943f66c75d9d948d48cabc13d75d7d43b --- /dev/null +++ b/data/tests/test_url_utils.py @@ -0,0 +1,80 @@ +"""Tests for the build_ws_url utility.""" + +import pytest + +from elevenlabs.url_utils import build_ws_url + + +class TestSchemeConversion: + def test_https_to_wss(self): + url = build_ws_url("https://api.example.com", ["v1"], {}) + assert url.startswith("wss://") + + def test_http_to_ws(self): + url = build_ws_url("http://localhost:8080", ["v1"], {}) + assert url.startswith("ws://") + + def test_wss_preserved(self): + url = build_ws_url("wss://api.example.com", ["v1"], {}) + assert url.startswith("wss://") + + def test_ws_preserved(self): + url = build_ws_url("ws://localhost:8080", ["v1"], {}) + assert url.startswith("ws://") + + +class TestPathSegments: + def test_segments_joined(self): + url = build_ws_url("wss://api.example.com", ["v1", "speech", "realtime"], {}) + assert url == "wss://api.example.com/v1/speech/realtime" + + def test_segments_percent_encoded(self): + url = build_ws_url("wss://api.example.com", ["v1", "hello world"], {}) + assert "/v1/hello%20world" in url + + def test_special_characters_encoded(self): + url = build_ws_url("wss://api.example.com", ["v1", "a/b", "c?d", "e&f"], {}) + assert "/v1/a%2Fb/c%3Fd/e%26f" in url + + def test_non_string_segments_converted(self): + url = build_ws_url("wss://api.example.com", ["v1", 42, True], {}) + assert "/v1/42/True" in url + + def test_appended_to_existing_base_path(self): + url = build_ws_url("wss://api.example.com/base", ["v1", "endpoint"], {}) + assert url == "wss://api.example.com/base/v1/endpoint" + + def test_base_path_trailing_slash_not_duplicated(self): + url = build_ws_url("wss://api.example.com/base/", ["v1"], {}) + assert "//v1" not in url + assert "/base/v1" in url + + +class TestQueryParams: + def test_dict_params(self): + url = build_ws_url("wss://api.example.com", ["v1"], {"key": "value"}) + assert url.endswith("?key=value") + + def test_tuple_params(self): + url = build_ws_url("wss://api.example.com", ["v1"], [("a", "1"), ("b", "2")]) + assert "a=1" in url + assert "b=2" in url + + def test_params_percent_encoded(self): + url = build_ws_url("wss://api.example.com", ["v1"], {"term": "hello world"}) + assert "term=hello%20world" in url + + def test_repeated_keys(self): + url = build_ws_url("wss://api.example.com", ["v1"], [("k", "a"), ("k", "b")]) + assert "k=a" in url + assert "k=b" in url + + def test_empty_params(self): + url = build_ws_url("wss://api.example.com", ["v1"], {}) + assert url == "wss://api.example.com/v1" + + +class TestPortPreserved: + def test_custom_port(self): + url = build_ws_url("http://localhost:9090", ["v1"], {}) + assert url == "ws://localhost:9090/v1" diff --git a/data/tests/test_voices.py b/data/tests/test_voices.py new file mode 100644 index 0000000000000000000000000000000000000000..220fe6f0c275cd20b5d9bc0c677971d199a8a84b --- /dev/null +++ b/data/tests/test_voices.py @@ -0,0 +1,24 @@ +from elevenlabs import Voice, VoiceSettings, ElevenLabs +from .utils import DEFAULT_VOICE + + +def test_get_voice(): + client = ElevenLabs() + voice_id = DEFAULT_VOICE + + voice = client.voices.get(voice_id) + assert isinstance(voice, Voice) + + assert voice.voice_id == voice_id + if voice.settings is not None: + assert isinstance(voice.settings, VoiceSettings) + + +def test_get_voices(): + client = ElevenLabs() + response = client.voices.search() + + assert len(response.voices) > 0 + + for voice in response.voices: + assert isinstance(voice, Voice) diff --git a/data/tests/test_webhooks.py b/data/tests/test_webhooks.py new file mode 100644 index 0000000000000000000000000000000000000000..7282fdd8677c3052f28a0f11bf7a271d6a9dc89c --- /dev/null +++ b/data/tests/test_webhooks.py @@ -0,0 +1,140 @@ +import json +import time +import hmac +import hashlib +from unittest import mock + +from elevenlabs.client import ElevenLabs +from elevenlabs.errors import BadRequestError + +import pytest + + +def test_construct_event_valid_signature(): + """Test webhook event construction with valid signature.""" + # Setup + client = ElevenLabs() + webhook_secret = "test_secret" + payload = {"event_type": "speech.completed", "id": "123456"} + + # Create a valid signature + body = json.dumps(payload) + timestamp = str(int(time.time())) + message = f"{timestamp}.{body}" + signature = "v0=" + hmac.new( + webhook_secret.encode('utf-8'), + message.encode('utf-8'), + hashlib.sha256 + ).hexdigest() + sig_header = f"t={timestamp},{signature}" + + # Verify event construction + event = client.webhooks.construct_event(body, sig_header, webhook_secret) + assert event == payload, "Event should match the original payload" + + +def test_construct_event_missing_signature(): + """Test webhook event construction with missing signature header.""" + client = ElevenLabs() + webhook_secret = "test_secret" + payload = {"event_type": "speech.completed", "id": "123456"} + + with pytest.raises(BadRequestError) as excinfo: + client.webhooks.construct_event(payload, "", webhook_secret) + + assert "Missing signature header" in str(excinfo.value) + + +def test_construct_event_invalid_signature_format(): + """Test webhook event construction with invalid signature format.""" + client = ElevenLabs() + webhook_secret = "test_secret" + payload = {"event_type": "speech.completed", "id": "123456"} + body = json.dumps(payload) + sig_header = "invalid_format" + + with pytest.raises(BadRequestError) as excinfo: + client.webhooks.construct_event(body, sig_header, webhook_secret) + + assert "No signature hash found with expected scheme v0" in str(excinfo.value) + + +def test_construct_event_expired_timestamp(): + """Test webhook event construction with expired timestamp.""" + client = ElevenLabs() + webhook_secret = "test_secret" + payload = {"event_type": "speech.completed", "id": "123456"} + + # Create an expired timestamp (31 minutes old) + expired_time = int(time.time()) - 31 * 60 + timestamp = str(expired_time) + + body = json.dumps(payload) + message = f"{timestamp}.{body}" + signature = "v0=" + hmac.new( + webhook_secret.encode('utf-8'), + message.encode('utf-8'), + hashlib.sha256 + ).hexdigest() + sig_header = f"t={timestamp},{signature}" + + with pytest.raises(BadRequestError) as excinfo: + client.webhooks.construct_event(body, sig_header, webhook_secret) + + assert "Timestamp outside the tolerance zone" in str(excinfo.value) + + +def test_construct_event_invalid_signature(): + """Test webhook event construction with invalid signature.""" + client = ElevenLabs() + webhook_secret = "test_secret" + payload = {"event_type": "speech.completed", "id": "123456"} + body = json.dumps(payload) + + timestamp = str(int(time.time())) + sig_header = f"t={timestamp},v0=invalid_signature" + + with pytest.raises(BadRequestError) as excinfo: + client.webhooks.construct_event(body, sig_header, webhook_secret) + + assert "Signature hash does not match" in str(excinfo.value) + + +def test_construct_event_missing_secret(): + """Test webhook event construction with missing secret.""" + client = ElevenLabs() + payload = {"event_type": "speech.completed", "id": "123456"} + body = json.dumps(payload) + + timestamp = str(int(time.time())) + sig_header = f"t={timestamp},v0=some_signature" + + with pytest.raises(BadRequestError) as excinfo: + client.webhooks.construct_event(body, sig_header, "") + + assert "Webhook secret not configured" in str(excinfo.value) + + +@mock.patch('time.time') +def test_construct_event_mocked_time(mock_time): + """Test webhook event construction with mocked time.""" + mock_time.return_value = 1600000000 + + client = ElevenLabs() + webhook_secret = "test_secret" + payload = {"event_type": "speech.completed", "id": "123456"} + + # Create a valid signature with fixed timestamp + body = json.dumps(payload) + timestamp = "1600000000" + message = f"{timestamp}.{body}" + signature = "v0=" + hmac.new( + webhook_secret.encode('utf-8'), + message.encode('utf-8'), + hashlib.sha256 + ).hexdigest() + sig_header = f"t={timestamp},{signature}" + + # Verify event construction + event = client.webhooks.construct_event(body, sig_header, webhook_secret) + assert event == payload, "Event should match the original payload" diff --git a/data/tests/utils.py b/data/tests/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..3b0d48d3dbe2cdc4b12f81c3c9d269789a2f1df7 --- /dev/null +++ b/data/tests/utils.py @@ -0,0 +1,27 @@ +import os +import tempfile +import httpx + +from typing import Sequence, Generator + +IN_GITHUB = "GITHUB_ACTIONS" in os.environ + +DEFAULT_VOICE = "IRHApOXLvnW57QJPQH2P" +DEFAULT_TEXT = "Hello" +DEFAULT_MODEL = "eleven_multilingual_v2" +DEFAULT_VOICE_FILE = "tests/fixtures/voice_sample.mp3" + + +def as_local_files(urls: Sequence[str]) -> Generator[str, None, None]: + """Util to download files from urls and return local file paths""" + + temp_files = [] + for url in urls: + response = httpx.get(url) + temp_file = tempfile.NamedTemporaryFile() + temp_file.write(response.content) + temp_files.append(temp_file) + yield temp_file.name + # Remove the files + for temp_file in temp_files: + temp_file.close() diff --git a/data/tests/verify_types.py b/data/tests/verify_types.py new file mode 100644 index 0000000000000000000000000000000000000000..16e65bc38df5c793c9fff79bffdf80cea0d70766 --- /dev/null +++ b/data/tests/verify_types.py @@ -0,0 +1,152 @@ +#!/usr/bin/env python3 +""" +Script to verify all types in src/elevenlabs/types/ can be imported and instantiated. +Allows pydantic ValidationError but catches other errors (like circular imports). +Each type is tested in a separate Python process to avoid import cache issues. +""" +import subprocess +import sys +from pathlib import Path +from typing import Optional +from concurrent.futures import ThreadPoolExecutor, as_completed + + +def get_class_name_from_file(file_path: Path) -> Optional[str]: + """Convert a file name to the expected class name using PascalCase.""" + # Remove .py extension + name = file_path.stem + + # Skip special files + if name.startswith('__'): + return None + + # Convert snake_case to PascalCase + parts = name.split('_') + class_name = ''.join(word.capitalize() for word in parts) + + return class_name + + +def verify_type_import_in_subprocess(module_name: str, class_name: str) -> Optional[str]: + """ + Test importing and instantiating a type in a separate subprocess. + Returns error_message if failed, None if successful. + """ + # Get project root (parent of tests directory) + project_root = Path(__file__).parent.parent + + # Python code to test import in isolation + test_code = f""" +import sys +from pydantic import ValidationError as PydanticValidationError + +try: + # Try to import the type + from elevenlabs.types.{module_name} import {class_name} + + # Try to instantiate with no args (expect ValidationError) + try: + {class_name}() + except PydanticValidationError: + pass # Expected - type requires arguments + except TypeError: + pass # Some types might not be Pydantic models (enums, etc.) + + sys.exit(0) # Success + +except ImportError as e: + print(f"ImportError: {{e}}", file=sys.stderr) + sys.exit(1) +except Exception as e: + print(f"{{type(e).__name__}}: {{e}}", file=sys.stderr) + sys.exit(1) +""" + + try: + result = subprocess.run( + ["poetry", "run", "python", "-c", test_code], + capture_output=True, + text=True, + timeout=30, + cwd=str(project_root) + ) + + if result.returncode == 0: + return None + else: + error_msg = result.stderr.strip() if result.stderr else "Unknown error" + return error_msg + + except subprocess.TimeoutExpired: + return "Timeout: Import took longer than 30 seconds" + except Exception as e: + return f"Subprocess error: {str(e)}" + + +def main(): + # Get project root (parent of tests directory) + project_root = Path(__file__).parent.parent + types_dir = project_root / "src/elevenlabs/types" + + if not types_dir.exists(): + print(f"Error: {types_dir} does not exist", file=sys.stderr) + sys.exit(1) + + # Get all Python files + py_files = sorted([f for f in types_dir.glob("*.py") if not f.name.startswith("__")]) + + print(f"Testing {len(py_files)} type files in parallel...\n") + + failures = [] + successes = [] + + # Test types in parallel for speed + with ThreadPoolExecutor(max_workers=10) as executor: + future_to_file = {} + + for py_file in py_files: + module_name = py_file.stem + class_name = get_class_name_from_file(py_file) + + if class_name is None: + continue # Skip special files + + future = executor.submit(verify_type_import_in_subprocess, module_name, class_name) + future_to_file[future] = (module_name, class_name) + + for future in as_completed(future_to_file): + module_name, class_name = future_to_file[future] + try: + error = future.result() + + if error is None: + successes.append((module_name, class_name)) + print(f"✓ {module_name}.{class_name}") + else: + failures.append((module_name, class_name, error)) + print(f"✗ {module_name}.{class_name}") + + except Exception as e: + failures.append((module_name, class_name, f"Test execution failed: {str(e)}")) + print(f"✗ {module_name}.{class_name}") + + # Print summary + print(f"\n{'='*80}") + print(f"Summary: {len(successes)} passed, {len(failures)} failed") + print(f"{'='*80}") + + if failures: + print("\nFailed imports:") + for module_name, class_name, error in failures: + print(f"\n{module_name}.{class_name}:") + # Indent error messages + for line in error.split('\n'): + print(f" {line}") + sys.exit(1) + else: + print("\nAll types can be imported successfully!") + sys.exit(0) + + +if __name__ == "__main__": + main()